X87: Eliminate code duplication in lithium calls to vector-based LoadICs

port r23359.

original commit message:
  Eliminate code duplication in lithium calls to vector-based LoadICs

BUG=
R=weiliang.lin@intel.com

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

Patch from Chunyang Dai <chunyang.dai@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23382 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b5972802
...@@ -2963,13 +2963,9 @@ void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { ...@@ -2963,13 +2963,9 @@ void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) {
} }
void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { template <class T>
DCHECK(ToRegister(instr->context()).is(esi)); void LCodeGen::EmitVectorLoadICRegisters(T* instr) {
DCHECK(ToRegister(instr->global_object()).is(LoadIC::ReceiverRegister())); DCHECK(FLAG_vector_ics);
DCHECK(ToRegister(instr->result()).is(eax));
__ mov(LoadIC::NameRegister(), instr->name());
if (FLAG_vector_ics) {
Register vector = ToRegister(instr->temp_vector()); Register vector = ToRegister(instr->temp_vector());
DCHECK(vector.is(LoadIC::VectorRegister())); DCHECK(vector.is(LoadIC::VectorRegister()));
__ mov(vector, instr->hydrogen()->feedback_vector()); __ mov(vector, instr->hydrogen()->feedback_vector());
...@@ -2977,6 +2973,17 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { ...@@ -2977,6 +2973,17 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
DCHECK(LoadIC::SlotRegister().is(eax)); DCHECK(LoadIC::SlotRegister().is(eax));
__ mov(LoadIC::SlotRegister(), __ mov(LoadIC::SlotRegister(),
Immediate(Smi::FromInt(instr->hydrogen()->slot()))); Immediate(Smi::FromInt(instr->hydrogen()->slot())));
}
void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
DCHECK(ToRegister(instr->context()).is(esi));
DCHECK(ToRegister(instr->global_object()).is(LoadIC::ReceiverRegister()));
DCHECK(ToRegister(instr->result()).is(eax));
__ mov(LoadIC::NameRegister(), instr->name());
if (FLAG_vector_ics) {
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
} }
ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode);
...@@ -3111,13 +3118,7 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { ...@@ -3111,13 +3118,7 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
__ mov(LoadIC::NameRegister(), instr->name()); __ mov(LoadIC::NameRegister(), instr->name());
if (FLAG_vector_ics) { if (FLAG_vector_ics) {
Register vector = ToRegister(instr->temp_vector()); EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
DCHECK(vector.is(LoadIC::VectorRegister()));
__ mov(vector, instr->hydrogen()->feedback_vector());
// No need to allocate this register.
DCHECK(LoadIC::SlotRegister().is(eax));
__ mov(LoadIC::SlotRegister(),
Immediate(Smi::FromInt(instr->hydrogen()->slot())));
} }
Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL);
CallCode(ic, RelocInfo::CODE_TARGET, instr); CallCode(ic, RelocInfo::CODE_TARGET, instr);
...@@ -3341,13 +3342,7 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { ...@@ -3341,13 +3342,7 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
DCHECK(ToRegister(instr->key()).is(LoadIC::NameRegister())); DCHECK(ToRegister(instr->key()).is(LoadIC::NameRegister()));
if (FLAG_vector_ics) { if (FLAG_vector_ics) {
Register vector = ToRegister(instr->temp_vector()); EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
DCHECK(vector.is(LoadIC::VectorRegister()));
__ mov(vector, instr->hydrogen()->feedback_vector());
// No need to allocate this register.
DCHECK(LoadIC::SlotRegister().is(eax));
__ mov(LoadIC::SlotRegister(),
Immediate(Smi::FromInt(instr->hydrogen()->slot())));
} }
Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
......
...@@ -344,6 +344,9 @@ class LCodeGen: public LCodeGenBase { ...@@ -344,6 +344,9 @@ class LCodeGen: public LCodeGenBase {
void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr);
void DoStoreKeyedFixedArray(LStoreKeyed* instr); void DoStoreKeyedFixedArray(LStoreKeyed* instr);
template <class T>
void EmitVectorLoadICRegisters(T* instr);
void EmitReturn(LReturn* instr, bool dynamic_frame_alignment); void EmitReturn(LReturn* instr, bool dynamic_frame_alignment);
// Emits code for pushing either a tagged constant, a (non-double) // Emits code for pushing either a tagged constant, a (non-double)
......
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