Reviewers: Benedikt Meurer,

Description:
Mark some common operator with Property::kNoThrow.

[email protected]
TEST=unittests/CommonOperatorTest

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

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

Affected files (+25, -22 lines):
  M src/compiler/common-operator.cc
  M test/unittests/compiler/common-operator-unittest.cc


Index: src/compiler/common-operator.cc
diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc index 880908952ba4d2f367a1244be2e98196ff286fb5..bd422b7574cbd0fc5399326039aa3311582af76a 100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -118,11 +118,11 @@ size_t ProjectionIndexOf(const Operator* const op) {
 #define CACHED_OP_LIST(V)                                  \
   V(Always, Operator::kPure, 0, 0, 0, 1, 0, 0)             \
   V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1)           \
-  V(End, Operator::kFoldable, 0, 0, 1, 0, 0, 0)            \
-  V(IfTrue, Operator::kFoldable, 0, 0, 1, 0, 0, 1)         \
-  V(IfFalse, Operator::kFoldable, 0, 0, 1, 0, 0, 1)        \
+  V(End, Operator::kPure, 0, 0, 1, 0, 0, 0)                \
+  V(IfTrue, Operator::kPure, 0, 0, 1, 0, 0, 1)             \
+  V(IfFalse, Operator::kPure, 0, 0, 1, 0, 0, 1)            \
   V(Throw, Operator::kFoldable, 1, 1, 1, 0, 0, 1)          \
-  V(Return, Operator::kNoProperties, 1, 1, 1, 0, 0, 1)     \
+  V(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1)          \
   V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \
   V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1)

@@ -171,11 +171,12 @@ struct CommonOperatorGlobalCache FINAL {
   template <BranchHint kBranchHint>
   struct BranchOperator FINAL : public Operator1<BranchHint> {
     BranchOperator()
-        : Operator1<BranchHint>(                       // --
-              IrOpcode::kBranch, Operator::kFoldable,  // opcode
-              "Branch",                                // name
-              1, 0, 1, 0, 0, 2,                        // counts
-              kBranchHint) {}                          // parameter
+        : Operator1<BranchHint>(                         // --
+              IrOpcode::kBranch,                         // opcode
+              Operator::kFoldable | Operator::kNoThrow,  // flags
+              "Branch",                                  // name
+              1, 0, 1, 0, 0, 2,                          // counts
+              kBranchHint) {}                            // parameter
   };
   BranchOperator<BranchHint::kNone> kBranchNoneOperator;
   BranchOperator<BranchHint::kTrue> kBranchTrueOperator;
@@ -184,10 +185,11 @@ struct CommonOperatorGlobalCache FINAL {
   template <size_t kInputCount>
   struct LoopOperator FINAL : public Operator {
     LoopOperator()
-        : Operator(                                  // --
-              IrOpcode::kLoop, Operator::kFoldable,  // opcode
-              "Loop",                                // name
-              0, 0, kInputCount, 0, 0, 1) {}         // counts
+        : Operator(                                      // --
+              IrOpcode::kLoop,                           // opcode
+              Operator::kFoldable | Operator::kNoThrow,  // flags
+              "Loop",                                    // name
+              0, 0, kInputCount, 0, 0, 1) {}             // counts
   };
 #define CACHED_LOOP(input_count) \
   LoopOperator<input_count> kLoop##input_count##Operator;
@@ -197,10 +199,11 @@ struct CommonOperatorGlobalCache FINAL {
   template <size_t kInputCount>
   struct MergeOperator FINAL : public Operator {
     MergeOperator()
-        : Operator(                                   // --
-              IrOpcode::kMerge, Operator::kFoldable,  // opcode
-              "Merge",                                // name
-              0, 0, kInputCount, 0, 0, 1) {}          // counts
+        : Operator(                                      // --
+              IrOpcode::kMerge,                          // opcode
+              Operator::kFoldable | Operator::kNoThrow,  // flags
+              "Merge",                                   // name
+              0, 0, kInputCount, 0, 0, 1) {}             // counts
   };
 #define CACHED_MERGE(input_count) \
   MergeOperator<input_count> kMerge##input_count##Operator;
Index: test/unittests/compiler/common-operator-unittest.cc
diff --git a/test/unittests/compiler/common-operator-unittest.cc b/test/unittests/compiler/common-operator-unittest.cc index 5ebabdc09721933dca7eaa113354e9f3e539ed62..e82c40847b225586036b8ae006bed62a3307bb1e 100644
--- a/test/unittests/compiler/common-operator-unittest.cc
+++ b/test/unittests/compiler/common-operator-unittest.cc
@@ -50,11 +50,11 @@ const SharedOperator kSharedOperators[] = {
   }
     SHARED(Always, Operator::kPure, 0, 0, 0, 1, 0, 0),
     SHARED(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1),
-    SHARED(End, Operator::kFoldable, 0, 0, 1, 0, 0, 0),
-    SHARED(IfTrue, Operator::kFoldable, 0, 0, 1, 0, 0, 1),
-    SHARED(IfFalse, Operator::kFoldable, 0, 0, 1, 0, 0, 1),
+    SHARED(End, Operator::kPure, 0, 0, 1, 0, 0, 0),
+    SHARED(IfTrue, Operator::kPure, 0, 0, 1, 0, 0, 1),
+    SHARED(IfFalse, Operator::kPure, 0, 0, 1, 0, 0, 1),
     SHARED(Throw, Operator::kFoldable, 1, 1, 1, 0, 0, 1),
-    SHARED(Return, Operator::kNoProperties, 1, 1, 1, 0, 0, 1)
+    SHARED(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1)
 #undef SHARED
 };

@@ -170,7 +170,7 @@ TEST_F(CommonOperatorTest, Branch) {
   TRACED_FOREACH(BranchHint, hint, kHints) {
     const Operator* const op = common()->Branch(hint);
     EXPECT_EQ(IrOpcode::kBranch, op->opcode());
-    EXPECT_EQ(Operator::kFoldable, op->properties());
+    EXPECT_EQ(Operator::kFoldable | Operator::kNoThrow, op->properties());
     EXPECT_EQ(hint, BranchHintOf(op));
     EXPECT_EQ(1, op->ValueInputCount());
     EXPECT_EQ(0, op->EffectInputCount());


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