On 2014/06/26 15:55:12, rossberg wrote:
On 2014/06/25 16:08:37, wingo wrote:
> PTAL; an early RFC patch for comments.  Some more tests are needed for
> accessor/data duplicate property interactions.  I propose not doing this
change
> behind a flag; wdyt?

Hm, why is the complication necessary? Can't we just do something really
simple
and generic in the case where there actually is a duplicate? Doesn't matter
that
it would be slow.

I don't really see a way to do this.  If you want an abstraction between:

(1) the existing code where you can use a boilerplate object with pre-filled constant values, just emitting code to set things at runtime when needed, trying to collect getters and setters to avoid having to look up a getter at runtime
when adding a setter and vice versa, and:

 (2) a translation to "do () { var o = {}; o.foo = 20; o.bar = 30; o }"

If this is what you want, then you have to represent some of the aspects of (1)
in the generic solution.

Particularly with duplicate properties we run into tricky semantic corner-cases.
 For example:

  ({ get foo() { 42 }, foo: 10, set foo(x) { ... } })

What does the resulting object look like? It has one property, "foo", and it's an accessor property, but does it have a getter? (In the above patch: it does
not have a getter.  However,-writing to es-discuss to clarify has not been
useful.)

Likewise:

  ({ get __proto__() { 42 }, __proto__: 10, set __proto__(x) { ... } })

Clearly the __proto__:10 sets the [[Prototype]].  But does it have a getter?
The state machine in ast.cc provides a fairly simple (though regrettably
verbose) way to answer these questions once in a central place, which I find
more better than the current state of things ;) It's also easy to extend to the computed property name case, with no impact on code generation either (except
taking out some UNREACHABLE()s).

https://codereview.chromium.org/352173004/

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