Commit ffca7c03 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Fix reduction result for branches in generic lowering.

R=bmeurer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#25547}
parent 0b6773fa
......@@ -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);
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment