Commit 704e3d80 authored by bmeurer's avatar bmeurer Committed by Commit bot

[crankshaft] Generalize PropertyAccessInfo to Name (so it can deal with symbols).

This doesn't fix the performance regression mentioned by the bug yet,
but is necessary cleanup to land the fix, and should be separated from
the actual fix.

R=jkummerow@chromium.org
BUG=chromium:534200
LOG=n

Review URL: https://codereview.chromium.org/1345313005

Cr-Commit-Position: refs/heads/master@{#30847}
parent 41111e3d
...@@ -4589,7 +4589,7 @@ HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, ...@@ -4589,7 +4589,7 @@ HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset,
HObjectAccess HObjectAccess::ForField(Handle<Map> map, int index, HObjectAccess HObjectAccess::ForField(Handle<Map> map, int index,
Representation representation, Representation representation,
Handle<String> name) { Handle<Name> name) {
if (index < 0) { if (index < 0) {
// Negative property indices are in-object properties, indexed // Negative property indices are in-object properties, indexed
// from the end of the fixed part of the object. // from the end of the fixed part of the object.
......
...@@ -5912,9 +5912,7 @@ class HObjectAccess final { ...@@ -5912,9 +5912,7 @@ class HObjectAccess final {
return Representation::FromKind(RepresentationField::decode(value_)); return Representation::FromKind(RepresentationField::decode(value_));
} }
inline Handle<String> name() const { inline Handle<Name> name() const { return name_; }
return name_;
}
inline bool immutable() const { inline bool immutable() const {
return ImmutableField::decode(value_); return ImmutableField::decode(value_);
...@@ -5977,7 +5975,7 @@ class HObjectAccess final { ...@@ -5977,7 +5975,7 @@ class HObjectAccess final {
static HObjectAccess ForAllocationSiteList() { static HObjectAccess ForAllocationSiteList() {
return HObjectAccess(kExternalMemory, 0, Representation::Tagged(), return HObjectAccess(kExternalMemory, 0, Representation::Tagged(),
Handle<String>::null(), false, false); Handle<Name>::null(), false, false);
} }
static HObjectAccess ForFixedArrayLength() { static HObjectAccess ForFixedArrayLength() {
...@@ -6140,12 +6138,12 @@ class HObjectAccess final { ...@@ -6140,12 +6138,12 @@ class HObjectAccess final {
static HObjectAccess ForCounter() { static HObjectAccess ForCounter() {
return HObjectAccess(kExternalMemory, 0, Representation::Integer32(), return HObjectAccess(kExternalMemory, 0, Representation::Integer32(),
Handle<String>::null(), false, false); Handle<Name>::null(), false, false);
} }
static HObjectAccess ForExternalUInteger8() { static HObjectAccess ForExternalUInteger8() {
return HObjectAccess(kExternalMemory, 0, Representation::UInteger8(), return HObjectAccess(kExternalMemory, 0, Representation::UInteger8(),
Handle<String>::null(), false, false); Handle<Name>::null(), false, false);
} }
// Create an access to an offset in a fixed array header. // Create an access to an offset in a fixed array header.
...@@ -6181,7 +6179,7 @@ class HObjectAccess final { ...@@ -6181,7 +6179,7 @@ class HObjectAccess final {
// Create an access to a resolved field (in-object or backing store). // Create an access to a resolved field (in-object or backing store).
static HObjectAccess ForField(Handle<Map> map, int index, static HObjectAccess ForField(Handle<Map> map, int index,
Representation representation, Representation representation,
Handle<String> name); Handle<Name> name);
static HObjectAccess ForJSTypedArrayLength() { static HObjectAccess ForJSTypedArrayLength() {
return HObjectAccess::ForObservableJSObjectOffset( return HObjectAccess::ForObservableJSObjectOffset(
...@@ -6296,16 +6294,15 @@ class HObjectAccess final { ...@@ -6296,16 +6294,15 @@ class HObjectAccess final {
HObjectAccess(Portion portion, int offset, HObjectAccess(Portion portion, int offset,
Representation representation = Representation::Tagged(), Representation representation = Representation::Tagged(),
Handle<String> name = Handle<String>::null(), Handle<Name> name = Handle<Name>::null(),
bool immutable = false, bool immutable = false, bool existing_inobject_property = true)
bool existing_inobject_property = true) : value_(PortionField::encode(portion) |
: value_(PortionField::encode(portion) | RepresentationField::encode(representation.kind()) |
RepresentationField::encode(representation.kind()) | ImmutableField::encode(immutable ? 1 : 0) |
ImmutableField::encode(immutable ? 1 : 0) | ExistingInobjectPropertyField::encode(
ExistingInobjectPropertyField::encode( existing_inobject_property ? 1 : 0) |
existing_inobject_property ? 1 : 0) | OffsetField::encode(offset)),
OffsetField::encode(offset)), name_(name) {
name_(name) {
// assert that the fields decode correctly // assert that the fields decode correctly
DCHECK(this->offset() == offset); DCHECK(this->offset() == offset);
DCHECK(this->portion() == portion); DCHECK(this->portion() == portion);
...@@ -6322,7 +6319,7 @@ class HObjectAccess final { ...@@ -6322,7 +6319,7 @@ class HObjectAccess final {
class OffsetField : public BitField<int, 9, 23> {}; class OffsetField : public BitField<int, 9, 23> {};
uint32_t value_; // encodes portion, representation, immutable, and offset uint32_t value_; // encodes portion, representation, immutable, and offset
Handle<String> name_; Handle<Name> name_;
friend class HLoadNamedField; friend class HLoadNamedField;
friend class HStoreNamedField; friend class HStoreNamedField;
......
...@@ -6409,8 +6409,8 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupInPrototypes() { ...@@ -6409,8 +6409,8 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupInPrototypes() {
bool HOptimizedGraphBuilder::PropertyAccessInfo::IsIntegerIndexedExotic() { bool HOptimizedGraphBuilder::PropertyAccessInfo::IsIntegerIndexedExotic() {
InstanceType instance_type = map_->instance_type(); InstanceType instance_type = map_->instance_type();
return instance_type == JS_TYPED_ARRAY_TYPE && return instance_type == JS_TYPED_ARRAY_TYPE && name_->IsString() &&
IsSpecialIndex(isolate()->unicode_cache(), *name_); IsSpecialIndex(isolate()->unicode_cache(), String::cast(*name_));
} }
......
...@@ -2543,7 +2543,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2543,7 +2543,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
public: public:
PropertyAccessInfo(HOptimizedGraphBuilder* builder, PropertyAccessInfo(HOptimizedGraphBuilder* builder,
PropertyAccessType access_type, Handle<Map> map, PropertyAccessType access_type, Handle<Map> map,
Handle<String> name) Handle<Name> name)
: builder_(builder), : builder_(builder),
access_type_(access_type), access_type_(access_type),
map_(map), map_(map),
...@@ -2569,7 +2569,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2569,7 +2569,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
bool NeedsWrappingFor(Handle<JSFunction> target) const; bool NeedsWrappingFor(Handle<JSFunction> target) const;
Handle<Map> map(); Handle<Map> map();
Handle<String> name() const { return name_; } Handle<Name> name() const { return name_; }
bool IsJSObjectFieldAccessor() { bool IsJSObjectFieldAccessor() {
int offset; // unused int offset; // unused
...@@ -2580,10 +2580,10 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2580,10 +2580,10 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
int offset; int offset;
if (Accessors::IsJSObjectFieldAccessor(map_, name_, &offset)) { if (Accessors::IsJSObjectFieldAccessor(map_, name_, &offset)) {
if (IsStringType()) { if (IsStringType()) {
DCHECK(String::Equals(isolate()->factory()->length_string(), name_)); DCHECK(Name::Equals(isolate()->factory()->length_string(), name_));
*access = HObjectAccess::ForStringLength(); *access = HObjectAccess::ForStringLength();
} else if (IsArrayType()) { } else if (IsArrayType()) {
DCHECK(String::Equals(isolate()->factory()->length_string(), name_)); DCHECK(Name::Equals(isolate()->factory()->length_string(), name_));
*access = HObjectAccess::ForArrayLength(map_->elements_kind()); *access = HObjectAccess::ForArrayLength(map_->elements_kind());
} else { } else {
*access = HObjectAccess::ForMapAndOffset(map_, offset); *access = HObjectAccess::ForMapAndOffset(map_, offset);
...@@ -2716,7 +2716,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2716,7 +2716,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
HOptimizedGraphBuilder* builder_; HOptimizedGraphBuilder* builder_;
PropertyAccessType access_type_; PropertyAccessType access_type_;
Handle<Map> map_; Handle<Map> map_;
Handle<String> name_; Handle<Name> name_;
Handle<JSObject> holder_; Handle<JSObject> holder_;
Handle<JSFunction> accessor_; Handle<JSFunction> accessor_;
Handle<JSObject> api_holder_; Handle<JSObject> api_holder_;
......
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