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

Issue 947683002: Reimplement Maps and Sets in JS (Closed)

Created:
5 years, 10 months ago by adamk
Modified:
5 years, 8 months ago
CC:
v8-dev, jochen (gone - plz use gerrit)
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Reimplement Maps and Sets in JS Previously, the only optimized code path for Maps and Sets was for String keys. This was achieved through an implementation of various complex operations in Hydrogen. This approach was neither scalable nor forward-compatible. This patch adds the necessary intrinsics to implement Maps and Sets almost entirely in JS. The added intrinsics are: %_FixedArrayGet %_FixedArraySet %_TheHole %_JSCollectionGetTable %_StringGetRawHashField With these additions, as well as a few changes to what's exposed as runtime functions, most of the C++ code backing Maps and Sets is gone (including both runtime code in objects.cc and Crankshaft in hydrogen.cc). Committed: https://crrev.com/909500aa1db9789b68e101045a6359a7fcb30e83 Cr-Commit-Position: refs/heads/master@{#27605}

Patch Set 1 #

Patch Set 2 : Disable one more test #

Total comments: 21

Patch Set 3 : Moved more to JS #

Total comments: 2

Patch Set 4 : Fix harmony-templates.js #

Patch Set 5 : A few more tweaks #

Patch Set 6 : More macro-ification #

Patch Set 7 : Rename all the things, add more macros, and remove unnecessary %_CallFunctions #

Total comments: 24

Patch Set 8 : Rebased #

Patch Set 9 : Address verwaest comments #

Patch Set 10 : arv change #

Patch Set 11 : Un-indent, remove extra use strict #

Patch Set 12 : Merged to master #

Unified diffs Side-by-side diffs Delta from patch set Stats (+351 lines, -1062 lines) Patch
M src/arm/code-stubs-arm.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -10 lines 0 comments Download
M src/collection.js View 1 2 3 4 5 6 7 8 9 10 7 chunks +209 lines, -27 lines 0 comments Download
M src/hydrogen.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -9 lines 0 comments Download
M src/hydrogen.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +19 lines, -493 lines 0 comments Download
M src/ia32/code-stubs-ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -10 lines 0 comments Download
M src/macros.py View 1 2 3 4 5 6 7 1 chunk +27 lines, -0 lines 0 comments Download
M src/mips/code-stubs-mips.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -10 lines 0 comments Download
M src/mips64/code-stubs-mips64.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -10 lines 0 comments Download
M src/objects.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +2 lines, -46 lines 0 comments Download
M src/objects.cc View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +5 lines, -150 lines 0 comments Download
M src/ppc/code-stubs-ppc.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -10 lines 0 comments Download
M src/runtime/runtime.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +12 lines, -9 lines 0 comments Download
M src/runtime/runtime-collections.cc View 1 2 3 chunks +69 lines, -73 lines 0 comments Download
M src/templates.js View 1 2 3 4 5 6 7 2 chunks +3 lines, -3 lines 0 comments Download
M src/x64/code-stubs-x64.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -10 lines 0 comments Download
M test/cctest/cctest.gyp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -1 line 0 comments Download
M test/cctest/test-dictionary.cc View 1 2 3 4 3 chunks +0 lines, -12 lines 0 comments Download
D test/cctest/test-ordered-hash-table.cc View 1 chunk +0 lines, -179 lines 0 comments Download

Messages

