23 auto array = *array_slot;
25 if (array ==
nullptr) {
30 while (array->length() <= index) {
34 if (array->At(index) ==
nullptr) {
35 (*array)[index] =
create();
37 return array->At(index);
46 if (comparable_class_ ==
nullptr) {
61 comparable_class_ = &cls;
63 return *comparable_class_;
67 if (interpolate_single_ ==
nullptr) {
78 return *interpolate_single_;
82 if (interpolate_ ==
nullptr) {
95#define DEFINE_TYPED_LIST_NATIVE_FUNCTION_GETTER(Upper, Lower) \
96 const Function& CompilerState::TypedListGet##Upper() { \
97 if (typed_list_get_##Lower##_ == nullptr) { \
98 Thread* thread = Thread::Current(); \
99 Zone* zone = thread->zone(); \
100 const auto& cls = CompilerState::TypedListClass(); \
101 typed_list_get_##Lower##_ = &Function::ZoneHandle( \
102 zone, cls.LookupFunctionAllowPrivate(Symbols::_nativeGet##Upper())); \
103 ASSERT(!typed_list_get_##Lower##_->IsNull()); \
105 return *typed_list_get_##Lower##_; \
107 const Function& CompilerState::TypedListSet##Upper() { \
108 if (typed_list_set_##Lower##_ == nullptr) { \
109 Thread* thread = Thread::Current(); \
110 Zone* zone = thread->zone(); \
111 const auto& cls = CompilerState::TypedListClass(); \
112 typed_list_set_##Lower##_ = &Function::ZoneHandle( \
113 zone, cls.LookupFunctionAllowPrivate(Symbols::_nativeSet##Upper())); \
114 ASSERT(!typed_list_set_##Lower##_->IsNull()); \
116 return *typed_list_set_##Lower##_; \
125#undef DEFINE_TYPED_LIST_NATIVE_FUNCTION_GETTER
127#define DEFINE_CLASS_GETTER(Lib, Upper, Lower, Symbol) \
128 const Class& CompilerState::Upper##Class() { \
129 if (Lower##_class_ == nullptr) { \
130 Thread* thread = Thread::Current(); \
131 Zone* zone = thread->zone(); \
132 const auto& lib = Library::Handle(zone, Library::Lib##Library()); \
134 Class::Handle(zone, lib.LookupClassAllowPrivate(Symbols::Symbol())); \
135 ASSERT(!cls.IsNull()); \
136 const Error& error = Error::Handle(zone, cls.EnsureIsFinalized(thread)); \
137 ASSERT(error.IsNull()); \
138 Lower##_class_ = &cls; \
140 return *Lower##_class_; \
150#undef DEFINE_CLASS_GETTER
153 if (compound_offset_in_bytes_field_ ==
nullptr) {
158 Symbols::_offsetInBytes()));
160 compound_offset_in_bytes_field_ = &field;
162 return *compound_offset_in_bytes_field_;
166 if (compound_typed_data_base_field_ ==
nullptr) {
171 Symbols::_typedDataBase()));
173 compound_typed_data_base_field_ = &field;
175 return *compound_typed_data_base_field_;
179 OS::PrintErr(
"=== Crash occurred when compiling %s in %s mode in %s pass\n",
181 :
"unknown function",
186 if (
pass_state() !=
nullptr &&
pass()->
id() == CompilerPass::kGenerateCode) {
187 if (
pass_state()->graph_compiler->current_block() !=
nullptr) {
189 pass_state()->graph_compiler->current_block()->ToCString());
191 if (
pass_state()->graph_compiler->current_instruction() !=
nullptr) {
193 "=== When compiling instruction %s\n",
194 pass_state()->graph_compiler->current_instruction()->ToCString());
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
const Class & CompoundClass()
const Class & ComparableClass()
bool is_optimizing() const
const Function & StringBaseInterpolateSingle()
const CompilerPass * pass() const
static bool ShouldTrace()
const Field & CompoundTypedDataBaseField()
const Function & StringBaseInterpolate()
const Field & CompoundOffsetInBytesField()
const CompilerPassState * pass_state() const
const Function * function() const
static bool ShouldPrint(const Function &function, uint8_t **compiler_pass_filter=nullptr)
void Print(const char *phase="unknown")
static LibraryPtr CoreLibrary()
static ClassPtr LookupCoreClass(const String &class_name)
ClassPtr LookupClass(const String &name) const
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
StringPtr Rename(const String &name, bool atomic=false)
static Object & ZoneHandle()
static StringPtr New(Thread *thread, const char *cstr)
static Thread * Current()
IsolateGroup * isolate_group() const
#define DEFINE_TYPED_LIST_NATIVE_FUNCTION_GETTER(Upper, Lower)
#define DEFINE_CLASS_GETTER(Lib, Upper, Lower, Symbol)
Dart_NativeFunction function
static void Union(GrowableArray< Chain * > *chains, Chain *source_chain, Chain *target_chain)
T * PutIfAbsent(Thread *thread, ZoneGrowableArray< T * > **array_slot, intptr_t index, std::function< T *()> create)
FlowGraph * flow_graph() const