Revision: 23372
Author:   [email protected]
Date:     Mon Aug 25 18:25:58 2014 UTC
Log: MIPS: Eliminate code duplication in lithium calls to vector-based LoadICs.

Port r23359 (2e682e9)

BUG=
[email protected]

Review URL: https://codereview.chromium.org/503103002
https://code.google.com/p/v8/source/detail?r=23372

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

=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Mon Aug 25 09:09:25 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Mon Aug 25 18:25:58 2014 UTC
@@ -2885,6 +2885,19 @@
     DeoptimizeIf(eq, instr->environment(), result, Operand(at));
   }
 }
+
+
+template <class T>
+void LCodeGen::EmitVectorLoadICRegisters(T* instr) {
+  DCHECK(FLAG_vector_ics);
+  Register vector = ToRegister(instr->temp_vector());
+  DCHECK(vector.is(LoadIC::VectorRegister()));
+  __ li(vector, instr->hydrogen()->feedback_vector());
+  // No need to allocate this register.
+  DCHECK(LoadIC::SlotRegister().is(a0));
+  __ li(LoadIC::SlotRegister(),
+        Operand(Smi::FromInt(instr->hydrogen()->slot())));
+}


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

   __ li(LoadIC::NameRegister(), Operand(instr->name()));
   if (FLAG_vector_ics) {
-    Register vector = ToRegister(instr->temp_vector());
-    DCHECK(vector.is(LoadIC::VectorRegister()));
-    __ li(vector, instr->hydrogen()->feedback_vector());
-    // No need to allocate this register.
-    DCHECK(LoadIC::SlotRegister().is(a0));
-    __ li(LoadIC::SlotRegister(),
-          Operand(Smi::FromInt(instr->hydrogen()->slot())));
+    EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
   }
   ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
   Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode);
@@ -3028,13 +3035,7 @@
   // Name is always in a2.
   __ li(LoadIC::NameRegister(), Operand(instr->name()));
   if (FLAG_vector_ics) {
-    Register vector = ToRegister(instr->temp_vector());
-    DCHECK(vector.is(LoadIC::VectorRegister()));
-    __ li(vector, instr->hydrogen()->feedback_vector());
-    // No need to allocate this register.
-    DCHECK(LoadIC::SlotRegister().is(a0));
-    __ li(LoadIC::SlotRegister(),
-          Operand(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()));
-    __ li(vector, instr->hydrogen()->feedback_vector());
-    // No need to allocate this register.
-    DCHECK(LoadIC::SlotRegister().is(a0));
-    __ li(LoadIC::SlotRegister(),
-          Operand(Smi::FromInt(instr->hydrogen()->slot())));
+    EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
   }

   Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.h Mon Aug 25 18:25:58 2014 UTC
@@ -364,6 +364,9 @@
   void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr);
   void DoStoreKeyedFixedArray(LStoreKeyed* instr);

+  template <class T>
+  void EmitVectorLoadICRegisters(T* instr);
+
   ZoneList<LEnvironment*> deoptimizations_;
   ZoneList<Deoptimizer::JumpTableEntry> deopt_jump_table_;
   ZoneList<Handle<Object> > deoptimization_literals_;
=======================================
--- /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.cc Mon Aug 25 09:09:25 2014 UTC +++ /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.cc Mon Aug 25 18:25:58 2014 UTC
@@ -2863,6 +2863,19 @@
     DeoptimizeIf(eq, instr->environment(), result, Operand(at));
   }
 }
+
+
+template <class T>
+void LCodeGen::EmitVectorLoadICRegisters(T* instr) {
+  DCHECK(FLAG_vector_ics);
+  Register vector = ToRegister(instr->temp_vector());
+  DCHECK(vector.is(LoadIC::VectorRegister()));
+  __ li(vector, instr->hydrogen()->feedback_vector());
+  // No need to allocate this register.
+  DCHECK(LoadIC::SlotRegister().is(a0));
+  __ li(LoadIC::SlotRegister(),
+        Operand(Smi::FromInt(instr->hydrogen()->slot())));
+}


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

   __ li(LoadIC::NameRegister(), Operand(instr->name()));
   if (FLAG_vector_ics) {
-    Register vector = ToRegister(instr->temp_vector());
-    DCHECK(vector.is(LoadIC::VectorRegister()));
-    __ li(vector, instr->hydrogen()->feedback_vector());
-    // No need to allocate this register.
-    DCHECK(LoadIC::SlotRegister().is(a0));
-    __ li(LoadIC::SlotRegister(),
-          Operand(Smi::FromInt(instr->hydrogen()->slot())));
+    EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
   }
   ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL;
   Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode);
@@ -3020,13 +3027,7 @@
   // Name is always in a2.
   __ li(LoadIC::NameRegister(), Operand(instr->name()));
   if (FLAG_vector_ics) {
-    Register vector = ToRegister(instr->temp_vector());
-    DCHECK(vector.is(LoadIC::VectorRegister()));
-    __ li(vector, instr->hydrogen()->feedback_vector());
-    // No need to allocate this register.
-    DCHECK(LoadIC::SlotRegister().is(a0));
-    __ li(LoadIC::SlotRegister(),
-          Operand(Smi::FromInt(instr->hydrogen()->slot())));
+    EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
   }
   Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL);
   CallCode(ic, RelocInfo::CODE_TARGET, instr);
@@ -3374,13 +3375,7 @@
   DCHECK(ToRegister(instr->key()).is(LoadIC::NameRegister()));

   if (FLAG_vector_ics) {
-    Register vector = ToRegister(instr->temp_vector());
-    DCHECK(vector.is(LoadIC::VectorRegister()));
-    __ li(vector, instr->hydrogen()->feedback_vector());
-    // No need to allocate this register.
-    DCHECK(LoadIC::SlotRegister().is(a0));
-    __ li(LoadIC::SlotRegister(),
-          Operand(Smi::FromInt(instr->hydrogen()->slot())));
+    EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr);
   }

   Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
=======================================
--- /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/mips64/lithium-codegen-mips64.h Mon Aug 25 18:25:58 2014 UTC
@@ -365,6 +365,9 @@
   void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr);
   void DoStoreKeyedFixedArray(LStoreKeyed* instr);

+  template <class T>
+  void EmitVectorLoadICRegisters(T* instr);
+
   ZoneList<LEnvironment*> deoptimizations_;
   ZoneList<Deoptimizer::JumpTableEntry> deopt_jump_table_;
   ZoneList<Handle<Object> > deoptimization_literals_;

--
--
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