56a486c322
- this avoids using relative include paths which are forbidden by the style guide - makes the code more readable since it's clear which header is meant - allows for starting to use checkdeps BUG=none R=jkummerow@chromium.org, danno@chromium.org LOG=n Review URL: https://codereview.chromium.org/304153016 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21625 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
// Copyright 2013 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "src/hydrogen-sce.h"
|
|
#include "src/v8.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
void HStackCheckEliminationPhase::Run() {
|
|
// For each loop block walk the dominator tree from the backwards branch to
|
|
// the loop header. If a call instruction is encountered the backwards branch
|
|
// is dominated by a call and the stack check in the backwards branch can be
|
|
// removed.
|
|
for (int i = 0; i < graph()->blocks()->length(); i++) {
|
|
HBasicBlock* block = graph()->blocks()->at(i);
|
|
if (block->IsLoopHeader()) {
|
|
HBasicBlock* back_edge = block->loop_information()->GetLastBackEdge();
|
|
HBasicBlock* dominator = back_edge;
|
|
while (true) {
|
|
for (HInstructionIterator it(dominator); !it.Done(); it.Advance()) {
|
|
if (it.Current()->HasStackCheck()) {
|
|
block->loop_information()->stack_check()->Eliminate();
|
|
break;
|
|
}
|
|
}
|
|
|
|
// Done when the loop header is processed.
|
|
if (dominator == block) break;
|
|
|
|
// Move up the dominator tree.
|
|
dominator = dominator->dominator();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
} } // namespace v8::internal
|