Commit f449fded authored by whesse@chromium.org's avatar whesse@chromium.org

Eliminate *IC::Generate() function on all platforms.

Review URL: http://codereview.chromium.org/583008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3817 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4acaded3
......@@ -438,7 +438,7 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
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 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) {
// 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 @@ void LoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) {
__ 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 @@ Object* KeyedLoadIC_Miss(Arguments args);
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 @@ void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) {
__ 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 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// 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 KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm,
}
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 @@ void KeyedStoreIC::Generate(MacroAssembler* masm,
__ 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 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
__ 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
......
......@@ -295,7 +295,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// 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 @@ void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm,
// 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 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
// 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 @@ void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm,
// Slow case: call runtime.
__ bind(&slow);
Generate(masm, ExternalReference(Runtime::kSetProperty));
GenerateRuntimeSetProperty(masm);
}
......@@ -1164,7 +1164,7 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
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 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) {
// 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 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
// -- 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 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
// -- 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,26 @@ void StoreIC::GenerateMiss(MacroAssembler* masm) {
// 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
// -- 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(Runtime::kSetProperty), 3, 1);
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax : value
// -- esp[0] : return address
......@@ -1450,7 +1461,7 @@ void KeyedStoreIC::Generate(MacroAssembler* masm, const ExternalReference& f) {
__ push(ecx);
// Do tail-call to runtime routine.
__ TailCallRuntime(f, 3, 1);
__ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3, 1);
}
......
......@@ -1320,16 +1320,6 @@ Object* LoadIC_Miss(Arguments args) {
}
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
Object* KeyedLoadIC_Miss(Arguments args) {
NoHandleAllocation na;
......@@ -1340,16 +1330,6 @@ Object* KeyedLoadIC_Miss(Arguments args) {
}
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.
Object* StoreIC_Miss(Arguments args) {
NoHandleAllocation na;
......@@ -1406,16 +1386,6 @@ Object* KeyedStoreIC_Miss(Arguments args) {
}
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[] = {
#define ADDR(name) FUNCTION_ADDR(name),
IC_UTIL_LIST(ADDR)
......
......@@ -223,8 +223,10 @@ class LoadIC: public IC {
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 @@ class LoadIC: public IC {
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 @@ class KeyedLoadIC: public IC {
// 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 @@ class KeyedLoadIC: public IC {
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 @@ class KeyedStoreIC: public IC {
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 @@ class KeyedStoreIC: public IC {
static void RestoreInlinedVersion(Address address);
private:
static void Generate(MacroAssembler* masm, const ExternalReference& f);
// Update the inline cache.
void UpdateCaches(LookupResult* lookup,
State state,
......
......@@ -228,23 +228,37 @@ void KeyedStoreIC::RestoreInlinedVersion(Address address) {
}
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 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// 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 @@ void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm,
// 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 @@ void KeyedStoreIC::Generate(MacroAssembler* masm, ExternalReference const& f) {
__ push(rcx); // return address
// Do tail-call to runtime routine.
__ TailCallRuntime(f, 3, 1);
__ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1);
}
......@@ -659,7 +682,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
// 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 @@ void KeyedStoreIC::GenerateExternalArray(MacroAssembler* masm,
// Slow case: call runtime.
__ bind(&slow);
Generate(masm, ExternalReference(Runtime::kSetProperty));
GenerateRuntimeSetProperty(masm);
}
......@@ -1153,22 +1176,20 @@ void LoadIC::ClearInlinedVersion(Address address) {
}
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);
}
......@@ -1224,17 +1245,6 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
}
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) {
// ----------- S t a t e -------------
// -- rcx : name
......@@ -1278,7 +1288,7 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) {
// 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);
}
......
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