Chromium Code Reviews| Index: src/compiler/simplified-lowering.cc |
| diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
| index 44eed8fddfd64d417c749b94e50f58ea82dd50cd..5a99768bc5c4fd4d7b9b28ab97ad77fb910b16a2 100644 |
| --- a/src/compiler/simplified-lowering.cc |
| +++ b/src/compiler/simplified-lowering.cc |
| @@ -193,9 +193,10 @@ void SimplifiedLowering::DoChangeBitToBool(Node* node, Node* effect, |
| static WriteBarrierKind ComputeWriteBarrierKind( |
| - MachineRepresentation representation, Type* type) { |
| + bool base_is_tagged, MachineRepresentation representation, Type* type) { |
|
Benedikt Meurer
2014/08/04 12:18:31
Nit: Use that same enum here as well.
|
| // TODO(turbofan): skip write barriers for Smis, etc. |
| - if (representation == kMachineTagged) { |
| + if (base_is_tagged && representation == kMachineTagged) { |
| + // Write barriers are only for writes into heap objects (i.e. tagged base). |
| return kFullWriteBarrier; |
| } |
| return kNoWriteBarrier; |
| @@ -205,19 +206,17 @@ static WriteBarrierKind ComputeWriteBarrierKind( |
| void SimplifiedLowering::DoLoadField(Node* node, Node* effect, Node* control) { |
| const FieldAccess& access = FieldAccessOf(node->op()); |
| node->set_op(machine_.Load(access.representation)); |
| - Node* offset = |
| - graph()->NewNode(common()->Int32Constant(access.offset - kHeapObjectTag)); |
| + Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); |
| node->InsertInput(zone(), 1, offset); |
| } |
| void SimplifiedLowering::DoStoreField(Node* node, Node* effect, Node* control) { |
| const FieldAccess& access = FieldAccessOf(node->op()); |
| - WriteBarrierKind kind = |
| - ComputeWriteBarrierKind(access.representation, access.type); |
| + WriteBarrierKind kind = ComputeWriteBarrierKind( |
| + access.tag() != 0, access.representation, access.type); |
| node->set_op(machine_.Store(access.representation, kind)); |
| - Node* offset = |
| - graph()->NewNode(common()->Int32Constant(access.offset - kHeapObjectTag)); |
| + Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); |
| node->InsertInput(zone(), 1, offset); |
| } |
| @@ -247,15 +246,13 @@ Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access, |
| break; |
| } |
| if (element_size != 1) { |
| - index = graph()->NewNode( |
| - machine()->Int32Mul(), |
| - graph()->NewNode(common()->Int32Constant(element_size)), index); |
| + index = graph()->NewNode(machine()->Int32Mul(), |
| + jsgraph()->Int32Constant(element_size), index); |
| } |
| - int fixed_offset = access.header_size - kHeapObjectTag; |
| + int fixed_offset = access.header_size - access.tag(); |
| if (fixed_offset == 0) return index; |
| - return graph()->NewNode( |
| - machine()->Int32Add(), |
| - graph()->NewNode(common()->Int32Constant(fixed_offset)), index); |
| + return graph()->NewNode(machine()->Int32Add(), |
| + jsgraph()->Int32Constant(fixed_offset), index); |
| } |
| @@ -270,8 +267,8 @@ void SimplifiedLowering::DoLoadElement(Node* node, Node* effect, |
| void SimplifiedLowering::DoStoreElement(Node* node, Node* effect, |
| Node* control) { |
| const ElementAccess& access = ElementAccessOf(node->op()); |
| - WriteBarrierKind kind = |
| - ComputeWriteBarrierKind(access.representation, access.type); |
| + WriteBarrierKind kind = ComputeWriteBarrierKind( |
| + access.tag() != 0, access.representation, access.type); |
| node->set_op(machine_.Store(access.representation, kind)); |
| node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
| } |