Ignore:
Timestamp:
Apr 26, 2017, 8:38:12 PM (8 years ago)
Author:
[email protected]
Message:

Print Wasm function index in stack trace
https://bugs.webkit.org/show_bug.cgi?id=171349

Reviewed by JF Bastien.

JSTests:

  • wasm/function-tests/stack-trace.js: Added.

(import.Builder.from.string_appeared_here.assert):
(let.imp):

  • wasm/function-tests/trap-after-cross-instance-call.js:

(wasmFrameCountFromError):

  • wasm/function-tests/trap-load-2.js:

(wasmFrameCountFromError):

  • wasm/function-tests/trap-load.js:

(wasmFrameCountFromError):

Source/JavaScriptCore:

This patch prints a Callee's index in the function index
space in Error.stack.

This will lead to stack traces that have lines of text like:
wasm function index: 4@[wasm code]

We don't ascribe indices to everything in wasm. Specifically, the
Wasm->JS call stub callee does not get a name, and neither does
the JS -> Wasm entrypoint.

  • interpreter/Interpreter.cpp:

(JSC::GetStackTraceFunctor::operator()):

  • interpreter/StackVisitor.cpp:

(JSC::StackVisitor::readNonInlinedFrame):
(JSC::StackVisitor::Frame::functionName):

  • interpreter/StackVisitor.h:

(JSC::StackVisitor::Frame::wasmFunctionIndex):

  • runtime/StackFrame.cpp:

(JSC::StackFrame::functionName):

  • runtime/StackFrame.h:

(JSC::StackFrame::StackFrame):
(JSC::StackFrame::wasm):
(JSC::StackFrame::hasBytecodeOffset):
(JSC::StackFrame::bytecodeOffset):

  • wasm/WasmBBQPlanInlines.h:

(JSC::Wasm::BBQPlan::initializeCallees):

  • wasm/WasmCallee.cpp:

(JSC::Wasm::Callee::Callee):

  • wasm/WasmCallee.h:

(JSC::Wasm::Callee::create):
(JSC::Wasm::Callee::index):

  • wasm/WasmOMGPlan.cpp:

(JSC::Wasm::OMGPlan::work):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r215779 r215854  
    480480
    481481        if (m_remainingCapacityForFrameCapture) {
    482             if (visitor->isWasmFrame())
    483                 m_results.append(StackFrame::wasm());
    484             else if (!!visitor->codeBlock() && !visitor->codeBlock()->unlinkedCodeBlock()->isBuiltinFunction()) {
     482            if (visitor->isWasmFrame()) {
     483                std::optional<unsigned> wasmFunctionIndex = visitor->wasmFunctionIndex();
     484                m_results.append(StackFrame::wasm(wasmFunctionIndex ? *wasmFunctionIndex : StackFrame::invalidWasmIndex));
     485            } else if (!!visitor->codeBlock() && !visitor->codeBlock()->unlinkedCodeBlock()->isBuiltinFunction()) {
    485486                m_results.append(
    486487                    StackFrame(m_vm, visitor->callee().asCell(), visitor->codeBlock(), visitor->bytecodeOffset()));
Note: See TracChangeset for help on using the changeset viewer.