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 20 matching lines...) Expand all Loading... |
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 WASM_MODULE_HEADER, |
40 // sig#0 ------------------------------------------ | 40 // sig#0 ------------------------------------------ |
41 kDeclSignatures, 2, 0, kLocalI32, // void -> int | 41 WASM_SECTION_SIGNATURES_SIZE + 7, // Section size. |
42 2, kLocalI32, kLocalI32, kLocalI32, // int,int -> int | 42 WASM_SECTION_SIGNATURES, 2, 0, kLocalI32, // void -> int |
| 43 2, kLocalI32, kLocalI32, kLocalI32, // int,int -> int |
43 // func#0 (main) ---------------------------------- | 44 // func#0 (main) ---------------------------------- |
44 kDeclFunctions, 2, kDeclFunctionExport, 0, 0, // sig index | 45 WASM_SECTION_FUNCTIONS_SIZE + 24, WASM_SECTION_FUNCTIONS, 2, |
45 7, 0, // body size | 46 kDeclFunctionExport, 0, 0, // sig index |
46 0, // locals | 47 7, 0, // body size |
47 kExprCallFunction, 1, // -- | 48 0, // locals |
48 kExprI8Const, 77, // -- | 49 kExprCallFunction, 1, // -- |
49 kExprI8Const, 22, // -- | 50 kExprI8Const, 77, // -- |
| 51 kExprI8Const, 22, // -- |
50 // func#1 ----------------------------------------- | 52 // func#1 ----------------------------------------- |
51 0, // no name, not exported | 53 0, // no name, not exported |
52 1, 0, // sig index | 54 1, 0, // sig index |
53 6, 0, // body size | 55 6, 0, // body size |
54 0, // locals | 56 0, // locals |
55 kExprI32Add, // -- | 57 kExprI32Add, // -- |
56 kExprGetLocal, 0, // -- | 58 kExprGetLocal, 0, // -- |
57 kExprGetLocal, 1, // -- | 59 kExprGetLocal, 1, // -- |
58 }; | 60 }; |
59 | 61 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), | 202 byte code2[] = {WASM_STORE_GLOBAL(global1, WASM_I32V_1(56)), |
201 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), | 203 WASM_STORE_GLOBAL(global2, WASM_I32V_1(41)), |
202 WASM_RETURN(WASM_CALL_FUNCTION0(f1_index))}; | 204 WASM_RETURN(WASM_CALL_FUNCTION0(f1_index))}; |
203 f->EmitCode(code2, sizeof(code2)); | 205 f->EmitCode(code2, sizeof(code2)); |
204 WasmModuleWriter* writer = builder->Build(&zone); | 206 WasmModuleWriter* writer = builder->Build(&zone); |
205 TestModule(writer->WriteTo(&zone), 97); | 207 TestModule(writer->WriteTo(&zone), 97); |
206 } | 208 } |
207 #endif | 209 #endif |
208 | 210 |
209 #endif // !V8_TARGET_ARCH_ARM64 | 211 #endif // !V8_TARGET_ARCH_ARM64 |
OLD | NEW |