Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::GraphInfoCollector Class Reference
Inheritance diagram for dart::GraphInfoCollector:
dart::ValueObject

Public Member Functions

 GraphInfoCollector ()
 
void Collect (const FlowGraph &graph)
 
intptr_t call_site_count () const
 
intptr_t instruction_count () const
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 151 of file inliner.cc.

Constructor & Destructor Documentation

◆ GraphInfoCollector()

dart::GraphInfoCollector::GraphInfoCollector ( )
inline

Definition at line 153 of file inliner.cc.

153: call_site_count_(0), instruction_count_(0) {}

Member Function Documentation

◆ call_site_count()

intptr_t dart::GraphInfoCollector::call_site_count ( ) const
inline

Definition at line 214 of file inliner.cc.

214{ return call_site_count_; }

◆ Collect()

void dart::GraphInfoCollector::Collect ( const FlowGraph graph)
inline

Definition at line 155 of file inliner.cc.

155 {
156 call_site_count_ = 0;
157 instruction_count_ = 0;
158 for (BlockIterator block_it = graph.postorder_iterator(); !block_it.Done();
159 block_it.Advance()) {
160 // Skip any blocks from the prologue to make them not count towards the
161 // inlining instruction budget.
162 const intptr_t block_id = block_it.Current()->block_id();
163 if (graph.prologue_info().Contains(block_id)) {
164 continue;
165 }
166
167 for (ForwardInstructionIterator it(block_it.Current()); !it.Done();
168 it.Advance()) {
169 Instruction* current = it.Current();
170 // Don't count instructions that won't generate any code.
171 if (current->IsRedefinition()) {
172 continue;
173 }
174 // UnboxedConstant is often folded into the indexing
175 // instructions (similar to Constant instructions which
176 // belong to initial definitions and not counted here).
177 if (current->IsUnboxedConstant()) {
178 continue;
179 }
180 ++instruction_count_;
181 // Count inputs of certain instructions as if separate MoveArgument
182 // instructions are used for inputs. This is done in order to
183 // preserve inlining behavior and avoid code size growth after
184 // MoveArgument insertion was moved to the end of the
185 // compilation pipeline.
186 if (current->IsAllocateObject()) {
187 instruction_count_ += current->InputCount();
188 } else if (current->ArgumentCount() > 0) {
189 ASSERT(!current->HasMoveArguments());
190 instruction_count_ += current->ArgumentCount();
191 }
192 if (current->IsInstanceCall() || current->IsStaticCall() ||
193 current->IsClosureCall()) {
194 ++call_site_count_;
195 continue;
196 }
197 if (current->IsPolymorphicInstanceCall()) {
198 PolymorphicInstanceCallInstr* call =
199 current->AsPolymorphicInstanceCall();
200 // These checks make sure that the number of call-sites counted does
201 // not change relative to the time when the current set of inlining
202 // parameters was fixed.
203 // TODO(fschneider): Determine new heuristic parameters that avoid
204 // these checks entirely.
205 if (!call->IsSureToCallSingleRecognizedTarget() &&
206 (call->token_kind() != Token::kEQ)) {
207 ++call_site_count_;
208 }
209 }
210 }
211 }
212 }
#define ASSERT(E)
call(args)
Definition dom.py:159

◆ instruction_count()

intptr_t dart::GraphInfoCollector::instruction_count ( ) const
inline

Definition at line 215 of file inliner.cc.

215{ return instruction_count_; }

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