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

Unified Diff: src/compiler/int64-lowering.cc

Issue 1779713009: Implement optional turbofan UnalignedLoad and UnalignedStore operators (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Unaligned access simulate using load/shift/or and store/shift/and Created 4 years, 8 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/int64-lowering.cc
diff --git a/src/compiler/int64-lowering.cc b/src/compiler/int64-lowering.cc
index 8824a03dc974565f545aa57dedba7cfda19f60b3..8f5c78bdb48b874ca3c439f1b29e20dd2df97544 100644
--- a/src/compiler/int64-lowering.cc
+++ b/src/compiler/int64-lowering.cc
@@ -107,17 +107,31 @@ void Int64Lowering::LowerNode(Node* node) {
ReplaceNode(node, low_node, high_node);
break;
}
- case IrOpcode::kLoad: {
- LoadRepresentation load_rep = LoadRepresentationOf(node->op());
+ case IrOpcode::kLoad:
+ case IrOpcode::kUnalignedLoad: {
+ MachineRepresentation rep;
+ if (node->opcode() == IrOpcode::kLoad) {
+ rep = LoadRepresentationOf(node->op()).representation();
+ } else {
+ DCHECK(node->opcode() == IrOpcode::kUnalignedLoad);
+ rep = UnalignedLoadRepresentationOf(node->op()).representation();
+ }
- if (load_rep.representation() == MachineRepresentation::kWord64) {
+ if (rep == MachineRepresentation::kWord64) {
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
Node* index_high =
graph()->NewNode(machine()->Int32Add(), index,
graph()->NewNode(common()->Int32Constant(4)));
- const Operator* load_op = machine()->Load(MachineType::Int32());
+ const Operator* load_op;
+ if (node->opcode() == IrOpcode::kLoad) {
+ load_op = machine()->Load(MachineType::Int32());
+ } else {
+ DCHECK(node->opcode() == IrOpcode::kUnalignedLoad);
+ load_op = machine()->UnalignedLoad(MachineType::Int32()).op();
+ }
+
Node* high_node;
if (node->InputCount() > 2) {
Node* effect_high = node->InputAt(2);
@@ -137,15 +151,21 @@ void Int64Lowering::LowerNode(Node* node) {
}
break;
}
- case IrOpcode::kStore: {
- StoreRepresentation store_rep = StoreRepresentationOf(node->op());
- if (store_rep.representation() == MachineRepresentation::kWord64) {
+ case IrOpcode::kStore:
+ case IrOpcode::kUnalignedStore: {
+ MachineRepresentation rep;
+ if (node->opcode() == IrOpcode::kStore) {
+ rep = StoreRepresentationOf(node->op()).representation();
+ } else {
+ DCHECK(node->opcode() == IrOpcode::kUnalignedStore);
+ rep = UnalignedStoreRepresentationOf(node->op());
+ }
+
+ if (rep == MachineRepresentation::kWord64) {
// We change the original store node to store the low word, and create
// a new store node to store the high word. The effect and control edges
// are copied from the original store to the new store node, the effect
// edge of the original store is redirected to the new store.
- WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind();
-
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
Node* index_high =
@@ -156,8 +176,17 @@ void Int64Lowering::LowerNode(Node* node) {
DCHECK(HasReplacementLow(value));
DCHECK(HasReplacementHigh(value));
- const Operator* store_op = machine()->Store(StoreRepresentation(
- MachineRepresentation::kWord32, write_barrier_kind));
+ const Operator* store_op;
+ if (node->opcode() == IrOpcode::kStore) {
+ WriteBarrierKind write_barrier_kind =
+ StoreRepresentationOf(node->op()).write_barrier_kind();
+ store_op = machine()->Store(StoreRepresentation(
+ MachineRepresentation::kWord32, write_barrier_kind));
+ } else {
+ DCHECK(node->opcode() == IrOpcode::kUnalignedStore);
+ store_op =
+ machine()->UnalignedStore(MachineRepresentation::kWord32).op();
+ }
Node* high_node;
if (node->InputCount() > 3) {

Powered by Google App Engine
This is Rietveld 408576698