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/runtime/StackFrame.cpp b/Source/JavaScriptCore/runtime/StackFrame.cpp
index edb326a..9f2d60d 100644
--- a/Source/JavaScriptCore/runtime/StackFrame.cpp
+++ b/Source/JavaScriptCore/runtime/StackFrame.cpp
@@ -75,11 +75,8 @@
String StackFrame::functionName(VM& vm) const
{
- if (m_isWasmFrame) {
- if (m_wasmFunctionIndexOrName.isEmpty())
- return ASCIILiteral("wasm function");
- return makeString("wasm function: ", makeString(m_wasmFunctionIndexOrName));
- }
+ if (m_isWasmFrame)
+ return makeString(m_wasmFunctionIndexOrName);
if (m_codeBlock) {
switch (m_codeBlock->codeType()) {
@@ -147,9 +144,6 @@
void StackFrame::visitChildren(SlotVisitor& visitor)
{
- // FIXME: We should do something here about Wasm::IndexOrName.
- // https://bugs.webkit.org/show_bug.cgi?id=176644
-
if (m_callee)
visitor.append(m_callee);
if (m_codeBlock)