Revision: 3817
Author: [email protected]
Date: Mon Feb 8 08:08:26 2010
Log: Eliminate *IC::Generate() function on all platforms.
Review URL: http://codereview.chromium.org/583008
http://code.google.com/p/v8/source/detail?r=3817
Modified:
/branches/bleeding_edge/src/arm/ic-arm.cc
/branches/bleeding_edge/src/ia32/ic-ia32.cc
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/src/ic.h
/branches/bleeding_edge/src/x64/ic-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/ic-arm.cc Mon Feb 1 03:07:41 2010
+++ /branches/bleeding_edge/src/arm/ic-arm.cc Mon Feb 8 08:08:26 2010
@@ -438,7 +438,7 @@
StubCache::GenerateProbe(masm, flags, r0, r2, r3, no_reg);
// Cache miss: Jump to runtime.
- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
+ GenerateMiss(masm);
}
@@ -482,16 +482,11 @@
// Cache miss: Restore receiver from stack and jump to runtime.
__ bind(&miss);
- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
+ GenerateMiss(masm);
}
void LoadIC::GenerateMiss(MacroAssembler* masm) {
- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
-}
-
-
-void LoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) {
// ----------- S t a t e -------------
// -- r2 : name
// -- lr : return address
@@ -502,7 +497,7 @@
__ stm(db_w, sp, r2.bit() | r3.bit());
// Perform tail call to the entry.
- __ TailCallRuntime(f, 2, 1);
+ __ TailCallRuntime(ExternalReference(IC_Utility(kLoadIC_Miss)), 2, 1);
}
@@ -530,11 +525,20 @@
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
- Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss)));
+ // ---------- S t a t e --------------
+ // -- lr : return address
+ // -- sp[0] : key
+ // -- sp[4] : receiver
+ // -----------------------------------
+
+ __ ldm(ia, sp, r2.bit() | r3.bit());
+ __ stm(db_w, sp, r2.bit() | r3.bit());
+
+ __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedLoadIC_Miss)), 2,
1);
}
-void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference&
f) {
+void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// ---------- S t a t e --------------
// -- lr : return address
// -- sp[0] : key
@@ -544,7 +548,7 @@
__ ldm(ia, sp, r2.bit() | r3.bit());
__ stm(db_w, sp, r2.bit() | r3.bit());
- __ TailCallRuntime(f, 2, 1);
+ __ TailCallRuntime(ExternalReference(Runtime::kGetProperty), 2, 1);
}
@@ -597,10 +601,7 @@
// Slow case: Push extra copies of the arguments (2).
__ bind(&slow);
__ IncrementCounter(&Counters::keyed_load_generic_slow, 1, r0, r1);
- __ ldm(ia, sp, r0.bit() | r1.bit());
- __ stm(db_w, sp, r0.bit() | r1.bit());
- // Do tail-call to runtime routine.
- __ TailCallRuntime(ExternalReference(Runtime::kGetProperty), 2, 1);
+ GenerateRuntimeGetProperty(masm);
// Fast case: Do the load.
__ bind(&fast);
@@ -634,8 +635,7 @@
}
-void KeyedStoreIC::Generate(MacroAssembler* masm,
- const ExternalReference& f) {
+void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
// ---------- S t a t e --------------
// -- r0 : value
// -- lr : return address
@@ -646,7 +646,21 @@
__ ldm(ia, sp, r2.bit() | r3.bit());
__ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit());
- __ TailCallRuntime(f, 3, 1);
+ __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3,
1);
+}
+
+
+void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) {
+ // ---------- S t a t e --------------
+ // -- r0 : value
+ // -- lr : return address
+ // -- sp[0] : key
+ // -- sp[1] : receiver
+ // -----------------------------------
+ __ ldm(ia, sp, r1.bit() | r3.bit()); // r0 == value, r1 == key, r3 ==
object
+ __ stm(db_w, sp, r0.bit() | r1.bit() | r3.bit());
+
+ __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1);
}
@@ -701,12 +715,9 @@
__ b(lo, &fast);
- // Slow case: Push extra copies of the arguments (3).
+ // Slow case:
__ bind(&slow);
- __ ldm(ia, sp, r1.bit() | r3.bit()); // r0 == value, r1 == key, r3 ==
object
- __ stm(db_w, sp, r0.bit() | r1.bit() | r3.bit());
- // Do tail-call to runtime routine.
- __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1);
+ GenerateRuntimeSetProperty(masm);
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
=======================================
--- /branches/bleeding_edge/src/ia32/ic-ia32.cc Mon Feb 1 03:07:41 2010
+++ /branches/bleeding_edge/src/ia32/ic-ia32.cc Mon Feb 8 08:08:26 2010
@@ -295,7 +295,7 @@
// Slow case: Load name and receiver from stack and jump to runtime.
__ bind(&slow);
__ IncrementCounter(&Counters::keyed_load_generic_slow, 1);
- Generate(masm, ExternalReference(Runtime::kKeyedGetProperty));
+ GenerateRuntimeGetProperty(masm);
__ bind(&check_string);
// The key is not a smi.
@@ -586,7 +586,7 @@
// Slow case: Load name and receiver from stack and jump to runtime.
__ bind(&slow);
__ IncrementCounter(&Counters::keyed_load_external_array_slow, 1);
- Generate(masm, ExternalReference(Runtime::kKeyedGetProperty));
+ GenerateRuntimeGetProperty(masm);
}
@@ -645,7 +645,7 @@
// Slow case: call runtime.
__ bind(&slow);
- Generate(masm, ExternalReference(Runtime::kSetProperty));
+ GenerateRuntimeSetProperty(masm);
// Check whether the elements is a pixel array.
// eax: value
@@ -918,7 +918,7 @@
// Slow case: call runtime.
__ bind(&slow);
- Generate(masm, ExternalReference(Runtime::kSetProperty));
+ GenerateRuntimeSetProperty(masm);
}
@@ -1164,7 +1164,7 @@
StubCache::GenerateProbe(masm, flags, eax, ecx, ebx, edx);
// Cache miss: Jump to runtime.
- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
+ GenerateMiss(masm);
}
@@ -1214,7 +1214,7 @@
// Cache miss: Restore receiver from stack and jump to runtime.
__ bind(&miss);
__ mov(eax, Operand(esp, 1 * kPointerSize));
- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
+ GenerateMiss(masm);
}
@@ -1225,25 +1225,13 @@
// -- esp[4] : receiver
// -----------------------------------
- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
-}
-
-
-void LoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) {
- // ----------- S t a t e -------------
- // -- ecx : name
- // -- esp[0] : return address
- // -- esp[4] : receiver
- // -----------------------------------
-
- __ mov(eax, Operand(esp, kPointerSize));
__ pop(ebx);
- __ push(eax); // receiver
+ __ push(Operand(esp, 0)); // receiver
__ push(ecx); // name
__ push(ebx); // return address
// Perform tail call to the entry.
- __ TailCallRuntime(f, 2, 1);
+ __ TailCallRuntime(ExternalReference(IC_Utility(kLoadIC_Miss)), 2, 1);
}
@@ -1352,26 +1340,30 @@
// -- esp[8] : receiver
// -----------------------------------
- Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss)));
+ __ pop(ebx);
+ __ push(Operand(esp, kPointerSize)); // receiver
+ __ push(Operand(esp, kPointerSize)); // name
+ __ push(ebx); // return address
+
+ // Perform tail call to the entry.
+ __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedLoadIC_Miss)), 2,
1);
}
-void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference&
f) {
+void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- esp[0] : return address
// -- esp[4] : name
// -- esp[8] : receiver
// -----------------------------------
- __ mov(eax, Operand(esp, kPointerSize));
- __ mov(ecx, Operand(esp, 2 * kPointerSize));
__ pop(ebx);
- __ push(ecx); // receiver
- __ push(eax); // name
+ __ push(Operand(esp, 1 * kPointerSize)); // receiver
+ __ push(Operand(esp, 1 * kPointerSize)); // name
__ push(ebx); // return address
// Perform tail call to the entry.
- __ TailCallRuntime(f, 2, 1);
+ __ TailCallRuntime(ExternalReference(Runtime::kKeyedGetProperty), 2, 1);
}
@@ -1435,7 +1427,7 @@
// Defined in ic.cc.
Object* KeyedStoreIC_Miss(Arguments args);
-void KeyedStoreIC::Generate(MacroAssembler* masm, const ExternalReference&
f) {
+void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax : value
// -- esp[0] : return address
@@ -1450,7 +1442,26 @@
__ push(ecx);
// Do tail-call to runtime routine.
- __ TailCallRuntime(f, 3, 1);
+ __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1);
+}
+
+
+void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- eax : value
+ // -- esp[0] : return address
+ // -- esp[4] : key
+ // -- esp[8] : receiver
+ // -----------------------------------
+
+ __ pop(ecx);
+ __ push(Operand(esp, 1 * kPointerSize));
+ __ push(Operand(esp, 1 * kPointerSize));
+ __ push(eax);
+ __ push(ecx);
+
+ // Do tail-call to runtime routine.
+ __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3,
1);
}
=======================================
--- /branches/bleeding_edge/src/ic.cc Mon Feb 1 03:07:41 2010
+++ /branches/bleeding_edge/src/ic.cc Mon Feb 8 08:08:26 2010
@@ -1318,16 +1318,6 @@
IC::State state = IC::StateFrom(ic.target(), args[0]);
return ic.Load(state, args.at<Object>(0), args.at<String>(1));
}
-
-
-void LoadIC::GenerateInitialize(MacroAssembler* masm) {
- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
-}
-
-
-void LoadIC::GeneratePreMonomorphic(MacroAssembler* masm) {
- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
-}
// Used from ic_<arch>.cc
@@ -1338,16 +1328,6 @@
IC::State state = IC::StateFrom(ic.target(), args[0]);
return ic.Load(state, args.at<Object>(0), args.at<Object>(1));
}
-
-
-void KeyedLoadIC::GenerateInitialize(MacroAssembler* masm) {
- Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss)));
-}
-
-
-void KeyedLoadIC::GeneratePreMonomorphic(MacroAssembler* masm) {
- Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss)));
-}
// Used from ic_<arch>.cc.
@@ -1404,16 +1384,6 @@
return ic.Store(state, args.at<Object>(0), args.at<Object>(1),
args.at<Object>(2));
}
-
-
-void KeyedStoreIC::GenerateInitialize(MacroAssembler* masm) {
- Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss)));
-}
-
-
-void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
- Generate(masm, ExternalReference(IC_Utility(kKeyedStoreIC_Miss)));
-}
static Address IC_utilities[] = {
=======================================
--- /branches/bleeding_edge/src/ic.h Mon Feb 1 03:07:41 2010
+++ /branches/bleeding_edge/src/ic.h Mon Feb 8 08:08:26 2010
@@ -223,8 +223,10 @@
Object* Load(State state, Handle<Object> object, Handle<String> name);
// Code generator routines.
- static void GenerateInitialize(MacroAssembler* masm);
- static void GeneratePreMonomorphic(MacroAssembler* masm);
+ static void GenerateInitialize(MacroAssembler* masm) {
GenerateMiss(masm); }
+ static void GeneratePreMonomorphic(MacroAssembler* masm) {
+ GenerateMiss(masm);
+ }
static void GenerateMiss(MacroAssembler* masm);
static void GenerateMegamorphic(MacroAssembler* masm);
static void GenerateNormal(MacroAssembler* masm);
@@ -240,8 +242,6 @@
static const int kOffsetToLoadInstruction;
private:
- static void Generate(MacroAssembler* masm, const ExternalReference& f);
-
// Update the inline cache and the global stub cache based on the
// lookup result.
void UpdateCaches(LookupResult* lookup,
@@ -279,8 +279,11 @@
// Code generator routines.
static void GenerateMiss(MacroAssembler* masm);
- static void GenerateInitialize(MacroAssembler* masm);
- static void GeneratePreMonomorphic(MacroAssembler* masm);
+ static void GenerateRuntimeGetProperty(MacroAssembler* masm);
+ static void GenerateInitialize(MacroAssembler* masm) {
GenerateMiss(masm); }
+ static void GeneratePreMonomorphic(MacroAssembler* masm) {
+ GenerateMiss(masm);
+ }
static void GenerateGeneric(MacroAssembler* masm);
static void GenerateString(MacroAssembler* masm);
@@ -302,8 +305,6 @@
static const int kSlowCaseBitFieldMask =
(1 << Map::kIsAccessCheckNeeded) | (1 <<
Map::kHasIndexedInterceptor);
- static void Generate(MacroAssembler* masm, const ExternalReference& f);
-
// Update the inline cache.
void UpdateCaches(LookupResult* lookup,
State state,
@@ -384,8 +385,9 @@
Handle<Object> value);
// Code generators for stub routines. Only called once at startup.
- static void GenerateInitialize(MacroAssembler* masm);
+ static void GenerateInitialize(MacroAssembler* masm) {
GenerateMiss(masm); }
static void GenerateMiss(MacroAssembler* masm);
+ static void GenerateRuntimeSetProperty(MacroAssembler* masm);
static void GenerateGeneric(MacroAssembler* masm);
static void GenerateExtendStorage(MacroAssembler* masm);
@@ -403,8 +405,6 @@
static void RestoreInlinedVersion(Address address);
private:
- static void Generate(MacroAssembler* masm, const ExternalReference& f);
-
// Update the inline cache.
void UpdateCaches(LookupResult* lookup,
State state,
=======================================
--- /branches/bleeding_edge/src/x64/ic-x64.cc Tue Feb 2 01:20:19 2010
+++ /branches/bleeding_edge/src/x64/ic-x64.cc Mon Feb 8 08:08:26 2010
@@ -228,23 +228,37 @@
}
-void KeyedLoadIC::Generate(MacroAssembler* masm,
- ExternalReference const& f) {
+void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- rsp[0] : return address
// -- rsp[8] : name
// -- rsp[16] : receiver
// -----------------------------------
- __ movq(rax, Operand(rsp, kPointerSize));
- __ movq(rcx, Operand(rsp, 2 * kPointerSize));
__ pop(rbx);
- __ push(rcx); // receiver
- __ push(rax); // name
+ __ push(Operand(rsp, 1 * kPointerSize)); // receiver
+ __ push(Operand(rsp, 1 * kPointerSize)); // name
__ push(rbx); // return address
// Perform tail call to the entry.
- __ TailCallRuntime(f, 2, 1);
+ __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedLoadIC_Miss)), 2,
1);
+}
+
+
+void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- rsp[0] : return address
+ // -- rsp[8] : name
+ // -- rsp[16] : receiver
+ // -----------------------------------
+
+ __ pop(rbx);
+ __ push(Operand(rsp, 1 * kPointerSize)); // receiver
+ __ push(Operand(rsp, 1 * kPointerSize)); // name
+ __ push(rbx); // return address
+
+ // Perform tail call to the entry.
+ __ TailCallRuntime(ExternalReference(Runtime::kKeyedGetProperty), 2, 1);
}
@@ -317,7 +331,7 @@
// Slow case: Load name and receiver from stack and jump to runtime.
__ bind(&slow);
__ IncrementCounter(&Counters::keyed_load_generic_slow, 1);
- Generate(masm, ExternalReference(Runtime::kKeyedGetProperty));
+ GenerateRuntimeGetProperty(masm);
__ bind(&check_string);
// The key is not a smi.
// Is it a string?
@@ -555,21 +569,30 @@
// Slow case: Load name and receiver from stack and jump to runtime.
__ bind(&slow);
__ IncrementCounter(&Counters::keyed_load_external_array_slow, 1);
- Generate(masm, ExternalReference(Runtime::kKeyedGetProperty));
+ GenerateRuntimeGetProperty(masm);
}
-void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
+void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
// ----------- S t a t e -------------
- // -- rsp[0] : return address
- // -- rsp[8] : name
+ // -- rax : value
+ // -- rsp[0] : return address
+ // -- rsp[8] : key
// -- rsp[16] : receiver
// -----------------------------------
- Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss)));
+
+ __ pop(rcx);
+ __ push(Operand(rsp, 1 * kPointerSize)); // receiver
+ __ push(Operand(rsp, 1 * kPointerSize)); // key
+ __ push(rax); // value
+ __ push(rcx); // return address
+
+ // Do tail-call to runtime routine.
+ __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3,
1);
}
-void KeyedStoreIC::Generate(MacroAssembler* masm, ExternalReference const&
f) {
+void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- rax : value
// -- rsp[0] : return address
@@ -584,7 +607,7 @@
__ push(rcx); // return address
// Do tail-call to runtime routine.
- __ TailCallRuntime(f, 3, 1);
+ __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1);
}
@@ -659,7 +682,7 @@
// Slow case: call runtime.
__ bind(&slow);
- Generate(masm, ExternalReference(Runtime::kSetProperty));
+ GenerateRuntimeSetProperty(masm);
// Check whether the elements is a pixel array.
// rax: value
@@ -923,7 +946,7 @@
// Slow case: call runtime.
__ bind(&slow);
- Generate(masm, ExternalReference(Runtime::kSetProperty));
+ GenerateRuntimeSetProperty(masm);
}
@@ -1153,22 +1176,20 @@
}
-void LoadIC::Generate(MacroAssembler* masm, ExternalReference const& f) {
+void LoadIC::GenerateMiss(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- rcx : name
// -- rsp[0] : return address
// -- rsp[8] : receiver
// -----------------------------------
- __ movq(rax, Operand(rsp, kPointerSize));
-
__ pop(rbx);
- __ push(rax); // receiver
+ __ push(Operand(rsp, 0)); // receiver
__ push(rcx); // name
__ push(rbx); // return address
// Perform tail call to the entry.
- __ TailCallRuntime(f, 2, 1);
+ __ TailCallRuntime(ExternalReference(IC_Utility(kLoadIC_Miss)), 2, 1);
}
@@ -1222,17 +1243,6 @@
// Cache miss: Jump to runtime.
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC);
}
-
-
-void LoadIC::GenerateMiss(MacroAssembler* masm) {
- // ----------- S t a t e -------------
- // -- rcx : name
- // -- rsp[0] : return address
- // -- rsp[8] : receiver
- // -----------------------------------
-
- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
-}
void LoadIC::GenerateNormal(MacroAssembler* masm) {
@@ -1278,7 +1288,7 @@
// Cache miss: Restore receiver from stack and jump to runtime.
__ bind(&miss);
__ movq(rax, Operand(rsp, 1 * kPointerSize));
- Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
+ GenerateMiss(masm);
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev