Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Issue 6992072: Implement set trap for proxies, and revamp class hierarchy in preparation (Closed)

Created:
9 years, 7 months ago by rossberg
Modified:
9 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

Implement set trap for proxies, and revamp class hierarchy in preparation: - Introduce a class JSReceiver, that is a common superclass of JSObject and JSProxy. Use JSReceiver where appropriate (probably lots of places that we still have to migrate, but we will find those later with proxy test suite). - Move appropriate methods to JSReceiver class (SetProperty, GetPropertyAttribute, Get/SetPrototype, Lookup, and so on). - Introduce new JSFunctionProxy subclass of JSProxy. Currently only a stub. - Overhaul enum InstanceType: * Introduce FIRST/LAST_SPEC_OBJECT_TYPE that ranges over all types that represent JS objects, and use that consistently to check language types. * Rename FIRST/LAST_JS_OBJECT_TYPE and FIRST/LAST_FUNCTION_CLASS_TYPE to FIRST/LAST_[NON]CALLABLE_SPEC_OBJECT_TYPE for clarity. * Eliminate the overlap over JS_REGEXP_TYPE. * Also replace FIRST_JS_OBJECT with FIRST_JS_RECEIVER, but only use it where we exclusively talk about the internal representation type. * Insert JS_PROXY and JS_FUNCTION_PROXY in the appropriate places. - Fix all checks concerning classification, especially for functions, to use the CALLABLE_SPEC_OBJECT range (that includes funciton proxies). - Handle proxies in SetProperty (that was the easiest part :) ). - A few simple test cases. R=kmillikin@chromium.org

Patch Set 1 #

Total comments: 5

Patch Set 2 : Renamed range constants for InstanceType enum. #

Total comments: 30

Patch Set 3 : Address review. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+750 lines, -397 lines) Patch
M include/v8.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/arm/builtins-arm.cc View 1 2 3 chunks +6 lines, -8 lines 0 comments Download
M src/arm/code-stubs-arm.cc View 1 2 5 chunks +10 lines, -10 lines 0 comments Download
M src/arm/full-codegen-arm.cc View 1 2 6 chunks +20 lines, -18 lines 0 comments Download
M src/arm/ic-arm.cc View 1 2 2 chunks +8 lines, -4 lines 0 comments Download
M src/arm/lithium-codegen-arm.cc View 1 2 4 chunks +21 lines, -18 lines 0 comments Download
M src/arm/macro-assembler-arm.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M src/arm/stub-cache-arm.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/bootstrapper.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/contexts.h View 2 chunks +3 lines, -1 line 0 comments Download
M src/handles.h View 2 chunks +3 lines, -7 lines 0 comments Download
M src/handles.cc View 1 2 4 chunks +3 lines, -14 lines 0 comments Download
M src/hydrogen.cc View 1 2 2 chunks +5 lines, -3 lines 0 comments Download
M src/hydrogen-instructions.h View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M src/hydrogen-instructions.cc View 1 2 chunks +4 lines, -5 lines 0 comments Download
M src/ia32/builtins-ia32.cc View 1 2 3 chunks +6 lines, -8 lines 0 comments Download
M src/ia32/code-stubs-ia32.cc View 1 2 5 chunks +7 lines, -7 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 2 5 chunks +18 lines, -16 lines 0 comments Download
M src/ia32/ic-ia32.cc View 1 2 2 chunks +8 lines, -4 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 2 4 chunks +18 lines, -16 lines 0 comments Download
M src/ia32/macro-assembler-ia32.cc View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M src/ia32/stub-cache-ia32.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/ic.cc View 1 2 4 chunks +11 lines, -4 lines 0 comments Download
M src/mark-compact.cc View 1 2 3 chunks +7 lines, -9 lines 0 comments Download
M src/objects.h View 1 2 21 chunks +142 lines, -82 lines 0 comments Download
M src/objects.cc View 1 2 22 chunks +142 lines, -44 lines 0 comments Download
M src/objects-inl.h View 1 2 5 chunks +25 lines, -11 lines 0 comments Download
M src/proxy.js View 2 chunks +52 lines, -3 lines 0 comments Download
M src/runtime.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M src/x64/builtins-x64.cc View 1 2 3 chunks +6 lines, -8 lines 0 comments Download
M src/x64/code-stubs-x64.cc View 1 2 7 chunks +12 lines, -12 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 2 5 chunks +19 lines, -16 lines 0 comments Download
M src/x64/ic-x64.cc View 1 2 2 chunks +8 lines, -4 lines 0 comments Download
M src/x64/lithium-codegen-x64.cc View 1 2 4 chunks +17 lines, -16 lines 0 comments Download
M src/x64/stub-cache-x64.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
A test/mjsunit/harmony/proxies.js View 1 2 1 chunk +116 lines, -0 lines 0 comments Download
M test/mjsunit/testcfg.py View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M test/mjsunit/typeof.js View 1 2 2 chunks +1 line, -2 lines 0 comments Download
M tools/grokdump.py View 1 chunk +35 lines, -33 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
rossberg
9 years, 7 months ago (2011-05-25 17:34:59 UTC) #1
Kevin Millikin (Chromium)
The set trap looks good to me. I've solicited some more feedback on the name ...
9 years, 7 months ago (2011-05-26 09:31:08 UTC) #2
Kevin Millikin (Chromium)
A quick round of comments. http://codereview.chromium.org/6992072/diff/4002/src/arm/builtins-arm.cc File src/arm/builtins-arm.cc (right): http://codereview.chromium.org/6992072/diff/4002/src/arm/builtins-arm.cc#newcode953 src/arm/builtins-arm.cc:953: __ b(ge, &exit); Not ...
9 years, 7 months ago (2011-05-26 13:30:10 UTC) #3
Kevin Millikin (Chromium)
http://codereview.chromium.org/6992072/diff/4002/src/arm/builtins-arm.cc File src/arm/builtins-arm.cc (right): http://codereview.chromium.org/6992072/diff/4002/src/arm/builtins-arm.cc#newcode953 src/arm/builtins-arm.cc:953: __ b(ge, &exit); On 2011/05/26 13:30:10, Kevin Millikin wrote: ...
9 years, 6 months ago (2011-05-30 16:32:29 UTC) #4
rossberg
9 years, 6 months ago (2011-05-31 14:50:24 UTC) #5
http://codereview.chromium.org/6992072/diff/1/src/arm/builtins-arm.cc
File src/arm/builtins-arm.cc (right):

