Reviewers: jarin,

Description:
[turbofan] Eliminatable JS/call nodes should not have a control input.

The control input is only relevant for operations that may "write" (to
prevent hoisting) or "throw" (because they are part of the control chain).

[email protected]

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

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

Affected files (+8, -4 lines):
  M src/compiler/common-operator.cc
  M src/compiler/js-operator.cc
  M src/compiler/operator.h
  M test/unittests/compiler/js-operator-unittest.cc


Index: src/compiler/common-operator.cc
diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc index 27a9d63f48626cc7339faf202c25f534c35d612e..6cc124909a4c69e8829be47dfac6b461c2da5902 100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -623,7 +623,7 @@ const Operator* CommonOperatorBuilder::Call(const CallDescriptor* descriptor) {
               IrOpcode::kCall, descriptor->properties(), mnemonic,
               descriptor->InputCount() + descriptor->FrameStateCount(),
               Operator::ZeroIfPure(descriptor->properties()),
-              Operator::ZeroIfPure(descriptor->properties()),
+              Operator::ZeroIfEliminatable(descriptor->properties()),
               descriptor->ReturnCount(),
               Operator::ZeroIfPure(descriptor->properties()),
Operator::ZeroIfNoThrow(descriptor->properties()), descriptor) {}
Index: src/compiler/js-operator.cc
diff --git a/src/compiler/js-operator.cc b/src/compiler/js-operator.cc
index bc0e61f8bbdf607e0a342cdee82f4306921fa8a4..6e7ee07504b352fd67b9f6d63678f3c6d070408b 100644
--- a/src/compiler/js-operator.cc
+++ b/src/compiler/js-operator.cc
@@ -254,8 +254,8 @@ struct JSOperatorGlobalCache FINAL {
     Name##Operator()                                                     \
         : Operator(IrOpcode::kJS##Name, properties, "JS" #Name,          \
                    value_input_count, Operator::ZeroIfPure(properties),  \
-                   Operator::ZeroIfPure(properties), value_output_count, \
-                   Operator::ZeroIfPure(properties),                     \
+                   Operator::ZeroIfEliminatable(properties),             \
+                   value_output_count, Operator::ZeroIfPure(properties), \
                    Operator::ZeroIfNoThrow(properties)) {}               \
   };                                                                     \
   Name##Operator k##Name##Operator;
Index: src/compiler/operator.h
diff --git a/src/compiler/operator.h b/src/compiler/operator.h
index 114cf6aff577d02a8cea2740c4ef13ca70468fac..ec365fab6f963bcce60a023f4674d3fefbd2efbb 100644
--- a/src/compiler/operator.h
+++ b/src/compiler/operator.h
@@ -97,6 +97,10 @@ class Operator : public ZoneObject {
   int EffectOutputCount() const { return effect_out_; }
   int ControlOutputCount() const { return control_out_; }

+  static size_t ZeroIfEliminatable(Properties properties) {
+    return (properties & kEliminatable) == kEliminatable ? 0 : 1;
+  }
+
   static size_t ZeroIfNoThrow(Properties properties) {
     return (properties & kNoThrow) == kNoThrow ? 0 : 2;
   }
Index: test/unittests/compiler/js-operator-unittest.cc
diff --git a/test/unittests/compiler/js-operator-unittest.cc b/test/unittests/compiler/js-operator-unittest.cc index f8ef7fbbb223516e1ac35a27991c5cff98002aba..14939edcd33139eabd986e193cf7b50c17ebce63 100644
--- a/test/unittests/compiler/js-operator-unittest.cc
+++ b/test/unittests/compiler/js-operator-unittest.cc
@@ -73,7 +73,7 @@ const SharedOperator kSharedOperators[] = {
     SHARED(ToName, Operator::kNoProperties, 1, 1, 1, 1, 1, 1, 2),
     SHARED(ToObject, Operator::kNoProperties, 1, 1, 1, 1, 1, 1, 2),
     SHARED(Yield, Operator::kNoProperties, 1, 0, 1, 1, 1, 1, 2),
-    SHARED(Create, Operator::kEliminatable, 0, 0, 1, 1, 1, 1, 0),
+    SHARED(Create, Operator::kEliminatable, 0, 0, 1, 0, 1, 1, 0),
     SHARED(HasProperty, Operator::kNoProperties, 2, 1, 1, 1, 1, 1, 2),
     SHARED(TypeOf, Operator::kPure, 1, 0, 0, 0, 1, 0, 0),
     SHARED(InstanceOf, Operator::kNoProperties, 2, 1, 1, 1, 1, 1, 2),


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