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,
HObjectAccess HObjectAccess::ForField(Handle<Map> map, int index,
Representation representation,
Handle<String> name) {
Handle<Name> name) {
if (index < 0) {
// Negative property indices are in-object properties, indexed
// from the end of the fixed part of the object.
......
......@@ -5912,9 +5912,7 @@ class HObjectAccess final {
return Representation::FromKind(RepresentationField::decode(value_));
}
inline Handle<String> name() const {
return name_;
}
inline Handle<Name> 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<String>::null(), false, false);
Handle<Name>::null(), false, false);
}
static HObjectAccess ForFixedArrayLength() {
......@@ -6140,12 +6138,12 @@ class HObjectAccess final {
static HObjectAccess ForCounter() {
return HObjectAccess(kExternalMemory, 0, Representation::Integer32(),
Handle<String>::null(), false, false);
Handle<Name>::null(), false, false);
}
static HObjectAccess ForExternalUInteger8() {
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.
......@@ -6181,7 +6179,7 @@ class HObjectAccess final {
// Create an access to a resolved field (in-object or backing store).
static HObjectAccess ForField(Handle<Map> map, int index,
Representation representation,
Handle<String> name);
Handle<Name> name);
static HObjectAccess ForJSTypedArrayLength() {
return HObjectAccess::ForObservableJSObjectOffset(
......@@ -6296,9 +6294,8 @@ class HObjectAccess final {
HObjectAccess(Portion portion, int offset,
Representation representation = Representation::Tagged(),
Handle<String> name = Handle<String>::null(),
bool immutable = false,
bool existing_inobject_property = true)
Handle<Name> name = Handle<Name>::null(),
bool immutable = false, bool existing_inobject_property = true)
: value_(PortionField::encode(portion) |
RepresentationField::encode(representation.kind()) |
ImmutableField::encode(immutable ? 1 : 0) |
......@@ -6322,7 +6319,7 @@ class HObjectAccess final {
class OffsetField : public BitField<int, 9, 23> {};
uint32_t value_; // encodes portion, representation, immutable, and offset
Handle<String> name_;
Handle<Name> name_;
friend class HLoadNamedField;
friend class HStoreNamedField;
......
......@@ -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_));
}
......
......@@ -2543,7 +2543,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
public:
PropertyAccessInfo(HOptimizedGraphBuilder* builder,
PropertyAccessType access_type, Handle<Map> map,
Handle<String> name)
Handle<Name> name)
: builder_(builder),
access_type_(access_type),
map_(map),
......@@ -2569,7 +2569,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
bool NeedsWrappingFor(Handle<JSFunction> target) const;
Handle<Map> map();
Handle<String> name() const { return name_; }
Handle<Name> 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> map_;
Handle<String> name_;
Handle<Name> name_;
Handle<JSObject> holder_;
Handle<JSFunction> accessor_;
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