WebAssembly: improve stack trace
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Dec 2017 02:41:10 +0000 (02:41 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Dec 2017 02:41:10 +0000 (02:41 +0000)
commit257c3bdeb273ffb7699793ae7b1f5a08d0684b0b
tree25637ad36dad92979aed6f713dcb111e9e942822
parent5868b64b106ce6d7949f8fd583d5dd589a12a747
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: https://svn.webkit.org/repository/webkit/trunk@225378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
JSTests/ChangeLog
JSTests/wasm/assert.js
JSTests/wasm/function-tests/nameSection.js
JSTests/wasm/function-tests/stack-overflow.js
JSTests/wasm/function-tests/stack-trace.js
JSTests/wasm/function-tests/trap-after-cross-instance-call.js
JSTests/wasm/function-tests/trap-load-2.js
JSTests/wasm/function-tests/trap-load.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/interpreter/StackVisitor.cpp
Source/JavaScriptCore/runtime/StackFrame.cpp
Source/JavaScriptCore/wasm/WasmIndexOrName.cpp
Source/JavaScriptCore/wasm/WasmIndexOrName.h
Source/JavaScriptCore/wasm/WasmModuleInformation.cpp
Source/JavaScriptCore/wasm/WasmModuleInformation.h
Source/JavaScriptCore/wasm/WasmNameSection.h
Source/JavaScriptCore/wasm/WasmNameSectionParser.cpp