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/module-decoder.h" | 9 #include "src/wasm/module-decoder.h" |
10 #include "src/wasm/wasm-js.h" | 10 #include "src/wasm/wasm-js.h" |
11 #include "src/wasm/wasm-macro-gen.h" | 11 #include "src/wasm/wasm-macro-gen.h" |
12 #include "src/wasm/wasm-module.h" | 12 #include "src/wasm/wasm-module.h" |
13 #include "src/wasm/wasm-opcodes.h" | 13 #include "src/wasm/wasm-opcodes.h" |
14 | 14 |
15 #include "test/cctest/cctest.h" | 15 #include "test/cctest/cctest.h" |
16 #include "test/cctest/wasm/test-signatures.h" | 16 #include "test/cctest/wasm/test-signatures.h" |
17 #include "test/cctest/wasm/wasm-module-runner.h" | 17 #include "test/common/wasm/wasm-module-runner.h" |
18 | 18 |
19 using namespace v8::base; | 19 using namespace v8::base; |
20 using namespace v8::internal; | 20 using namespace v8::internal; |
21 using namespace v8::internal::compiler; | 21 using namespace v8::internal::compiler; |
22 using namespace v8::internal::wasm; | 22 using namespace v8::internal::wasm; |
23 | 23 |
24 namespace { | 24 namespace { |
25 void TestModule(Zone* zone, WasmModuleBuilder* builder, | 25 void TestModule(Zone* zone, WasmModuleBuilder* builder, |
26 int32_t expected_result) { | 26 int32_t expected_result) { |
27 ZoneBuffer buffer(zone); | 27 ZoneBuffer buffer(zone); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); | 283 WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); |
284 uint16_t f_index = builder->AddFunction(); | 284 uint16_t f_index = builder->AddFunction(); |
285 WasmFunctionBuilder* f = builder->FunctionAt(f_index); | 285 WasmFunctionBuilder* f = builder->FunctionAt(f_index); |
286 f->SetSignature(sigs.i_v()); | 286 f->SetSignature(sigs.i_v()); |
287 ExportAsMain(f); | 287 ExportAsMain(f); |
288 byte code[] = {WASM_IF_ELSE(WASM_I32V(0), WASM_GROW_MEMORY(WASM_I32V(1)), | 288 byte code[] = {WASM_IF_ELSE(WASM_I32V(0), WASM_GROW_MEMORY(WASM_I32V(1)), |
289 WASM_I32V(12))}; | 289 WASM_I32V(12))}; |
290 f->EmitCode(code, sizeof(code)); | 290 f->EmitCode(code, sizeof(code)); |
291 TestModule(&zone, builder, 12); | 291 TestModule(&zone, builder, 12); |
292 } | 292 } |
OLD | NEW |