Index: src/compiler/simplified-lowering.cc |
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
index 69d1d1ac79a40cbd3f55f836c64742b68a8219b7..88ce773216b4a5f3019cbb639a87b67dd7977e10 100644 |
--- a/src/compiler/simplified-lowering.cc |
+++ b/src/compiler/simplified-lowering.cc |
@@ -1135,12 +1135,13 @@ Node* SimplifiedLowering::OffsetMinusTagConstant(int32_t offset) { |
} |
-WriteBarrierKind SimplifiedLowering::ComputeWriteBarrierKind( |
- BaseTaggedness base_is_tagged, MachineType representation, Node* value) { |
- // TODO(turbofan): skip write barriers for Smis, etc. |
- if (machine()->Is64() && value->opcode() == IrOpcode::kChangeInt32ToTagged) { |
- // TODO(bmeurer): Remove this hack once we have a way to represent "sminess" |
- // of values, either in types or representations. |
+namespace { |
+ |
+WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged, |
+ MachineType representation, |
+ Type* type) { |
+ if (type->Is(Type::TaggedSigned())) { |
+ // Write barriers are only for writes of heap objects. |
return kNoWriteBarrier; |
} |
if (base_is_tagged == kTaggedBase && |
@@ -1151,6 +1152,8 @@ WriteBarrierKind SimplifiedLowering::ComputeWriteBarrierKind( |
return kNoWriteBarrier; |
} |
+} // namespace |
+ |
void SimplifiedLowering::DoLoadField(Node* node) { |
const FieldAccess& access = FieldAccessOf(node->op()); |
@@ -1162,8 +1165,9 @@ void SimplifiedLowering::DoLoadField(Node* node) { |
void SimplifiedLowering::DoStoreField(Node* node) { |
const FieldAccess& access = FieldAccessOf(node->op()); |
- WriteBarrierKind kind = ComputeWriteBarrierKind( |
- access.base_is_tagged, access.machine_type, node->InputAt(1)); |
+ Type* type = NodeProperties::GetBounds(node->InputAt(1)).upper; |
+ WriteBarrierKind kind = |
+ ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type, type); |
node->set_op( |
machine()->Store(StoreRepresentation(access.machine_type, kind))); |
Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag()); |
@@ -1268,10 +1272,11 @@ void SimplifiedLowering::DoLoadElement(Node* node) { |
void SimplifiedLowering::DoStoreElement(Node* node) { |
const ElementAccess& access = ElementAccessOf(node->op()); |
- node->set_op(machine()->Store(StoreRepresentation( |
- access.machine_type, |
- ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type, |
- node->InputAt(2))))); |
+ Type* type = NodeProperties::GetBounds(node->InputAt(2)).upper; |
+ node->set_op(machine()->Store( |
+ StoreRepresentation(access.machine_type, |
+ ComputeWriteBarrierKind(access.base_is_tagged, |
+ access.machine_type, type)))); |
node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); |
} |