Index: src/compiler/int64-lowering.cc |
diff --git a/src/compiler/int64-lowering.cc b/src/compiler/int64-lowering.cc |
index 71f500886b40afe101ff6a32ed570ead578d0bfa..5b2dad4488d2b7603ba7bef2ed8b9c500a43f74b 100644 |
--- a/src/compiler/int64-lowering.cc |
+++ b/src/compiler/int64-lowering.cc |
@@ -117,10 +117,17 @@ void Int64Lowering::LowerNode(Node* node) { |
if (load_rep.representation() == MachineRepresentation::kWord64) { |
Node* base = node->InputAt(0); |
Node* index = node->InputAt(1); |
+#if defined(V8_TARGET_LITTLE_ENDIAN) |
titzer
2016/06/21 21:22:59
Can you factor this out into a common subroutine?
|
+ Node* index_low = index; |
Node* index_high = |
graph()->NewNode(machine()->Int32Add(), index, |
graph()->NewNode(common()->Int32Constant(4))); |
- |
+#elif defined(V8_TARGET_BIG_ENDIAN) |
+ Node* index_low = |
+ graph()->NewNode(machine()->Int32Add(), index, |
+ graph()->NewNode(common()->Int32Constant(4))); |
+ Node* index_high = index; |
+#endif |
const Operator* load_op = machine()->Load(MachineType::Int32()); |
Node* high_node; |
if (node->InputCount() > 2) { |
@@ -134,6 +141,7 @@ void Int64Lowering::LowerNode(Node* node) { |
} else { |
high_node = graph()->NewNode(load_op, base, index_high); |
} |
+ node->ReplaceInput(1, index_low); |
NodeProperties::ChangeOp(node, load_op); |
ReplaceNode(node, node, high_node); |
} else { |
@@ -152,10 +160,17 @@ void Int64Lowering::LowerNode(Node* node) { |
Node* base = node->InputAt(0); |
Node* index = node->InputAt(1); |
+#if defined(V8_TARGET_LITTLE_ENDIAN) |
+ Node* index_low = index; |
Node* index_high = |
graph()->NewNode(machine()->Int32Add(), index, |
graph()->NewNode(common()->Int32Constant(4))); |
- |
+#elif defined(V8_TARGET_BIG_ENDIAN) |
+ Node* index_low = |
+ graph()->NewNode(machine()->Int32Add(), index, |
+ graph()->NewNode(common()->Int32Constant(4))); |
+ Node* index_high = index; |
+#endif |
Node* value = node->InputAt(2); |
DCHECK(HasReplacementLow(value)); |
DCHECK(HasReplacementHigh(value)); |
@@ -177,6 +192,7 @@ void Int64Lowering::LowerNode(Node* node) { |
GetReplacementHigh(value)); |
} |
+ node->ReplaceInput(1, index_low); |
node->ReplaceInput(2, GetReplacementLow(value)); |
NodeProperties::ChangeOp(node, store_op); |
ReplaceNode(node, node, high_node); |
@@ -491,14 +507,16 @@ void Int64Lowering::LowerNode(Node* node) { |
machine()->Store( |
StoreRepresentation(MachineRepresentation::kWord32, |
WriteBarrierKind::kNoWriteBarrier)), |
- stack_slot, graph()->NewNode(common()->Int32Constant(4)), |
+ stack_slot, |
+ graph()->NewNode(common()->Int32Constant(GetHigherWordOffset())), |
GetReplacementHigh(input), graph()->start(), graph()->start()); |
Node* store_low_word = graph()->NewNode( |
machine()->Store( |
StoreRepresentation(MachineRepresentation::kWord32, |
WriteBarrierKind::kNoWriteBarrier)), |
- stack_slot, graph()->NewNode(common()->Int32Constant(0)), |
+ stack_slot, |
+ graph()->NewNode(common()->Int32Constant(GetLowerWordOffset())), |
GetReplacementLow(input), store_high_word, graph()->start()); |
Node* load = |
@@ -524,15 +542,15 @@ void Int64Lowering::LowerNode(Node* node) { |
stack_slot, graph()->NewNode(common()->Int32Constant(0)), input, |
graph()->start(), graph()->start()); |
- Node* high_node = |
- graph()->NewNode(machine()->Load(MachineType::Int32()), stack_slot, |
- graph()->NewNode(common()->Int32Constant(4)), store, |
- graph()->start()); |
+ Node* high_node = graph()->NewNode( |
+ machine()->Load(MachineType::Int32()), stack_slot, |
+ graph()->NewNode(common()->Int32Constant(GetHigherWordOffset())), |
+ store, graph()->start()); |
- Node* low_node = |
- graph()->NewNode(machine()->Load(MachineType::Int32()), stack_slot, |
- graph()->NewNode(common()->Int32Constant(0)), store, |
- graph()->start()); |
+ Node* low_node = graph()->NewNode( |
+ machine()->Load(MachineType::Int32()), stack_slot, |
+ graph()->NewNode(common()->Int32Constant(GetLowerWordOffset())), |
+ store, graph()->start()); |
ReplaceNode(node, low_node, high_node); |
break; |
} |