https://codereview.chromium.org/553413002/diff/20001/src/array.js
File src/array.js (right):
https://codereview.chromium.org/553413002/diff/20001/src/array.js#newcode1139
src/array.js:1139: if (!IS_NULL_OR_UNDEFINED(receiver) &&
On 2014/09/12 16:29:17, arv wrote:
Can this test be moved out of the loop?
In strict mode, GetDefaultReceiver can return 'undefined'. ToObject
throws an exception if the argument is undefined, so I need to avoid
that case.
https://codereview.chromium.org/553413002/diff/20001/src/array.js#newcode1175
src/array.js:1175: if (!IS_NULL_OR_UNDEFINED(receiver) &&
On 2014/09/12 16:29:17, arv wrote:
Maybe we can introduce a helper function/macro for this?
SHOULD_CREATE_WRAPPER(receiver, f)
Acknowledged.
https://codereview.chromium.org/553413002/diff/20001/src/collection.js
File src/collection.js (right):
https://codereview.chromium.org/553413002/diff/20001/src/collection.js#newcode118
src/collection.js:118: if (!IS_NULL_OR_UNDEFINED(receiver)) {
On 2014/09/12 16:29:17, arv wrote:
Why is this one different? Can you verify with the spec and add a test
that
hilights the difference if the spec requires a different semantic?
I tried to preserve the semantics of the old code. There was no
!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f) checking, so I
didn't add it.
The reason of IsSloppyModeFunction(f) is that according to the ECMA-262,
Annex C (The strict mode): "If this is evaluated within strict mode
code, then the this value is not coerced to an object". Currently, this
is not being coerced to an object (that's what the patch fixes :)) but
it shouldn't do it if the function is in strict mode, so MapForEach and
SetForEach need this checking too.
https://codereview.chromium.org/553413002/diff/20001/src/harmony-array.js
File src/harmony-array.js (right):
https://codereview.chromium.org/553413002/diff/20001/src/harmony-array.js#newcode36
src/harmony-array.js:36: var new_thisArg = thisArg;
On 2014/09/15 09:12:21, wingo wrote:
Call it "receiver", or something that doesn't have this_awfulStyle :)
Same
comments about factoring out the test to some kind of macro.
Acknowledged.
https://codereview.chromium.org/553413002/diff/20001/test/mjsunit/array-iteration.js
File test/mjsunit/array-iteration.js (right):
https://codereview.chromium.org/553413002/diff/20001/test/mjsunit/array-iteration.js#newcode76
test/mjsunit/array-iteration.js:76: // Do not create a new object in
each function call when receiver is a primitive value.
On 2014/09/15 09:12:21, wingo wrote:
"when receiver is not a primitive value" here, and below
Acknowledged.
https://codereview.chromium.org/553413002/
--
--
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.