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

Issue 1936393002: Make array __proto__ manipulations not disturb the species protector (Closed)

Created:
4 years, 7 months ago by Dan Ehrenberg
Modified:
4 years, 7 months ago
CC:
v8-reviews_googlegroups.com, Toon Verwaest
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Make array __proto__ manipulations not disturb the species protector Previously, the species protector was invalidated whenever the __proto__ of an Array instance was manipulated. Then, if the map's new_target_is_base field remained set, it was correct to conclude that GetPrototypeOf(array) was %ArrayPrototype%. However, this choice caused the popular D3 framework to invalidate the species protector, causing many functions to become slower. This patch eliminates that aspect of the species protector. Instead, the check is to look at the instance->map()->prototype(). It is valid to look directly at the map's prototype slot, ignoring hidden prototypes and proxies, because - This is only called on Array instances, so the receiver cannot be a Proxy. - For hidden prototypes, any inaccuracy would only result in conservatively taking the slow path. Theoretically, this patch could make methods applied to arrays from other contexts slower. However, the slowdown would only affect a particular array instance and not have a global spill-over effect. Further, the slowdown could be addressed by tracking, either in the instance's map or in the actual prototype object, whether it is a %ArrayPrototype% from any context, in a way which is cheap to query, and use that rather than comparing to the currently executing native context. In interactive testing, this patch led the OnShape CAD system to experience faster load times (110+s -> 40s). BUG=chromium:606207 LOG=Y Committed: https://crrev.com/04c8c11ee569a41d4b07839154eb0c718ff6e381 Cr-Commit-Position: refs/heads/master@{#36033}

Patch Set 1 #

Patch Set 2 : Clean up code; still needs tests #

Patch Set 3 : Tests, cleanup #

Total comments: 12

Patch Set 4 : Fix review issues #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+41 lines, -23 lines) Patch
M src/builtins.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M src/isolate.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/objects.h View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
M src/objects.cc View 1 2 chunks +1 line, -11 lines 0 comments Download
M src/objects-inl.h View 1 2 3 3 chunks +6 lines, -1 line 0 comments Download
M src/runtime/runtime.h View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/runtime/runtime-test.cc View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
M test/mjsunit/harmony/array-species-constructor.js View 1 2 3 2 chunks +2 lines, -1 line 2 comments Download
M test/mjsunit/harmony/array-species-constructor-accessor.js View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M test/mjsunit/harmony/array-species-constructor-delete.js View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M test/mjsunit/harmony/array-species-delete.js View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M test/mjsunit/harmony/array-species-modified.js View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M test/mjsunit/harmony/array-species-parent-constructor.js View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download
M test/mjsunit/harmony/array-species-proto.js View 1 2 3 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 34 (15 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1936393002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1936393002/1
4 years, 7 months ago (2016-05-02 21:47:29 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: v8_linux_arm_rel_ng on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_arm_rel_ng/builds/1033) v8_linux_arm_rel_ng_triggered on ...
4 years, 7 months ago (2016-05-02 22:07:21 UTC) #7
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1936393002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1936393002/40001
4 years, 7 months ago (2016-05-03 00:29:12 UTC) #9
Dan Ehrenberg
4 years, 7 months ago (2016-05-03 00:31:56 UTC) #11
adamk
+verwaest to verify that it's OK to avoid the PrototypeIterator here. There are two sets ...
4 years, 7 months ago (2016-05-03 00:45:31 UTC) #14
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: v8_linux64_avx2_rel_ng on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_avx2_rel_ng/builds/1051) v8_linux64_avx2_rel_ng_triggered on ...
4 years, 7 months ago (2016-05-03 00:49:52 UTC) #16
Camillo Bruni
https://codereview.chromium.org/1936393002/diff/40001/src/objects-inl.h File src/objects-inl.h (right): https://codereview.chromium.org/1936393002/diff/40001/src/objects-inl.h#newcode7588 src/objects-inl.h:7588: bool JSArray::HasArrayPrototype(Isolate* isolate) { On 2016/05/03 at 00:45:31, adamk ...
4 years, 7 months ago (2016-05-03 08:05:54 UTC) #17
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1936393002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1936393002/60001
4 years, 7 months ago (2016-05-04 00:08:43 UTC) #19
Dan Ehrenberg
https://codereview.chromium.org/1936393002/diff/40001/src/builtins.cc File src/builtins.cc (right): https://codereview.chromium.org/1936393002/diff/40001/src/builtins.cc#newcode701 src/builtins.cc:701: !array->HasArrayPrototype(isolate)) { On 2016/05/03 at 00:45:31, adamk wrote: > ...
4 years, 7 months ago (2016-05-04 00:18:50 UTC) #20
adamk
This looks fine to me now, but I'd like cbruni to sign off too.
4 years, 7 months ago (2016-05-04 00:24:12 UTC) #21
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 7 months ago (2016-05-04 00:33:49 UTC) #23
Toon Verwaest
For me the CL is fine. JSArrays are not "api objects", so don't require anything ...
4 years, 7 months ago (2016-05-04 09:21:16 UTC) #24
Toon Verwaest
lgtm
4 years, 7 months ago (2016-05-04 16:45:33 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1936393002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1936393002/60001
4 years, 7 months ago (2016-05-04 16:45:58 UTC) #27
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 7 months ago (2016-05-04 16:47:41 UTC) #29
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/04c8c11ee569a41d4b07839154eb0c718ff6e381 Cr-Commit-Position: refs/heads/master@{#36033}
4 years, 7 months ago (2016-05-04 16:48:56 UTC) #31
Camillo Bruni
LGTM with nit https://codereview.chromium.org/1936393002/diff/60001/test/mjsunit/harmony/array-species-constructor.js File test/mjsunit/harmony/array-species-constructor.js (right): https://codereview.chromium.org/1936393002/diff/60001/test/mjsunit/harmony/array-species-constructor.js#newcode21 test/mjsunit/harmony/array-species-constructor.js:21: assertFalse(%SpeciesProtector()); nit: could you also check ...
4 years, 7 months ago (2016-05-11 12:50:08 UTC) #32
Dan Ehrenberg
https://codereview.chromium.org/1936393002/diff/60001/test/mjsunit/harmony/array-species-constructor.js File test/mjsunit/harmony/array-species-constructor.js (right): https://codereview.chromium.org/1936393002/diff/60001/test/mjsunit/harmony/array-species-constructor.js#newcode21 test/mjsunit/harmony/array-species-constructor.js:21: assertFalse(%SpeciesProtector()); On 2016/05/11 at 12:50:08, Camillo Bruni wrote: > ...
4 years, 7 months ago (2016-05-11 14:32:16 UTC) #33
Dan Ehrenberg
4 years, 7 months ago (2016-05-11 14:32:20 UTC) #34
Message was sent while issue was closed.

          

Powered by Google App Engine
This is Rietveld 408576698