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

Issue 2007803002: Promises: Lazily create arrays to store resolve, reject callbacks (Closed)

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

Description

Promises: Lazily create arrays to store resolve, reject callbacks For the common use case of having a single resolve or reject callback, the callbacks are stored directly. Only when an additional callback is registered, we create an array to store these callbacks. There are 3 possible states for the resolve, reject symbols when we add a new callback -- 1) UNDEFINED -- This is the zero state where there is no callback registered. When we see this state, we directly attach the callbacks to the symbol. 2) !IS_ARRAY -- There is a single callback directly attached to the symbols. We need to create a new array to store additional callbacks. 3) IS_ARRAY -- There are multiple callbacks already registered, therefore we can just push the new callback to the existing array. Also, this change creates a new symbol for storing the deferred objects. Previously the deferred objects were stored in the callback arrays, but since we no longer create arrays for the initial case, we need this new symbol. The cctest has been updated to account for this new symbol. This patch results in a 19% improvement(over 5 runs) in the bluebird benchmark. BUG=v8:5046 Committed: https://crrev.com/1d4fe00287eabfb64d6bba51d685b2e668f179af Cr-Commit-Position: refs/heads/master@{#36536}

Patch Set 1 #

Patch Set 2 : shave yak #

Patch Set 3 : Remove length #

Patch Set 4 : Fix tests #

Patch Set 5 : Update cctest #

Total comments: 24

Patch Set 6 : Address review comments #

Patch Set 7 : Refactor PromiseHasUserDefinedRejectHandlerRecursive #

Patch Set 8 : minor cleanup #

Unified diffs Side-by-side diffs Delta from patch set Stats (+83 lines, -25 lines) Patch
M src/heap-symbols.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M src/js/promise.js View 1 2 3 4 5 6 7 8 chunks +81 lines, -24 lines 0 comments Download
M test/cctest/test-inobject-slack-tracking.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 35 (18 generated)
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2007803002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2007803002/60001
4 years, 7 months ago (2016-05-25 03:49:03 UTC) #8
commit-bot: I haz the power
No L-G-T-M from a valid reviewer yet. CQ run can only be started by full ...
4 years, 7 months ago (2016-05-25 03:49:05 UTC) #10
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2007803002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2007803002/60001
4 years, 7 months ago (2016-05-25 03:49:33 UTC) #13
gsathya
This could use some additional clean up especially in PromiseThen and PromiseHasUserDefinedRejectHandlerRecursive, but sending it ...
4 years, 7 months ago (2016-05-25 03:49:51 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/2172) v8_linux64_avx2_rel_ng_triggered on ...
4 years, 7 months ago (2016-05-25 04:07:35 UTC) #16
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2007803002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2007803002/80001
4 years, 7 months ago (2016-05-25 04:15:15 UTC) #19
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 7 months ago (2016-05-25 04:49:44 UTC) #21
commit-bot: I haz the power
Dry run: None
4 years, 7 months ago (2016-05-25 04:49:53 UTC) #22
adamk
https://codereview.chromium.org/2007803002/diff/80001/src/js/promise.js File src/js/promise.js (right): https://codereview.chromium.org/2007803002/diff/80001/src/js/promise.js#newcode104 src/js/promise.js:104: promise, status, value, onResolve, onReject, deferred) { None of ...
4 years, 7 months ago (2016-05-25 19:18:57 UTC) #23
gsathya
Thanks for the review! PTAL https://codereview.chromium.org/2007803002/diff/80001/src/js/promise.js File src/js/promise.js (right): https://codereview.chromium.org/2007803002/diff/80001/src/js/promise.js#newcode104 src/js/promise.js:104: promise, status, value, onResolve, ...
4 years, 7 months ago (2016-05-25 21:46:35 UTC) #24
adamk
https://codereview.chromium.org/2007803002/diff/80001/src/js/promise.js File src/js/promise.js (right): https://codereview.chromium.org/2007803002/diff/80001/src/js/promise.js#newcode339 src/js/promise.js:339: } else if (!IS_ARRAY(resolveCallbacks)) { On 2016/05/25 21:46:35, gsathya ...
4 years, 7 months ago (2016-05-25 21:57:43 UTC) #25
adamk
https://codereview.chromium.org/2007803002/diff/80001/src/js/promise.js File src/js/promise.js (right): https://codereview.chromium.org/2007803002/diff/80001/src/js/promise.js#newcode339 src/js/promise.js:339: } else if (!IS_ARRAY(resolveCallbacks)) { On 2016/05/25 21:57:43, adamk ...
4 years, 7 months ago (2016-05-25 23:41:35 UTC) #26
gsathya
Thanks for the review! PTAL https://codereview.chromium.org/2007803002/diff/80001/src/js/promise.js File src/js/promise.js (right): https://codereview.chromium.org/2007803002/diff/80001/src/js/promise.js#newcode488 src/js/promise.js:488: queue = [queue]; On ...
4 years, 7 months ago (2016-05-26 22:18:47 UTC) #28
adamk
lgtm
4 years, 7 months ago (2016-05-26 22:30:02 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2007803002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2007803002/140001
4 years, 7 months ago (2016-05-26 22:52:32 UTC) #31
commit-bot: I haz the power
Committed patchset #8 (id:140001)
4 years, 7 months ago (2016-05-26 23:28:32 UTC) #33
commit-bot: I haz the power
4 years, 7 months ago (2016-05-26 23:30:47 UTC) #35
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/1d4fe00287eabfb64d6bba51d685b2e668f179af
Cr-Commit-Position: refs/heads/master@{#36536}

Powered by Google App Engine
This is Rietveld 408576698