These should all be fixed in v2.

https://codereview.chromium.org/1132163011/diff/1/src/harmony-typedarray.js
File src/harmony-typedarray.js (right):

https://codereview.chromium.org/1132163011/diff/1/src/harmony-typedarray.js#newcode104
src/harmony-typedarray.js:104: // TODO(dehrenberg): This is an
approximation of the spec, which requires
On 2015/05/15 00:20:22, arv wrote:
I thought you wanted littledan?

Done.

https://codereview.chromium.org/1132163011/diff/1/src/harmony-typedarray.js#newcode106
src/harmony-typedarray.js:106: if (!IS_SPEC_OBJECT(constructor) ||
constructor.prototype === undefined ||
On 2015/05/15 00:20:22, arv wrote:
Use IS_UNDEFINED since undefined can be redefined.

Done.

https://codereview.chromium.org/1132163011/diff/1/src/harmony-typedarray.js#newcode107
src/harmony-typedarray.js:107: !%HasOwnProperty(constructor.prototype,
"BYTES_PER_ELEMENT"))
On 2015/05/15 00:20:22, arv wrote:
Use {}

Done.

https://codereview.chromium.org/1132163011/diff/1/src/harmony-typedarray.js#newcode119
src/harmony-typedarray.js:119: var array = $arrayFrom.call(global.Array,
source, mapfn, thisArg);
On 2015/05/15 00:20:22, arv wrote:
Is global.Array correct here? Shouldn't Uint8Array.from(new Set([1, 2,
3])
create a new Uint8Array?

I'm first making an array with the contents and then making a TypedArray
with that in it.

https://codereview.chromium.org/1132163011/diff/1/src/harmony-typedarray.js#newcode119
src/harmony-typedarray.js:119: var array = $arrayFrom.call(global.Array,
source, mapfn, thisArg);
On 2015/05/15 00:20:22, arv wrote:
Please add

var GlobalArray = global.Array;

to the top since Array can be redefined.

Done.

https://codereview.chromium.org/1132163011/diff/1/src/harmony-typedarray.js#newcode119
src/harmony-typedarray.js:119: var array = $arrayFrom.call(global.Array,
source, mapfn, thisArg);
On 2015/05/15 00:20:22, arv wrote:
Use %_CallFunction since Function.prototype.call can be redefined.

Done.

https://codereview.chromium.org/1132163011/diff/1/src/harmony-typedarray.js#newcode127
src/harmony-typedarray.js:127: "from", TypedArrayFrom,
On 2015/05/15 00:20:22, arv wrote:
This needs one more object in the [[Prototype]] chain:

Uint8Array.__proto__ === %TypedArray%
%TypedArray%.__proto__ === %FunctionPrototype%


http://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-typedarray-constructors

Maybe add a todo and reference the bug we already have on this?

I have a bug open for this
https://code.google.com/p/v8/issues/detail?id=4085 . Added a reference.

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js
File test/mjsunit/harmony/typedarray-from.js (right):

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js#newcode16
test/mjsunit/harmony/typedarray-from.js:16: Float64Array];
On 2015/05/15 00:20:22, arv wrote:
] on next line

Done.

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js#newcode18
test/mjsunit/harmony/typedarray-from.js:18:
typedArrayConstructors.forEach(function(constructor) {
On 2015/05/15 00:20:22, arv wrote:
I find for-of loops easier to read

Done.

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js#newcode20
test/mjsunit/harmony/typedarray-from.js:20: assertEquals(1,
constructor.from.length);
On 2015/05/15 00:20:22, arv wrote:
indent

Done.

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js#newcode25
test/mjsunit/harmony/typedarray-from.js:25: var construct_fn =
constructor.construct;
On 2015/05/15 00:20:22, arv wrote:
Where did construct come from?

Oops, this was a remnant for a test that I deleted, and it was supposed
to read constructor.constructor.

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js#newcode28
test/mjsunit/harmony/typedarray-from.js:28: assertInstanceof(value,
type);
On 2015/05/15 00:20:22, arv wrote:
I tend to prefer to check the __proto__ or Object.getPrototypeOf since
it is
more exact. Checking instanceof does not care if there are extra
object in the
prototype chain.

Done.

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js#newcode30
test/mjsunit/harmony/typedarray-from.js:30: for (var i=0;
i<value.length; ++i) {
On 2015/05/15 00:20:22, arv wrote:
ws around binops

Done.

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js#newcode38
test/mjsunit/harmony/typedarray-from.js:38: function non_strict(){
assertEquals(global, this); }
On 2015/05/15 00:20:23, arv wrote:
ws before {

Done.

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js#newcode39
test/mjsunit/harmony/typedarray-from.js:39: function strict(){ "use
strict"; assertEquals(void 0, this); }
On 2015/05/15 00:20:22, arv wrote:
you can use undefined in tests if you want

Done.

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js#newcode58
test/mjsunit/harmony/typedarray-from.js:58: { length: 1, '0': 5 }), [5],
constructor);
On 2015/05/15 00:20:22, arv wrote:
no need to quote the key here.

Done.

https://codereview.chromium.org/1132163011/diff/1/test/mjsunit/harmony/typedarray-from.js#newcode82
test/mjsunit/harmony/typedarray-from.js:82: assertThrows(function() {
constructor.from([], "noncallable"); },
On 2015/05/15 00:20:22, arv wrote:
stick to either " or '

Done.

https://codereview.chromium.org/1132163011/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to