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

Issue 2357423002: Improve stack traces for async functions (Closed)

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

Description

Improve stack traces for async functions This patch tracks the stack of async functions differently from other Promise async stack tracking. With this patch, the stack trace of a callstack of async functions should look similarly to the call stack if all of the functions were synchronous. An example can be found in the updated test expectations: https://codereview.chromium.org/2362923002 . The new stack traces are implemented using existing mechanisms in the inspector. The inspector has two ways to save async stack traces: recurring and non-recurring stacks. An example of a non-recurring stack is setTimeout, and a recurring one is saved for setInterval. Recurring stacks are deleted only when a special "cancel" function is called, rather than being deleted after being used the first time. Previous Promise async stack tracking always used non-recurring stacks. For async functions, this patch saves a recurring stack. The top frame of the stack is duplicated, as the resuming function contains a similar frame; the devtools frontend is responsible for removing or marking this frame, which it can do based on seeing the [async function] line which follows it. The second frame will instead be provided by the resuming execution context. The recurring stack is saved when the async function is entered, and it is deleted from a finally block. The id of the stack is saved in the outer Promise being constructed by the async function. When an intermediate throwaway Promise will be triggered as a reaction, it will be identified as such based on its debugging metadata, and the corresponding async function's recurring stack will be used. BUG=v8:4483 Committed: https://crrev.com/f296dad962e452ced1e5396b9ced7203747f7209 Cr-Commit-Position: refs/heads/master@{#39695}

Patch Set 1 #

Patch Set 2 : Change around resume id #

Patch Set 3 : Pop off the top of the inspector's stack #

Patch Set 4 : Async function stack traces #

Patch Set 5 : Better data model #

Patch Set 6 : Cleanup and fix test #

Patch Set 7 : Rebase #

Total comments: 2

Patch Set 8 : Make skipping the top stack frame a private API #

Patch Set 9 : Format #

Total comments: 6

Patch Set 10 : Remove skipInitialFrame #

Patch Set 11 : Remove skipInitialFrame #

Patch Set 12 : REbase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -70 lines) Patch
M src/contexts.h View 1 chunk +4 lines, -0 lines 0 comments Download
M src/heap-symbols.h View 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/inspector/v8-debugger.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -0 lines 0 comments Download
M src/inspector/v8-stack-trace-impl.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M src/js/harmony-async-await.js View 1 2 3 4 5 chunks +47 lines, -9 lines 0 comments Download
M src/js/prologue.js View 2 3 4 5 2 chunks +2 lines, -0 lines 0 comments Download
M src/js/promise.js View 1 2 3 4 5 7 chunks +29 lines, -4 lines 0 comments Download
M src/parsing/parser.cc View 1 2 3 4 5 6 7 8 9 3 chunks +13 lines, -48 lines 0 comments Download
M test/mjsunit/harmony/debug-async-function-async-task-event.js View 1 2 3 4 5 3 chunks +13 lines, -9 lines 0 comments Download

Messages

