OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include "src/wasm/encoder.h" | 8 #include "src/wasm/encoder.h" |
9 #include "src/wasm/wasm-js.h" | 9 #include "src/wasm/wasm-js.h" |
10 #include "src/wasm/wasm-macro-gen.h" | 10 #include "src/wasm/wasm-macro-gen.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 f = builder->FunctionAt(f2_index); | 186 f = builder->FunctionAt(f2_index); |
187 f->ReturnType(kAstI32); | 187 f->ReturnType(kAstI32); |
188 f->Exported(1); | 188 f->Exported(1); |
189 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), | 189 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), |
190 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), | 190 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), |
191 WASM_RETURN(WASM_CALL_FUNCTION0(f1_index))}; | 191 WASM_RETURN(WASM_CALL_FUNCTION0(f1_index))}; |
192 f->EmitCode(code2, sizeof(code2)); | 192 f->EmitCode(code2, sizeof(code2)); |
193 WasmModuleWriter* writer = builder->Build(&zone); | 193 WasmModuleWriter* writer = builder->Build(&zone); |
194 TestModule(writer->WriteTo(&zone), 97); | 194 TestModule(writer->WriteTo(&zone), 97); |
195 } | 195 } |
| 196 |
| 197 TEST(Run_WasmModule_SubDebug) { |
| 198 v8::base::AccountingAllocator allocator; |
| 199 Zone zone(&allocator); |
| 200 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); |
| 201 uint16_t f_index = builder->AddFunction(); |
| 202 WasmFunctionBuilder* f = builder->FunctionAt(f_index); |
| 203 f->ReturnType(kAstI32); |
| 204 f->Exported(1); |
| 205 uint16_t local = f->AddLocal(kAstI32); |
| 206 byte code[] = { |
| 207 WASM_SET_LOCAL(local, WASM_I32V(-1)), |
| 208 WASM_RETURN(WASM_I32_SUB(WASM_GET_LOCAL(local), WASM_I32V(0)))}; |
| 209 uint32_t local_indices[] = {1, 11}; |
| 210 f->EmitCode(code, sizeof(code), local_indices, sizeof(local_indices) / 4); |
| 211 WasmModuleWriter* writer = builder->Build(&zone); |
| 212 TestModule(writer->WriteTo(&zone), -1); |
| 213 } |
OLD | NEW |