| Index: src/compiler/wasm-compiler.cc
|
| diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
|
| index 24eba9cdee2a1bca8e1d0f054539ec5c7676fc4d..94b85f77e4163b729cee673cd0b76cbfbdec8b8f 100644
|
| --- a/src/compiler/wasm-compiler.cc
|
| +++ b/src/compiler/wasm-compiler.cc
|
| @@ -2120,9 +2120,8 @@ void WasmGraphBuilder::BoundsCheckMem(MachineType memtype, Node* index,
|
| trap_->AddTrapIfFalse(kTrapMemOutOfBounds, cond);
|
| }
|
|
|
| -
|
| Node* WasmGraphBuilder::LoadMem(wasm::LocalType type, MachineType memtype,
|
| - Node* index, uint32_t offset) {
|
| + Node* index, uint32_t offset, bool aligned) {
|
| Node* load;
|
|
|
| if (module_ && module_->asm_js()) {
|
| @@ -2134,8 +2133,13 @@ Node* WasmGraphBuilder::LoadMem(wasm::LocalType type, MachineType memtype,
|
| } else {
|
| // WASM semantics throw on OOB. Introduce explicit bounds check.
|
| BoundsCheckMem(memtype, index, offset);
|
| - load = graph()->NewNode(jsgraph()->machine()->Load(memtype),
|
| - MemBuffer(offset), index, *effect_, *control_);
|
| + if (aligned) {
|
| + load = graph()->NewNode(jsgraph()->machine()->Load(memtype),
|
| + MemBuffer(offset), index, *effect_, *control_);
|
| + } else {
|
| + load = graph()->NewNode(jsgraph()->machine()->UnalignedLoad(memtype),
|
| + MemBuffer(offset), index, *effect_, *control_);
|
| + }
|
| }
|
|
|
| *effect_ = load;
|
| @@ -2156,9 +2160,8 @@ Node* WasmGraphBuilder::LoadMem(wasm::LocalType type, MachineType memtype,
|
| return load;
|
| }
|
|
|
| -
|
| Node* WasmGraphBuilder::StoreMem(MachineType memtype, Node* index,
|
| - uint32_t offset, Node* val) {
|
| + uint32_t offset, bool aligned, Node* val) {
|
| Node* store;
|
| if (module_ && module_->asm_js()) {
|
| // asm.js semantics use CheckedStore (i.e. ignore OOB writes).
|
| @@ -2170,10 +2173,16 @@ Node* WasmGraphBuilder::StoreMem(MachineType memtype, Node* index,
|
| } else {
|
| // WASM semantics throw on OOB. Introduce explicit bounds check.
|
| BoundsCheckMem(memtype, index, offset);
|
| - StoreRepresentation rep(memtype.representation(), kNoWriteBarrier);
|
| - store =
|
| - graph()->NewNode(jsgraph()->machine()->Store(rep), MemBuffer(offset),
|
| - index, val, *effect_, *control_);
|
| + if (aligned) {
|
| + StoreRepresentation rep(memtype.representation(), kNoWriteBarrier);
|
| + store =
|
| + graph()->NewNode(jsgraph()->machine()->Store(rep), MemBuffer(offset),
|
| + index, val, *effect_, *control_);
|
| + } else {
|
| + store = graph()->NewNode(
|
| + jsgraph()->machine()->UnalignedStore(memtype.representation()),
|
| + MemBuffer(offset), index, val, *effect_, *control_);
|
| + }
|
| }
|
| *effect_ = store;
|
| return store;
|
|
|