| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
| 10 | 10 |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 Node* WasmGraphBuilder::Int32Constant(int32_t value) { | 405 Node* WasmGraphBuilder::Int32Constant(int32_t value) { |
| 406 return jsgraph()->Int32Constant(value); | 406 return jsgraph()->Int32Constant(value); |
| 407 } | 407 } |
| 408 | 408 |
| 409 Node* WasmGraphBuilder::Int64Constant(int64_t value) { | 409 Node* WasmGraphBuilder::Int64Constant(int64_t value) { |
| 410 return jsgraph()->Int64Constant(value); | 410 return jsgraph()->Int64Constant(value); |
| 411 } | 411 } |
| 412 | 412 |
| 413 void WasmGraphBuilder::StackCheck(wasm::WasmCodePosition position, | 413 void WasmGraphBuilder::StackCheck(wasm::WasmCodePosition position, |
| 414 Node** effect, Node** control) { | 414 Node** effect, Node** control) { |
| 415 if (FLAG_wasm_no_stack_checks) return; |
| 415 if (effect == nullptr) { | 416 if (effect == nullptr) { |
| 416 effect = effect_; | 417 effect = effect_; |
| 417 } | 418 } |
| 418 if (control == nullptr) { | 419 if (control == nullptr) { |
| 419 control = control_; | 420 control = control_; |
| 420 } | 421 } |
| 421 // We do not generate stack checks for cctests. | 422 // We do not generate stack checks for cctests. |
| 422 if (module_ && !module_->instance->context.is_null()) { | 423 if (module_ && !module_->instance->context.is_null()) { |
| 423 Node* limit = graph()->NewNode( | 424 Node* limit = graph()->NewNode( |
| 424 jsgraph()->machine()->Load(MachineType::Pointer()), | 425 jsgraph()->machine()->Load(MachineType::Pointer()), |
| (...skipping 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2888 Node* node = graph()->NewNode(op, addr, jsgraph()->Int32Constant(0), val, | 2889 Node* node = graph()->NewNode(op, addr, jsgraph()->Int32Constant(0), val, |
| 2889 *effect_, *control_); | 2890 *effect_, *control_); |
| 2890 *effect_ = node; | 2891 *effect_ = node; |
| 2891 return node; | 2892 return node; |
| 2892 } | 2893 } |
| 2893 | 2894 |
| 2894 void WasmGraphBuilder::BoundsCheckMem(MachineType memtype, Node* index, | 2895 void WasmGraphBuilder::BoundsCheckMem(MachineType memtype, Node* index, |
| 2895 uint32_t offset, | 2896 uint32_t offset, |
| 2896 wasm::WasmCodePosition position) { | 2897 wasm::WasmCodePosition position) { |
| 2897 DCHECK(module_ && module_->instance); | 2898 DCHECK(module_ && module_->instance); |
| 2899 if (FLAG_wasm_no_bounds_checks) return; |
| 2898 uint32_t size = module_->instance->mem_size; | 2900 uint32_t size = module_->instance->mem_size; |
| 2899 byte memsize = wasm::WasmOpcodes::MemSize(memtype); | 2901 byte memsize = wasm::WasmOpcodes::MemSize(memtype); |
| 2900 | 2902 |
| 2901 size_t effective_size; | 2903 size_t effective_size; |
| 2902 if (size <= offset || size < (static_cast<uint64_t>(offset) + memsize)) { | 2904 if (size <= offset || size < (static_cast<uint64_t>(offset) + memsize)) { |
| 2903 // Two checks are needed in the case where the offset is statically | 2905 // Two checks are needed in the case where the offset is statically |
| 2904 // out of bounds; one check for the offset being in bounds, and the next for | 2906 // out of bounds; one check for the offset being in bounds, and the next for |
| 2905 // the offset + index being out of bounds for code to be patched correctly | 2907 // the offset + index being out of bounds for code to be patched correctly |
| 2906 // on relocation. | 2908 // on relocation. |
| 2907 | 2909 |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3486 function_->code_start_offset), | 3488 function_->code_start_offset), |
| 3487 compile_ms); | 3489 compile_ms); |
| 3488 } | 3490 } |
| 3489 | 3491 |
| 3490 return code; | 3492 return code; |
| 3491 } | 3493 } |
| 3492 | 3494 |
| 3493 } // namespace compiler | 3495 } // namespace compiler |
| 3494 } // namespace internal | 3496 } // namespace internal |
| 3495 } // namespace v8 | 3497 } // namespace v8 |
| OLD | NEW |