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 <setjmp.h> | 8 #include <setjmp.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 if (interpreter_) delete interpreter_; | 102 if (interpreter_) delete interpreter_; |
103 } | 103 } |
104 | 104 |
105 void ChangeOriginToAsmjs() { module_.origin = kAsmJsOrigin; } | 105 void ChangeOriginToAsmjs() { module_.origin = kAsmJsOrigin; } |
106 | 106 |
107 byte* AddMemory(uint32_t size) { | 107 byte* AddMemory(uint32_t size) { |
108 CHECK(!module_.has_memory); | 108 CHECK(!module_.has_memory); |
109 CHECK_NULL(instance->mem_start); | 109 CHECK_NULL(instance->mem_start); |
110 CHECK_EQ(0, instance->mem_size); | 110 CHECK_EQ(0, instance->mem_size); |
111 module_.has_memory = true; | 111 module_.has_memory = true; |
112 // Work around for GCC bug on AIX | |
113 // See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79839 | |
114 #if V8_OS_AIX && _LINUX_SOURCE_COMPAT | |
titzer
2017/03/04 23:29:56
What about changing the CHECK() below to be CHECK(
JaideepBajwa
2017/03/05 05:11:03
should the CHECK() be: CHECK(size == 0 || instance
JaideepBajwa
2017/03/06 22:35:26
Done.
| |
115 instance->mem_start = reinterpret_cast<byte*>(__linux_malloc(size)); | |
116 #else | |
112 instance->mem_start = reinterpret_cast<byte*>(malloc(size)); | 117 instance->mem_start = reinterpret_cast<byte*>(malloc(size)); |
118 #endif | |
113 CHECK(instance->mem_start); | 119 CHECK(instance->mem_start); |
114 memset(instance->mem_start, 0, size); | 120 memset(instance->mem_start, 0, size); |
115 instance->mem_size = size; | 121 instance->mem_size = size; |
116 return raw_mem_start<byte>(); | 122 return raw_mem_start<byte>(); |
117 } | 123 } |
118 | 124 |
119 template <typename T> | 125 template <typename T> |
120 T* AddMemoryElems(uint32_t count) { | 126 T* AddMemoryElems(uint32_t count) { |
121 AddMemory(count * sizeof(T)); | 127 AddMemory(count * sizeof(T)); |
122 return raw_mem_start<T>(); | 128 return raw_mem_start<T>(); |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
838 void RunWasm_##name(WasmExecutionMode execution_mode) | 844 void RunWasm_##name(WasmExecutionMode execution_mode) |
839 | 845 |
840 #define WASM_EXEC_COMPILED_TEST(name) \ | 846 #define WASM_EXEC_COMPILED_TEST(name) \ |
841 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 847 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
842 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 848 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
843 void RunWasm_##name(WasmExecutionMode execution_mode) | 849 void RunWasm_##name(WasmExecutionMode execution_mode) |
844 | 850 |
845 } // namespace | 851 } // namespace |
846 | 852 |
847 #endif | 853 #endif |
OLD | NEW |