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

Unified Diff: src/code-stub-assembler.cc

Issue 2842373005: [ic] Handle JSArray::length in CodeStubAssembler::CallGetterIfAccessor. (Closed)
Patch Set: Created 3 years, 8 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/code-stub-assembler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index ca2dce3c196be6fa84fa45bf5245788e15da28a4..ed07be577029c919d2f5359a3a119a5423c12e6b 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -3179,6 +3179,10 @@ Node* CodeStubAssembler::IsPropertyCell(Node* object) {
return IsPropertyCellMap(LoadMap(object));
}
+Node* CodeStubAssembler::IsAccessorInfo(Node* object) {
+ return IsAccessorInfoMap(LoadMap(object));
+}
+
Node* CodeStubAssembler::IsAccessorPair(Node* object) {
return IsAccessorPairMap(LoadMap(object));
}
@@ -5337,18 +5341,17 @@ Node* CodeStubAssembler::CallGetterIfAccessor(Node* value, Node* details,
Node* context, Node* receiver,
Label* if_bailout) {
VARIABLE(var_value, MachineRepresentation::kTagged, value);
- Label done(this);
+ Label done(this), if_accessor_info(this, Label::kDeferred);
Node* kind = DecodeWord32<PropertyDetails::KindField>(details);
GotoIf(Word32Equal(kind, Int32Constant(kData)), &done);
// Accessor case.
+ GotoIfNot(IsAccessorPair(value), &if_accessor_info);
+
+ // AccessorPair case.
{
Node* accessor_pair = value;
- GotoIf(Word32Equal(LoadInstanceType(accessor_pair),
- Int32Constant(ACCESSOR_INFO_TYPE)),
- if_bailout);
- CSA_ASSERT(this, IsAccessorPair(accessor_pair));
Node* getter = LoadObjectField(accessor_pair, AccessorPair::kGetterOffset);
Node* getter_map = LoadMap(getter);
Node* instance_type = LoadMapInstanceType(getter_map);
@@ -5368,6 +5371,21 @@ Node* CodeStubAssembler::CallGetterIfAccessor(Node* value, Node* details,
Goto(&done);
}
+ // AccessorInfo case.
+ BIND(&if_accessor_info);
+ {
+ // TODO(ishell): Consider doing this for the Function.prototype and the
+ // String.length accessor infos as well.
+ CSA_ASSERT(this, IsAccessorInfo(value));
+ CSA_ASSERT(this, TaggedIsNotSmi(receiver));
+ GotoIfNot(IsJSArray(receiver), if_bailout);
+ // The only AccessorInfo on JSArray is the "length" property.
+ CSA_ASSERT(this, IsLengthString(
+ LoadObjectField(value, AccessorInfo::kNameOffset)));
+ var_value.Bind(LoadJSArrayLength(receiver));
+ Goto(&done);
+ }
+
BIND(&done);
return var_value.value();
}
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698