Disable all code motion on the final optimization attempt.
Before, we disabled code motion for check instructions on the final optimization attempt. It is unsafe to prevent movement of check instructions but to allow movement of instructions that assume the checks were performed. Review URL: http://codereview.chromium.org/6378012 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6485 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
26a8dc3818
commit
97f09782fa
@ -684,7 +684,7 @@ HGraph::HGraph(CompilationInfo* info)
|
||||
}
|
||||
|
||||
|
||||
bool HGraph::AllowAggressiveOptimizations() const {
|
||||
bool HGraph::AllowCodeMotion() const {
|
||||
return info()->shared_info()->opt_count() + 1 < Compiler::kDefaultMaxOptCount;
|
||||
}
|
||||
|
||||
@ -1446,19 +1446,23 @@ void HGlobalValueNumberer::ProcessLoopBlock(HBasicBlock* block,
|
||||
}
|
||||
}
|
||||
|
||||
// Only move instructions that postdominate the loop header (i.e. are
|
||||
// always executed inside the loop). This is to avoid unnecessary
|
||||
// deoptimizations assuming the loop is executed at least once.
|
||||
// TODO(fschneider): Better type feedback should give us information
|
||||
// about code that was never executed.
|
||||
|
||||
bool HGlobalValueNumberer::ShouldMove(HInstruction* instr,
|
||||
HBasicBlock* loop_header) {
|
||||
if (FLAG_aggressive_loop_invariant_motion &&
|
||||
!instr->IsChange() &&
|
||||
(!instr->IsCheckInstruction() ||
|
||||
graph_->AllowAggressiveOptimizations())) {
|
||||
// If we've disabled code motion, don't move any instructions.
|
||||
if (!graph_->AllowCodeMotion()) return false;
|
||||
|
||||
// If --aggressive-loop-invariant-motion, move everything except change
|
||||
// instructions.
|
||||
if (FLAG_aggressive_loop_invariant_motion && !instr->IsChange()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise only move instructions that postdominate the loop header
|
||||
// (i.e. are always executed inside the loop). This is to avoid
|
||||
// unnecessary deoptimizations assuming the loop is executed at least
|
||||
// once. TODO(fschneider): Better type feedback should give us
|
||||
// information about code that was never executed.
|
||||
HBasicBlock* block = instr->block();
|
||||
bool result = true;
|
||||
if (block != loop_header) {
|
||||
|
@ -297,7 +297,7 @@ class HGraph: public HSubgraph {
|
||||
|
||||
CompilationInfo* info() const { return info_; }
|
||||
|
||||
bool AllowAggressiveOptimizations() const;
|
||||
bool AllowCodeMotion() const;
|
||||
|
||||
const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
|
||||
const ZoneList<HPhi*>* phi_list() const { return phi_list_; }
|
||||
|
Loading…
Reference in New Issue
Block a user