Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::kernel::SwitchBlock Class Reference

#include <kernel_to_il.h>

Public Member Functions

 SwitchBlock (FlowGraphBuilder *builder, intptr_t case_count)
 
 ~SwitchBlock ()
 
bool HadJumper (intptr_t case_num)
 
JoinEntryInstrDestination (intptr_t target_index, TryFinallyBlock **outer_finally=nullptr, intptr_t *context_depth=nullptr)
 
JoinEntryInstrDestinationDirect (intptr_t case_num, TryFinallyBlock **outer_finally=nullptr, intptr_t *context_depth=nullptr)
 

Detailed Description

Definition at line 687 of file kernel_to_il.h.

Constructor & Destructor Documentation

◆ SwitchBlock()

dart::kernel::SwitchBlock::SwitchBlock ( FlowGraphBuilder builder,
intptr_t  case_count 
)
inline

Definition at line 689 of file kernel_to_il.h.

690 : builder_(builder),
691 outer_(builder->switch_block_),
692 outer_finally_(builder->try_finally_block_),
693 case_count_(case_count),
694 context_depth_(builder->context_depth_),
695 try_index_(builder->CurrentTryIndex()) {
696 builder_->switch_block_ = this;
697 if (outer_ != nullptr) {
698 depth_ = outer_->depth_ + outer_->case_count_;
699 } else {
700 depth_ = 0;
701 }
702 }

◆ ~SwitchBlock()

dart::kernel::SwitchBlock::~SwitchBlock ( )
inline

Definition at line 703 of file kernel_to_il.h.

703{ builder_->switch_block_ = outer_; }

Member Function Documentation

◆ Destination()

JoinEntryInstr * dart::kernel::SwitchBlock::Destination ( intptr_t  target_index,
TryFinallyBlock **  outer_finally = nullptr,
intptr_t *  context_depth = nullptr 
)
inline

Definition at line 711 of file kernel_to_il.h.

713 {
714 // Verify consistency of program state.
715 ASSERT(builder_->switch_block_ == this);
716 // Find corresponding destination.
717 SwitchBlock* block = this;
718 while (block->depth_ > target_index) {
719 block = block->outer_;
720 ASSERT(block != nullptr);
721 }
722
723 // Set the outer finally block.
724 if (outer_finally != nullptr) {
725 *outer_finally = block->outer_finally_;
726 *context_depth = block->context_depth_;
727 }
728
729 // Ensure there's [JoinEntryInstr] for that [SwitchCase].
730 return block->EnsureDestination(target_index - block->depth_);
731 }
SwitchBlock(FlowGraphBuilder *builder, intptr_t case_count)
#define ASSERT(E)

◆ DestinationDirect()

JoinEntryInstr * dart::kernel::SwitchBlock::DestinationDirect ( intptr_t  case_num,
TryFinallyBlock **  outer_finally = nullptr,
intptr_t *  context_depth = nullptr 
)
inline

Definition at line 735 of file kernel_to_il.h.

737 {
738 // Set the outer finally block.
739 if (outer_finally != nullptr) {
740 *outer_finally = outer_finally_;
741 *context_depth = context_depth_;
742 }
743
744 // Ensure there's [JoinEntryInstr] for that [SwitchCase].
745 return EnsureDestination(case_num);
746 }

◆ HadJumper()

bool dart::kernel::SwitchBlock::HadJumper ( intptr_t  case_num)
inline

Definition at line 705 of file kernel_to_il.h.

705 {
706 return destinations_.Lookup(case_num) != nullptr;
707 }

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