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

#include <locations.h>

Inheritance diagram for dart::LocationSummary:
dart::ZoneAllocated

Public Types

enum  ContainsCall {
  kNoCall , kCall , kCallCalleeSafe , kCallOnSlowPath ,
  kCallOnSharedSlowPath , kNativeLeafCall
}
 

Public Member Functions

 LocationSummary (Zone *zone, intptr_t input_count, intptr_t temp_count, LocationSummary::ContainsCall contains_call)
 
intptr_t input_count () const
 
Location in (intptr_t index) const
 
Locationin_slot (intptr_t index)
 
void set_in (intptr_t index, Location loc)
 
intptr_t temp_count () const
 
Location temp (intptr_t index) const
 
Locationtemp_slot (intptr_t index)
 
void set_temp (intptr_t index, Location loc)
 
intptr_t output_count () const
 
Location out (intptr_t index) const
 
Locationout_slot (intptr_t index)
 
void set_out (intptr_t index, Location loc)
 
const BitmapBuilderstack_bitmap ()
 
void SetStackBit (intptr_t index)
 
bool always_calls () const
 
bool callee_safe_call () const
 
bool can_call ()
 
bool HasCallOnSlowPath ()
 
bool call_on_shared_slow_path () const
 
bool native_leaf_call () const
 
void PrintTo (BaseTextBuffer *f) const
 
RegisterSetlive_registers ()
 
void Write (FlowGraphSerializer *s) const
 
 LocationSummary (FlowGraphDeserializer *d)
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Static Public Member Functions

static LocationSummaryMake (Zone *zone, intptr_t input_count, Location out, ContainsCall contains_call)
 

Detailed Description

Definition at line 841 of file locations.h.

Member Enumeration Documentation

◆ ContainsCall

Enumerator
kNoCall 
kCall 
kCallCalleeSafe 
kCallOnSlowPath 
kCallOnSharedSlowPath 
kNativeLeafCall 

Definition at line 843 of file locations.h.

843 {
844 // Used registers must be reserved as tmp.
845 kNoCall,
846 // Registers have been saved and can be used without reservation.
847 kCall,
848 // Registers will be saved by the callee.
850 // Used registers must be reserved as tmp.
852 // Registers used to invoke shared stub must be reserved as tmp.
854 // Location is a native leaf call so any register not in the native ABI
855 // callee-save (or input/output/tmp) set might get clobbered.
857 };

Constructor & Destructor Documentation

◆ LocationSummary() [1/2]

dart::LocationSummary::LocationSummary ( Zone zone,
intptr_t  input_count,
intptr_t  temp_count,
LocationSummary::ContainsCall  contains_call 
)

Definition at line 170 of file locations.cc.

174 : num_inputs_(input_count),
175 num_temps_(temp_count),
176 output_location_(), // out(0)->IsInvalid() unless later set.
177 stack_bitmap_(nullptr),
178 contains_call_(contains_call),
179 live_registers_() {
180#if defined(DEBUG)
181 writable_inputs_ = 0;
182#endif
183 input_locations_ = zone->Alloc<Location>(num_inputs_);
184 temp_locations_ = zone->Alloc<Location>(num_temps_);
185}
intptr_t input_count() const
Definition: locations.h:864
intptr_t temp_count() const
Definition: locations.h:880

◆ LocationSummary() [2/2]

dart::LocationSummary::LocationSummary ( FlowGraphDeserializer d)
explicit

Definition at line 1308 of file il_serializer.cc.

1309 : num_inputs_(d->Read<intptr_t>()),
1310 num_temps_(d->Read<intptr_t>()),
1311 output_location_(),
1312 stack_bitmap_(nullptr),
1313 contains_call_(static_cast<ContainsCall>(d->Read<int8_t>())),
1314 live_registers_(d) {
1315 input_locations_ = d->zone()->Alloc<Location>(num_inputs_);
1316 for (intptr_t i = 0; i < num_inputs_; ++i) {
1317 input_locations_[i] = Location::Read(d);
1318 }
1319 temp_locations_ = d->zone()->Alloc<Location>(num_temps_);
1320 for (intptr_t i = 0; i < num_temps_; ++i) {
1321 temp_locations_[i] = Location::Read(d);
1322 }
1323 output_location_ = Location::Read(d);
1324
1325 if (d->Read<int8_t>() != 0) {
1326 EnsureStackBitmap().Read(d->stream());
1327 }
1328
1329#if defined(DEBUG)
1330 writable_inputs_ = d->Read<intptr_t>();
1331#endif
1332}
void Read(ReadStream *stream)
Definition: bitmap.cc:161
static Location Read(FlowGraphDeserializer *d)
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19

Member Function Documentation

◆ always_calls()

bool dart::LocationSummary::always_calls ( ) const
inline

