Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 4555 of file redundancy_elimination.cc.

4555 {
4556 const bool should_remove_all = IsMarkedWithNoInterrupts(graph->function());
4557 if (should_remove_all) {
4558 for (auto entry : graph->reverse_postorder()) {
4559 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
4560 if (it.Current()->IsCheckStackOverflow()) {
4561 it.RemoveCurrentFromGraph();
4562 }
4563 }
4564 }
4565 return;
4566 }
4567
4568 CheckStackOverflowInstr* first_stack_overflow_instr = nullptr;
4569 for (auto entry : graph->reverse_postorder()) {
4570 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
4571 Instruction* current = it.Current();
4572
4573 if (CheckStackOverflowInstr* instr = current->AsCheckStackOverflow()) {
4574 if (first_stack_overflow_instr == nullptr) {
4575 first_stack_overflow_instr = instr;
4576 ASSERT(!first_stack_overflow_instr->in_loop());
4577 }
4578 continue;
4579 }
4580
4581 if (current->IsBranch()) {
4582 current = current->AsBranch()->comparison();
4583 }
4584
4585 if (current->HasUnknownSideEffects()) {
4586 return;
4587 }
4588 }
4589 }
4590
4591 if (first_stack_overflow_instr != nullptr) {
4592 first_stack_overflow_instr->RemoveFromGraph();
4593 }
4594}
#define ASSERT(E)
static bool IsMarkedWithNoInterrupts(const Function &function)

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