Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: test/mjsunit/wasm/debug-disassembly.js

Issue 2345593003: [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures and TSAN races. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-wasm --expose-debug-as debug 5 // Flags: --expose-wasm --expose-debug-as debug
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 Debug = debug.Debug 10 Debug = debug.Debug
(...skipping 27 matching lines...) Expand all
38 if (offset_table[p] != pos) continue; 38 if (offset_table[p] != pos) continue;
39 lineNr = offset_table[p+1]; 39 lineNr = offset_table[p+1];
40 columnNr = offset_table[p+2]; 40 columnNr = offset_table[p+2];
41 } 41 }
42 assertNotNull(lineNr, "position should occur in offset table"); 42 assertNotNull(lineNr, "position should occur in offset table");
43 assertNotNull(columnNr, "position should occur in offset table"); 43 assertNotNull(columnNr, "position should occur in offset table");
44 var line = disassembly.split("\n")[lineNr]; 44 var line = disassembly.split("\n")[lineNr];
45 assertTrue(!!line, "line number must occur in disassembly"); 45 assertTrue(!!line, "line number must occur in disassembly");
46 assertTrue(line.length > columnNr, "column number must be valid"); 46 assertTrue(line.length > columnNr, "column number must be valid");
47 var expected_string; 47 var expected_string;
48 if (name.endsWith("/0")) { 48 if (name.endsWith("/1")) {
49 // Function 0 calls the imported function. 49 // Function 0 calls the imported function.
50 expected_string = "kExprCallImport,"; 50 expected_string = "kExprCallFunction,";
51 } else if (name.endsWith("/1")) { 51 } else if (name.endsWith("/2")) {
52 // Function 1 calls function 0. 52 // Function 1 calls function 0.
53 expected_string = "kExprCallFunction,"; 53 expected_string = "kExprCallFunction,";
54 } else { 54 } else {
55 assertTrue(false, "Unexpected wasm script: " + name); 55 assertTrue(false, "Unexpected wasm script: " + name);
56 } 56 }
57 assertTrue(line.substr(columnNr).startsWith(expected_string), 57 assertTrue(line.substr(columnNr).startsWith(expected_string),
58 "offset " + columnNr + " should start with '" + expected_string 58 "offset " + columnNr + " should start with '" + expected_string
59 + "': " + line); 59 + "': " + line);
60 } 60 }
61 } 61 }
62 } else if (event == Debug.DebugEvent.AfterCompile) { 62 } else if (event == Debug.DebugEvent.AfterCompile) {
63 var script = event_data.script(); 63 var script = event_data.script();
64 if (script.scriptType() == Debug.ScriptType.Wasm) { 64 if (script.scriptType() == Debug.ScriptType.Wasm) {
65 ++num_wasm_scripts; 65 ++num_wasm_scripts;
66 } 66 }
67 } 67 }
68 } catch (e) { 68 } catch (e) {
69 print("exception: " + e); 69 print("exception: " + e);
70 exception = e; 70 exception = e;
71 } 71 }
72 }; 72 };
73 73
74 var builder = new WasmModuleBuilder(); 74 var builder = new WasmModuleBuilder();
75 75
76 builder.addImport("func", kSig_v_v); 76 builder.addImport("func", kSig_v_v);
77 77
78 builder.addFunction("call_import", kSig_v_v) 78 builder.addFunction("call_import", kSig_v_v)
79 .addBody([kExprCallImport, kArity0, 0]) 79 .addBody([kExprCallFunction, 0])
80 .exportFunc(); 80 .exportFunc();
81 81
82 // Add a bit of unneccessary code to increase the byte offset. 82 // Add a bit of unneccessary code to increase the byte offset.
83 builder.addFunction("call_call_import", kSig_v_v) 83 builder.addFunction("call_call_import", kSig_v_v)
84 .addLocals({i32_count: 2}) 84 .addLocals({i32_count: 2})
85 .addBody([ 85 .addBody([
86 kExprI32Const, 27, kExprSetLocal, 0, 86 kExprI32Const, 27, kExprSetLocal, 0,
87 kExprI32Const, (-7 & 0x7f), kExprSetLocal, 1, 87 kExprI32Const, (-7 & 0x7f), kExprSetLocal, 1,
88 kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add, kExprI64UConvertI32, 88 kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add, kExprI64UConvertI32,
89 kExprI64Const, 0, 89 kExprI64Const, 0,
90 kExprI64Ne, kExprIf, 90 kExprI64Ne, kExprIf, kAstStmt,
91 kExprCallFunction, kArity0, 0, 91 kExprCallFunction, 1,
92 kExprEnd 92 kExprEnd
93 ]) 93 ])
94 .exportFunc(); 94 .exportFunc();
95 95
96 function call_debugger() { 96 function call_debugger() {
97 debugger; 97 debugger;
98 } 98 }
99 99
100 function setup() { 100 function setup() {
101 module = builder.instantiate({func: call_debugger}); 101 module = builder.instantiate({func: call_debugger});
(...skipping 17 matching lines...) Expand all
119 119
120 (function testRegisteredWasmScripts2() { 120 (function testRegisteredWasmScripts2() {
121 setup(); 121 setup();
122 Debug.setListener(listener); 122 Debug.setListener(listener);
123 module.exports.call_call_import(); 123 module.exports.call_call_import();
124 Debug.setListener(null); 124 Debug.setListener(null);
125 125
126 assertEquals(1, break_count); 126 assertEquals(1, break_count);
127 if (exception) throw exception; 127 if (exception) throw exception;
128 })(); 128 })();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/compiled-module-serialization.js ('k') | test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698