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

Issue 35413006: Correct handling of arrays with callbacks in the prototype chain. (Closed)

Created:
7 years, 2 months ago by mvstanton
Modified:
7 years, 1 month ago
CC:
v8-dev
Visibility:
Public.

Description

Correct handling of arrays with callbacks in the prototype chain. Our generic KeyedStoreIC doesn't handle the case when a callback is set on array elements in the prototype chain of the object, nor do we recognize that we need to avoid the monomorphic case if these callbacks exist. This CL addresses the issue by looking for dictionary elements in the prototype chain on IC misses and crankshaft element store instructions. When found, the generic IC is used. The generic IC is changed to go to the runtime in this case too. In general, keyed loads are immune from this problem because they won't return the hole: discovery of the hole goes to the runtime where the callback will be found in the prototype chain. Double array loads in crankshaft can return the hole but only if the prototype chain is unaltered (we will catch such alterations). Includes the following patch as well (already reviewed by bmeurer): Performance regression found in test regress-2185-2.js. The problem was that the bailout method for TransitionAndStoreStub was not performing the appropriate transition. (Review URL for the ElementsTransitionAndStoreIC_Miss change: https://codereview.chromium.org/26911007) R=danno@chromium.org Committed: https://code.google.com/p/v8/source/detail?r=17525

Patch Set 1 #

Patch Set 2 : A few test updates and simpler prototype updating. #

Total comments: 22

Patch Set 3 : REBASE (actually small fix to previous rebase) #

Total comments: 2

Patch Set 4 : Quit deopting everything #

Patch Set 5 : Fixes for correct transitions #

Patch Set 6 : Test fixes #

Total comments: 27

Patch Set 7 : Allow a double transition, plus x64 port. #

Patch Set 8 : Simply check on dictionary elements rather than transitioning #

Patch Set 9 : ports. #

Total comments: 6

Patch Set 10 : Addressed Michaels comments. #

Total comments: 4

Patch Set 11 : Nit fixin. #

Patch Set 12 : REBASE #

Patch Set 13 : Bugfix: check on dictionary elements was incorrect. Added test. Re-enabled test. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+715 lines, -13 lines) Patch
M src/arm/ic-arm.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +29 lines, -0 lines 0 comments Download
M src/arm/macro-assembler-arm.h View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -0 lines 0 comments Download
M src/arm/macro-assembler-arm.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +26 lines, -0 lines 0 comments Download
M src/heap.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -0 lines 0 comments Download
M src/heap.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +14 lines, -0 lines 0 comments Download
M src/hydrogen.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +32 lines, -1 line 0 comments Download
M src/ia32/ic-ia32.cc View 1 2 3 4 5 6 7 8 9 2 chunks +23 lines, -0 lines 0 comments Download
M src/ia32/macro-assembler-ia32.h View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -0 lines 0 comments Download
M src/ia32/macro-assembler-ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +26 lines, -0 lines 0 comments Download
M src/ic.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +15 lines, -4 lines 0 comments Download
M src/objects.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +8 lines, -0 lines 0 comments Download
M src/objects.cc View 1 2 3 4 5 6 7 8 9 10 11 12 8 chunks +59 lines, -4 lines 0 comments Download
M src/x64/ic-x64.cc View 1 2 3 4 5 6 7 8 9 2 chunks +24 lines, -0 lines 0 comments Download
M src/x64/macro-assembler-x64.h View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -0 lines 0 comments Download
M src/x64/macro-assembler-x64.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +26 lines, -0 lines 0 comments Download
M test/mjsunit/allocation-site-info.js View 1 chunk +5 lines, -1 line 0 comments Download
A test/mjsunit/getters-on-elements.js View 1 2 3 4 5 6 1 chunk +214 lines, -0 lines 0 comments Download
M test/mjsunit/mjsunit.status View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +0 lines, -3 lines 0 comments Download
A test/mjsunit/setters-on-elements.js View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +199 lines, -0 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
mvstanton
Hi guys, PTAL, here is the version without use of dependent code, just a deopt ...
7 years, 2 months ago (2013-10-23 11:37:16 UTC) #1
danno
https://codereview.chromium.org/35413006/diff/30001/src/heap.cc File src/heap.cc (right): https://codereview.chromium.org/35413006/diff/30001/src/heap.cc#newcode470 src/heap.cc:470: void Heap::ClearAllKeyedStoreICs() { Can you please add a parameter ...
7 years, 2 months ago (2013-10-23 12:22:10 UTC) #2
mvstanton
Hi Danno, I've addressed these issues. PTAL. It might be possible/desirable to break up the ...
7 years, 1 month ago (2013-10-30 10:42:42 UTC) #3
danno
In general, definitely going in the right direction, see my comments below I think you ...
7 years, 1 month ago (2013-10-30 12:17:44 UTC) #4
mvstanton
Hi Danno, thx for the comments, PTAL (again :p), --Michael https://codereview.chromium.org/35413006/diff/200001/src/ia32/ic-ia32.cc File src/ia32/ic-ia32.cc (right): https://codereview.chromium.org/35413006/diff/200001/src/ia32/ic-ia32.cc#newcode738 ...
7 years, 1 month ago (2013-10-30 18:22:27 UTC) #5
mvstanton
Per Toon's idea, I've removed the map flag in favor of making sure keyed stores ...
7 years, 1 month ago (2013-11-04 14:01:06 UTC) #6
Michael Starzinger
Looking good. Just a coupe of nits. Some might apply to more than one architecture, ...
7 years, 1 month ago (2013-11-04 15:18:16 UTC) #7
mvstanton
thx, addressed Michael's points. https://codereview.chromium.org/35413006/diff/450001/src/heap.h File src/heap.h (right): https://codereview.chromium.org/35413006/diff/450001/src/heap.h#newcode770 src/heap.h:770: void ClearAllICsByKind(Code::Kind kind); On 2013/11/04 ...
7 years, 1 month ago (2013-11-04 16:30:04 UTC) #8
danno
lgtm with nits https://codereview.chromium.org/35413006/diff/520001/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/35413006/diff/520001/src/objects.cc#newcode6256 src/objects.cc:6256: nit: two returns between functions https://codereview.chromium.org/35413006/diff/520001/src/x64/macro-assembler-x64.cc ...
7 years, 1 month ago (2013-11-04 17:44:44 UTC) #9
mvstanton
Right on, thanks! https://codereview.chromium.org/35413006/diff/520001/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/35413006/diff/520001/src/objects.cc#newcode6256 src/objects.cc:6256: On 2013/11/04 17:44:44, danno wrote: > ...
7 years, 1 month ago (2013-11-05 09:06:50 UTC) #10
mvstanton
Hi Danno, Could you have another quick look? thanks, --Michael
7 years, 1 month ago (2013-11-06 08:45:44 UTC) #11
danno
lgtm
7 years, 1 month ago (2013-11-06 15:37:28 UTC) #12
mvstanton
Committed patchset #13 manually as r17525 (presubmit successful).
7 years, 1 month ago (2013-11-06 15:45:59 UTC) #13
Paul Lind
Drive-by comment: Hi Michael - In your JumpIfDictionaryInPrototypeChain() you read Map::kBitField2Offset with a word-load on ...
7 years, 1 month ago (2013-11-06 21:32:58 UTC) #14
Sven Panne
Just a note: This CL regresses the "--stress-opt --always-opt" variant of mjsunit/readonly by roughly 60%, ...
7 years, 1 month ago (2013-11-12 08:58:46 UTC) #15
mvstanton
7 years, 1 month ago (2013-11-12 09:32:03 UTC) #16
Message was sent while issue was closed.
On 2013/11/12 08:58:46, Sven Panne wrote:
> Just a note: This CL regresses the "--stress-opt --always-opt" variant of
> mjsunit/readonly by roughly 60%, not sure if this is a real issue, though.

Thx guys. Paul, I'll address the word load issue you mentioned, thx for the
heads up!

Sven, I believe this is because setting a prototype got more expensive in one
case. I clear all KeyedStoreICs in the code on prototype set when the set
introduced dictionary elements into the chain where the receiver elements are
fast. I'll have a look.

Powered by Google App Engine
This is Rietveld 408576698