WebAssembly: improve stack trace
https://bugs.webkit.org/show_bug.cgi?id=179343
Reviewed by Saam Barati.
JSTests:
Update the tests to follow the new format. Notably, SHA1 module
hash is now included in traces, and stubs are properly identified.
* wasm/assert.js: Add an assertion which matches regular expressions.
* wasm/function-tests/nameSection.js:
* wasm/function-tests/stack-overflow.js:
(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.assertOverflows):
(assertOverflows.assertThrows.wasm.1):
(assertOverflows.assertThrows.wasm.0):
(assertOverflows.assertThrows):
(assertOverflows):
* wasm/function-tests/stack-trace.js:
(import.Builder.from.string_appeared_here.assert): Deleted.
* 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:
Stack traces now include:
- Module name, if provided by the name section.
- Module SHA1 hash if no name was provided
- Stub identification, to differentiate from user code
- Slightly different naming to match design from:
https://github.com/WebAssembly/design/blob/master/Web.md#developer-facing-display-conventions
* interpreter/StackVisitor.cpp:
(JSC::StackVisitor::Frame::functionName const):
* runtime/StackFrame.cpp:
(JSC::StackFrame::functionName const):
(JSC::StackFrame::visitChildren):
* wasm/WasmIndexOrName.cpp:
(JSC::Wasm::IndexOrName::IndexOrName):
(JSC::Wasm::makeString):
* wasm/WasmIndexOrName.h:
(JSC::Wasm::IndexOrName::nameSection const):
* wasm/WasmModuleInformation.cpp:
(JSC::Wasm::ModuleInformation::ModuleInformation):
* wasm/WasmModuleInformation.h:
* wasm/WasmNameSection.h:
(JSC::Wasm::NameSection::NameSection):
(JSC::Wasm::NameSection::get):
* wasm/WasmNameSectionParser.cpp:
(JSC::Wasm::NameSectionParser::parse):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@225378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/interpreter/StackVisitor.cpp b/Source/JavaScriptCore/interpreter/StackVisitor.cpp
index d082b63..33bf995 100644
--- a/Source/JavaScriptCore/interpreter/StackVisitor.cpp
+++ b/Source/JavaScriptCore/interpreter/StackVisitor.cpp
@@ -279,10 +279,7 @@
switch (codeType()) {
case CodeType::Wasm:
- if (m_wasmFunctionIndexOrName.isEmpty())
- traceLine = makeString("wasm function");
- else
- traceLine = makeString("wasm function: ", makeString(m_wasmFunctionIndexOrName));
+ traceLine = makeString(m_wasmFunctionIndexOrName);
break;
case CodeType::Eval:
traceLine = ASCIILiteral("eval code");