Reviewers: Michael Starzinger,

Description:
[turbofan] Rename IrOpcode predicate IsLeafOpcode to IsConstantOpcode.

[email protected]
BUG=

Please review this at https://codereview.chromium.org/863513002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+20, -20 lines):
  M src/compiler/js-typed-lowering.cc
  M src/compiler/opcodes.h
  M test/unittests/compiler/opcodes-unittest.cc


Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc index 56ffc5f715c27ed97c002bf5f06558beb405ed7a..da47c5f8bfbfe5a4144df336d16d5787b790685d 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -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: src/compiler/opcodes.h
diff --git a/src/compiler/opcodes.h b/src/compiler/opcodes.h
index fa85974c0136e2ff46b8dcb2007efc75bfed89b3..651c37b05b2dde28f5ddfbfead98d8c3d39e02fd 100644
--- a/src/compiler/opcodes.h
+++ b/src/compiler/opcodes.h
@@ -24,14 +24,14 @@
   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: test/unittests/compiler/opcodes-unittest.cc
diff --git a/test/unittests/compiler/opcodes-unittest.cc b/test/unittests/compiler/opcodes-unittest.cc index 2a278be0c951012ba60c4b388420fd8009ccbfd7..ca79e8ac8b6e33099d5d18e5f386ecc5ecb72db3 100644
--- a/test/unittests/compiler/opcodes-unittest.cc
+++ b/test/unittests/compiler/opcodes-unittest.cc
@@ -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
 }


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