Total messages: 35 (7 generated)
arv (Not doing code reviews)
Nice. https://codereview.chromium.org/947683002/diff/20001/src/collection.js File src/collection.js (right): https://codereview.chromium.org/947683002/diff/20001/src/collection.js#newcode40 src/collection.js:40: if (keyIsNaN && IS_NUMBER(candidate) && NUMBER_IS_NAN(candidate)) { Nice ...
5 years, 10 months ago (2015-02-21 16:20:16 UTC) #2
Sven Panne
The general direction looks fine, I just made a few remarks about the granularity of ...
5 years, 10 months ago (2015-02-23 09:26:53 UTC) #4
adamk
Thanks for taking a look! https://codereview.chromium.org/947683002/diff/20001/src/collection.js File src/collection.js (right): https://codereview.chromium.org/947683002/diff/20001/src/collection.js#newcode218 src/collection.js:218: while (%SetIteratorNext(iterator, value_array)) { ...
5 years, 10 months ago (2015-02-23 18:43:35 UTC) #5
adamk
https://codereview.chromium.org/947683002/diff/20001/src/hydrogen.cc File src/hydrogen.cc (right): https://codereview.chromium.org/947683002/diff/20001/src/hydrogen.cc#newcode12151 src/hydrogen.cc:12151: IfBuilder string_checker(this); On 2015/02/23 18:43:34, adamk wrote: > On ...
5 years, 10 months ago (2015-02-23 19:49:06 UTC) #6
adamk
Updated a few bits, and made this hopefully easier to diff against master by avoiding ...
5 years, 9 months ago (2015-03-16 17:35:06 UTC) #7
Michael Starzinger
https://codereview.chromium.org/947683002/diff/40001/src/runtime/runtime-collections.cc File src/runtime/runtime-collections.cc (right): https://codereview.chromium.org/947683002/diff/40001/src/runtime/runtime-collections.cc#newcode26 src/runtime/runtime-collections.cc:26: return isolate->heap()->the_hole_value(); This will trigger debug code in CEntryStub::Generate ...
5 years, 9 months ago (2015-03-16 22:54:13 UTC) #8
adamk
https://codereview.chromium.org/947683002/diff/40001/src/runtime/runtime-collections.cc File src/runtime/runtime-collections.cc (right): https://codereview.chromium.org/947683002/diff/40001/src/runtime/runtime-collections.cc#newcode26 src/runtime/runtime-collections.cc:26: return isolate->heap()->the_hole_value(); On 2015/03/16 22:54:13, Michael Starzinger wrote: > ...
5 years, 9 months ago (2015-03-17 09:05:31 UTC) #9
adamk
Cleaned up a bit more, and removed checks pointed out by mstarzinger. +verwaest in case ...
5 years, 9 months ago (2015-03-18 09:29:47 UTC) #12
adamk
Patch now ready for serious review. Who should be on the R line?
5 years, 9 months ago (2015-03-20 11:50:44 UTC) #13
adamk
Also, I realize it's a bit big. Could try to split out Map and Set ...
5 years, 9 months ago (2015-03-20 11:51:33 UTC) #14
adamk
Ping? I think Sven and Toon are reasonable folks to start looking at this. If ...
5 years, 9 months ago (2015-03-25 10:44:35 UTC) #15
arv (Not doing code reviews)
https://codereview.chromium.org/947683002/diff/140001/src/collection.js File src/collection.js (right): https://codereview.chromium.org/947683002/diff/140001/src/collection.js#newcode128 src/collection.js:128: if (IS_NUMBER(key) && key === 0) { Is this ...
5 years, 9 months ago (2015-03-25 11:17:01 UTC) #16
caitp (gmail)
https://1001-9732e57c756f-tainted-dot-chromiumcodereview.appspot.com/947683002/diff/140001/src/harmony-templates.js File src/harmony-templates.js (right): https://1001-9732e57c756f-tainted-dot-chromiumcodereview.appspot.com/947683002/diff/140001/src/harmony-templates.js#newcode24 src/harmony-templates.js:24: var obj = %_CallFunction(callSiteCache, hash, $MapGet); Couldn't we just ...
5 years, 9 months ago (2015-03-25 12:56:27 UTC) #18
Sven Panne
Looks OK from my (intrinsic-)side, let's wait for other reviews. The FooGrow/BarShrink intrinsics are probably ...
5 years, 9 months ago (2015-03-25 14:45:56 UTC) #19
adamk
On 2015/03/25 14:45:56, Sven Panne wrote: > The FooGrow/BarShrink intrinsics are probably too complex to ...
5 years, 9 months ago (2015-03-25 15:42:11 UTC) #20
adamk
https://1001-9732e57c756f-tainted-dot-chromiumcodereview.appspot.com/947683002/diff/140001/src/harmony-templates.js File src/harmony-templates.js (right): https://1001-9732e57c756f-tainted-dot-chromiumcodereview.appspot.com/947683002/diff/140001/src/harmony-templates.js#newcode24 src/harmony-templates.js:24: var obj = %_CallFunction(callSiteCache, hash, $MapGet); On 2015/03/25 12:56:27, ...
5 years, 9 months ago (2015-03-25 15:43:07 UTC) #21
caitp (gmail)
https://codereview.chromium.org/947683002/diff/140001/src/harmony-templates.js File src/harmony-templates.js (right): https://codereview.chromium.org/947683002/diff/140001/src/harmony-templates.js#newcode24 src/harmony-templates.js:24: var obj = %_CallFunction(callSiteCache, hash, $MapGet); On 2015/03/25 15:43:06, ...
5 years, 9 months ago (2015-03-25 15:46:24 UTC) #22
adamk
https://codereview.chromium.org/947683002/diff/140001/src/collection.js File src/collection.js (right): https://codereview.chromium.org/947683002/diff/140001/src/collection.js#newcode462 src/collection.js:462: $MapGet = MapGet; This is where I copy MapGet ...
5 years, 9 months ago (2015-03-25 16:13:37 UTC) #23
adamk
https://codereview.chromium.org/947683002/diff/140001/src/harmony-templates.js File src/harmony-templates.js (right): https://codereview.chromium.org/947683002/diff/140001/src/harmony-templates.js#newcode24 src/harmony-templates.js:24: var obj = %_CallFunction(callSiteCache, hash, $MapGet); On 2015/03/25 16:13:36, ...
5 years, 9 months ago (2015-03-25 16:14:24 UTC) #24
caitp (gmail)
https://codereview.chromium.org/947683002/diff/140001/src/harmony-templates.js File src/harmony-templates.js (right): https://codereview.chromium.org/947683002/diff/140001/src/harmony-templates.js#newcode24 src/harmony-templates.js:24: var obj = %_CallFunction(callSiteCache, hash, $MapGet); On 2015/03/25 16:14:24, ...
5 years, 9 months ago (2015-03-25 16:31:50 UTC) #25
Toon Verwaest
LGTM Sorry for the long delay, I've been a bit swamped. https://codereview.chromium.org/947683002/diff/140001/src/collection.js File src/collection.js (right): ...
5 years, 8 months ago (2015-03-30 12:55:42 UTC) #26
adamk
Thanks, Toon. I've removed the IS_NUMBER optimization for now, can re-add later (will also see ...
5 years, 8 months ago (2015-03-30 18:44:54 UTC) #27
arv (Not doing code reviews)
LGTM https://codereview.chromium.org/947683002/diff/140001/src/collection.js File src/collection.js (right): https://codereview.chromium.org/947683002/diff/140001/src/collection.js#newcode21 src/collection.js:21: "use strict"; This extra use strict is not ...
5 years, 8 months ago (2015-03-30 18:55:22 UTC) #28
adamk
https://codereview.chromium.org/947683002/diff/140001/src/collection.js File src/collection.js (right): https://codereview.chromium.org/947683002/diff/140001/src/collection.js#newcode21 src/collection.js:21: "use strict"; On 2015/03/30 18:55:22, arv wrote: > This ...
5 years, 8 months ago (2015-03-30 22:31:50 UTC) #29
adamk
I think this is ready to land, but I'm going to wait till after the ...
5 years, 8 months ago (2015-03-31 00:25:46 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/947683002/240001
5 years, 8 months ago (2015-04-06 23:27:09 UTC) #33
commit-bot: I haz the power
Committed patchset #12 (id:240001)
5 years, 8 months ago (2015-04-07 00:11:57 UTC) #34
commit-bot: I haz the power
5 years, 8 months ago (2015-04-07 00:12:16 UTC) #35
Message was sent while issue was closed.
Patchset 12 (id:??) landed as
https://crrev.com/909500aa1db9789b68e101045a6359a7fcb30e83
Cr-Commit-Position: refs/heads/master@{#27605}

Powered by Google App Engine
This is Rietveld 408576698