Fix reduction result for branches in generic lowering.
authormstarzinger <mstarzinger@chromium.org>
Thu, 27 Nov 2014 13:44:27 +0000 (05:44 -0800)
committerCommit bot <commit-bot@chromium.org>
Thu, 27 Nov 2014 13:44:36 +0000 (13:44 +0000)
R=bmeurer@chromium.org

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

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

src/compiler/js-generic-lowering.cc
src/compiler/js-generic-lowering.h

index f9c25c3..a57f5aa 100644 (file)
@@ -60,13 +60,23 @@ Node* JSGenericLowering::ExternalConstant(ExternalReference ref) {
 
 Reduction JSGenericLowering::Reduce(Node* node) {
   switch (node->opcode()) {
-#define DECLARE_CASE(x) \
-  case IrOpcode::k##x:  \
-    Lower##x(node);     \
-    break;
-    DECLARE_CASE(Branch)
+#define DECLARE_CASE(x)  \
+    case IrOpcode::k##x: \
+      Lower##x(node);    \
+      break;
     JS_OP_LIST(DECLARE_CASE)
 #undef DECLARE_CASE
+    case IrOpcode::kBranch:
+      // TODO(mstarzinger): If typing is enabled then simplified lowering will
+      // have inserted the correct ChangeBoolToBit, otherwise we need to perform
+      // poor-man's representation inference here and insert manual change.
+      if (!info()->is_typing_enabled()) {
+        Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0),
+                                      jsgraph()->TrueConstant());
+        node->ReplaceInput(0, test);
+        break;
+      }
+      // Fall-through.
     default:
       // Nothing to see.
       return NoChange();
@@ -230,18 +240,6 @@ void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
 }
 
 
-void JSGenericLowering::LowerBranch(Node* node) {
-  if (!info()->is_typing_enabled()) {
-    // TODO(mstarzinger): If typing is enabled then simplified lowering will
-    // have inserted the correct ChangeBoolToBit, otherwise we need to perform
-    // poor-man's representation inference here and insert manual change.
-    Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0),
-                                  jsgraph()->TrueConstant());
-    node->ReplaceInput(0, test);
-  }
-}
-
-
 void JSGenericLowering::LowerJSUnaryNot(Node* node) {
   Callable callable = CodeFactory::ToBoolean(
       isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
index 63d8e93..60d8ea2 100644 (file)
@@ -33,7 +33,7 @@ class JSGenericLowering : public Reducer {
  protected:
 #define DECLARE_LOWER(x) void Lower##x(Node* node);
   // Dispatched depending on opcode.
-  ALL_OP_LIST(DECLARE_LOWER)
+  JS_OP_LIST(DECLARE_LOWER)
 #undef DECLARE_LOWER
 
   // Helpers to create new constant nodes.