Remove KeyedStoreIC::GenerateRuntimeSetProperty and move Store::GenerateRuntimeSetProperty to the PropertyICCompiler

BUG=
R=yangguo@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23311 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2014-08-22 12:48:15 +00:00
parent 1f9bd09f36
commit d1a9559750
11 changed files with 79 additions and 130 deletions

View File

@ -8,6 +8,7 @@
#include "src/codegen.h"
#include "src/ic/ic.h"
#include "src/ic/ic-compiler.h"
#include "src/ic/stub-cache.h"
namespace v8 {
@ -756,18 +757,6 @@ void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
}
void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
// Push receiver, key and value for runtime call.
__ Push(ReceiverRegister(), NameRegister(), ValueRegister());
__ mov(r0, Operand(Smi::FromInt(strict_mode))); // Strict mode.
__ Push(r0);
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
static void KeyedStoreGenerateGenericHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length,
@ -965,7 +954,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
// r0: value.
// r1: key.
// r2: receiver.
GenerateRuntimeSetProperty(masm, strict_mode);
PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
@ -1062,18 +1051,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
}
void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
__ Push(ReceiverRegister(), NameRegister(), ValueRegister());
__ mov(r0, Operand(Smi::FromInt(strict_mode)));
__ Push(r0);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
#undef __

View File

@ -964,6 +964,19 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
}
void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
__ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(),
StoreIC::ValueRegister());
__ mov(r0, Operand(Smi::FromInt(strict_mode)));
__ Push(r0);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
#undef __
}
} // namespace v8::internal

View File

@ -8,6 +8,7 @@
#include "src/codegen.h"
#include "src/ic/ic.h"
#include "src/ic/ic-compiler.h"
#include "src/ic/stub-cache.h"
namespace v8 {
@ -788,21 +789,6 @@ void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
}
void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
ASM_LOCATION("KeyedStoreIC::GenerateRuntimeSetProperty");
// Push receiver, key and value for runtime call.
__ Push(ReceiverRegister(), NameRegister(), ValueRegister());
// Push strict_mode for runtime call.
__ Mov(x10, Smi::FromInt(strict_mode));
__ Push(x10);
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
static void KeyedStoreGenerateGenericHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length,
@ -989,7 +975,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
// x0: value
// x1: key
// x2: receiver
GenerateRuntimeSetProperty(masm, strict_mode);
PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
__ Bind(&extra);
@ -1083,20 +1069,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
}
void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
ASM_LOCATION("StoreIC::GenerateRuntimeSetProperty");
__ Push(ReceiverRegister(), NameRegister(), ValueRegister());
__ Mov(x10, Smi::FromInt(strict_mode));
__ Push(x10);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
void StoreIC::GenerateSlow(MacroAssembler* masm) {
// ---------- S t a t e --------------
// -- x0 : value

View File

@ -974,6 +974,22 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
}
void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
ASM_LOCATION("PropertyICCompiler::GenerateRuntimeSetProperty");
__ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(),
StoreIC::ValueRegister());
__ Mov(x10, Smi::FromInt(strict_mode));
__ Push(x10);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
#undef __
}
} // namespace v8::internal

View File

@ -979,6 +979,23 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
}
void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
// Return address is on the stack.
DCHECK(!ebx.is(StoreIC::ReceiverRegister()) &&
!ebx.is(StoreIC::NameRegister()) && !ebx.is(StoreIC::ValueRegister()));
__ pop(ebx);
__ push(StoreIC::ReceiverRegister());
__ push(StoreIC::NameRegister());
__ push(StoreIC::ValueRegister());
__ push(Immediate(Smi::FromInt(strict_mode)));
__ push(ebx); // return address
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
#undef __
}
} // namespace v8::internal

View File

