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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 memset(global_data, 0, sizeof(global_data)); | 88 memset(global_data, 0, sizeof(global_data)); |
89 } | 89 } |
90 | 90 |
91 ~TestingModule() { | 91 ~TestingModule() { |
92 if (instance->mem_start) { | 92 if (instance->mem_start) { |
93 free(instance->mem_start); | 93 free(instance->mem_start); |
94 } | 94 } |
95 if (interpreter_) delete interpreter_; | 95 if (interpreter_) delete interpreter_; |
96 } | 96 } |
97 | 97 |
| 98 void ChangeOriginToAsmjs() { origin = kAsmJsOrigin; } |
| 99 |
98 byte* AddMemory(uint32_t size) { | 100 byte* AddMemory(uint32_t size) { |
99 CHECK_NULL(instance->mem_start); | 101 CHECK_NULL(instance->mem_start); |
100 CHECK_EQ(0, instance->mem_size); | 102 CHECK_EQ(0, instance->mem_size); |
101 instance->mem_start = reinterpret_cast<byte*>(malloc(size)); | 103 instance->mem_start = reinterpret_cast<byte*>(malloc(size)); |
102 CHECK(instance->mem_start); | 104 CHECK(instance->mem_start); |
103 memset(instance->mem_start, 0, size); | 105 memset(instance->mem_start, 0, size); |
104 instance->mem_size = size; | 106 instance->mem_size = size; |
105 return raw_mem_start<byte>(); | 107 return raw_mem_start<byte>(); |
106 } | 108 } |
107 | 109 |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 // interpreter. | 786 // interpreter. |
785 #define WASM_EXEC_TEST(name) \ | 787 #define WASM_EXEC_TEST(name) \ |
786 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 788 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
787 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 789 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
788 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 790 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
789 void RunWasm_##name(WasmExecutionMode execution_mode) | 791 void RunWasm_##name(WasmExecutionMode execution_mode) |
790 | 792 |
791 } // namespace | 793 } // namespace |
792 | 794 |
793 #endif | 795 #endif |
OLD | NEW |