Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: src/compiler/scheduler.cc

Issue 931623002: [turbofan] Optimize certain chains of Branch into a Switch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addrssed comments. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/schedule.h ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/scheduler.cc
diff --git a/src/compiler/scheduler.cc b/src/compiler/scheduler.cc
index 25bdba4961cc6c79fb39d716859dceccc301dc62..a21d650ed318b86623065150027120cdf98f0fc4 100644
--- a/src/compiler/scheduler.cc
+++ b/src/compiler/scheduler.cc
@@ -373,13 +373,14 @@ 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 if_value_index = 0;
for (Node* const use : node->uses()) {
size_t index;
switch (use->opcode()) {
@@ -394,13 +395,18 @@ class CFGBuilder : public ZoneObject {
DCHECK_EQ(IrOpcode::kBranch, node->opcode());
index = 1;
break;
- case IrOpcode::kCase:
+ case IrOpcode::kIfValue:
DCHECK_EQ(IrOpcode::kSwitch, node->opcode());
- index = CaseIndexOf(use->op());
+ index = if_value_index++;
+ break;
+ case IrOpcode::kIfDefault:
+ DCHECK_EQ(IrOpcode::kSwitch, node->opcode());
+ index = successor_count - 1;
break;
}
+ DCHECK_LT(if_value_index, successor_count);
DCHECK_LT(index, successor_count);
- DCHECK(successors[index] == nullptr);
+ DCHECK_NULL(successors[index]);
successors[index] = use;
}
#ifdef DEBUG
« no previous file with comments | « src/compiler/schedule.h ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698