| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 instance->function_table->set(i, Smi::FromInt(function->sig_index)); | 189 instance->function_table->set(i, Smi::FromInt(function->sig_index)); |
| 190 instance->function_table->set( | 190 instance->function_table->set( |
| 191 i + table_size, *instance->function_code->at(function_index)); | 191 i + table_size, *instance->function_code->at(function_index)); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 | 194 |
| 195 | 195 |
| 196 private: | 196 private: |
| 197 WasmModuleInstance instance_; | 197 WasmModuleInstance instance_; |
| 198 uint32_t global_offset; | 198 uint32_t global_offset; |
| 199 byte global_data[kMaxGlobalsSize]; // preallocated global data. | 199 V8_ALIGNED(8) byte global_data[kMaxGlobalsSize]; // preallocated global data. |
| 200 | 200 |
| 201 WasmGlobal* AddGlobal(MachineType mem_type) { | 201 WasmGlobal* AddGlobal(MachineType mem_type) { |
| 202 AllocModule(); | 202 AllocModule(); |
| 203 if (!module->globals) { | 203 if (!module->globals) { |
| 204 module->globals = new std::vector<WasmGlobal>(); | 204 module->globals = new std::vector<WasmGlobal>(); |
| 205 } | 205 } |
| 206 byte size = WasmOpcodes::MemSize(mem_type); | 206 byte size = WasmOpcodes::MemSize(mem_type); |
| 207 global_offset = (global_offset + size - 1) & ~(size - 1); // align | 207 global_offset = (global_offset + size - 1) & ~(size - 1); // align |
| 208 module->globals->push_back({0, mem_type, global_offset, false}); | 208 module->globals->push_back({0, mem_type, global_offset, false}); |
| 209 global_offset += size; | 209 global_offset += size; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 if (p1 == MachineType::None()) return 1; | 407 if (p1 == MachineType::None()) return 1; |
| 408 if (p2 == MachineType::None()) return 2; | 408 if (p2 == MachineType::None()) return 2; |
| 409 if (p3 == MachineType::None()) return 3; | 409 if (p3 == MachineType::None()) return 3; |
| 410 return 4; | 410 return 4; |
| 411 } | 411 } |
| 412 }; | 412 }; |
| 413 | 413 |
| 414 } // namespace | 414 } // namespace |
| 415 | 415 |
| 416 #endif | 416 #endif |
| OLD | NEW |