OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/compiler/wasm-compiler.h" | 5 #include "src/compiler/wasm-compiler.h" |
6 | 6 |
7 #include "src/isolate-inl.h" | 7 #include "src/isolate-inl.h" |
8 | 8 |
9 #include "src/base/platform/elapsed-timer.h" | 9 #include "src/base/platform/elapsed-timer.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2542 Node* WasmGraphBuilder::FunctionTable() { | 2542 Node* WasmGraphBuilder::FunctionTable() { |
2543 DCHECK(module_ && module_->instance && | 2543 DCHECK(module_ && module_->instance && |
2544 !module_->instance->function_table.is_null()); | 2544 !module_->instance->function_table.is_null()); |
2545 if (!function_table_) { | 2545 if (!function_table_) { |
2546 function_table_ = HeapConstant(module_->instance->function_table); | 2546 function_table_ = HeapConstant(module_->instance->function_table); |
2547 } | 2547 } |
2548 return function_table_; | 2548 return function_table_; |
2549 } | 2549 } |
2550 | 2550 |
2551 Node* WasmGraphBuilder::LoadGlobal(uint32_t index) { | 2551 Node* WasmGraphBuilder::LoadGlobal(uint32_t index) { |
2552 DCHECK(module_ && module_->instance && module_->instance->globals_start); | |
2553 MachineType mem_type = module_->GetGlobalType(index); | 2552 MachineType mem_type = module_->GetGlobalType(index); |
2554 Node* addr = jsgraph()->IntPtrConstant( | 2553 Node* addr = jsgraph()->RelocatableIntPtrConstant( |
2555 reinterpret_cast<uintptr_t>(module_->instance->globals_start + | 2554 reinterpret_cast<uintptr_t>(module_->instance->globals_start + |
2556 module_->module->globals[index].offset)); | 2555 module_->module->globals[index].offset), |
| 2556 RelocInfo::WASM_GLOBAL_REFERENCE); |
2557 const Operator* op = jsgraph()->machine()->Load(mem_type); | 2557 const Operator* op = jsgraph()->machine()->Load(mem_type); |
2558 Node* node = graph()->NewNode(op, addr, jsgraph()->Int32Constant(0), *effect_, | 2558 Node* node = graph()->NewNode(op, addr, jsgraph()->Int32Constant(0), *effect_, |
2559 *control_); | 2559 *control_); |
2560 *effect_ = node; | 2560 *effect_ = node; |
2561 return node; | 2561 return node; |
2562 } | 2562 } |
2563 | 2563 |
2564 Node* WasmGraphBuilder::StoreGlobal(uint32_t index, Node* val) { | 2564 Node* WasmGraphBuilder::StoreGlobal(uint32_t index, Node* val) { |
2565 DCHECK(module_ && module_->instance && module_->instance->globals_start); | |
2566 MachineType mem_type = module_->GetGlobalType(index); | 2565 MachineType mem_type = module_->GetGlobalType(index); |
2567 Node* addr = jsgraph()->IntPtrConstant( | 2566 Node* addr = jsgraph()->RelocatableIntPtrConstant( |
2568 reinterpret_cast<uintptr_t>(module_->instance->globals_start + | 2567 reinterpret_cast<uintptr_t>(module_->instance->globals_start + |
2569 module_->module->globals[index].offset)); | 2568 module_->module->globals[index].offset), |
| 2569 RelocInfo::WASM_GLOBAL_REFERENCE); |
2570 const Operator* op = jsgraph()->machine()->Store( | 2570 const Operator* op = jsgraph()->machine()->Store( |
2571 StoreRepresentation(mem_type.representation(), kNoWriteBarrier)); | 2571 StoreRepresentation(mem_type.representation(), kNoWriteBarrier)); |
2572 Node* node = graph()->NewNode(op, addr, jsgraph()->Int32Constant(0), val, | 2572 Node* node = graph()->NewNode(op, addr, jsgraph()->Int32Constant(0), val, |
2573 *effect_, *control_); | 2573 *effect_, *control_); |
2574 *effect_ = node; | 2574 *effect_ = node; |
2575 return node; | 2575 return node; |
2576 } | 2576 } |
2577 | 2577 |
2578 void WasmGraphBuilder::BoundsCheckMem(MachineType memtype, Node* index, | 2578 void WasmGraphBuilder::BoundsCheckMem(MachineType memtype, Node* index, |
2579 uint32_t offset, | 2579 uint32_t offset, |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3286 function_->code_start_offset), | 3286 function_->code_start_offset), |
3287 compile_ms); | 3287 compile_ms); |
3288 } | 3288 } |
3289 | 3289 |
3290 return code; | 3290 return code; |
3291 } | 3291 } |
3292 | 3292 |
3293 } // namespace compiler | 3293 } // namespace compiler |
3294 } // namespace internal | 3294 } // namespace internal |
3295 } // namespace v8 | 3295 } // namespace v8 |
OLD | NEW |