http://codereview.chromium.org/6992072/diff/1/src/arm/builtins-arm.cc#newcode951
src/arm/builtins-arm.cc:951: // FIRST_OBJECT_OR_FUNCTION_CLASS_TYPE, it is not
an object in the ECMA sense.
On 2011/05/26 09:31:08, Kevin Millikin wrote:
> Maybe the terminology is still not quite right.  This catches lots of Objects
> that don't have [[Class]] "Object" or "Function" (e.g., "Arguments", "Array",
> "Number", etc.).
> 
> All of those things do have type Object.

Changed according to your suggestion on the list.

http://codereview.chromium.org/6992072/diff/1/src/arm/lithium-codegen-arm.cc
File src/arm/lithium-codegen-arm.cc (right):

http://codereview.chromium.org/6992072/diff/1/src/arm/lithium-codegen-arm.cc#...
src/arm/lithium-codegen-arm.cc:1989: ASSERT(LAST_TYPE ==
LAST_FUNCTION_CLASS_TYPE);
On 2011/05/26 09:31:08, Kevin Millikin wrote:
> Do you think that all these asserts can be STATIC_ASSERT?

Done (here and elsewhere).

http://codereview.chromium.org/6992072/diff/4002/src/arm/full-codegen-arm.cc
File src/arm/full-codegen-arm.cc (right):

http://codereview.chromium.org/6992072/diff/4002/src/arm/full-codegen-arm.cc#...
src/arm/full-codegen-arm.cc:896: __ b(hs, &done_convert);
On 2011/05/30 16:32:29, Kevin Millikin wrote:
> See, here is 'hs'.

Changed to ge.

http://codereview.chromium.org/6992072/diff/4002/src/arm/full-codegen-arm.cc#...
src/arm/full-codegen-arm.cc:2440: void
FullCodeGenerator::EmitIsObject(ZoneList<Expression*>* args) {
On 2011/05/26 13:30:10, Kevin Millikin wrote:
> We should probably name the corresponding runtime function to %_IsSpecObject
(as
> a separate change).

Hm, SpecObject includes functions, so that would probably give the wrong idea.
%_IsNoncallableSpecObject then? :)

http://codereview.chromium.org/6992072/diff/4002/src/arm/full-codegen-arm.cc#...
src/arm/full-codegen-arm.cc:2779: __ b(hs, &function);
On 2011/05/30 16:32:29, Kevin Millikin wrote:
> This should possibly be "hs" --> "ge".

Done.

