Index: src/compiler/js-generic-lowering.cc |
diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc |
index c16aa82bafaad8e3af459df12a8099a7d08a8b61..11979ec6edc9ea800980354a4ca70521fe7bddaa 100644 |
--- a/src/compiler/js-generic-lowering.cc |
+++ b/src/compiler/js-generic-lowering.cc |
@@ -64,6 +64,7 @@ Reduction JSGenericLowering::Reduce(Node* node) { |
Lower##x(node); \ |
break; |
DECLARE_CASE(Branch) |
+ DECLARE_CASE(Select) |
JS_OP_LIST(DECLARE_CASE) |
#undef DECLARE_CASE |
default: |
@@ -241,6 +242,23 @@ void JSGenericLowering::LowerBranch(Node* node) { |
} |
+void JSGenericLowering::LowerSelect(Node* node) { |
+ // TODO(bmeurer): This should probably be moved into a separate file. |
+ SelectParameters const& p = SelectParametersOf(node->op()); |
+ Node* branch = graph()->NewNode(common()->Branch(p.hint()), node->InputAt(0), |
+ graph()->start()); |
+ Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
+ Node* vtrue = node->InputAt(1); |
+ Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
+ Node* vfalse = node->InputAt(2); |
+ Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); |
+ node->set_op(common()->Phi(p.type(), 2)); |
+ node->ReplaceInput(0, vtrue); |
+ node->ReplaceInput(1, vfalse); |
+ node->ReplaceInput(2, merge); |
+} |
+ |
+ |
void JSGenericLowering::LowerJSUnaryNot(Node* node) { |
Callable callable = CodeFactory::ToBoolean( |
isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL); |