Chromium Code Reviews| Index: src/compiler/simplified-lowering.cc |
| diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
| index 7f8e68e9839e08a944c71cc78aa96e2ea9b13701..9a46e3771f70107cd40ac9370ae117be3a1e9970 100644 |
| --- a/src/compiler/simplified-lowering.cc |
| +++ b/src/compiler/simplified-lowering.cc |
| @@ -2472,13 +2472,22 @@ class RepresentationSelector { |
| case IrOpcode::kStoreField: { |
| FieldAccess access = FieldAccessOf(node->op()); |
| NodeInfo* input_info = GetInfo(node->InputAt(1)); |
| + MachineRepresentation field_representation = |
| + access.machine_type.representation(); |
| + |
| + // Make sure we convert to Smi if possible. This should help write |
| + // barrier elimination. |
| + if (field_representation == MachineRepresentation::kTagged && |
| + TypeOf(node->InputAt(1))->Is(Type::SignedSmall())) { |
| + field_representation = MachineRepresentation::kTaggedSigned; |
| + } |
| WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( |
| - access.base_is_tagged, access.machine_type.representation(), |
| - access.offset, access.type, input_info->representation(), |
| - node->InputAt(1)); |
| + access.base_is_tagged, field_representation, access.offset, |
| + access.type, input_info->representation(), node->InputAt(1)); |
|
Benedikt Meurer
2017/06/06 10:32:47
Please give the node->InputAt(1) a name. (Same bel
|
| + |
| ProcessInput(node, 0, UseInfoForBasePointer(access)); |
| - ProcessInput(node, 1, TruncatingUseInfoFromRepresentation( |
| - access.machine_type.representation())); |
| + ProcessInput(node, 1, |
| + TruncatingUseInfoFromRepresentation(field_representation)); |
| ProcessRemainingInputs(node, 2); |
| SetOutput(node, MachineRepresentation::kNone); |
| if (lower()) { |
| @@ -2548,14 +2557,23 @@ class RepresentationSelector { |
| case IrOpcode::kStoreElement: { |
| ElementAccess access = ElementAccessOf(node->op()); |
| NodeInfo* input_info = GetInfo(node->InputAt(2)); |
| + MachineRepresentation element_representation = |
| + access.machine_type.representation(); |
| + |
| + // Make sure we convert to Smi if possible. This should help write |
| + // barrier elimination. |
| + if (element_representation == MachineRepresentation::kTagged && |
| + TypeOf(node->InputAt(2))->Is(Type::SignedSmall())) { |
| + element_representation = MachineRepresentation::kTaggedSigned; |
| + } |
| WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( |
| - access.base_is_tagged, access.machine_type.representation(), |
| - access.type, input_info->representation(), node->InputAt(2)); |
| + access.base_is_tagged, element_representation, access.type, |
| + input_info->representation(), node->InputAt(2)); |
| ProcessInput(node, 0, UseInfoForBasePointer(access)); // base |
| ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index |
| ProcessInput(node, 2, |
| TruncatingUseInfoFromRepresentation( |
| - access.machine_type.representation())); // value |
| + element_representation)); // value |
| ProcessRemainingInputs(node, 3); |
| SetOutput(node, MachineRepresentation::kNone); |
| if (lower()) { |