http://codereview.chromium.org/6992072/diff/4002/src/arm/full-codegen-arm.cc#...
src/arm/full-codegen-arm.cc:4083: __ b(lo, if_false);
On 2011/05/30 16:32:29, Kevin Millikin wrote:
> Likewise, "lo" --> "lt" here and "hi" --> "gt" just below.  It's not
consistent
> with the other cases :(

Done.

http://codereview.chromium.org/6992072/diff/4002/src/arm/lithium-codegen-arm.cc
File src/arm/lithium-codegen-arm.cc (right):

http://codereview.chromium.org/6992072/diff/4002/src/arm/lithium-codegen-arm....
src/arm/lithium-codegen-arm.cc:2711: DeoptimizeIf(lo, instr->environment());
On 2011/05/30 16:32:29, Kevin Millikin wrote:
> "lo" --> "lt"

Done.

http://codereview.chromium.org/6992072/diff/4002/src/arm/lithium-codegen-arm....
src/arm/lithium-codegen-arm.cc:4363: __ b(lo, false_label);
On 2011/05/30 16:32:29, Kevin Millikin wrote:
> "lo" --> "lt", "hi" --> "gt" just below.

Done.

http://codereview.chromium.org/6992072/diff/4002/src/ia32/lithium-codegen-ia3...
File src/ia32/lithium-codegen-ia32.cc (right):

http://codereview.chromium.org/6992072/diff/4002/src/ia32/lithium-codegen-ia3...
src/ia32/lithium-codegen-ia32.cc:1884: __ j(greater_equal, is_true);
On 2011/05/30 16:32:29, Kevin Millikin wrote:
> This needs to be above_equal (also just below).

Done.

http://codereview.chromium.org/6992072/diff/4002/src/ic.cc
File src/ic.cc (right):

http://codereview.chromium.org/6992072/diff/4002/src/ic.cc#newcode1389
src/ic.cc:1389: HandleScope scope(isolate());
On 2011/05/30 16:32:29, Kevin Millikin wrote:
> The handle scope should not be needed here.

Done.

http://codereview.chromium.org/6992072/diff/4002/src/objects.cc
File src/objects.cc (right):

http://codereview.chromium.org/6992072/diff/4002/src/objects.cc#newcode144
src/objects.cc:144: return result->HandlerResult();
On 2011/05/30 16:32:29, Kevin Millikin wrote:
> Indentation looks off.

Done.

http://codereview.chromium.org/6992072/diff/4002/src/objects.h
File src/objects.h (right):

http://codereview.chromium.org/6992072/diff/4002/src/objects.h#newcode294
src/objects.h:294: V(JS_PROXY_TYPE)                                             
               \
On 2011/05/26 13:30:10, Kevin Millikin wrote:
> These aren't required by the implementation to be in the same order as in the
> enum, but it might be helpful for the reader.

Done.

http://codereview.chromium.org/6992072/diff/4002/src/objects.h#newcode590
src/objects.h:590: FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_VALUE_TYPE,
On 2011/05/26 13:30:10, Kevin Millikin wrote:
> That's not really pithy :(.  How about FIRST_NONCALLABLE_OBJECT_TYPE without
the
> SPEC?

Hm, with neither SPEC nor JS, wouldn't that name logically refer to FIRST_TYPE?
(All the types here are "object" types in the V8 sense.)

With the current name, it is immediately clear that it is a subcategory of
SPEC_OBJECT_TYPEs. (Fortunately, we don't use it that often.)

http://codereview.chromium.org/6992072/diff/4002/src/objects.h#newcode1706
src/objects.h:1706: //  void Lookup(String* name, LookupResult* result);
On 2011/05/26 13:30:10, Kevin Millikin wrote:
> Can this be removed?

Oops.

http://codereview.chromium.org/6992072/diff/4002/src/x64/lithium-codegen-x64.cc
File src/x64/lithium-codegen-x64.cc (right):

http://codereview.chromium.org/6992072/diff/4002/src/x64/lithium-codegen-x64....
src/x64/lithium-codegen-x64.cc:1896: __ j(greater_equal, is_true);
On 2011/05/30 16:32:29, Kevin Millikin wrote:
> Here: above_equal, and also just below.

Done.

http://codereview.chromium.org/6992072/diff/4002/test/harmony/proxies.js
File test/harmony/proxies.js (right):

http://codereview.chromium.org/6992072/diff/4002/test/harmony/proxies.js#newc...
test/harmony/proxies.js:1: 
On 2011/05/30 16:32:29, Kevin Millikin wrote:
> This needs the license header.
> 
> I'd move it into a new subdirectory test/mjsunit/harmony/ and use the
mjsunit.js
> utilities where it makes sense.

Done.

Powered by Google App Engine
This is Rietveld 408576698