Total messages: 37 (23 generated)
Dan Ehrenberg
4 years, 3 months ago (2016-09-22 22:32:21 UTC) #10
kozy
https://codereview.chromium.org/2357423002/diff/120001/src/inspector/v8-debugger.h File src/inspector/v8-debugger.h (right): https://codereview.chromium.org/2357423002/diff/120001/src/inspector/v8-debugger.h#newcode93 src/inspector/v8-debugger.h:93: bool recurring, int skipInitialFrames = 0); Please not expose ...
4 years, 3 months ago (2016-09-23 01:27:36 UTC) #13
Dan Ehrenberg
https://codereview.chromium.org/2357423002/diff/120001/src/inspector/v8-debugger.h File src/inspector/v8-debugger.h (right): https://codereview.chromium.org/2357423002/diff/120001/src/inspector/v8-debugger.h#newcode93 src/inspector/v8-debugger.h:93: bool recurring, int skipInitialFrames = 0); On 2016/09/23 at ...
4 years, 3 months ago (2016-09-23 04:11:31 UTC) #14
gsathya
https://codereview.chromium.org/2357423002/diff/160001/src/js/promise.js File src/js/promise.js (right): https://codereview.chromium.org/2357423002/diff/160001/src/js/promise.js#newcode37 src/js/promise.js:37: var ObjectHasOwnProperty; Is this used anywhere?
4 years, 3 months ago (2016-09-23 06:06:20 UTC) #23
Dan Ehrenberg
https://codereview.chromium.org/2357423002/diff/160001/src/js/promise.js File src/js/promise.js (right): https://codereview.chromium.org/2357423002/diff/160001/src/js/promise.js#newcode37 src/js/promise.js:37: var ObjectHasOwnProperty; On 2016/09/23 at 06:06:20, gsathya wrote: > ...
4 years, 3 months ago (2016-09-23 07:05:56 UTC) #24
gsathya
lgtm https://codereview.chromium.org/2357423002/diff/160001/src/js/promise.js File src/js/promise.js (right): https://codereview.chromium.org/2357423002/diff/160001/src/js/promise.js#newcode240 src/js/promise.js:240: SET_PRIVATE(promise, promiseDeferredReactionsSymbol, UNDEFINED); Extra symbol lookup + update ...
4 years, 3 months ago (2016-09-23 16:06:25 UTC) #25
Dan Ehrenberg
https://codereview.chromium.org/2357423002/diff/160001/src/js/promise.js File src/js/promise.js (right): https://codereview.chromium.org/2357423002/diff/160001/src/js/promise.js#newcode240 src/js/promise.js:240: SET_PRIVATE(promise, promiseDeferredReactionsSymbol, UNDEFINED); On 2016/09/23 at 16:06:25, gsathya wrote: ...
4 years, 3 months ago (2016-09-23 18:11:44 UTC) #26
kozy
lgtm for inspector part. https://codereview.chromium.org/2357423002/diff/160001/src/inspector/v8-debugger.cc File src/inspector/v8-debugger.cc (right): https://codereview.chromium.org/2357423002/diff/160001/src/inspector/v8-debugger.cc#newcode659 src/inspector/v8-debugger.cc:659: asyncTaskScheduled(name, ptr, true, true); Based ...
4 years, 3 months ago (2016-09-23 21:49:45 UTC) #28
Dan Ehrenberg
https://codereview.chromium.org/2357423002/diff/160001/src/inspector/v8-debugger.cc File src/inspector/v8-debugger.cc (right): https://codereview.chromium.org/2357423002/diff/160001/src/inspector/v8-debugger.cc#newcode659 src/inspector/v8-debugger.cc:659: asyncTaskScheduled(name, ptr, true, true); On 2016/09/23 at 21:49:45, kozyatinskiy ...
4 years, 3 months ago (2016-09-23 21:51:25 UTC) #29
kozy
On 2016/09/23 21:51:25, Dan Ehrenberg wrote: > If you look at patchset 12, you will ...
4 years, 3 months ago (2016-09-23 21:54:11 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2357423002/220001
4 years, 3 months ago (2016-09-23 21:55:18 UTC) #33
commit-bot: I haz the power
Committed patchset #12 (id:220001)
4 years, 3 months ago (2016-09-23 22:23:56 UTC) #34
commit-bot: I haz the power
Patchset 12 (id:??) landed as https://crrev.com/f296dad962e452ced1e5396b9ced7203747f7209 Cr-Commit-Position: refs/heads/master@{#39695}
4 years, 3 months ago (2016-09-23 22:24:13 UTC) #36
Dan Ehrenberg
4 years, 3 months ago (2016-09-23 22:28:16 UTC) #37
Message was sent while issue was closed.
On 2016/09/23 at 22:24:13, commit-bot wrote:
> Patchset 12 (id:??) landed as
https://crrev.com/f296dad962e452ced1e5396b9ced7203747f7209
> Cr-Commit-Position: refs/heads/master@{#39695}

This patch may cause the blink bot to temporarily break. A fix is being landed
at https://codereview.chromium.org/2362923002 . Sorry if there are any ephemeral
infrastructure issues due to the timing.

Powered by Google App Engine
This is Rietveld 408576698