[turbofan] Rename IrOpcode predicate IsLeafOpcode to IsConstantOpcode.
authorBen L. Titzer <titzer@chromium.org>
Mon, 19 Jan 2015 15:35:03 +0000 (16:35 +0100)
committerBen L. Titzer <titzer@chromium.org>
Mon, 19 Jan 2015 15:35:16 +0000 (15:35 +0000)
R=mstarzinger@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#26141}

src/compiler/js-typed-lowering.cc
src/compiler/opcodes.h
test/unittests/compiler/opcodes-unittest.cc

index 56ffc5f..da47c5f 100644 (file)
@@ -858,8 +858,8 @@ Reduction JSTypedLowering::ReduceJSStoreContext(Node* node) {
 Reduction JSTypedLowering::Reduce(Node* node) {
   // Check if the output type is a singleton.  In that case we already know the
   // result value and can simply replace the node if it's eliminable.
-  if (NodeProperties::IsTyped(node) &&
-      !IrOpcode::IsLeafOpcode(node->opcode()) &&
+  if (!IrOpcode::IsConstantOpcode(node->opcode()) &&
+      NodeProperties::IsTyped(node) &&
       node->op()->HasProperty(Operator::kEliminatable)) {
     Type* upper = NodeProperties::GetBounds(node).upper;
     if (upper->IsConstant()) {
index fa85974..651c37b 100644 (file)
   V(Start)                 \
   V(End)
 
-// Opcodes for common operators.
-#define LEAF_OP_LIST(V) \
-  V(Int32Constant)      \
-  V(Int64Constant)      \
-  V(Float32Constant)    \
-  V(Float64Constant)    \
-  V(ExternalConstant)   \
-  V(NumberConstant)     \
+// Opcodes for constant operators.
+#define CONSTANT_OP_LIST(V) \
+  V(Int32Constant)          \
+  V(Int64Constant)          \
+  V(Float32Constant)        \
+  V(Float64Constant)        \
+  V(ExternalConstant)       \
+  V(NumberConstant)         \
   V(HeapConstant)
 
 #define INNER_OP_LIST(V) \
@@ -48,7 +48,7 @@
   V(Projection)
 
 #define COMMON_OP_LIST(V) \
-  LEAF_OP_LIST(V)         \
+  CONSTANT_OP_LIST(V)     \
   INNER_OP_LIST(V)
 
 // Opcodes for JavaScript operators.
@@ -290,8 +290,8 @@ class IrOpcode {
     return kJSEqual <= value && value <= kJSDebugger;
   }
 
-  // Returns true if opcode for leaf operator.
-  static bool IsLeafOpcode(Value value) {
+  // Returns true if opcode for constant operator.
+  static bool IsConstantOpcode(Value value) {
     return kInt32Constant <= value && value <= kHeapConstant;
   }
 };
index 2a278be..ca79e8a 100644 (file)
@@ -51,12 +51,12 @@ bool IsJsOpcode(IrOpcode::Value opcode) {
 }
 
 
-bool IsLeafOpcode(IrOpcode::Value opcode) {
+bool IsConstantOpcode(IrOpcode::Value opcode) {
   switch (opcode) {
 #define OPCODE(Opcode)      \
   case IrOpcode::k##Opcode: \
     return true;
-    LEAF_OP_LIST(OPCODE)
+    CONSTANT_OP_LIST(OPCODE)
 #undef OPCODE
     default:
       return false;
@@ -99,11 +99,11 @@ TEST(IrOpcodeTest, IsJsOpcode) {
 }
 
 
-TEST(IrOpcodeTest, IsLeafOpcode) {
-  EXPECT_FALSE(IrOpcode::IsLeafOpcode(kInvalidOpcode));
-#define OPCODE(Opcode)                         \
-  EXPECT_EQ(IsLeafOpcode(IrOpcode::k##Opcode), \
-            IrOpcode::IsLeafOpcode(IrOpcode::k##Opcode));
+TEST(IrOpcodeTest, IsConstantOpcode) {
+  EXPECT_FALSE(IrOpcode::IsConstantOpcode(kInvalidOpcode));
+#define OPCODE(Opcode)                             \
+  EXPECT_EQ(IsConstantOpcode(IrOpcode::k##Opcode), \
+            IrOpcode::IsConstantOpcode(IrOpcode::k##Opcode));
   ALL_OP_LIST(OPCODE)
 #undef OPCODE
 }