diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/debug/wasm-05.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/debug/wasm-05.js')
-rw-r--r-- | js/src/jit-test/tests/debug/wasm-05.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/wasm-05.js b/js/src/jit-test/tests/debug/wasm-05.js new file mode 100644 index 000000000..e0262abe4 --- /dev/null +++ b/js/src/jit-test/tests/debug/wasm-05.js @@ -0,0 +1,38 @@ +// Tests that wasm module scripts have text line to bytecode offset information +// when source text is generated. + +load(libdir + "asserts.js"); + +// Disabled in aurora (see also bug 1326452). +quit(); + +// Checking if experimental format generates internal source map to binary file +// by querying debugger scripts getLineOffsets. +// (Notice that the source map will not be produced by wasmBinaryToText) +function getAllOffsets(wast) { + var sandbox = newGlobal(''); + var dbg = new Debugger(); + dbg.addDebuggee(sandbox); + sandbox.eval(` + var wasm = wasmTextToBinary('${wast}'); + var m = new WebAssembly.Instance(new WebAssembly.Module(wasm)); + `); + var wasmScript = dbg.findScripts().filter(s => s.format == 'wasm')[0]; + var lines = wasmScript.source.text.split('\n'); + return lines.map((l, n) => { return { str: l, offsets: wasmScript.getLineOffsets(n + 1) }; }); +} + +var result1 = getAllOffsets('(module \ + (func (nop)) \ + (func (drop (f32.sqrt (f32.add (f32.const 1.0) (f32.const 2.0))))) \ +)'); + +var nopLine = result1.filter(i => i.str.indexOf('nop') >= 0); +assertEq(nopLine.length, 1); +// The nopLine shall have single offset. +assertEq(nopLine[0].offsets.length, 1); +assertEq(nopLine[0].offsets[0] > 0, true); + +var singleOffsetLines = result1.filter(i => i.offsets.length === 1); +// There shall be total 6 lines with single offset. +assertEq(singleOffsetLines.length === 6, true); |