Add LoadIC_Slow builtin and use it for loading properties from primitive values.

This fixes recent performance regressions on Dromaeo.

BUG=chromium:242512
R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/16226024

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14950 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jkummerow@chromium.org 2013-06-05 11:12:49 +00:00
parent 4a70dcf530
commit 2272aa71d9
7 changed files with 65 additions and 9 deletions

View File

@ -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::kGetProperty, 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

View File

@ -1495,6 +1495,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);
}

View File

@ -143,6 +143,8 @@ enum BuiltinExtraArguments {
V(LoadIC_Megamorphic, LOAD_IC, MEGAMORPHIC, \
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, \

View File

@ -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::kGetProperty, 2, 1);
}
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// ----------- S t a t e -------------
// -- ecx : key

View File

@ -937,8 +937,14 @@ MaybeObject* LoadIC::Load(State state,
// Update inline cache and stub cache.
if (FLAG_use_ic) {
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;
if (lookup.IsInterceptor() || lookup.IsHandler()) {

View File

@ -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() {

View File

@ -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::kGetProperty, 2, 1);
}
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
// ----------- S t a t e -------------
// -- rax : key