Reviewers: Toon Verwaest,
Message:
PTAL.
Description:
Add LoadIC_Slow builtin and use it for loading properties from primitive
values.
This fixes recent performance regressions on Dromaeo.
BUG=chromium:242512
Please review this at https://codereview.chromium.org/16226024/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/arm/ic-arm.cc
M src/builtins.h
M src/builtins.cc
M src/ia32/ic-ia32.cc
M src/ic.h
M src/ic.cc
M src/x64/ic-x64.cc
Index: src/arm/ic-arm.cc
diff --git a/src/arm/ic-arm.cc b/src/arm/ic-arm.cc
index
14c4794f4f0e61311cc0e36e4e86897634fccfc5..29ebd9775772de0623609ee6e3ff086b613b3df8
100644
--- a/src/arm/ic-arm.cc
+++ b/src/arm/ic-arm.cc
@@ -646,9 +646,6 @@ void KeyedCallIC::GenerateNormal(MacroAssembler* masm,
int argc) {
}
-// Defined in ic.cc.
-Object* LoadIC_Miss(Arguments args);
-
void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r2 : name
@@ -711,6 +708,21 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
}
+void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
+ // ---------- S t a t e --------------
+ // -- r2 : name
+ // -- lr : return address
+ // -- r0 : receiver
+ // -- sp[0] : receiver
+ // -----------------------------------
+
+ __ mov(r3, r0);
+ __ Push(r3, r2);
+
+ __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
+}
+
+
static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm,
Register object,
Register key,
@@ -878,9 +890,6 @@ void
KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm,
}
-Object* KeyedLoadIC_Miss(Arguments args);
-
-
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode)
{
// ---------- S t a t e --------------
// -- lr : return address
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index
37ba1e5301a9e17a9e5f4f026e0ad902bb03fd9d..3c6122ac6ed40a9d0603e2fdcd8a9882033dbb74
100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -1466,6 +1466,11 @@ static void
Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) {
}
+static void Generate_LoadIC_Slow(MacroAssembler* masm) {
+ LoadIC::GenerateRuntimeGetProperty(masm);
+}
+
+
static void Generate_KeyedLoadIC_Initialize(MacroAssembler* masm) {
KeyedLoadIC::GenerateInitialize(masm);
}
Index: src/builtins.h
diff --git a/src/builtins.h b/src/builtins.h
index
58d1a8b147963ca79ff86a87059f332d049e80dc..c45fbfd335da1a2a6c80f2c2568db44f9c079106
100644
--- a/src/builtins.h
+++ b/src/builtins.h
@@ -144,6 +144,8 @@ enum BuiltinExtraArguments {
Code::kNoExtraICState) \
V(LoadIC_Getter_ForDeopt, LOAD_IC, MONOMORPHIC, \
Code::kNoExtraICState) \
+ V(LoadIC_Slow, LOAD_IC, GENERIC, \
+ Code::kNoExtraICState) \
\
V(KeyedLoadIC_Initialize, KEYED_LOAD_IC, UNINITIALIZED, \
Code::kNoExtraICState) \
Index: src/ia32/ic-ia32.cc
diff --git a/src/ia32/ic-ia32.cc b/src/ia32/ic-ia32.cc
index
5f32910c44e68041dd044fc6c2d1ef3f89f9656c..0c3bbb1831a1e786d076cb66336482d28ecd0665
100644
--- a/src/ia32/ic-ia32.cc
+++ b/src/ia32/ic-ia32.cc
@@ -1354,6 +1354,23 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
}
+void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- ecx : key
+ // -- edx : receiver
+ // -- esp[0] : return address
+ // -----------------------------------
+
+ __ pop(ebx);
+ __ push(edx); // receiver
+ __ push(ecx); // name
+ __ push(ebx); // return address
+
+ // Perform tail call to the entry.
+ __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
+}
+
+
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode)
{
// ----------- S t a t e -------------
// -- ecx : key
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index
148e06976f6ad6387f76ebf7a10eb9946337ea66..ef8ab8a309eb3a4e5bb067f3cf2419b3629f05c4
100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -937,7 +937,13 @@ MaybeObject* LoadIC::Load(State state,
// Update inline cache and stub cache.
if (FLAG_use_ic) {
- UpdateCaches(&lookup, state, object, name);
+ if (!object->IsJSObject()) {
+ // TODO(jkummerow): It would be nice to support non-JSObjects in
+ // UpdateCaches, then we wouldn't need to go generic here.
+ set_target(*generic_stub());
+ } else {
+ UpdateCaches(&lookup, state, object, name);
+ }
}
PropertyAttributes attr;
Index: src/ic.h
diff --git a/src/ic.h b/src/ic.h
index
4715f0e2f987c307b67789163a72b7ea8b6c45f1..dadb743337f52afef1193523a6b24fd1ae2b91cd
100644
--- a/src/ic.h
+++ b/src/ic.h
@@ -369,6 +369,7 @@ class LoadIC: public IC {
static void GenerateMiss(MacroAssembler* masm);
static void GenerateMegamorphic(MacroAssembler* masm);
static void GenerateNormal(MacroAssembler* masm);
+ static void GenerateRuntimeGetProperty(MacroAssembler* masm);
MUST_USE_RESULT MaybeObject* Load(State state,
Handle<Object> object,
@@ -378,8 +379,7 @@ class LoadIC: public IC {
virtual Code::Kind kind() const { return Code::LOAD_IC; }
virtual Handle<Code> generic_stub() const {
- UNREACHABLE();
- return Handle<Code>::null();
+ return isolate()->builtins()->LoadIC_Slow();
}
virtual Handle<Code> megamorphic_stub() {
Index: src/x64/ic-x64.cc
diff --git a/src/x64/ic-x64.cc b/src/x64/ic-x64.cc
index
6425f894164db5d2c27faf4341bbef67719dbcc7..0bf650e77c9f22a02a632f9ca1bd2e122a9d9f8b
100644
--- a/src/x64/ic-x64.cc
+++ b/src/x64/ic-x64.cc
@@ -1380,6 +1380,23 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
}
+void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- rax : receiver
+ // -- rcx : name
+ // -- rsp[0] : return address
+ // -----------------------------------
+
+ __ pop(rbx);
+ __ push(rax); // receiver
+ __ push(rcx); // name
+ __ push(rbx); // return address
+
+ // Perform tail call to the entry.
+ __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
+}
+
+
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode)
{
// ----------- S t a t e -------------
// -- rax : key
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.