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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 Isolate* isolate_; | 261 Isolate* isolate_; |
262 v8::internal::AccountingAllocator allocator_; | 262 v8::internal::AccountingAllocator allocator_; |
263 uint32_t global_offset; | 263 uint32_t global_offset; |
264 V8_ALIGNED(8) byte global_data[kMaxGlobalsSize]; // preallocated global data. | 264 V8_ALIGNED(8) byte global_data[kMaxGlobalsSize]; // preallocated global data. |
265 WasmInterpreter* interpreter_; | 265 WasmInterpreter* interpreter_; |
266 | 266 |
267 const WasmGlobal* AddGlobal(LocalType type) { | 267 const WasmGlobal* AddGlobal(LocalType type) { |
268 byte size = WasmOpcodes::MemSize(WasmOpcodes::MachineTypeFor(type)); | 268 byte size = WasmOpcodes::MemSize(WasmOpcodes::MachineTypeFor(type)); |
269 global_offset = (global_offset + size - 1) & ~(size - 1); // align | 269 global_offset = (global_offset + size - 1) & ~(size - 1); // align |
270 module_.globals.push_back( | 270 module_.globals.push_back( |
271 {type, true, NO_INIT, global_offset, false, false}); | 271 {type, true, WasmInitExpr(), global_offset, false, false}); |
272 global_offset += size; | 272 global_offset += size; |
273 // limit number of globals. | 273 // limit number of globals. |
274 CHECK_LT(global_offset, kMaxGlobalsSize); | 274 CHECK_LT(global_offset, kMaxGlobalsSize); |
275 return &module->globals.back(); | 275 return &module->globals.back(); |
276 } | 276 } |
277 }; | 277 }; |
278 | 278 |
279 inline void TestBuildingGraph(Zone* zone, JSGraph* jsgraph, ModuleEnv* module, | 279 inline void TestBuildingGraph(Zone* zone, JSGraph* jsgraph, ModuleEnv* module, |
280 FunctionSig* sig, | 280 FunctionSig* sig, |
281 SourcePositionTable* source_position_table, | 281 SourcePositionTable* source_position_table, |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 // interpreter. | 783 // interpreter. |
784 #define WASM_EXEC_TEST(name) \ | 784 #define WASM_EXEC_TEST(name) \ |
785 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 785 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
786 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 786 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
787 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 787 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
788 void RunWasm_##name(WasmExecutionMode execution_mode) | 788 void RunWasm_##name(WasmExecutionMode execution_mode) |
789 | 789 |
790 } // namespace | 790 } // namespace |
791 | 791 |
792 #endif | 792 #endif |
OLD | NEW |