@ -8,6 +8,7 @@
#include "src/codegen.h"
#include "src/ic/ic.h"
#include "src/ic/ic-compiler.h"
#include "src/ic/stub-cache.h"
namespace v8 {
@ -777,7 +778,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
// Slow case: call runtime.
__ bind(&slow);
GenerateRuntimeSetProperty(masm, strict_mode);
PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
// Extra capacity case: Check if there is extra capacity to
// perform the store and update the length. Used for adding one
@ -1006,40 +1007,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
}
void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
// Return address is on the stack.
DCHECK(!ebx.is(ReceiverRegister()) && !ebx.is(NameRegister()) &&
!ebx.is(ValueRegister()));
__ pop(ebx);
__ push(ReceiverRegister());
__ push(NameRegister());
__ push(ValueRegister());
__ push(Immediate(Smi::FromInt(strict_mode)));
__ push(ebx); // return address
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
// Return address is on the stack.
DCHECK(!ebx.is(ReceiverRegister()) && !ebx.is(NameRegister()) &&
!ebx.is(ValueRegister()));
__ pop(ebx);
__ push(ReceiverRegister());
__ push(NameRegister());
__ push(ValueRegister());
__ push(Immediate(Smi::FromInt(strict_mode)));
__ push(ebx); // return address
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);

View File

@ -387,7 +387,7 @@ Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) {
Handle<Code> PropertyICCompiler::CompileStoreGeneric(Code::Flags flags) {
ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
StrictMode strict_mode = StoreIC::GetStrictMode(extra_state);
StoreIC::GenerateRuntimeSetProperty(masm(), strict_mode);
GenerateRuntimeSetProperty(masm(), strict_mode);
Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric");
PROFILE(isolate(), CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0));
return code;

View File

@ -125,6 +125,12 @@ class PropertyICCompiler : public PropertyAccessCompiler {
static Handle<Code> ComputeCompareNil(Handle<Map> receiver_map,
CompareNilICStub* stub);
// Helpers
// TODO(verwaest): Move all uses of these helpers to the PropertyICCompiler
// and make the helpers private.
static void GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode);
private:
PropertyICCompiler(Isolate* isolate, Code::Kind kind,

View File

@ -650,8 +650,6 @@ class KeyedStoreIC : public StoreIC {
}
static void GenerateMiss(MacroAssembler* masm);
static void GenerateSlow(MacroAssembler* masm);
static void GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode);
static void GenerateGeneric(MacroAssembler* masm, StrictMode strict_mode);
static void GenerateSloppyArguments(MacroAssembler* masm);

View File

@ -968,6 +968,24 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
}
void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
// Return address is on the stack.
DCHECK(!rbx.is(StoreIC::ReceiverRegister()) &&
!rbx.is(StoreIC::NameRegister()) && !rbx.is(StoreIC::ValueRegister()));
__ PopReturnAddressTo(rbx);
__ Push(StoreIC::ReceiverRegister());
__ Push(StoreIC::NameRegister());
__ Push(StoreIC::ValueRegister());
__ Push(Smi::FromInt(strict_mode));
__ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
#undef __
}
} // namespace v8::internal

View File

@ -8,6 +8,7 @@
#include "src/codegen.h"
#include "src/ic/ic.h"
#include "src/ic/ic-compiler.h"
#include "src/ic/stub-cache.h"
namespace v8 {
@ -649,7 +650,7 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
__ bind(&slow);
__ Integer32ToSmi(key, key);
__ bind(&slow_with_tagged_index);
GenerateRuntimeSetProperty(masm, strict_mode);
PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
// Never returns to here.
// Extra capacity case: Check if there is extra capacity to
@ -1011,42 +1012,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
}
void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
// Return address is on the stack.
DCHECK(!rbx.is(ReceiverRegister()) && !rbx.is(NameRegister()) &&
!rbx.is(ValueRegister()));
__ PopReturnAddressTo(rbx);
__ Push(ReceiverRegister());
__ Push(NameRegister());
__ Push(ValueRegister());
__ Push(Smi::FromInt(strict_mode));
__ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
StrictMode strict_mode) {
// Return address is on the stack.
DCHECK(!rbx.is(ReceiverRegister()) && !rbx.is(NameRegister()) &&
!rbx.is(ValueRegister()));
__ PopReturnAddressTo(rbx);
__ Push(ReceiverRegister());
__ Push(NameRegister());
__ Push(ValueRegister());
__ Push(Smi::FromInt(strict_mode)); // Strict mode.
__ PushReturnAddressFrom(rbx);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kSetProperty, 4, 1);
}
void StoreIC::GenerateSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);