On Sat, Oct 18, 2014 at 2:30 PM, Dmitry Lomov <dslo...@chromium.org> wrote:

> On Sat, Oct 18, 2014 at 7:56 PM, Erik Arvidsson <a...@chromium.org> wrote:
>
>> I don't think an access check is needed. The function and prototype are
>> both new objects created by the class definition evaluation.
>>
> I see, you are right. This code is scary though. I would like this
> invariant (that the function and prototype are new, just created objects to
> be very prominent in the code.
>
> Here is an idea:
> - Split Runtime_Define class into Runtime_CreateClassPrototype and
> Runtime_DefineClassConstructor.
> - Pass class prototype into both Runtime_DefineConstructor and into
> EmitClassDefineProperties (the latter will assume class prototype and
> constructor are both on the stack. In fact, you probably do not need a
> constructor there at all).
>
> WDYT?
>

I've been trying to find a clean way to split "create class" into "create
constructor" and "create prototype" but they are highly intertwined.

If you look at the spec you can see how it computes protoParent and
constructorParent in parallel, including doing a Get(superclass,
"prototype"). These two needs to go hand in hand.

If I split this I think I need at least 3 stages

- Create prototype. Pass: extends value
- Create constructor. Pass: extends value, name, prototype and constructor
- Define the rest of the methods. Pass: prototype and constructor
(constructor is need for statics)

(and setup the toString data too)

As I was trying to change the code to the above I am convinced that it is a
lot less clean than what I have at the moment.


>
> On Oct 18, 2014 5:05 AM, <dslo...@chromium.org> wrote:
>>
>>>
>>> https://codereview.chromium.org/639123009/diff/1/src/ia32/
>>> full-codegen-ia32.cc
>>> File src/ia32/full-codegen-ia32.cc (right):
>>>
>>> https://codereview.chromium.org/639123009/diff/1/src/ia32/
>>> full-codegen-ia32.cc#newcode2446
>>> src/ia32/full-codegen-ia32.cc:2446: __
>>> CallRuntime(Runtime::kSetProperty, 4);
>>> On 2014/10/18 08:30:33, Dmitry Lomov (chromium) wrote:
>>>
>>>> You should use StoreIC here (see EmitKeyedPropertyAssignment for how
>>>>
>>> it is done)
>>>
>>> s/Keyed/Named/ of course.
>>> Maybe given how much runtime calling is going on here anyway, maybe it's
>>> not worth it yet to install ICs here
>>>
>>> https://codereview.chromium.org/639123009/
>>>
>>
>


-- 
erik

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to