Definition at line 918 of file locations.h.

918 {
919 return contains_call_ == kCall || contains_call_ == kCallCalleeSafe;
920 }

◆ call_on_shared_slow_path()

bool dart::LocationSummary::call_on_shared_slow_path ( ) const
inline

Definition at line 928 of file locations.h.

928 {
929 return contains_call_ == kCallOnSharedSlowPath;
930 }

◆ callee_safe_call()

bool dart::LocationSummary::callee_safe_call ( ) const
inline

Definition at line 922 of file locations.h.

922{ return contains_call_ == kCallCalleeSafe; }

◆ can_call()

bool dart::LocationSummary::can_call ( )
inline

Definition at line 924 of file locations.h.

924{ return contains_call_ != kNoCall; }

◆ HasCallOnSlowPath()

bool dart::LocationSummary::HasCallOnSlowPath ( )
inline

Definition at line 926 of file locations.h.

926{ return can_call() && !always_calls(); }
bool always_calls() const
Definition: locations.h:918

◆ in()

Location dart::LocationSummary::in ( intptr_t  index) const
inline

Definition at line 866 of file locations.h.

866 {
867 ASSERT(index >= 0);
868 ASSERT(index < num_inputs_);
869 return input_locations_[index];
870 }
#define ASSERT(E)

◆ in_slot()

Location * dart::LocationSummary::in_slot ( intptr_t  index)
inline

Definition at line 872 of file locations.h.

872 {
873 ASSERT(index >= 0);
874 ASSERT(index < num_inputs_);
875 return &input_locations_[index];
876 }

◆ input_count()

intptr_t dart::LocationSummary::input_count ( ) const
inline

Definition at line 864 of file locations.h.

864{ return num_inputs_; }

◆ live_registers()

RegisterSet * dart::LocationSummary::live_registers ( )
inline

Definition at line 941 of file locations.h.

941{ return &live_registers_; }

◆ Make()

LocationSummary * dart::LocationSummary::Make ( Zone zone,
intptr_t  input_count,
Location  out,
LocationSummary::ContainsCall  contains_call 
)
static

Definition at line 187 of file locations.cc.

191 {
192 LocationSummary* summary =
193 new (zone) LocationSummary(zone, input_count, 0, contains_call);
194 for (intptr_t i = 0; i < input_count; i++) {
195 summary->set_in(i, Location::RequiresRegister());
196 }
197 summary->set_out(0, out);
198 return summary;
199}
Location out(intptr_t index) const
Definition: locations.h:903
LocationSummary(Zone *zone, intptr_t input_count, intptr_t temp_count, LocationSummary::ContainsCall contains_call)
Definition: locations.cc:170
static Location RequiresRegister()
Definition: locations.h:365

◆ native_leaf_call()

bool dart::LocationSummary::native_leaf_call ( ) const
inline

Definition at line 932 of file locations.h.

932{ return contains_call_ == kNativeLeafCall; }

◆ out()

Location dart::LocationSummary::out ( intptr_t  index) const
inline

Definition at line 903 of file locations.h.

903 {
904 ASSERT(index == 0);
905 return output_location_;
906 }

◆ out_slot()

Location * dart::LocationSummary::out_slot ( intptr_t  index)
inline

Definition at line 908 of file locations.h.

908 {
909 ASSERT(index == 0);
910 return &output_location_;
911 }

◆ output_count()

intptr_t dart::LocationSummary::output_count ( ) const
inline

Definition at line 901 of file locations.h.

901{ return 1; }

◆ PrintTo()

void dart::LocationSummary::PrintTo ( BaseTextBuffer f) const

Definition at line 554 of file locations.cc.

554 {
556 return;
557 }
558 if (input_count() > 0) {
559 f->AddString(" (");
560 for (intptr_t i = 0; i < input_count(); i++) {
561 if (i != 0) f->AddString(", ");
562 in(i).PrintTo(f);
563 }
564 f->AddString(")");
565 }
566
567 if (temp_count() > 0) {
568 f->AddString(" [");
569 for (intptr_t i = 0; i < temp_count(); i++) {
570 if (i != 0) f->AddString(", ");
571 temp(i).PrintTo(f);
572 }
573 f->AddString("]");
574 }
575
576 if (!out(0).IsInvalid()) {
577 f->AddString(" => ");
578 out(0).PrintTo(f);
579 }
580
581 if (always_calls()) f->AddString(" C");
582}
Location temp(intptr_t index) const
Definition: locations.h:882
Location in(intptr_t index) const
Definition: locations.h:866
void PrintTo(BaseTextBuffer *f) const
Definition: locations.cc:420
constexpr bool FLAG_support_il_printer
Definition: flag_list.h:48

◆ set_in()

void dart::LocationSummary::set_in ( intptr_t  index,
Location  loc 
)

