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

Issue 2296703004: Inline CreateResolvingFunctions

Created:
4 years, 3 months ago by gsathya
Modified:
4 years, 3 months ago
Reviewers:
Dan Ehrenberg, adamk
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[promise] Inline CreateResolvingFunctions This CL inlines CreateResolvingFunctions removing the need for the 'alreadyResolved' variable and object literal which is used to return the two closures. Instead this patch stores the state directly on the promise using a symbol. This patch also adds an additional parameter to the ResolvePromise and RejectPromise to make ensure that we do the resolution/rejection again when we resolve with a Promise. The symbol and this extra parameter only prevent external users from resolving/rejecting multiple times. This patch results in a 7.3% improvement in the bluebird benchmark over 5 runs. BUG=v8:5046

Patch Set 1 #

Patch Set 2 : update cctest #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+72 lines, -82 lines) Patch
M src/heap-symbols.h View 1 chunk +42 lines, -41 lines 1 comment Download
M src/js/promise.js View 9 chunks +29 lines, -40 lines 4 comments Download
M test/cctest/test-inobject-slack-tracking.cc View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 12 (8 generated)
gsathya
"promiseResolvingFunctionCalledSymbol" and "follow" aren't probably the best names, couldn't think of anything better for now ...
4 years, 3 months ago (2016-08-30 22:02:46 UTC) #5
Dan Ehrenberg
Great win! A few comments. https://codereview.chromium.org/2296703004/diff/20001/src/heap-symbols.h File src/heap-symbols.h (right): https://codereview.chromium.org/2296703004/diff/20001/src/heap-symbols.h#newcode197 src/heap-symbols.h:197: V(promise_resolving_function_called_symbol) \ Naming suggestion: ...
4 years, 3 months ago (2016-08-30 22:29:28 UTC) #8
adamk
I see a failing test under webkit/, interested if that's related to Dan's comment. I ...
4 years, 3 months ago (2016-08-30 23:00:35 UTC) #11
Dan Ehrenberg
4 years, 3 months ago (2016-09-07 00:24:11 UTC) #12
This patch does two things: avoid creating the object with the two
resolve/reject fields, and avoid closing over alreadyResolved. I bet most of the
win comes from the first one, and the spec violation is introduced by the second
one. Maybe it'd be worth trying this again, but only with that part. Sure,
there's some code duplication, but not that much.

Powered by Google App Engine
This is Rietveld 408576698