Flutter Engine
The Flutter Engine
Static Public Member Functions | List of all members
dart::CheckStackOverflowElimination Class Reference

#include <redundancy_elimination.h>

Inheritance diagram for dart::CheckStackOverflowElimination:
dart::AllStatic

Static Public Member Functions

static void EliminateStackOverflow (FlowGraph *graph)
 

Detailed Description

Definition at line 163 of file redundancy_elimination.h.

Member Function Documentation

◆ EliminateStackOverflow()

void dart::CheckStackOverflowElimination::EliminateStackOverflow ( FlowGraph graph)
static

Definition at line 4574 of file redundancy_elimination.cc.

4574 {
4575 const bool should_remove_all = IsMarkedWithNoInterrupts(graph->function());
4576 if (should_remove_all) {
4577 for (auto entry : graph->reverse_postorder()) {
4578 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
4579 if (it.Current()->IsCheckStackOverflow()) {
4580 it.RemoveCurrentFromGraph();
4581 }
4582 }
4583 }
4584 return;
4585 }
4586
4587 CheckStackOverflowInstr* first_stack_overflow_instr = nullptr;
4588 for (auto entry : graph->reverse_postorder()) {
4589 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
4590 Instruction* current = it.Current();
4591
4592 if (CheckStackOverflowInstr* instr = current->AsCheckStackOverflow()) {
4593 if (first_stack_overflow_instr == nullptr) {
4594 first_stack_overflow_instr = instr;
4595 ASSERT(!first_stack_overflow_instr->in_loop());
4596 }
4597 continue;
4598 }
4599
4600 if (current->IsBranch()) {
4601 current = current->AsBranch()->comparison();
4602 }
4603
4604 if (current->HasUnknownSideEffects()) {
4605 return;
4606 }
4607 }
4608 }
4609
4610 if (first_stack_overflow_instr != nullptr) {
4611 first_stack_overflow_instr->RemoveFromGraph();
4612 }
4613}
#define ASSERT(E)
static bool IsMarkedWithNoInterrupts(const Function &function)

The documentation for this class was generated from the following files: