Index: src/compiler/raw-machine-assembler.h |
diff --git a/src/compiler/raw-machine-assembler.h b/src/compiler/raw-machine-assembler.h |
index 1f27a9ab00f2e30cfedb1d66b3d2efd89fb14798..62b31ccb553ae16e2ecce46bf1cd17a8c60b3f05 100644 |
--- a/src/compiler/raw-machine-assembler.h |
+++ b/src/compiler/raw-machine-assembler.h |
@@ -40,7 +40,10 @@ class RawMachineAssembler { |
Isolate* isolate, Graph* graph, CallDescriptor* call_descriptor, |
MachineRepresentation word = MachineType::PointerRepresentation(), |
MachineOperatorBuilder::Flags flags = |
- MachineOperatorBuilder::Flag::kNoFlags); |
+ MachineOperatorBuilder::Flag::kNoFlags, |
+ MachineOperatorBuilder::AlignmentRequirements alignment_requirements = |
+ MachineOperatorBuilder::AlignmentRequirements:: |
+ FullUnalignedAccessSupport()); |
~RawMachineAssembler() {} |
Isolate* isolate() const { return isolate_; } |
@@ -133,6 +136,34 @@ class RawMachineAssembler { |
base, index, value); |
} |
+ // Unaligned memory operations |
+ Node* UnalignedLoad(MachineType rep, Node* base) { |
+ return UnalignedLoad(rep, base, IntPtrConstant(0)); |
+ } |
+ Node* UnalignedLoad(MachineType rep, Node* base, Node* index) { |
+ if (machine()->UnalignedLoadSupported(rep, 1)) { |
+ return AddNode(machine()->Load(rep), base, index); |
+ } else { |
+ return AddNode(machine()->UnalignedLoad(rep), base, index); |
+ } |
+ } |
+ Node* UnalignedStore(MachineRepresentation rep, Node* base, Node* value) { |
+ return UnalignedStore(rep, base, IntPtrConstant(0), value); |
+ } |
+ Node* UnalignedStore(MachineRepresentation rep, Node* base, Node* index, |
+ Node* value) { |
+ MachineType t = MachineType::TypeForRepresentation(rep); |
+ if (machine()->UnalignedStoreSupported(t, 1)) { |
+ return AddNode(machine()->Store(StoreRepresentation( |
+ rep, WriteBarrierKind::kNoWriteBarrier)), |
+ base, index, value); |
+ } else { |
+ return AddNode( |
+ machine()->UnalignedStore(UnalignedStoreRepresentation(rep)), base, |
+ index, value); |
+ } |
+ } |
+ |
// Atomic memory operations. |
Node* AtomicLoad(MachineType rep, Node* base, Node* index) { |
return AddNode(machine()->AtomicLoad(rep), base, index); |
@@ -647,6 +678,14 @@ class RawMachineAssembler { |
Node* StoreToPointer(void* address, MachineRepresentation rep, Node* node) { |
return Store(rep, PointerConstant(address), node, kNoWriteBarrier); |
} |
+ Node* UnalignedLoadFromPointer(void* address, MachineType rep, |
+ int32_t offset = 0) { |
+ return UnalignedLoad(rep, PointerConstant(address), Int32Constant(offset)); |
+ } |
+ Node* UnalignedStoreToPointer(void* address, MachineRepresentation rep, |
+ Node* node) { |
+ return UnalignedStore(rep, PointerConstant(address), node); |
+ } |
Node* StringConstant(const char* string) { |
return HeapConstant(isolate()->factory()->InternalizeUtf8String(string)); |
} |