Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5dd8842ba4a06129cdf32b13f7bc44f395ad9c93
      
https://github.com/WebKit/WebKit/commit/5dd8842ba4a06129cdf32b13f7bc44f395ad9c93
  Author: Sosuke Suzuki <[email protected]>
  Date:   2025-09-06 (Sat, 06 Sep 2025)

  Changed paths:
    M JSTests/stress/async-stack-trace-basic.js
    M JSTests/stress/async-stack-trace-bound-functions-basic.js
    M JSTests/stress/async-stack-trace-nested-deep.js
    M JSTests/stress/async-stack-trace-nested.js
    M JSTests/stress/async-stack-trace-switch.js
    M Source/JavaScriptCore/interpreter/Interpreter.cpp
    M Source/JavaScriptCore/runtime/StackFrame.cpp
    M Source/JavaScriptCore/runtime/StackFrame.h

  Log Message:
  -----------
  [JSC] Add `async` prefix for async function frame on stack trace
https://bugs.webkit.org/show_bug.cgi?id=298508

Reviewed by Yusuke Suzuki.

When we have code like this:

   async function one() { await two(); }
   async function two() { await three(); }
   async function three() { await 3; throw new Error("error from three");  }

V8 generates stack traces like the following. Note that async functions that
were executing before being suspended have an "async" prefix in the stack trace:

   Error: error from three
       at three (./WebKitBuild/Debug/test.js:3:41)
       at async two (./WebKitBuild/Debug/test.js:2:24)
       at async one (./WebKitBuild/Debug/test.js:1:24)

Currently, JSC's async stack traces do not add this prefix.

This patch changes to add an "async" prefix to async functions in stack traces.
(This change only affects when `--useAsyncStackTrace=1` is enabled.)

For example, before this patch:

   three@./WebKitBuild/Debug/test.js:3:50
   two@./WebKitBuild/Debug/test.js:2:35
   one@./WebKitBuild/Debug/test.js:1:33

After this patch:
   three@./WebKitBuild/Debug/test.js:3:50
   async two@./WebKitBuild/Debug/test.js:2:35
   async one@./WebKitBuild/Debug/test.js:1:33

* JSTests/stress/async-stack-trace-basic.js:
* JSTests/stress/async-stack-trace-bound-functions-basic.js:
* JSTests/stress/async-stack-trace-nested-deep.js:
* JSTests/stress/async-stack-trace-nested.js:
* JSTests/stress/async-stack-trace-switch.js:
* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::Interpreter::getAsyncStackTrace):
* Source/JavaScriptCore/runtime/StackFrame.cpp:
(JSC::StackFrame::StackFrame):
(JSC::StackFrame::sourceURL const):
(JSC::StackFrame::sourceURLStripped const):
(JSC::StackFrame::functionName const):
* Source/JavaScriptCore/runtime/StackFrame.h:
(JSC::StackFrame::isAsyncFrameWithoutCodeBlock const):

Canonical link: https://commits.webkit.org/299668@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to