From 704e3d809b071ad3a4a5331a01768a004069a429 Mon Sep 17 00:00:00 2001 From: bmeurer Date: Mon, 21 Sep 2015 05:58:00 -0700 Subject: [PATCH] [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} --- src/hydrogen-instructions.cc | 2 +- src/hydrogen-instructions.h | 33 +++++++++++++++------------------ src/hydrogen.cc | 4 ++-- src/hydrogen.h | 10 +++++----- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index f65b0c2..1d9d3ac 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -4589,7 +4589,7 @@ HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, HObjectAccess HObjectAccess::ForField(Handle map, int index, Representation representation, - Handle name) { + Handle name) { if (index < 0) { // Negative property indices are in-object properties, indexed // from the end of the fixed part of the object. diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index f39cbf7..a59cd2f 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -5912,9 +5912,7 @@ class HObjectAccess final { return Representation::FromKind(RepresentationField::decode(value_)); } - inline Handle name() const { - return name_; - } + inline Handle name() const { return name_; } inline bool immutable() const { return ImmutableField::decode(value_); @@ -5977,7 +5975,7 @@ class HObjectAccess final { static HObjectAccess ForAllocationSiteList() { return HObjectAccess(kExternalMemory, 0, Representation::Tagged(), - Handle::null(), false, false); + Handle::null(), false, false); } static HObjectAccess ForFixedArrayLength() { @@ -6140,12 +6138,12 @@ class HObjectAccess final { static HObjectAccess ForCounter() { return HObjectAccess(kExternalMemory, 0, Representation::Integer32(), - Handle::null(), false, false); + Handle::null(), false, false); } static HObjectAccess ForExternalUInteger8() { return HObjectAccess(kExternalMemory, 0, Representation::UInteger8(), - Handle::null(), false, false); + Handle::null(), false, false); } // Create an access to an offset in a fixed array header. @@ -6181,7 +6179,7 @@ class HObjectAccess final { // Create an access to a resolved field (in-object or backing store). static HObjectAccess ForField(Handle map, int index, Representation representation, - Handle name); + Handle name); static HObjectAccess ForJSTypedArrayLength() { return HObjectAccess::ForObservableJSObjectOffset( @@ -6296,16 +6294,15 @@ class HObjectAccess final { HObjectAccess(Portion portion, int offset, Representation representation = Representation::Tagged(), - Handle name = Handle::null(), - bool immutable = false, - bool existing_inobject_property = true) - : value_(PortionField::encode(portion) | - RepresentationField::encode(representation.kind()) | - ImmutableField::encode(immutable ? 1 : 0) | - ExistingInobjectPropertyField::encode( - existing_inobject_property ? 1 : 0) | - OffsetField::encode(offset)), - name_(name) { + Handle name = Handle::null(), + bool immutable = false, bool existing_inobject_property = true) + : value_(PortionField::encode(portion) | + RepresentationField::encode(representation.kind()) | + ImmutableField::encode(immutable ? 1 : 0) | + ExistingInobjectPropertyField::encode( + existing_inobject_property ? 1 : 0) | + OffsetField::encode(offset)), + name_(name) { // assert that the fields decode correctly DCHECK(this->offset() == offset); DCHECK(this->portion() == portion); @@ -6322,7 +6319,7 @@ class HObjectAccess final { class OffsetField : public BitField {}; uint32_t value_; // encodes portion, representation, immutable, and offset - Handle name_; + Handle name_; friend class HLoadNamedField; friend class HStoreNamedField; diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 31c42c7..5ea5776 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -6409,8 +6409,8 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::LookupInPrototypes() { bool HOptimizedGraphBuilder::PropertyAccessInfo::IsIntegerIndexedExotic() { InstanceType instance_type = map_->instance_type(); - return instance_type == JS_TYPED_ARRAY_TYPE && - IsSpecialIndex(isolate()->unicode_cache(), *name_); + return instance_type == JS_TYPED_ARRAY_TYPE && name_->IsString() && + IsSpecialIndex(isolate()->unicode_cache(), String::cast(*name_)); } diff --git a/src/hydrogen.h b/src/hydrogen.h index 272bc5a..0b9ef42 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -2543,7 +2543,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { public: PropertyAccessInfo(HOptimizedGraphBuilder* builder, PropertyAccessType access_type, Handle map, - Handle name) + Handle name) : builder_(builder), access_type_(access_type), map_(map), @@ -2569,7 +2569,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { bool NeedsWrappingFor(Handle target) const; Handle map(); - Handle name() const { return name_; } + Handle name() const { return name_; } bool IsJSObjectFieldAccessor() { int offset; // unused @@ -2580,10 +2580,10 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { int offset; if (Accessors::IsJSObjectFieldAccessor(map_, name_, &offset)) { if (IsStringType()) { - DCHECK(String::Equals(isolate()->factory()->length_string(), name_)); + DCHECK(Name::Equals(isolate()->factory()->length_string(), name_)); *access = HObjectAccess::ForStringLength(); } 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()); } else { *access = HObjectAccess::ForMapAndOffset(map_, offset); @@ -2716,7 +2716,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { HOptimizedGraphBuilder* builder_; PropertyAccessType access_type_; Handle map_; - Handle name_; + Handle name_; Handle holder_; Handle accessor_; Handle api_holder_; -- 2.7.4