Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: src/compiler/raw-machine-assembler.h

Issue 2122853002: Implement UnaligedLoad and UnaligedStore turbofan operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add UnalingedLoad and UnalignedStore tests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/raw-machine-assembler.h
diff --git a/src/compiler/raw-machine-assembler.h b/src/compiler/raw-machine-assembler.h
index 96a91e2dc3ca370dcb4affe998fd4b0f539e0ccd..8e86adcbf68bc5bacfad6bf8cb50b470e525f309 100644
--- a/src/compiler/raw-machine-assembler.h
+++ b/src/compiler/raw-machine-assembler.h
@@ -133,6 +133,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);
@@ -650,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));
}

Powered by Google App Engine
This is Rietveld 408576698