On 2014/08/05 02:11:14, caitp wrote:
For what it's worth, if AddElement is in some way a useful implementation of CreateDataPropertyOrThrow, we'd have uses for it elsewhere, so the connection
should be more clearly explained.

This is a valid concern and I also have my doubts. There are currently several
operations implemented in V8 which its spec description relies on
CreateDataPropertyOrThrow, so how it's possible that there's not an
implementation of this method available already?

Let's take the spec of Array.prototype.map for example. The spec describes the
following steps:

   * Let mappedValue be the result of calling the Call internal method of
callbackfn with T as thisArgument and a List containing kValue, k, and O as
argumentsList.
   * ReturnIfAbrupt(mappedValue).
   * Let status be CreateDataPropertyOrThrow (A, Pk, mappedValue).
   * ReturnIfAbrupt(status).

Which is translated to the following implementation in V8:

accumulator[i] = %_CallFunction(receiver, element, i, array, f);

That means, to an array assignment, and it happens the same in many other
functions (which in the spec rely on CreateDataPropertyOrThrow). So, should we drop the implementation of AddElement and use a simple array assignment? Or in
contrast, should we change all the functions which rely on
CreateDataPropertyOrThrow and use AddElement instead of doing an array
assignment?

The subtle difference between AddElement and a direct array assignment is that
the former defines a property an the letter sets an element. If we drop the
implementation of AddElement and use an array assignment we should consider the
"Array.of does not trigger prototype setters" test invalid.


https://codereview.chromium.org/364853009/

--
--
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