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 2991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3002 return load; | 3002 return load; |
3003 } | 3003 } |
3004 | 3004 |
3005 | 3005 |
3006 Node* WasmGraphBuilder::StoreMem(MachineType memtype, Node* index, | 3006 Node* WasmGraphBuilder::StoreMem(MachineType memtype, Node* index, |
3007 uint32_t offset, uint32_t alignment, Node* val, | 3007 uint32_t offset, uint32_t alignment, Node* val, |
3008 wasm::WasmCodePosition position) { | 3008 wasm::WasmCodePosition position) { |
3009 Node* store; | 3009 Node* store; |
3010 | 3010 |
3011 // WASM semantics throw on OOB. Introduce explicit bounds check. | 3011 // WASM semantics throw on OOB. Introduce explicit bounds check. |
3012 BoundsCheckMem(memtype, index, offset, position); | 3012 if (!FLAG_wasm_trap_handler) { |
bradnelson
2016/11/22 02:02:36
The fuzzers are going to throw up a lot of issues
titzer
2016/11/22 10:33:20
I think we should (eventually) implement Protected
Eric Holk
2016/11/22 23:16:25
I actually added something similar in the guard pa
| |
3013 BoundsCheckMem(memtype, index, offset, position); | |
3014 } | |
3013 StoreRepresentation rep(memtype.representation(), kNoWriteBarrier); | 3015 StoreRepresentation rep(memtype.representation(), kNoWriteBarrier); |
3014 | 3016 |
3015 bool aligned = static_cast<int>(alignment) >= | 3017 bool aligned = static_cast<int>(alignment) >= |
3016 ElementSizeLog2Of(memtype.representation()); | 3018 ElementSizeLog2Of(memtype.representation()); |
3017 | 3019 |
3018 #if defined(V8_TARGET_BIG_ENDIAN) | 3020 #if defined(V8_TARGET_BIG_ENDIAN) |
3019 val = BuildChangeEndianness(val, memtype); | 3021 val = BuildChangeEndianness(val, memtype); |
3020 #endif | 3022 #endif |
3021 | 3023 |
3022 if (aligned || | 3024 if (aligned || |
3023 jsgraph()->machine()->UnalignedStoreSupported(memtype, alignment)) { | 3025 jsgraph()->machine()->UnalignedStoreSupported(memtype, alignment)) { |
3024 StoreRepresentation rep(memtype.representation(), kNoWriteBarrier); | 3026 if (FLAG_wasm_trap_handler) { |
3025 store = | 3027 Node* context = HeapConstant(module_->instance->context); |
3026 graph()->NewNode(jsgraph()->machine()->Store(rep), MemBuffer(offset), | 3028 Node* position_node = jsgraph()->Int32Constant(position); |
3027 index, val, *effect_, *control_); | 3029 store = graph()->NewNode( |
3030 jsgraph()->machine()->ProtectedStore(memtype.representation()), | |
3031 MemBuffer(offset), index, val, context, position_node, *effect_, | |
3032 *control_); | |
3033 } else { | |
3034 StoreRepresentation rep(memtype.representation(), kNoWriteBarrier); | |
3035 store = | |
3036 graph()->NewNode(jsgraph()->machine()->Store(rep), MemBuffer(offset), | |
3037 index, val, *effect_, *control_); | |
3038 } | |
3028 } else { | 3039 } else { |
3040 DCHECK(!FLAG_wasm_trap_handler); | |
bradnelson
2016/11/22 02:02:36
A TODO to support this?
Eric Holk
2016/11/22 23:16:25
Done, and for ProtectedLoad.
| |
3029 UnalignedStoreRepresentation rep(memtype.representation()); | 3041 UnalignedStoreRepresentation rep(memtype.representation()); |
3030 store = | 3042 store = |
3031 graph()->NewNode(jsgraph()->machine()->UnalignedStore(rep), | 3043 graph()->NewNode(jsgraph()->machine()->UnalignedStore(rep), |
3032 MemBuffer(offset), index, val, *effect_, *control_); | 3044 MemBuffer(offset), index, val, *effect_, *control_); |
3033 } | 3045 } |
3034 | 3046 |
3035 *effect_ = store; | 3047 *effect_ = store; |
3036 | 3048 |
3037 return store; | 3049 return store; |
3038 } | 3050 } |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3491 function_->code_start_offset), | 3503 function_->code_start_offset), |
3492 compile_ms); | 3504 compile_ms); |
3493 } | 3505 } |
3494 | 3506 |
3495 return code; | 3507 return code; |
3496 } | 3508 } |
3497 | 3509 |
3498 } // namespace compiler | 3510 } // namespace compiler |
3499 } // namespace internal | 3511 } // namespace internal |
3500 } // namespace v8 | 3512 } // namespace v8 |
OLD | NEW |