[webkit-changes] [WebKit/WebKit] d32c0d: Fix stack traces for wasm inlined functions

Justin Michaud noreply at github.com
Tue Mar 14 20:12:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d32c0d56c8d26375f1bcce2f1597bc0817651431
      https://github.com/WebKit/WebKit/commit/d32c0d56c8d26375f1bcce2f1597bc0817651431
  Author: Justin Michaud <justin_michaud at apple.com>
  Date:   2023-03-14 (Tue, 14 Mar 2023)

  Changed paths:
    M JSTests/wasm/function-tests/stack-trace.js
    A JSTests/wasm/stress/simple-inline-stacktrace-2.js
    A JSTests/wasm/stress/simple-inline-stacktrace-with-catch-2.js
    A JSTests/wasm/stress/simple-inline-stacktrace-with-catch.js
    A JSTests/wasm/stress/simple-inline-stacktrace-with-catch.wasm
    A JSTests/wasm/stress/simple-inline-stacktrace-with-catch.wat
    A JSTests/wasm/stress/simple-inline-stacktrace.js
    A JSTests/wasm/stress/simple-inline-stacktrace.wasm
    A JSTests/wasm/stress/simple-inline-stacktrace.wat
    M Source/JavaScriptCore/interpreter/Interpreter.cpp
    M Source/JavaScriptCore/interpreter/ShadowChicken.cpp
    M Source/JavaScriptCore/interpreter/StackVisitor.cpp
    M Source/JavaScriptCore/interpreter/StackVisitor.h
    M Source/JavaScriptCore/tools/JSDollarVM.cpp
    M Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmB3IRGenerator.h
    M Source/JavaScriptCore/wasm/WasmCallee.cpp
    M Source/JavaScriptCore/wasm/WasmCallee.h
    M Source/JavaScriptCore/wasm/WasmIRGeneratorHelpers.h
    M Tools/Scripts/run-jsc-stress-tests

  Log Message:
  -----------
  Fix stack traces for wasm inlined functions
https://bugs.webkit.org/show_bug.cgi?id=253685
rdar://106532509

Reviewed by Yusuke Suzuki.

Wasm inlining broke stack traces. We now store our call site index
at the beginning of an inlined function if we otherwise would have skipped
this. Like before, we continue storing the call site index at
places where we can throw if any function in our current stack frame has
exception handlers.

We add a map to wasm jit callees to go from CallSiteIndex to function name.

We separate out the code to read a wasm frame from the code to read JS
or native frames, and consult this map inside StackVisitor.

* JSTests/wasm/function-tests/stack-trace.js:
* JSTests/wasm/stress/simple-inline-stacktrace.js: Added.
(a.doThrow):
(i.catch):
* JSTests/wasm/stress/simple-inline-stacktrace.wasm: Added.
* JSTests/wasm/stress/simple-inline-stacktrace.wat: Added.
* Source/JavaScriptCore/interpreter/CallFrameInlines.h:
(JSC::CallFrame::codeBlock const):
* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::findExceptionHandler):
* Source/JavaScriptCore/interpreter/ShadowChicken.cpp:
(JSC::ShadowChicken::update):
* Source/JavaScriptCore/interpreter/StackVisitor.cpp:
(JSC::StackVisitor::gotoNextFrame):
(JSC::StackVisitor::unwindToMachineCodeBlockFrame):
(JSC::StackVisitor::readFrame):
(JSC::StackVisitor::readNonInlinedFrame):
(JSC::StackVisitor::readInlinedWasmFrame):
(JSC::StackVisitor::readInlinedFrame):
(JSC::StackVisitor::Frame::calleeSaveRegistersForUnwinding):
(JSC::StackVisitor::Frame::createArguments):
(JSC::StackVisitor::Frame::setToEnd):
(JSC::StackVisitor::Frame::dump const):
* Source/JavaScriptCore/interpreter/StackVisitor.h:
(JSC::StackVisitor::Frame::inlineCallFrame const):
(JSC::StackVisitor::Frame::isInlinedDFGFrame const):
(JSC::StackVisitor::Frame::isInlinedFrame const): Deleted.
* Source/JavaScriptCore/tools/JSDollarVM.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::B3IRGenerator::preparePatchpointForExceptions):
(JSC::Wasm::B3IRGenerator::createTailCallPatchpoint):
(JSC::Wasm::B3IRGenerator::emitInlineDirectCall):
(JSC::Wasm::B3IRGenerator::addCall):
(JSC::Wasm::parseAndCompileB3):
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.h:
* Source/JavaScriptCore/wasm/WasmBBQPlan.cpp:
(JSC::Wasm::BBQPlan::compileFunction):
* Source/JavaScriptCore/wasm/WasmBBQPlan.h:
* Source/JavaScriptCore/wasm/WasmCallee.cpp:
(JSC::Wasm::OptimizingJITCallee::addCodeOrigin):
(JSC::Wasm::OptimizingJITCallee::getOrigin const):
* Source/JavaScriptCore/wasm/WasmCallee.h:
* Source/JavaScriptCore/wasm/WasmIRGeneratorHelpers.h:
(JSC::Wasm::PatchpointExceptionHandle::generate const):
* Source/JavaScriptCore/wasm/WasmNameSectionParser.cpp:
(JSC::Wasm::NameSectionParser::parse):

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




More information about the webkit-changes mailing list