Commit b8dec98d authored by mvstanton's avatar mvstanton Committed by Commit bot

[turbofan] Base more write barrier decisions on machine representation.

This furthers our goal of avoiding using the representation dimension of
the Type class.

BUG=v8:5270

Review-Url: https://codereview.chromium.org/2295883004
Cr-Commit-Position: refs/heads/master@{#39064}
parent 83e14103
...@@ -966,7 +966,6 @@ JSNativeContextSpecialization::BuildPropertyAccess( ...@@ -966,7 +966,6 @@ JSNativeContextSpecialization::BuildPropertyAccess(
control); control);
} }
} else { } else {
// DCHECK(field_type->Is(Type::Tagged()));
DCHECK(rep == MachineRepresentation::kTagged); DCHECK(rep == MachineRepresentation::kTagged);
} }
Handle<Map> transition_map; Handle<Map> transition_map;
......
...@@ -139,6 +139,12 @@ class UseInfo { ...@@ -139,6 +139,12 @@ class UseInfo {
static UseInfo AnyTagged() { static UseInfo AnyTagged() {
return UseInfo(MachineRepresentation::kTagged, Truncation::Any()); return UseInfo(MachineRepresentation::kTagged, Truncation::Any());
} }
static UseInfo TaggedSigned() {
return UseInfo(MachineRepresentation::kTaggedSigned, Truncation::Any());
}
static UseInfo TaggedPointer() {
return UseInfo(MachineRepresentation::kTaggedPointer, Truncation::Any());
}
// Possibly deoptimizing conversions. // Possibly deoptimizing conversions.
static UseInfo CheckedSignedSmallAsWord32() { static UseInfo CheckedSignedSmallAsWord32() {
......
...@@ -1031,12 +1031,12 @@ class RepresentationSelector { ...@@ -1031,12 +1031,12 @@ class RepresentationSelector {
WriteBarrierKind WriteBarrierKindFor( WriteBarrierKind WriteBarrierKindFor(
BaseTaggedness base_taggedness, BaseTaggedness base_taggedness,
MachineRepresentation field_representation, Type* field_type, MachineRepresentation field_representation, Type* field_type,
Node* value) { MachineRepresentation value_representation, Node* value) {
if (base_taggedness == kTaggedBase && if (base_taggedness == kTaggedBase &&
CanBeTaggedPointer(field_representation)) { CanBeTaggedPointer(field_representation)) {
Type* value_type = NodeProperties::GetType(value); Type* value_type = NodeProperties::GetType(value);
if (field_type->Is(Type::TaggedSigned()) || if (field_representation == MachineRepresentation::kTaggedSigned ||
value_type->Is(Type::TaggedSigned())) { value_representation == MachineRepresentation::kTaggedSigned) {
// Write barriers are only for stores of heap objects. // Write barriers are only for stores of heap objects.
return kNoWriteBarrier; return kNoWriteBarrier;
} }
...@@ -1062,8 +1062,8 @@ class RepresentationSelector { ...@@ -1062,8 +1062,8 @@ class RepresentationSelector {
return kMapWriteBarrier; return kMapWriteBarrier;
} }
} }
if (field_type->Is(Type::TaggedPointer()) || if (field_representation == MachineRepresentation::kTaggedPointer ||
value_type->Is(Type::TaggedPointer())) { value_representation == MachineRepresentation::kTaggedPointer) {
// Write barriers for heap objects are cheaper. // Write barriers for heap objects are cheaper.
return kPointerWriteBarrier; return kPointerWriteBarrier;
} }
...@@ -1084,13 +1084,14 @@ class RepresentationSelector { ...@@ -1084,13 +1084,14 @@ class RepresentationSelector {
WriteBarrierKind WriteBarrierKindFor( WriteBarrierKind WriteBarrierKindFor(
BaseTaggedness base_taggedness, BaseTaggedness base_taggedness,
MachineRepresentation field_representation, int field_offset, MachineRepresentation field_representation, int field_offset,
Type* field_type, Node* value) { Type* field_type, MachineRepresentation value_representation,
Node* value) {
if (base_taggedness == kTaggedBase && if (base_taggedness == kTaggedBase &&
field_offset == HeapObject::kMapOffset) { field_offset == HeapObject::kMapOffset) {
return kMapWriteBarrier; return kMapWriteBarrier;
} }
return WriteBarrierKindFor(base_taggedness, field_representation, return WriteBarrierKindFor(base_taggedness, field_representation,
field_type, value); field_type, value_representation, value);
} }
Graph* graph() const { return jsgraph_->graph(); } Graph* graph() const { return jsgraph_->graph(); }
...@@ -2171,15 +2172,16 @@ class RepresentationSelector { ...@@ -2171,15 +2172,16 @@ class RepresentationSelector {
FieldAccess access = FieldAccessOf(node->op()); FieldAccess access = FieldAccessOf(node->op());
MachineRepresentation const representation = MachineRepresentation const representation =
access.machine_type.representation(); access.machine_type.representation();
// TODO(bmeurer): Introduce an appropriate tagged-signed machine rep.
VisitUnop(node, UseInfoForBasePointer(access), representation); VisitUnop(node, UseInfoForBasePointer(access), representation);
return; return;
} }
case IrOpcode::kStoreField: { case IrOpcode::kStoreField: {
FieldAccess access = FieldAccessOf(node->op()); FieldAccess access = FieldAccessOf(node->op());
NodeInfo* input_info = GetInfo(node->InputAt(1));
WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( WriteBarrierKind write_barrier_kind = WriteBarrierKindFor(
access.base_is_tagged, access.machine_type.representation(), access.base_is_tagged, access.machine_type.representation(),
access.offset, access.type, node->InputAt(1)); access.offset, access.type, input_info->representation(),
node->InputAt(1));
ProcessInput(node, 0, UseInfoForBasePointer(access)); ProcessInput(node, 0, UseInfoForBasePointer(access));
ProcessInput(node, 1, TruncatingUseInfoFromRepresentation( ProcessInput(node, 1, TruncatingUseInfoFromRepresentation(
access.machine_type.representation())); access.machine_type.representation()));
...@@ -2251,9 +2253,10 @@ class RepresentationSelector { ...@@ -2251,9 +2253,10 @@ class RepresentationSelector {
} }
case IrOpcode::kStoreElement: { case IrOpcode::kStoreElement: {
ElementAccess access = ElementAccessOf(node->op()); ElementAccess access = ElementAccessOf(node->op());
NodeInfo* input_info = GetInfo(node->InputAt(2));
WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( WriteBarrierKind write_barrier_kind = WriteBarrierKindFor(
access.base_is_tagged, access.machine_type.representation(), access.base_is_tagged, access.machine_type.representation(),
access.type, node->InputAt(2)); access.type, input_info->representation(), node->InputAt(2));
ProcessInput(node, 0, UseInfoForBasePointer(access)); // base ProcessInput(node, 0, UseInfoForBasePointer(access)); // base
ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index
ProcessInput(node, 2, ProcessInput(node, 2,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment