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

Unified Diff: runtime/vm/flow_graph_optimizer.cc

Issue 16844011: Revert r23330 and r23136 because of a bug with loop invariant code motion. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/object.h » ('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 23951)
+++ runtime/vm/flow_graph_optimizer.cc (working copy)
@@ -3432,6 +3432,8 @@
void LICM::Hoist(ForwardInstructionIterator* it,
BlockEntryInstr* pre_header,
Instruction* current) {
+ // TODO(fschneider): Avoid repeated deoptimization when
+ // speculatively hoisting checks.
if (FLAG_trace_optimization) {
OS::Print("Hoisting instruction %s:%"Pd" from B%"Pd" to B%"Pd"\n",
current->DebugName(),
@@ -3487,7 +3489,7 @@
}
// Host CheckSmi instruction and make this phi smi one.
- if (MayHoist(current, pre_header)) Hoist(it, pre_header, current);
+ Hoist(it, pre_header, current);
// Replace value we are checking with phi's input.
current->value()->BindTo(phi->InputAt(non_smi_input)->definition());
@@ -3506,31 +3508,6 @@
}
-bool LICM::MayHoist(Instruction* instr, BlockEntryInstr* pre_header) {
- // TODO(fschneider): Enable hoisting of Assert-instructions
- // if it safe to do.
- if (instr->IsAssertAssignable()) return false;
- if (instr->IsAssertBoolean()) return false;
-
- if (instr->CanDeoptimize()) {
- intptr_t target_deopt_id =
- pre_header->last_instruction()->AsGoto()->GetDeoptId();
- const Function& function = flow_graph_->parsed_function().function();
- const Array& deopt_history = Array::Handle(function.deopt_history());
- if (deopt_history.IsNull()) return true;
-
- Smi& deopt_id = Smi::Handle();
- for (intptr_t i = 0; i < deopt_history.Length(); ++i) {
- deopt_id ^= deopt_history.At(i);
- if (!deopt_id.IsNull() && (deopt_id.Value() == target_deopt_id)) {
- return false;
- }
- }
- }
- return true;
-}
-
-
void LICM::Optimize() {
const ZoneGrowableArray<BlockEntryInstr*>& loop_headers =
flow_graph()->loop_headers();
@@ -3565,7 +3542,11 @@
break;
}
}
- if (inputs_loop_invariant && MayHoist(current, pre_header)) {
+ if (inputs_loop_invariant &&
+ !current->IsAssertAssignable() &&
+ !current->IsAssertBoolean()) {
+ // TODO(fschneider): Enable hoisting of Assert-instructions
+ // if it safe to do.
Hoist(&it, pre_header, current);
} else if (current->IsCheckSmi() &&
current->InputAt(0)->definition()->IsPhi()) {
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698