| Index: src/hydrogen-sce.cc
|
| diff --git a/src/hydrogen-escape-analysis.cc b/src/hydrogen-sce.cc
|
| similarity index 63%
|
| copy from src/hydrogen-escape-analysis.cc
|
| copy to src/hydrogen-sce.cc
|
| index e852fb8d6d75d7756df6e4e03399bfb8789d4c76..a6995f647afc00437783f057110c7654a28265c3 100644
|
| --- a/src/hydrogen-escape-analysis.cc
|
| +++ b/src/hydrogen-sce.cc
|
| @@ -25,42 +25,38 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -#include "hydrogen-escape-analysis.h"
|
| +#include "hydrogen-sce.h"
|
| +#include "v8.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
|
|
| -
|
| -void HEscapeAnalysisPhase::CollectIfNoEscapingUses(HInstruction* instr) {
|
| - for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
|
| - HValue* use = it.value();
|
| - if (use->HasEscapingOperandAt(it.index())) {
|
| - if (FLAG_trace_escape_analysis) {
|
| - PrintF("#%d (%s) escapes through #%d (%s) @%d\n", instr->id(),
|
| - instr->Mnemonic(), use->id(), use->Mnemonic(), it.index());
|
| - }
|
| - return;
|
| - }
|
| - }
|
| - if (FLAG_trace_escape_analysis) {
|
| - PrintF("#%d (%s) is being captured\n", instr->id(), instr->Mnemonic());
|
| - }
|
| - captured_.Add(instr, zone());
|
| -}
|
| -
|
| -
|
| -void HEscapeAnalysisPhase::CollectCapturedValues() {
|
| - int block_count = graph()->blocks()->length();
|
| - for (int i = 0; i < block_count; ++i) {
|
| +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);
|
| - for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
|
| - HInstruction* instr = it.Current();
|
| - if (instr->IsAllocate() || instr->IsAllocateObject()) {
|
| - CollectIfNoEscapingUses(instr);
|
| + 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()->IsCall()) {
|
| + 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
|
|
|