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

Issue 7324027: Fix: FunctionTemplate::SetPrototypeAttributes broke prototype object (Closed)

Created:
9 years, 5 months ago by Jakob Kummerow
Modified:
9 years, 5 months ago
Reviewers:
Rico
CC:
v8-dev, danno, Mads Ager (chromium)
Visibility:
Public.

Description

Fix: FunctionTemplate::SetPrototypeAttributes broke prototype object BUG=v8:1539 TEST=cctest test-api/SetPrototypeAttributes Committed: http://code.google.com/p/v8/source/detail?r=8737

Patch Set 1 #

Total comments: 2

Patch Set 2 : different approach: new runtime function #

Total comments: 16

Patch Set 3 : address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+87 lines, -53 lines) Patch
M include/v8.h View 1 1 chunk +3 lines, -4 lines 0 comments Download
M src/api.cc View 1 2 chunks +2 lines, -4 lines 0 comments Download
M src/apinatives.js View 1 2 1 chunk +4 lines, -8 lines 0 comments Download
M src/macros.py View 1 2 chunks +2 lines, -1 line 0 comments Download
M src/objects.h View 1 3 chunks +3 lines, -3 lines 0 comments Download
M src/objects.cc View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M src/objects-inl.h View 1 2 chunks +2 lines, -2 lines 0 comments Download
M src/runtime.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/runtime.cc View 1 2 1 chunk +55 lines, -0 lines 0 comments Download
M test/cctest/test-api.cc View 1 2 1 chunk +12 lines, -31 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Jakob Kummerow
PTAL. Happy to discuss other solutions -- I've looked into changing JSObject::SetLocalPropertyIgnoreAttributes() instead, but a ...
9 years, 5 months ago (2011-07-08 09:55:24 UTC) #1
Jakob Kummerow
Mads, can you take a look?
9 years, 5 months ago (2011-07-11 09:04:45 UTC) #2
Mads Ager (chromium)
What happened if you used IgnoreAttributesAndSetProperty? Did it not call the FunctionSetPrototype setter? Was the ...
9 years, 5 months ago (2011-07-11 10:12:54 UTC) #3
Jakob Kummerow
[Mads to CC since he's on vacation.] Rico: PTAL. I've discussed this new approach with ...
9 years, 5 months ago (2011-07-25 11:10:32 UTC) #4
Rico
LGTM, are there some chromium guys that needs to change some bindings code? http://codereview.chromium.org/7324027/diff/6001/src/objects.cc File ...
9 years, 5 months ago (2011-07-25 13:05:42 UTC) #5
Jakob Kummerow
9 years, 5 months ago (2011-07-25 14:57:05 UTC) #6
Thanks for the review, comments addressed, landing.

http://codereview.chromium.org/7324027/diff/6001/src/objects.cc
File src/objects.cc (right):

http://codereview.chromium.org/7324027/diff/6001/src/objects.cc#newcode2439
src/objects.cc:2439: // will silently fail).
On 2011/07/25 13:05:42, Rico wrote:
> I can't see where we actually silently fail in this method, and it is not
> immediately clear which of the method calls would do that.

I've made the comment a bit more verbose.

http://codereview.chromium.org/7324027/diff/6001/src/runtime.cc
File src/runtime.cc (right):

http://codereview.chromium.org/7324027/diff/6001/src/runtime.cc#newcode1966
src/runtime.cc:1966: CONVERT_CHECKED(JSFunction, object, args[0]);
On 2011/07/25 13:05:42, Rico wrote:
> it's a function, maybe call it fun, function or f instead of object

Done.

http://codereview.chromium.org/7324027/diff/6001/src/runtime.cc#newcode1973
src/runtime.cc:1973: if (object->HasFastProperties()) {
On 2011/07/25 13:05:42, Rico wrote:
> If it is not performance critical to keep fast properties consider just
> converting to dictionary mode instead of the descriptor array juggling 

I'd prefer to keep performance as it is since this code can be called by
embedders at will.

http://codereview.chromium.org/7324027/diff/6001/src/runtime.cc#newcode1976
src/runtime.cc:1976: int index = instance_desc->Search(name);
On 2011/07/25 13:05:42, Rico wrote:
> assert that index != kNotFound

Done.

http://codereview.chromium.org/7324027/diff/6001/src/runtime.cc#newcode2004
src/runtime.cc:2004: int entry = object->property_dictionary()->FindEntry(name);
On 2011/07/25 13:05:42, Rico wrote:
> assert that entry != kNotFound

Done.

http://codereview.chromium.org/7324027/diff/6001/src/runtime.cc#newcode2008
src/runtime.cc:2008: details.type(), details.index());
On 2011/07/25 13:05:42, Rico wrote:
> nit, put last argument on seperate line

Done.

http://codereview.chromium.org/7324027/diff/6001/src/runtime.h
File src/runtime.h (right):

http://codereview.chromium.org/7324027/diff/6001/src/runtime.h#newcode213
src/runtime.h:213: F(FunctionReadOnlyPrototype, 1, 1) \
On 2011/07/25 13:05:42, Rico wrote:
> maybe rename to FunctionSetReadOnlyPrototype

Done.

http://codereview.chromium.org/7324027/diff/6001/test/cctest/test-api.cc
File test/cctest/test-api.cc (right):

http://codereview.chromium.org/7324027/diff/6001/test/cctest/test-api.cc#newc...
test/cctest/test-api.cc:6997: CHECK_EQ(42,
CompileRun("func2.prototype.x")->Int32Value());
On 2011/07/25 13:05:42, Rico wrote:
> We could also add a check that when we actually write to the prototype it is
not
> allowed (i.e., to prototype remains the same)

Done.

Powered by Google App Engine
This is Rietveld 408576698