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

Issue 7356013: Implement Object.prototype.hasOwnProperty in generated code. (Closed)

Created:
9 years, 5 months ago by Vitaly Repeshko
Modified:
7 years, 5 months ago
CC:
v8-dev
Visibility:
Public.

Description

Implement Object.prototype.hasOwnProperty in generated code. R=sgjesse@chromium.org TEST=mjsunit/has-own-property

Patch Set 1 #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+663 lines, -26 lines) Patch
M src/array.js View 9 chunks +9 lines, -9 lines 0 comments Download
M src/code-stubs.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/hydrogen.cc View 1 chunk +11 lines, -0 lines 1 comment Download
M src/ia32/code-stubs-ia32.h View 5 chunks +79 lines, -0 lines 1 comment Download
M src/ia32/code-stubs-ia32.cc View 6 chunks +485 lines, -3 lines 6 comments Download
M src/ia32/full-codegen-ia32.cc View 1 chunk +12 lines, -0 lines 0 comments Download
M src/ia32/lithium-codegen-ia32.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M src/json.js View 1 chunk +1 line, -1 line 0 comments Download
M src/runtime.h View 2 chunks +2 lines, -1 line 0 comments Download
M src/runtime.cc View 3 chunks +10 lines, -10 lines 0 comments Download
M src/v8natives.js View 2 chunks +2 lines, -2 lines 0 comments Download
M test/mjsunit/has-own-property.js View 1 chunk +46 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Vitaly Repeshko
9 years, 5 months ago (2011-07-13 11:21:48 UTC) #1
Vitaly Repeshko
Søren, Can you please take a look? Thanks, Vitaly
9 years, 5 months ago (2011-07-13 13:51:07 UTC) #2
Søren Thygesen Gjesse
Redirecting to Daniel as I will be on vacation from tomorrow.
9 years, 5 months ago (2011-07-13 14:00:50 UTC) #3
Mads Ager (chromium)
9 years, 5 months ago (2011-07-15 09:04:45 UTC) #4
Overall the code looks fine. I'm a bit concerned about the amount of generated
code just for hasOwnProperty. Do we have indications that it is used enough to
justify this much complexity?

It is not completely clear to me whether all cases are covered by your tests. We
should create some API tests as well for the behavior when iterceptors and
access checks are involved.

http://codereview.chromium.org/7356013/diff/1/src/hydrogen.cc
File src/hydrogen.cc (right):

http://codereview.chromium.org/7356013/diff/1/src/hydrogen.cc#newcode6150
src/hydrogen.cc:6150: HCallStub* result = new(zone()) HCallStub(
I would prefer

HCallStub* result =
    new(zone()) HCallStub(context, CodeStub::HasOwnProperty, 2);

Which also fits the style in the methods above.

http://codereview.chromium.org/7356013/diff/1/src/ia32/code-stubs-ia32.cc
File src/ia32/code-stubs-ia32.cc (right):

http://codereview.chromium.org/7356013/diff/1/src/ia32/code-stubs-ia32.cc#new...
src/ia32/code-stubs-ia32.cc:5528: __ shr(scratch, 6);
This looks wrong? The >> operator in C++ is arithmetic so you might end up with
inconsistent hash values computed in C++ and in generated code which will be
bad. Same thing for the methods below. Maybe for some reason it is OK to use shr
here. I don't think we should - we should make sure that this matches the C++
code.

http://codereview.chromium.org/7356013/diff/1/src/ia32/code-stubs-ia32.cc#new...
src/ia32/code-stubs-ia32.cc:6609: // TODO(vitalyr): access check?
Yes, I'm pretty sure you need to exclude objects that require access checks as
well. If you should not have access to the object you should not be able to ask
is about which properties it has.

http://codereview.chromium.org/7356013/diff/1/src/ia32/code-stubs-ia32.cc#new...
src/ia32/code-stubs-ia32.cc:6612: __ CmpInstanceType(map, JS_OBJECT_TYPE);
Do you want to be that restrictive? You don't want this to work for arrays and
global objects?

http://codereview.chromium.org/7356013/diff/1/src/ia32/code-stubs-ia32.cc#new...
src/ia32/code-stubs-ia32.cc:6623: __ test_b(FieldOperand(scratch1,
Map::kBitFieldOffset),
You are disregarding objects with hidden prototypes because the prototype in
that case is considered part of the object, right? Can you add a comment about
that?

http://codereview.chromium.org/7356013/diff/1/src/ia32/code-stubs-ia32.cc#new...
src/ia32/code-stubs-ia32.cc:6642: 
Add an abort here so it is clear that there is no fall-through?

http://codereview.chromium.org/7356013/diff/1/src/ia32/code-stubs-ia32.cc#new...
src/ia32/code-stubs-ia32.cc:6652: 
Ditto, add an abort?

http://codereview.chromium.org/7356013/diff/1/src/ia32/code-stubs-ia32.h
File src/ia32/code-stubs-ia32.h (right):

http://codereview.chromium.org/7356013/diff/1/src/ia32/code-stubs-ia32.h#newc...
src/ia32/code-stubs-ia32.h:546: // returns true if the property is found, jumps
to the given label
the given label -> the not_found_in_descriptors label?

Powered by Google App Engine
This is Rietveld 408576698