Definition at line 205 of file locations.cc.

205 {
206 ASSERT(index >= 0);
207 ASSERT(index < num_inputs_);
208#if defined(DEBUG)
209 // See FlowGraphAllocator::ProcessOneInstruction for explanation of these
210 // restrictions.
211 if (always_calls()) {
212 if (loc.IsUnallocated()) {
213 ASSERT(loc.policy() == Location::kAny ||
214 loc.policy() == Location::kRequiresStack);
215 } else if (loc.IsPairLocation()) {
216 ASSERT(!loc.AsPairLocation()->At(0).IsUnallocated() ||
217 loc.AsPairLocation()->At(0).policy() == Location::kAny ||
218 loc.AsPairLocation()->At(0).policy() == Location::kRequiresStack);
219 ASSERT(!loc.AsPairLocation()->At(1).IsUnallocated() ||
220 loc.AsPairLocation()->At(1).policy() == Location::kAny ||
221 loc.AsPairLocation()->At(1).policy() == Location::kRequiresStack);
222 }
223 if (index == 0 && out(0).IsUnallocated() &&
226 }
227 }
228#endif
229 input_locations_[index] = loc;
230}
static bool ValidOutputForAlwaysCalls(const Location &loc)
Definition: locations.cc:201
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network policy
Definition: switches.h:248

◆ set_out()

void dart::LocationSummary::set_out ( intptr_t  index,
Location  loc 
)

Definition at line 232 of file locations.cc.

232 {
233 ASSERT(index == 0);
235 (loc.IsUnallocated() && loc.policy() == Location::kSameAsFirstInput &&
236 num_inputs_ > 0 && ValidOutputForAlwaysCalls(in(0))));
237 output_location_ = loc;
238}

◆ set_temp()

void dart::LocationSummary::set_temp ( intptr_t  index,
Location  loc 
)
inline

Definition at line 894 of file locations.h.

894 {
895 ASSERT(index >= 0);
896 ASSERT(index < num_temps_);
897 ASSERT(!always_calls() || loc.IsMachineRegister());
898 temp_locations_[index] = loc;
899 }

◆ SetStackBit()

void dart::LocationSummary::SetStackBit ( intptr_t  index)
inline

Definition at line 916 of file locations.h.

916{ EnsureStackBitmap().Set(index, true); }
void Set(intptr_t bit_offset, bool value)
Definition: bitmap.cc:44

◆ stack_bitmap()

const BitmapBuilder & dart::LocationSummary::stack_bitmap ( )
inline

Definition at line 915 of file locations.h.

915{ return EnsureStackBitmap(); }

◆ temp()

Location dart::LocationSummary::temp ( intptr_t  index) const
inline

Definition at line 882 of file locations.h.

882 {
883 ASSERT(index >= 0);
884 ASSERT(index < num_temps_);
885 return temp_locations_[index];
886 }

◆ temp_count()

intptr_t dart::LocationSummary::temp_count ( ) const
inline

Definition at line 880 of file locations.h.

880{ return num_temps_; }

◆ temp_slot()

Location * dart::LocationSummary::temp_slot ( intptr_t  index)
inline

Definition at line 888 of file locations.h.

888 {
889 ASSERT(index >= 0);
890 ASSERT(index < num_temps_);
891 return &temp_locations_[index];
892 }

◆ Write()

void dart::LocationSummary::Write ( FlowGraphSerializer s) const

Definition at line 1281 of file il_serializer.cc.

1281 {
1282 s->Write<intptr_t>(input_count());
1283 s->Write<intptr_t>(temp_count());
1284 s->Write<int8_t>(static_cast<int8_t>(contains_call_));
1285 live_registers_.Write(s);
1286
1287 for (intptr_t i = 0, n = input_count(); i < n; ++i) {
1288 in(i).Write(s);
1289 }
1290 for (intptr_t i = 0, n = temp_count(); i < n; ++i) {
1291 temp(i).Write(s);
1292 }
1293 ASSERT(output_count() == 1);
1294 out(0).Write(s);
1295
1296 if ((stack_bitmap_ != nullptr) && (stack_bitmap_->Length() != 0)) {
1297 s->Write<int8_t>(1);
1298 stack_bitmap_->Write(s->stream());
1299 } else {
1300 s->Write<int8_t>(0);
1301 }
1302
1303#if defined(DEBUG)
1304 s->Write<intptr_t>(writable_inputs_);
1305#endif
1306}
void Write(BaseWriteStream *stream) const
Definition: bitmap.cc:152
intptr_t Length() const
Definition: bitmap.h:36
intptr_t output_count() const
Definition: locations.h:901
void Write(FlowGraphSerializer *s) const
void Write(FlowGraphSerializer *s) const
struct MyStruct s

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