Revision: 12383
Author:   [email protected]
Date:     Mon Aug 27 02:39:05 2012
Log:      First steps towards named Litihium operands.

Accessing Lithium operands via position is fragile and makes it impossible to statically find all uses of a given operand. This CL is a step towards cleaning
this up, more to come...

Review URL: https://chromiumcodereview.appspot.com/10878073
http://code.google.com/p/v8/source/detail?r=12383

Modified:
 /branches/bleeding_edge/src/arm/lithium-arm.h
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.h
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
 /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.h
 /branches/bleeding_edge/src/ia32/lithium-ia32.h
 /branches/bleeding_edge/src/mips/lithium-mips.h
 /branches/bleeding_edge/src/x64/lithium-x64.h

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h       Wed Aug 22 08:44:17 2012
+++ /branches/bleeding_edge/src/arm/lithium-arm.h       Mon Aug 27 02:39:05 2012
@@ -260,8 +260,6 @@
   virtual bool HasResult() const = 0;
   virtual LOperand* result() = 0;

-  virtual int InputCount() = 0;
-  virtual LOperand* InputAt(int i) = 0;
   virtual int TempCount() = 0;
   virtual LOperand* TempAt(int i) = 0;

@@ -273,6 +271,11 @@
 #endif

  private:
+  // Iterator support.
+  friend class InputIterator;
+  virtual int InputCount() = 0;
+  virtual LOperand* InputAt(int i) = 0;
+
   LEnvironment* environment_;
   SetOncePointer<LPointerMap> pointer_map_;
   HValue* hydrogen_value_;
@@ -292,7 +295,6 @@
   void set_result(LOperand* operand) { results_[0] = operand; }
   LOperand* result() { return results_[0]; }

-  int InputCount() { return I; }
   LOperand* InputAt(int i) { return inputs_[i]; }

   int TempCount() { return T; }
@@ -302,6 +304,9 @@
   EmbeddedContainer<LOperand*, R> results_;
   EmbeddedContainer<LOperand*, I> inputs_;
   EmbeddedContainer<LOperand*, T> temps_;
+
+ private:
+  virtual int InputCount() { return I; }
 };


=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Wed Aug 22 08:44:17 2012 +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Aug 27 02:39:05 2012
@@ -4310,7 +4310,9 @@
     DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
         : LDeferredCode(codegen), instr_(instr) { }
     virtual void Generate() {
-      codegen()->DoDeferredNumberTagI(instr_, SIGNED_INT32);
+      codegen()->DoDeferredNumberTagI(instr_,
+                                      instr_->InputAt(0),
+                                      SIGNED_INT32);
     }
     virtual LInstruction* instr() { return instr_; }
    private:
@@ -4333,7 +4335,9 @@
     DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
         : LDeferredCode(codegen), instr_(instr) { }
     virtual void Generate() {
-      codegen()->DoDeferredNumberTagI(instr_, UNSIGNED_INT32);
+      codegen()->DoDeferredNumberTagI(instr_,
+                                      instr_->InputAt(0),
+                                      UNSIGNED_INT32);
     }
     virtual LInstruction* instr() { return instr_; }
    private:
@@ -4353,9 +4357,10 @@


 void LCodeGen::DoDeferredNumberTagI(LInstruction* instr,
+                                    LOperand* value,
                                     IntegerSignedness signedness) {
   Label slow;
-  Register src = ToRegister(instr->InputAt(0));
+  Register src = ToRegister(value);
   Register dst = ToRegister(instr->result());
   DoubleRegister dbl_scratch = double_scratch0();
   SwVfpRegister flt_scratch = dbl_scratch.low();
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.h Wed Aug 22 08:44:17 2012 +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.h Mon Aug 27 02:39:05 2012
@@ -116,7 +116,9 @@
   void DoDeferredNumberTagD(LNumberTagD* instr);

   enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 };
- void DoDeferredNumberTagI(LInstruction* instr, IntegerSignedness signedness);
+  void DoDeferredNumberTagI(LInstruction* instr,
+                            LOperand* value,
+                            IntegerSignedness signedness);

   void DoDeferredTaggedToI(LTaggedToI* instr);
   void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Wed Aug 22 08:44:17 2012 +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon Aug 27 02:39:05 2012
@@ -4107,7 +4107,9 @@
     DeferredNumberTagI(LCodeGen* codegen, LNumberTagI* instr)
         : LDeferredCode(codegen), instr_(instr) { }
     virtual void Generate() {
-      codegen()->DoDeferredNumberTagI(instr_, SIGNED_INT32);
+      codegen()->DoDeferredNumberTagI(instr_,
+                                      instr_->InputAt(0),
+                                      SIGNED_INT32);
     }
     virtual LInstruction* instr() { return instr_; }
    private:
@@ -4131,7 +4133,9 @@
     DeferredNumberTagU(LCodeGen* codegen, LNumberTagU* instr)
         : LDeferredCode(codegen), instr_(instr) { }
     virtual void Generate() {
-      codegen()->DoDeferredNumberTagI(instr_, UNSIGNED_INT32);
+      codegen()->DoDeferredNumberTagI(instr_,
+                                      instr_->InputAt(0),
+                                      UNSIGNED_INT32);
     }
     virtual LInstruction* instr() { return instr_; }
    private:
@@ -4151,9 +4155,10 @@


 void LCodeGen::DoDeferredNumberTagI(LInstruction* instr,
+                                    LOperand* value,
                                     IntegerSignedness signedness) {
   Label slow;
-  Register reg = ToRegister(instr->InputAt(0));
+  Register reg = ToRegister(value);
   Register tmp = reg.is(eax) ? ecx : eax;

   // Preserve the value of all registers.
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.h Wed Aug 22 08:44:17 2012 +++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.h Mon Aug 27 02:39:05 2012
@@ -107,7 +107,9 @@
   void DoDeferredNumberTagD(LNumberTagD* instr);

   enum IntegerSignedness { SIGNED_INT32, UNSIGNED_INT32 };
- void DoDeferredNumberTagI(LInstruction* instr, IntegerSignedness signedness);
+  void DoDeferredNumberTagI(LInstruction* instr,
+                            LOperand* value,
+                            IntegerSignedness signedness);

   void DoDeferredTaggedToI(LTaggedToI* instr);
   void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h     Wed Aug 22 08:44:17 2012
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h     Mon Aug 27 02:39:05 2012
@@ -256,8 +256,6 @@
   virtual bool HasResult() const = 0;
   virtual LOperand* result() = 0;

-  virtual int InputCount() = 0;
-  virtual LOperand* InputAt(int i) = 0;
   virtual int TempCount() = 0;
   virtual LOperand* TempAt(int i) = 0;

@@ -269,6 +267,11 @@
 #endif

  private:
+  // Iterator support.
+  friend class InputIterator;
+  virtual int InputCount() = 0;
+  virtual LOperand* InputAt(int i) = 0;
+
   LEnvironment* environment_;
   SetOncePointer<LPointerMap> pointer_map_;
   HValue* hydrogen_value_;
@@ -288,7 +291,6 @@
   void set_result(LOperand* operand) { results_[0] = operand; }
   LOperand* result() { return results_[0]; }

-  int InputCount() { return I; }
   LOperand* InputAt(int i) { return inputs_[i]; }

   int TempCount() { return T; }
@@ -298,6 +300,9 @@
   EmbeddedContainer<LOperand*, R> results_;
   EmbeddedContainer<LOperand*, I> inputs_;
   EmbeddedContainer<LOperand*, T> temps_;
+
+ private:
+  virtual int InputCount() { return I; }
 };


=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.h     Thu Aug  9 01:28:52 2012
+++ /branches/bleeding_edge/src/mips/lithium-mips.h     Mon Aug 27 02:39:05 2012
@@ -256,8 +256,6 @@
   virtual bool HasResult() const = 0;
   virtual LOperand* result() = 0;

-  virtual int InputCount() = 0;
-  virtual LOperand* InputAt(int i) = 0;
   virtual int TempCount() = 0;
   virtual LOperand* TempAt(int i) = 0;

@@ -269,6 +267,11 @@
 #endif

  private:
+  // Iterator interface.
+  friend class InputIterator;
+  virtual int InputCount() = 0;
+  virtual LOperand* InputAt(int i) = 0;
+
   LEnvironment* environment_;
   SetOncePointer<LPointerMap> pointer_map_;
   HValue* hydrogen_value_;
@@ -289,7 +292,6 @@
   void set_result(LOperand* operand) { results_[0] = operand; }
   LOperand* result() { return results_[0]; }

-  int InputCount() { return I; }
   LOperand* InputAt(int i) { return inputs_[i]; }

   int TempCount() { return T; }
@@ -299,6 +301,9 @@
   EmbeddedContainer<LOperand*, R> results_;
   EmbeddedContainer<LOperand*, I> inputs_;
   EmbeddedContainer<LOperand*, T> temps_;
+
+ private:
+  virtual int InputCount() { return I; }
 };


=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h       Wed Aug 22 08:44:17 2012
+++ /branches/bleeding_edge/src/x64/lithium-x64.h       Mon Aug 27 02:39:05 2012
@@ -261,8 +261,6 @@
   virtual bool HasResult() const = 0;
   virtual LOperand* result() = 0;

-  virtual int InputCount() = 0;
-  virtual LOperand* InputAt(int i) = 0;
   virtual int TempCount() = 0;
   virtual LOperand* TempAt(int i) = 0;

@@ -274,6 +272,11 @@
 #endif

  private:
+  // Iterator support.
+  friend class InputIterator;
+  virtual int InputCount() = 0;
+  virtual LOperand* InputAt(int i) = 0;
+
   LEnvironment* environment_;
   SetOncePointer<LPointerMap> pointer_map_;
   HValue* hydrogen_value_;
@@ -293,7 +296,6 @@
   void set_result(LOperand* operand) { results_[0] = operand; }
   LOperand* result() { return results_[0]; }

-  int InputCount() { return I; }
   LOperand* InputAt(int i) { return inputs_[i]; }

   int TempCount() { return T; }
@@ -303,6 +305,9 @@
   EmbeddedContainer<LOperand*, R> results_;
   EmbeddedContainer<LOperand*, I> inputs_;
   EmbeddedContainer<LOperand*, T> temps_;
+
+ private:
+  virtual int InputCount() { return I; }
 };


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to