Commit e6995a01 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Move "slow handler" compiler code to handler-compiler

BUG=
R=yangguo@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23347 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 2803733a
......@@ -1298,11 +1298,6 @@ static void Generate_KeyedLoadIC_SloppyArguments(MacroAssembler* masm) {
}
static void Generate_StoreIC_Slow(MacroAssembler* masm) {
StoreIC::GenerateSlow(masm);
}
static void Generate_StoreIC_Miss(MacroAssembler* masm) {
StoreIC::GenerateMiss(masm);
}
......@@ -1313,6 +1308,16 @@ static void Generate_StoreIC_Normal(MacroAssembler* masm) {
}
static void Generate_StoreIC_Slow(MacroAssembler* masm) {
NamedStoreHandlerCompiler::GenerateSlow(masm);
}
static void Generate_KeyedStoreIC_Slow(MacroAssembler* masm) {
ElementHandlerCompiler::GenerateStoreSlow(masm);
}
static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) {
NamedStoreHandlerCompiler::GenerateStoreViaSetterForDeopt(masm);
}
......@@ -1333,11 +1338,6 @@ static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) {
}
static void Generate_KeyedStoreIC_Slow(MacroAssembler* masm) {
KeyedStoreIC::GenerateSlow(masm);
}
static void Generate_KeyedStoreIC_Initialize(MacroAssembler* masm) {
KeyedStoreIC::GenerateInitialize(masm);
}
......
......@@ -690,7 +690,7 @@ void StoreElementStub::Generate(MacroAssembler* masm) {
UNREACHABLE();
break;
case DICTIONARY_ELEMENTS:
ElementHandlerCompiler::GenerateStoreDictionaryElement(masm);
ElementHandlerCompiler::GenerateStoreSlow(masm);
break;
case SLOPPY_ARGUMENTS_ELEMENTS:
UNREACHABLE();
......
......@@ -314,6 +314,32 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
}
void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
// Push receiver, key and value for runtime call.
__ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(),
StoreIC::ValueRegister());
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
ExternalReference ref =
ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
// Push receiver, key and value for runtime call.
__ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(),
StoreIC::ValueRegister());
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
ExternalReference ref =
ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
#undef __
#define __ ACCESS_MASM(masm())
......
......@@ -733,30 +733,6 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
}
void StoreIC::GenerateSlow(MacroAssembler* masm) {
// Push receiver, key and value for runtime call.
__ Push(ReceiverRegister(), NameRegister(), ValueRegister());
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
ExternalReference ref =
ExternalReference(IC_Utility(kStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
// Push receiver, key and value for runtime call.
__ Push(ReceiverRegister(), NameRegister(), ValueRegister());
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
ExternalReference ref =
ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
static void KeyedStoreGenerateGenericHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length,
......
......@@ -306,6 +306,34 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
}
void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
// Push receiver, name and value for runtime call.
__ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(),
StoreIC::ValueRegister());
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
ExternalReference ref =
ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
ASM_LOCATION("ElementHandlerCompiler::GenerateStoreSlow");
// Push receiver, key and value for runtime call.
__ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(),
StoreIC::ValueRegister());
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
ExternalReference ref =
ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
#undef __
#define __ ACCESS_MASM(masm())
......
......@@ -775,20 +775,6 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
ASM_LOCATION("KeyedStoreIC::GenerateSlow");
// Push receiver, key and value for runtime call.
__ Push(ReceiverRegister(), NameRegister(), ValueRegister());
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
ExternalReference ref =
ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
static void KeyedStoreGenerateGenericHelper(
MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length,
......@@ -1069,25 +1055,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
}
void StoreIC::GenerateSlow(MacroAssembler* masm) {
// ---------- S t a t e --------------
// -- x0 : value
// -- x1 : receiver
// -- x2 : name
// -- lr : return address
// -----------------------------------
// Push receiver, name and value for runtime call.
__ Push(ReceiverRegister(), NameRegister(), ValueRegister());
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
ExternalReference ref =
ExternalReference(IC_Utility(kStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
Condition CompareIC::ComputeCondition(Token::Value op) {
switch (op) {
case Token::EQ_STRICT:
......
......@@ -388,11 +388,5 @@ void ElementHandlerCompiler::CompileElementHandlers(
handlers->Add(cached_stub);
}
}
void ElementHandlerCompiler::GenerateStoreDictionaryElement(
MacroAssembler* masm) {
KeyedStoreIC::GenerateSlow(masm);
}
}
} // namespace v8::internal
......@@ -221,6 +221,8 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler {
Handle<JSFunction>());
}
static void GenerateSlow(MacroAssembler* masm);
protected:
virtual Register FrontendHeader(Register object_reg, Handle<Name> name,
Label* miss);
......@@ -267,7 +269,7 @@ class ElementHandlerCompiler : public PropertyHandlerCompiler {
CodeHandleList* handlers);
static void GenerateLoadDictionaryElement(MacroAssembler* masm);
static void GenerateStoreDictionaryElement(MacroAssembler* masm);
static void GenerateStoreSlow(MacroAssembler* masm);
};
}
} // namespace v8::internal
......
......@@ -326,6 +326,41 @@ static void CompileCallLoadPropertyWithInterceptor(
}
static void StoreIC_PushArgs(MacroAssembler* masm) {
Register receiver = StoreIC::ReceiverRegister();
Register name = StoreIC::NameRegister();
Register value = StoreIC::ValueRegister();
DCHECK(!ebx.is(receiver) && !ebx.is(name) && !ebx.is(value));
__ pop(ebx);
__ push(receiver);
__ push(name);
__ push(value);
__ push(ebx);
}
void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(IC::kStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
#undef __
#define __ ACCESS_MASM(masm())
......
......@@ -1018,26 +1018,6 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
}
void StoreIC::GenerateSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
#undef __
......
......@@ -8,6 +8,7 @@
#include "src/ic/call-optimization.h"
#include "src/ic/handler-compiler.h"
#include "src/ic/ic.h"
namespace v8 {
namespace internal {
......@@ -319,6 +320,41 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement(
}
static void StoreIC_PushArgs(MacroAssembler* masm) {
Register receiver = StoreIC::ReceiverRegister();
Register name = StoreIC::NameRegister();
Register value = StoreIC::ValueRegister();
DCHECK(!rbx.is(receiver) && !rbx.is(name) && !rbx.is(value));
__ PopReturnAddressTo(rbx);
__ Push(receiver);
__ Push(name);
__ Push(value);
__ PushReturnAddressFrom(rbx);
}
void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(IC::kStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
#undef __
#define __ ACCESS_MASM((masm()))
......
......@@ -1012,26 +1012,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
}
void StoreIC::GenerateSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate());
__ TailCallExternalReference(ref, 3, 1);
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(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