| 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 24 matching lines...) Expand all Loading... |
| 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 kDeclSignatures, 2, 0, kLocalI32, // void -> int |
| 42 2, kLocalI32, kLocalI32, kLocalI32, // int,int -> int | 42 2, kLocalI32, kLocalI32, kLocalI32, // int,int -> int |
| 43 // func#0 (main) ---------------------------------- | 43 // func#0 (main) ---------------------------------- |
| 44 kDeclFunctions, 2, kDeclFunctionExport, 0, 0, // sig index | 44 kDeclFunctions, 2, kDeclFunctionExport, 0, 0, // sig index |
| 45 6, 0, // body size | 45 7, 0, // body size |
| 46 0, // locals |
| 46 kExprCallFunction, 1, // -- | 47 kExprCallFunction, 1, // -- |
| 47 kExprI8Const, 77, // -- | 48 kExprI8Const, 77, // -- |
| 48 kExprI8Const, 22, // -- | 49 kExprI8Const, 22, // -- |
| 49 // func#1 ----------------------------------------- | 50 // func#1 ----------------------------------------- |
| 50 0, // no name, not exported | 51 0, // no name, not exported |
| 51 1, 0, // sig index | 52 1, 0, // sig index |
| 52 5, 0, // body size | 53 6, 0, // body size |
| 54 0, // locals |
| 53 kExprI32Add, // -- | 55 kExprI32Add, // -- |
| 54 kExprGetLocal, 0, // -- | 56 kExprGetLocal, 0, // -- |
| 55 kExprGetLocal, 1, // -- | 57 kExprGetLocal, 1, // -- |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 Isolate* isolate = CcTest::InitIsolateOnce(); | 60 Isolate* isolate = CcTest::InitIsolateOnce(); |
| 59 HandleScope scope(isolate); | 61 HandleScope scope(isolate); |
| 60 WasmJs::InstallWasmFunctionMap(isolate, isolate->native_context()); | 62 WasmJs::InstallWasmFunctionMap(isolate, isolate->native_context()); |
| 61 int32_t result = | 63 int32_t result = |
| 62 CompileAndRunWasmModule(isolate, data, data + arraysize(data)); | 64 CompileAndRunWasmModule(isolate, data, data + arraysize(data)); |
| (...skipping 137 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 |