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 18 matching lines...) Expand all Loading... |
29 int32_t result = | 29 int32_t result = |
30 CompileAndRunWasmModule(isolate, module->Begin(), module->End()); | 30 CompileAndRunWasmModule(isolate, module->Begin(), module->End()); |
31 CHECK_EQ(expected_result, result); | 31 CHECK_EQ(expected_result, result); |
32 } | 32 } |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 | 35 |
36 // A raw test that skips the WasmModuleBuilder. | 36 // A raw test that skips the WasmModuleBuilder. |
37 TEST(Run_WasmModule_CallAdd_rev) { | 37 TEST(Run_WasmModule_CallAdd_rev) { |
38 static const byte data[] = { | 38 static const byte data[] = { |
| 39 WASM_MODULE_HEADER, |
39 // sig#0 ------------------------------------------ | 40 // sig#0 ------------------------------------------ |
40 kDeclSignatures, 2, 0, kLocalI32, // void -> int | 41 kDeclSignatures, 2, 0, kLocalI32, // void -> int |
41 2, kLocalI32, kLocalI32, kLocalI32, // int,int -> int | 42 2, kLocalI32, kLocalI32, kLocalI32, // int,int -> int |
42 // func#0 (main) ---------------------------------- | 43 // func#0 (main) ---------------------------------- |
43 kDeclFunctions, 2, kDeclFunctionExport, 0, 0, // sig index | 44 kDeclFunctions, 2, kDeclFunctionExport, 0, 0, // sig index |
44 6, 0, // body size | 45 6, 0, // body size |
45 kExprCallFunction, 1, // -- | 46 kExprCallFunction, 1, // -- |
46 kExprI8Const, 77, // -- | 47 kExprI8Const, 77, // -- |
47 kExprI8Const, 22, // -- | 48 kExprI8Const, 22, // -- |
48 // func#1 ----------------------------------------- | 49 // func#1 ----------------------------------------- |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32(56)), | 200 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32(56)), |
200 WASM_STORE_GLOBAL(global2, WASM_I32(41)), | 201 WASM_STORE_GLOBAL(global2, WASM_I32(41)), |
201 WASM_RETURN(WASM_CALL_FUNCTION0(f1_index))}; | 202 WASM_RETURN(WASM_CALL_FUNCTION0(f1_index))}; |
202 f->EmitCode(code2, sizeof(code2)); | 203 f->EmitCode(code2, sizeof(code2)); |
203 WasmModuleWriter* writer = builder->Build(&zone); | 204 WasmModuleWriter* writer = builder->Build(&zone); |
204 TestModule(writer->WriteTo(&zone), 97); | 205 TestModule(writer->WriteTo(&zone), 97); |
205 } | 206 } |
206 #endif | 207 #endif |
207 | 208 |
208 #endif // !V8_TARGET_ARCH_ARM64 | 209 #endif // !V8_TARGET_ARCH_ARM64 |
OLD | NEW |