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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 10802025: Fuse compare with branch at graph building time. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_optimizer.cc
===================================================================
--- runtime/vm/flow_graph_optimizer.cc (revision 9761)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -491,45 +491,6 @@
}
-static void TryFuseComparisonWithBranch(BindInstr* instr,
- ComparisonComp* comp) {
- Instruction* next_instr = instr->next();
- if ((next_instr != NULL) && next_instr->IsBranch()) {
- BranchInstr* branch = next_instr->AsBranch();
- UseVal* use = branch->value()->AsUse();
- if (instr == use->definition()) {
- comp->MarkFusedWithBranch(branch);
- branch->MarkFusedWithComparison(comp);
-
- // Remove comparison from the graph.
- branch->set_previous(instr->previous());
- instr->previous()->set_next(branch);
- return;
- }
- }
- if ((next_instr != NULL) && next_instr->IsBind()) {
- Computation* next_comp = next_instr->AsBind()->computation();
- if (next_comp->IsBooleanNegate()) {
- Instruction* next_next_instr = next_instr->next();
- if ((next_next_instr != NULL) && next_next_instr->IsBranch()) {
- BooleanNegateComp* negate = next_comp->AsBooleanNegate();
- BranchInstr* branch = next_next_instr->AsBranch();
- if ((branch->value()->AsUse()->definition() == next_instr) &&
- (negate->value()->AsUse()->definition() == instr)) {
- comp->MarkFusedWithBranch(branch);
- branch->MarkFusedWithComparison(comp);
- branch->set_is_negated(true);
- // Remove the comparison and the boolean negation from the graph.
- branch->set_previous(instr->previous());
- instr->previous()->set_next(branch);
- return;
- }
- }
- }
- }
-}
-
-
void FlowGraphOptimizer::VisitRelationalOp(RelationalOpComp* comp,
BindInstr* instr) {
if (!comp->HasICData()) return;
@@ -547,20 +508,9 @@
} else {
return;
}
-
- // For smi and double comparisons if the next instruction is a conditional
- // branch that uses the value of this comparison mark them as fused together
- // to avoid materializing a boolean value.
- TryFuseComparisonWithBranch(instr, comp);
}
-void FlowGraphOptimizer::VisitStrictCompare(StrictCompareComp* comp,
- BindInstr* instr) {
- TryFuseComparisonWithBranch(instr, comp);
-}
-
-
void FlowGraphOptimizer::VisitEqualityCompare(EqualityCompareComp* comp,
BindInstr* instr) {
if (comp->HasICData() && (comp->ic_data()->NumberOfChecks() == 1)) {
@@ -575,7 +525,6 @@
comp->set_receiver_class_id(kDouble);
}
}
- TryFuseComparisonWithBranch(instr, comp);
}
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698