Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: src/compiler/access-info.cc

Issue 2290233002: [turbofan] Introduce MachineRepresentation to PropertyAccessInfo. (Closed)
Patch Set: REBASE and comments. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/access-info.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/access-info.cc
diff --git a/src/compiler/access-info.cc b/src/compiler/access-info.cc
index 1172bfbc835960b166098bfeccd1479bf21e0e2c..262aa3cb06388f116a06495f9e6e9067b8c6996f 100644
--- a/src/compiler/access-info.cc
+++ b/src/compiler/access-info.cc
@@ -79,10 +79,11 @@ PropertyAccessInfo PropertyAccessInfo::DataConstant(
// static
PropertyAccessInfo PropertyAccessInfo::DataField(
- MapList const& receiver_maps, FieldIndex field_index, Type* field_type,
+ MapList const& receiver_maps, FieldIndex field_index,
+ MachineRepresentation field_representation, Type* field_type,
MaybeHandle<JSObject> holder, MaybeHandle<Map> transition_map) {
- return PropertyAccessInfo(holder, transition_map, field_index, field_type,
- receiver_maps);
+ return PropertyAccessInfo(holder, transition_map, field_index,
+ field_representation, field_type, receiver_maps);
}
// static
@@ -93,13 +94,16 @@ PropertyAccessInfo PropertyAccessInfo::AccessorConstant(
}
PropertyAccessInfo::PropertyAccessInfo()
- : kind_(kInvalid), field_type_(Type::None()) {}
+ : kind_(kInvalid),
+ field_representation_(MachineRepresentation::kNone),
+ field_type_(Type::None()) {}
PropertyAccessInfo::PropertyAccessInfo(MaybeHandle<JSObject> holder,
MapList const& receiver_maps)
: kind_(kNotFound),
receiver_maps_(receiver_maps),
holder_(holder),
+ field_representation_(MachineRepresentation::kNone),
field_type_(Type::None()) {}
PropertyAccessInfo::PropertyAccessInfo(Kind kind, MaybeHandle<JSObject> holder,
@@ -109,17 +113,19 @@ PropertyAccessInfo::PropertyAccessInfo(Kind kind, MaybeHandle<JSObject> holder,
receiver_maps_(receiver_maps),
constant_(constant),
holder_(holder),
+ field_representation_(MachineRepresentation::kNone),
field_type_(Type::Any()) {}
-PropertyAccessInfo::PropertyAccessInfo(MaybeHandle<JSObject> holder,
- MaybeHandle<Map> transition_map,
- FieldIndex field_index, Type* field_type,
- MapList const& receiver_maps)
+PropertyAccessInfo::PropertyAccessInfo(
+ MaybeHandle<JSObject> holder, MaybeHandle<Map> transition_map,
+ FieldIndex field_index, MachineRepresentation field_representation,
+ Type* field_type, MapList const& receiver_maps)
: kind_(kDataField),
receiver_maps_(receiver_maps),
transition_map_(transition_map),
holder_(holder),
field_index_(field_index),
+ field_representation_(field_representation),
field_type_(field_type) {}
bool PropertyAccessInfo::Merge(PropertyAccessInfo const* that) {
@@ -138,7 +144,8 @@ bool PropertyAccessInfo::Merge(PropertyAccessInfo const* that) {
if (this->transition_map_.address() == that->transition_map_.address() &&
this->field_index_ == that->field_index_ &&
this->field_type_->Is(that->field_type_) &&
- that->field_type_->Is(this->field_type_)) {
+ that->field_type_->Is(this->field_type_) &&
+ this->field_representation_ == that->field_representation_) {
this->receiver_maps_.insert(this->receiver_maps_.end(),
that->receiver_maps_.begin(),
that->receiver_maps_.end());
@@ -283,20 +290,23 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
}
case DATA: {
int index = descriptors->GetFieldIndex(number);
- Representation field_representation = details.representation();
+ Representation details_representation = details.representation();
FieldIndex field_index = FieldIndex::ForPropertyIndex(
- *map, index, field_representation.IsDouble());
+ *map, index, details_representation.IsDouble());
Type* field_type = Type::Tagged();
- if (field_representation.IsSmi()) {
+ MachineRepresentation field_representation =
+ MachineRepresentation::kTagged;
+ if (details_representation.IsSmi()) {
field_type = type_cache_.kSmi;
- } else if (field_representation.IsDouble()) {
+ field_representation = MachineRepresentation::kTaggedSigned;
+ } else if (details_representation.IsDouble()) {
field_type = type_cache_.kFloat64;
- } else if (field_representation.IsHeapObject()) {
+ field_representation = MachineRepresentation::kFloat64;
+ } else if (details_representation.IsHeapObject()) {
// Extract the field type from the property details (make sure its
// representation is TaggedPointer to reflect the heap object case).
- field_type = Type::Intersect(
- descriptors->GetFieldType(number)->Convert(zone()),
- Type::TaggedPointer(), zone());
+ field_representation = MachineRepresentation::kTaggedPointer;
+ field_type = descriptors->GetFieldType(number)->Convert(zone());
if (field_type->Is(Type::None())) {
// Store is not safe if the field type was cleared.
if (access_mode == AccessMode::kStore) return false;
@@ -305,17 +315,18 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
// about the contents now.
// TODO(bmeurer): It would be awesome to make this saner in the
// runtime/GC interaction.
- field_type = Type::TaggedPointer();
+ field_type = Type::Any();
} else if (!Type::Any()->Is(field_type)) {
// Add proper code dependencies in case of stable field map(s).
+ field_representation = MachineRepresentation::kTaggedPointer;
Handle<Map> field_owner_map(map->FindFieldOwner(number),
isolate());
dependencies()->AssumeFieldType(field_owner_map);
}
- DCHECK(field_type->Is(Type::TaggedPointer()));
}
*access_info = PropertyAccessInfo::DataField(
- MapList{receiver_map}, field_index, field_type, holder);
+ MapList{receiver_map}, field_index, field_representation,
+ field_type, holder);
return true;
}
case ACCESSOR_CONSTANT: {
@@ -422,11 +433,13 @@ bool AccessInfoFactory::LookupSpecialFieldAccessor(
if (Accessors::IsJSObjectFieldAccessor(map, name, &offset)) {
FieldIndex field_index = FieldIndex::ForInObjectOffset(offset);
Type* field_type = Type::Tagged();
+ MachineRepresentation field_representation = MachineRepresentation::kTagged;
if (map->IsStringMap()) {
DCHECK(Name::Equals(factory()->length_string(), name));
// The String::length property is always a smi in the range
// [0, String::kMaxLength].
field_type = type_cache_.kStringLengthType;
+ field_representation = MachineRepresentation::kTaggedSigned;
} else if (map->IsJSArrayMap()) {
DCHECK(Name::Equals(factory()->length_string(), name));
// The JSArray::length property is a smi in the range
@@ -436,14 +449,16 @@ bool AccessInfoFactory::LookupSpecialFieldAccessor(
// case of other arrays.
if (IsFastDoubleElementsKind(map->elements_kind())) {
field_type = type_cache_.kFixedDoubleArrayLengthType;
+ field_representation = MachineRepresentation::kTaggedSigned;
} else if (IsFastElementsKind(map->elements_kind())) {
field_type = type_cache_.kFixedArrayLengthType;
+ field_representation = MachineRepresentation::kTaggedSigned;
} else {
field_type = type_cache_.kJSArrayLengthType;
}
}
- *access_info =
- PropertyAccessInfo::DataField(MapList{map}, field_index, field_type);
+ *access_info = PropertyAccessInfo::DataField(
+ MapList{map}, field_index, field_representation, field_type);
return true;
}
return false;
@@ -466,21 +481,24 @@ bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name,
// TODO(bmeurer): Handle transition to data constant?
if (details.type() != DATA) return false;
int const index = details.field_index();
- Representation field_representation = details.representation();
+ Representation details_representation = details.representation();
FieldIndex field_index = FieldIndex::ForPropertyIndex(
- *transition_map, index, field_representation.IsDouble());
+ *transition_map, index, details_representation.IsDouble());
Type* field_type = Type::Tagged();
- if (field_representation.IsSmi()) {
+ MachineRepresentation field_representation = MachineRepresentation::kTagged;
+ if (details_representation.IsSmi()) {
field_type = type_cache_.kSmi;
- } else if (field_representation.IsDouble()) {
+ field_representation = MachineRepresentation::kTaggedSigned;
+ } else if (details_representation.IsDouble()) {
field_type = type_cache_.kFloat64;
- } else if (field_representation.IsHeapObject()) {
+ field_representation = MachineRepresentation::kFloat64;
+ } else if (details_representation.IsHeapObject()) {
// Extract the field type from the property details (make sure its
// representation is TaggedPointer to reflect the heap object case).
- field_type = Type::Intersect(
+ field_representation = MachineRepresentation::kTaggedPointer;
+ field_type =
transition_map->instance_descriptors()->GetFieldType(number)->Convert(
- zone()),
- Type::TaggedPointer(), zone());
+ zone());
if (field_type->Is(Type::None())) {
// Store is not safe if the field type was cleared.
return false;
@@ -490,11 +508,11 @@ bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name,
isolate());
dependencies()->AssumeFieldType(field_owner_map);
}
- DCHECK(field_type->Is(Type::TaggedPointer()));
}
dependencies()->AssumeMapNotDeprecated(transition_map);
*access_info = PropertyAccessInfo::DataField(
- MapList{map}, field_index, field_type, holder, transition_map);
+ MapList{map}, field_index, field_representation, field_type, holder,
+ transition_map);
return true;
}
return false;
« no previous file with comments | « src/compiler/access-info.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698