OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef WASM_RUN_UTILS_H | 5 #ifndef WASM_RUN_UTILS_H |
6 #define WASM_RUN_UTILS_H | 6 #define WASM_RUN_UTILS_H |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 interpreter_(mode == kExecuteInterpreted | 77 interpreter_(mode == kExecuteInterpreted |
78 ? new WasmInterpreter(&instance_, &allocator_) | 78 ? new WasmInterpreter(&instance_, &allocator_) |
79 : nullptr) { | 79 : nullptr) { |
80 module = &module_; | 80 module = &module_; |
81 instance = &instance_; | 81 instance = &instance_; |
82 instance->module = &module_; | 82 instance->module = &module_; |
83 instance->globals_start = global_data; | 83 instance->globals_start = global_data; |
84 module_.globals_size = kMaxGlobalsSize; | 84 module_.globals_size = kMaxGlobalsSize; |
85 instance->mem_start = nullptr; | 85 instance->mem_start = nullptr; |
86 instance->mem_size = 0; | 86 instance->mem_size = 0; |
87 linker = nullptr; | |
88 origin = kWasmOrigin; | 87 origin = kWasmOrigin; |
89 memset(global_data, 0, sizeof(global_data)); | 88 memset(global_data, 0, sizeof(global_data)); |
90 } | 89 } |
91 | 90 |
92 ~TestingModule() { | 91 ~TestingModule() { |
93 if (instance->mem_start) { | 92 if (instance->mem_start) { |
94 free(instance->mem_start); | 93 free(instance->mem_start); |
95 } | 94 } |
96 if (interpreter_) delete interpreter_; | 95 if (interpreter_) delete interpreter_; |
97 } | 96 } |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 // interpreter. | 762 // interpreter. |
764 #define WASM_EXEC_TEST(name) \ | 763 #define WASM_EXEC_TEST(name) \ |
765 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 764 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
766 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 765 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
767 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 766 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
768 void RunWasm_##name(WasmExecutionMode execution_mode) | 767 void RunWasm_##name(WasmExecutionMode execution_mode) |
769 | 768 |
770 } // namespace | 769 } // namespace |
771 | 770 |
772 #endif | 771 #endif |
OLD | NEW |