Revision: 7663
Author:   [email protected]
Date:     Tue Apr 19 06:43:36 2011
Log:      Revert r7662.
Review URL: http://codereview.chromium.org/6878042
http://code.google.com/p/v8/source/detail?r=7663

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

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h       Tue Apr 19 05:34:07 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.h       Tue Apr 19 06:43:36 2011
@@ -39,6 +39,12 @@
 // Forward declarations.
 class LCodeGen;

+#define LITHIUM_ALL_INSTRUCTION_LIST(V)         \
+  V(ControlInstruction)                         \
+  V(Call)                                       \
+  LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
+
+
 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V)    \
   V(AccessArgumentsAt)                          \
   V(AddI)                                       \
@@ -165,14 +171,18 @@
   V(ValueOf)


-#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic)              \
-  virtual Opcode opcode() const { return LInstruction::k##type; } \
-  virtual void CompileToNative(LCodeGen* generator);              \
-  virtual const char* Mnemonic() const { return mnemonic; }       \
-  static L##type* cast(LInstruction* instr) {                     \
-    ASSERT(instr->Is##type());                                    \
-    return reinterpret_cast<L##type*>(instr);                     \
-  }
+#define DECLARE_INSTRUCTION(type)                \
+  virtual bool Is##type() const { return true; } \
+  static L##type* cast(LInstruction* instr) {    \
+    ASSERT(instr->Is##type());                   \
+    return reinterpret_cast<L##type*>(instr);    \
+  }
+
+
+#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic)        \
+  virtual void CompileToNative(LCodeGen* generator);        \
+  virtual const char* Mnemonic() const { return mnemonic; } \
+  DECLARE_INSTRUCTION(type)


 #define DECLARE_HYDROGEN_ACCESSOR(type)     \
@@ -196,21 +206,10 @@
   virtual void PrintDataTo(StringStream* stream) = 0;
   virtual void PrintOutputOperandTo(StringStream* stream) = 0;

-  enum Opcode {
-    // Declare a unique enum value for each instruction.
-  #define DECLARE_OPCODE(type) k##type,
-    LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
-    kNumberOfInstructions
-  #undef DECLARE_OPCODE
-  };
-
-  virtual Opcode opcode() const = 0;
-
   // Declare virtual type testers.
-#define DECLARE_PREDICATE(type) \
-  bool Is##type() const { return opcode() == k##type; }
-  LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
-#undef DECLARE_PREDICATE
+#define DECLARE_DO(type) virtual bool Is##type() const { return false; }
+  LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
+#undef DECLARE_DO

   virtual bool IsControl() const { return false; }
   virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
@@ -456,6 +455,7 @@
 template<int I, int T>
 class LControlInstruction: public LTemplateInstruction<0, I, T> {
  public:
+  DECLARE_INSTRUCTION(ControlInstruction)
   virtual bool IsControl() const { return true; }

   int true_block_id() const { return true_block_id_; }
@@ -1106,7 +1106,6 @@

   Token::Value op() const { return op_; }

-  virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
   virtual void CompileToNative(LCodeGen* generator);
   virtual const char* Mnemonic() const;

@@ -1123,7 +1122,6 @@
     inputs_[1] = right;
   }

-  virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
   virtual void CompileToNative(LCodeGen* generator);
   virtual const char* Mnemonic() const;

@@ -2211,6 +2209,7 @@
 };

 #undef DECLARE_HYDROGEN_ACCESSOR
+#undef DECLARE_INSTRUCTION
 #undef DECLARE_CONCRETE_INSTRUCTION

 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h     Tue Apr 19 05:34:07 2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h     Tue Apr 19 06:43:36 2011
@@ -39,6 +39,13 @@
 // Forward declarations.
 class LCodeGen;

+
+#define LITHIUM_ALL_INSTRUCTION_LIST(V)         \
+  V(ControlInstruction)                         \
+  V(Call)                                       \
+  LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
+
+
 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V)    \
   V(AccessArgumentsAt)                          \
   V(AddI)                                       \
@@ -165,14 +172,18 @@
   V(ValueOf)


