Revision: 23382
Author:   [email protected]
Date:     Tue Aug 26 06:16:14 2014 UTC
Log: 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=
[email protected]

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

Patch from Chunyang Dai <[email protected]>.
https://code.google.com/p/v8/source/detail?r=23382

Modified:
 /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc
 /branches/bleeding_edge/src/x87/lithium-codegen-x87.h

=======================================
--- /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Mon Aug 25 09:00:04 2014 UTC +++ /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Tue Aug 26 06:16:14 2014 UTC
@@ -2961,6 +2961,19 @@
     DeoptimizeIf(equal, instr->environment());
   }
 }
+
+
+template <class T>
+void LCodeGen::EmitVectorLoadICRegisters(T* instr) {
+  DCHECK(FLAG_vector_ics);
+  Register vector = ToRegister(instr->temp_vector());
+  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())));
+}


 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
@@ -2970,13 +2983,7 @@

   __ mov(LoadIC::NameRegister(), instr->name());
   if (FLAG_vector_ics) {
-    Register vector = ToRegister(instr->temp_vector());
-    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())));
+    EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
   }
   ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
   Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode);
@@ -3111,13 +3118,7 @@

   __ mov(LoadIC::NameRegister(), instr->name());
   if (FLAG_vector_ics) {
-    Register vector = ToRegister(instr->temp_vector());
-    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())));
+    EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
   }
   Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL);
   CallCode(ic, RelocInfo::CODE_TARGET, instr);
@@ -3341,13 +3342,7 @@
   DCHECK(ToRegister(instr->key()).is(LoadIC::NameRegister()));

   if (FLAG_vector_ics) {
-    Register vector = ToRegister(instr->temp_vector());
-    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())));
+    EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
   }

   Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
=======================================
--- /branches/bleeding_edge/src/x87/lithium-codegen-x87.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/x87/lithium-codegen-x87.h Tue Aug 26 06:16:14 2014 UTC
@@ -344,6 +344,9 @@
   void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr);
   void DoStoreKeyedFixedArray(LStoreKeyed* instr);

+  template <class T>
+  void EmitVectorLoadICRegisters(T* instr);
+
   void EmitReturn(LReturn* instr, bool dynamic_frame_alignment);

   // Emits code for pushing either a tagged constant, a (non-double)

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to