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

Unified Diff: src/compiler/verifier.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/simplified-lowering.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/verifier.cc
diff --git a/src/compiler/verifier.cc b/src/compiler/verifier.cc
index 1cc8c9f32e7011c67b4d2f452c6fe0e6f1c3f640..26fd6933c631acddb27311355b3317079ab05983 100644
--- a/src/compiler/verifier.cc
+++ b/src/compiler/verifier.cc
@@ -216,7 +216,8 @@ void Verifier::Visitor::Check(Node* node) {
if (use->opcode() == IrOpcode::kIfTrue) ++count_true;
if (use->opcode() == IrOpcode::kIfFalse) ++count_false;
}
- CHECK(count_true == 1 && count_false == 1);
+ CHECK_EQ(1, count_true);
+ CHECK_EQ(1, count_false);
// Type is empty.
CheckNotTyped(node);
break;
@@ -229,21 +230,39 @@ void Verifier::Visitor::Check(Node* node) {
CheckNotTyped(node);
break;
case IrOpcode::kSwitch: {
- // Switch uses are Case.
- std::vector<bool> uses;
- uses.resize(node->UseCount());
+ // Switch uses are Case and Default.
+ int count_case = 0, count_default = 0;
for (auto use : node->uses()) {
- CHECK_EQ(IrOpcode::kCase, use->opcode());
- size_t const index = CaseIndexOf(use->op());
- CHECK_LT(index, uses.size());
- CHECK(!uses[index]);
- uses[index] = true;
+ switch (use->opcode()) {
+ case IrOpcode::kIfValue: {
+ for (auto user : node->uses()) {
+ if (user != use && user->opcode() == IrOpcode::kIfValue) {
+ CHECK_NE(OpParameter<int32_t>(use->op()),
+ OpParameter<int32_t>(user->op()));
+ }
+ }
+ ++count_case;
+ break;
+ }
+ case IrOpcode::kIfDefault: {
+ ++count_default;
+ break;
+ }
+ default: {
+ UNREACHABLE();
+ break;
+ }
+ }
}
+ CHECK_LE(1, count_case);
+ CHECK_EQ(1, count_default);
+ CHECK_EQ(node->op()->ControlOutputCount(), count_case + count_default);
// Type is empty.
CheckNotTyped(node);
break;
}
- case IrOpcode::kCase:
+ case IrOpcode::kIfValue:
+ case IrOpcode::kIfDefault:
CHECK_EQ(IrOpcode::kSwitch,
NodeProperties::GetControlInput(node)->opcode());
// Type is empty.
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698