Commit 70a13338 authored by titzer's avatar titzer Committed by Commit bot

[turbofan] Remove case_count >= 3 limit for switch.

R=bmeurer@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#32082}
parent e5ea13e2
...@@ -462,7 +462,6 @@ const Operator* CommonOperatorBuilder::IfException(IfExceptionHint hint) { ...@@ -462,7 +462,6 @@ const Operator* CommonOperatorBuilder::IfException(IfExceptionHint hint) {
const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) { const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) {
DCHECK_GE(control_output_count, 3u); // Disallow trivial switches.
return new (zone()) Operator( // -- return new (zone()) Operator( // --
IrOpcode::kSwitch, Operator::kKontrol, // opcode IrOpcode::kSwitch, Operator::kKontrol, // opcode
"Switch", // name "Switch", // name
......
...@@ -593,7 +593,6 @@ void InstructionSelector::VisitControl(BasicBlock* block) { ...@@ -593,7 +593,6 @@ void InstructionSelector::VisitControl(BasicBlock* block) {
DCHECK_EQ(IrOpcode::kIfDefault, sw.default_branch->front()->opcode()); DCHECK_EQ(IrOpcode::kIfDefault, sw.default_branch->front()->opcode());
// All other successors must be cases. // All other successors must be cases.
sw.case_count = block->SuccessorCount() - 1; sw.case_count = block->SuccessorCount() - 1;
DCHECK_LE(1u, sw.case_count);
sw.case_branches = &block->successors().front(); sw.case_branches = &block->successors().front();
// Determine case values and their min/max. // Determine case values and their min/max.
sw.case_values = zone()->NewArray<int32_t>(sw.case_count); sw.case_values = zone()->NewArray<int32_t>(sw.case_count);
......
...@@ -250,12 +250,12 @@ void Verifier::Visitor::Check(Node* node) { ...@@ -250,12 +250,12 @@ void Verifier::Visitor::Check(Node* node) {
break; break;
} }
default: { default: {
UNREACHABLE(); V8_Fatal(__FILE__, __LINE__, "Switch #%d illegally used by #%d:%s",
node->id(), use->id(), use->op()->mnemonic());
break; break;
} }
} }
} }
CHECK_LE(1, count_case);
CHECK_EQ(1, count_default); CHECK_EQ(1, count_default);
CHECK_EQ(node->op()->ControlOutputCount(), count_case + count_default); CHECK_EQ(node->op()->ControlOutputCount(), count_case + count_default);
// Type is empty. // Type is empty.
......
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