-#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic)              \
-  virtual Opcode opcode() const { return LInstruction::k##type; } \
-  virtual void CompileToNative(LCodeGen* generator);              \
-  virtual const char* Mnemonic() const { return mnemonic; }       \
-  static L##type* cast(LInstruction* instr) {                     \
-    ASSERT(instr->Is##type());                                    \
-    return reinterpret_cast<L##type*>(instr);                     \
-  }
+#define DECLARE_INSTRUCTION(type)                \
+  virtual bool Is##type() const { return true; } \
+  static L##type* cast(LInstruction* instr) {    \
+    ASSERT(instr->Is##type());                   \
+    return reinterpret_cast<L##type*>(instr);    \
+  }
+
+
+#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic)        \
+  virtual void CompileToNative(LCodeGen* generator);        \
+  virtual const char* Mnemonic() const { return mnemonic; } \
+  DECLARE_INSTRUCTION(type)


 #define DECLARE_HYDROGEN_ACCESSOR(type)     \
@@ -196,21 +207,10 @@
   virtual void PrintDataTo(StringStream* stream) = 0;
   virtual void PrintOutputOperandTo(StringStream* stream) = 0;

-  enum Opcode {
-    // Declare a unique enum value for each instruction.
-  #define DECLARE_OPCODE(type) k##type,
-    LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
-    kNumberOfInstructions
-  #undef DECLARE_OPCODE
-  };
-
-  virtual Opcode opcode() const = 0;
-
   // Declare virtual type testers.
-#define DECLARE_PREDICATE(type) \
-  bool Is##type() const { return opcode() == k##type; }
-  LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
-#undef DECLARE_PREDICATE
+#define DECLARE_DO(type) virtual bool Is##type() const { return false; }
+  LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
+#undef DECLARE_DO

   virtual bool IsControl() const { return false; }
   virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
@@ -463,6 +463,7 @@
 template<int I, int T>
 class LControlInstruction: public LTemplateInstruction<0, I, T> {
  public:
+  DECLARE_INSTRUCTION(ControlInstruction)
   virtual bool IsControl() const { return true; }

   int true_block_id() const { return true_block_id_; }
@@ -1132,7 +1133,6 @@

   Token::Value op() const { return op_; }

-  virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
   virtual void CompileToNative(LCodeGen* generator);
   virtual const char* Mnemonic() const;

@@ -1149,7 +1149,6 @@
     inputs_[1] = right;
   }

-  virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
   virtual void CompileToNative(LCodeGen* generator);
   virtual const char* Mnemonic() const;

@@ -2269,6 +2268,7 @@
 };

 #undef DECLARE_HYDROGEN_ACCESSOR
+#undef DECLARE_INSTRUCTION
 #undef DECLARE_CONCRETE_INSTRUCTION

 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h       Tue Apr 19 05:34:07 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.h       Tue Apr 19 06:43:36 2011
@@ -39,6 +39,12 @@
 // Forward declarations.
 class LCodeGen;

+#define LITHIUM_ALL_INSTRUCTION_LIST(V)         \
+  V(ControlInstruction)                         \
+  V(Call)                                       \
+  LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
+
+
 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V)    \
   V(AccessArgumentsAt)                          \
   V(AddI)                                       \
@@ -165,14 +171,18 @@
   V(ValueOf)


-#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic)              \
-  virtual Opcode opcode() const { return LInstruction::k##type; } \
-  virtual void CompileToNative(LCodeGen* generator);              \
-  virtual const char* Mnemonic() const { return mnemonic; }       \
-  static L##type* cast(LInstruction* instr) {                     \
-    ASSERT(instr->Is##type());                                    \
-    return reinterpret_cast<L##type*>(instr);                     \
-  }
+#define DECLARE_INSTRUCTION(type)                \
+  virtual bool Is##type() const { return true; } \
+  static L##type* cast(LInstruction* instr) {    \
+    ASSERT(instr->Is##type());                   \
+    return reinterpret_cast<L##type*>(instr);    \
+  }
+
+
+#define DECLARE_CONCRETE_INSTRUCTION(type, mnemonic)        \
+  virtual void CompileToNative(LCodeGen* generator);        \
+  virtual const char* Mnemonic() const { return mnemonic; } \
+  DECLARE_INSTRUCTION(type)


 #define DECLARE_HYDROGEN_ACCESSOR(type)     \
@@ -197,21 +207,10 @@
   virtual void PrintDataTo(StringStream* stream) = 0;
   virtual void PrintOutputOperandTo(StringStream* stream) = 0;

-  enum Opcode {
-    // Declare a unique enum value for each instruction.
-  #define DECLARE_OPCODE(type) k##type,
-    LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
-    kNumberOfInstructions
-  #undef DECLARE_OPCODE
-  };
-
-  virtual Opcode opcode() const = 0;
-
   // Declare virtual type testers.
-#define DECLARE_PREDICATE(type) \
-  bool Is##type() const { return opcode() == k##type; }
-  LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_PREDICATE)
-#undef DECLARE_PREDICATE
+#define DECLARE_DO(type) virtual bool Is##type() const { return false; }
+  LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
+#undef DECLARE_DO

   virtual bool IsControl() const { return false; }
   virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
@@ -457,6 +456,7 @@
 template<int I, int T>
 class LControlInstruction: public LTemplateInstruction<0, I, T> {
  public:
+  DECLARE_INSTRUCTION(ControlInstruction)
   virtual bool IsControl() const { return true; }

   int true_block_id() const { return true_block_id_; }
@@ -1092,7 +1092,6 @@

   Token::Value op() const { return op_; }

-  virtual Opcode opcode() const { return LInstruction::kArithmeticD; }
   virtual void CompileToNative(LCodeGen* generator);
   virtual const char* Mnemonic() const;

@@ -1109,7 +1108,6 @@
     inputs_[1] = right;
   }

-  virtual Opcode opcode() const { return LInstruction::kArithmeticT; }
   virtual void CompileToNative(LCodeGen* generator);
   virtual const char* Mnemonic() const;

@@ -2193,6 +2191,7 @@
 };

 #undef DECLARE_HYDROGEN_ACCESSOR
+#undef DECLARE_INSTRUCTION
 #undef DECLARE_CONCRETE_INSTRUCTION

 } }  // namespace v8::int

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

Reply via email to