Index: src/compiler/scheduler.cc |
diff --git a/src/compiler/scheduler.cc b/src/compiler/scheduler.cc |
index 25bdba4961cc6c79fb39d716859dceccc301dc62..2df99c50fd162c2513905a9743aea8d15e48c438 100644 |
--- a/src/compiler/scheduler.cc |
+++ b/src/compiler/scheduler.cc |
@@ -373,13 +373,17 @@ class CFGBuilder : public ZoneObject { |
} |
// Collect the branch-related projections from a node, such as IfTrue, |
- // IfFalse, and Case. |
+ // IfFalse, Case and Default. |
void CollectSuccessorProjections(Node* node, Node** successors, |
size_t successor_count) { |
#ifdef DEBUG |
DCHECK_EQ(static_cast<int>(successor_count), node->UseCount()); |
std::memset(successors, 0, sizeof(*successors) * successor_count); |
#endif |
+ size_t const kDefaultIndex = successor_count - 1; |
+ size_t const kIfFalseIndex = 1; |
Michael Starzinger
2015/02/17 12:23:35
Can we just inline these values below as it was be
Benedikt Meurer
2015/02/17 12:30:38
Done.
|
+ size_t const kIfTrueIndex = 0; |
+ size_t if_value_index = 0; |
for (Node* const use : node->uses()) { |
size_t index; |
switch (use->opcode()) { |
@@ -388,19 +392,24 @@ class CFGBuilder : public ZoneObject { |
// Fall through. |
case IrOpcode::kIfTrue: |
DCHECK_EQ(IrOpcode::kBranch, node->opcode()); |
- index = 0; |
+ index = kIfTrueIndex; |
break; |
case IrOpcode::kIfFalse: |
DCHECK_EQ(IrOpcode::kBranch, node->opcode()); |
- index = 1; |
+ index = kIfFalseIndex; |
break; |
- case IrOpcode::kCase: |
+ case IrOpcode::kIfValue: |
DCHECK_EQ(IrOpcode::kSwitch, node->opcode()); |
- index = CaseIndexOf(use->op()); |
+ DCHECK_LT(if_value_index, kDefaultIndex); |
+ index = if_value_index++; |
+ break; |
+ case IrOpcode::kIfDefault: |
+ DCHECK_EQ(IrOpcode::kSwitch, node->opcode()); |
+ index = kDefaultIndex; |
break; |
} |
DCHECK_LT(index, successor_count); |
- DCHECK(successors[index] == nullptr); |
+ DCHECK_NULL(successors[index]); |
successors[index] = use; |
} |
#ifdef DEBUG |