Chromium Code Reviews| Index: src/compiler/int64-lowering.cc |
| diff --git a/src/compiler/int64-lowering.cc b/src/compiler/int64-lowering.cc |
| index 403d4c961cfc3ebf6668c674138bda1cd1ea6546..7a358cfbf51dbf2a5a087dc1b01bc8fa240d9f9d 100644 |
| --- a/src/compiler/int64-lowering.cc |
| +++ b/src/compiler/int64-lowering.cc |
| @@ -126,6 +126,38 @@ void Int64Lowering::LowerNode(Node* node) { |
| } |
| break; |
| } |
| + case IrOpcode::kUnalignedLoad: { |
|
titzer
2016/03/29 08:42:48
Can you factor out the common code between load/un
|
| + UnalignedLoadRepresentation load_rep = |
| + UnalignedLoadRepresentationOf(node->op()); |
| + |
| + if (load_rep.representation() == 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()->UnalignedLoad(MachineType::Int32()).op(); |
| + Node* high_node; |
| + if (node->InputCount() > 2) { |
| + Node* effect_high = node->InputAt(2); |
| + Node* control_high = node->InputAt(3); |
| + high_node = graph()->NewNode(load_op, base, index_high, effect_high, |
| + control_high); |
| + // change the effect change from old_node --> old_effect to |
| + // old_node --> high_node --> old_effect. |
| + node->ReplaceInput(2, high_node); |
| + } else { |
| + high_node = graph()->NewNode(load_op, base, index_high); |
| + } |
| + NodeProperties::ChangeOp(node, load_op); |
| + ReplaceNode(node, node, high_node); |
| + } else { |
| + DefaultLowering(node); |
| + } |
| + break; |
| + } |
| case IrOpcode::kStore: { |
| StoreRepresentation store_rep = StoreRepresentationOf(node->op()); |
| if (store_rep.representation() == MachineRepresentation::kWord64) { |
| @@ -170,6 +202,46 @@ void Int64Lowering::LowerNode(Node* node) { |
| } |
| break; |
| } |
| + case IrOpcode::kUnalignedStore: { |
| + UnalignedStoreRepresentation store_rep = |
| + UnalignedStoreRepresentationOf(node->op()); |
| + if (store_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))); |
| + |
| + Node* value = node->InputAt(2); |
| + DCHECK(HasReplacementLow(value)); |
| + DCHECK(HasReplacementHigh(value)); |
| + |
| + const Operator* store_op = |
| + machine()->UnalignedStore(MachineRepresentation::kWord32).op(); |
| + |
| + Node* high_node; |
| + if (node->InputCount() > 3) { |
| + Node* effect_high = node->InputAt(3); |
| + Node* control_high = node->InputAt(4); |
| + high_node = graph()->NewNode(store_op, base, index_high, |
| + GetReplacementHigh(value), effect_high, |
| + control_high); |
| + node->ReplaceInput(3, high_node); |
| + |
| + } else { |
| + high_node = graph()->NewNode(store_op, base, index_high, |
| + GetReplacementHigh(value)); |
| + } |
| + |
| + node->ReplaceInput(2, GetReplacementLow(value)); |
| + NodeProperties::ChangeOp(node, store_op); |
| + ReplaceNode(node, node, high_node); |
| + } else { |
| + DefaultLowering(node); |
| + } |
| + break; |
| + } |
| + |
| case IrOpcode::kStart: { |
| int parameter_count = GetParameterCountAfterLowering(signature()); |
| // Only exchange the node if the parameter count actually changed. |