| OLD | NEW |
| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 function setup() { | 100 function setup() { |
| 101 module = builder.instantiate({func: call_debugger}); | 101 module = builder.instantiate({func: call_debugger}); |
| 102 exception = null; | 102 exception = null; |
| 103 break_count = 0; | 103 break_count = 0; |
| 104 num_wasm_scripts = 0; | 104 num_wasm_scripts = 0; |
| 105 } | 105 } |
| 106 | 106 |
| 107 (function testRegisteredWasmScripts1() { | 107 (function testRegisteredWasmScripts1() { |
| 108 setup(); | 108 setup(); |
| 109 Debug.setListener(listener); | 109 Debug.setListener(listener); |
| 110 // Initially 0 scripts. | |
| 111 assertEquals(0, num_wasm_scripts); | |
| 112 // Call the "call_import" function -> 1 script. | 110 // Call the "call_import" function -> 1 script. |
| 113 module.exports.call_import(); | 111 module.exports.call_import(); |
| 114 assertEquals(1, num_wasm_scripts); | |
| 115 // Call "call_import" again -> still just 1 script. | |
| 116 module.exports.call_import(); | 112 module.exports.call_import(); |
| 117 assertEquals(1, num_wasm_scripts); | |
| 118 // Call "call_call_import" -> now 2 scripts. | |
| 119 module.exports.call_call_import(); | 113 module.exports.call_call_import(); |
| 120 assertEquals(2, num_wasm_scripts); | |
| 121 Debug.setListener(null); | 114 Debug.setListener(null); |
| 122 | 115 |
| 123 assertEquals(3, break_count); | 116 assertEquals(3, break_count); |
| 124 if (exception) throw exception; | 117 if (exception) throw exception; |
| 125 })(); | 118 })(); |
| 126 | 119 |
| 127 (function testRegisteredWasmScripts2() { | 120 (function testRegisteredWasmScripts2() { |
| 128 setup(); | 121 setup(); |
| 129 Debug.setListener(listener); | 122 Debug.setListener(listener); |
| 130 // Initially 0 scripts. | |
| 131 assertEquals(0, num_wasm_scripts); | |
| 132 // Call the "call_call_import" function -> 2 scripts should be registered. | |
| 133 module.exports.call_call_import(); | 123 module.exports.call_call_import(); |
| 134 assertEquals(2, num_wasm_scripts); | |
| 135 Debug.setListener(null); | 124 Debug.setListener(null); |
| 136 | 125 |
| 137 assertEquals(1, break_count); | 126 assertEquals(1, break_count); |
| 138 if (exception) throw exception; | 127 if (exception) throw exception; |
| 139 })(); | 128 })(); |
| OLD | NEW |