74#if !defined(DART_PRECOMPILED_RUNTIME)
87 huge_method_cutoff_in_code_size,
89 "Huge method cutoff in unoptimized code size (in bytes).");
94 "Show names of internal classes (e.g. \"OneByteString\") in error messages "
95 "instead of showing the corresponding interface names (e.g. \"String\"). "
96 "Also show legacy nullability in type names.");
99 remove_script_timestamps_for_test,
101 "Remove script timestamps to allow for deterministic testing.");
103#if !defined(DART_PRECOMPILED_RUNTIME)
104DEFINE_FLAG(
bool, use_register_cc,
true,
"Use register calling conventions");
123ArrayPtr ICData::cached_icdata_arrays_[kCachedICDataArrayCount];
130#error RAW_NULL should not be defined.
132#define RAW_NULL static_cast<uword>(kHeapObjectTag)
134#define CHECK_ERROR(error) \
136 ErrorPtr err = (error); \
137 if (err != Error::null()) { \
142#define DEFINE_SHARED_READONLY_HANDLE(Type, name) \
143 Type* Object::name##_ = nullptr;
145#undef DEFINE_SHARED_READONLY_HANDLE
147ObjectPtr Object::null_ =
static_cast<ObjectPtr
>(
RAW_NULL);
148BoolPtr Object::true_ =
static_cast<BoolPtr
>(
RAW_NULL);
149BoolPtr Object::false_ =
static_cast<BoolPtr
>(
RAW_NULL);
150ClassPtr Object::class_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
151ClassPtr Object::dynamic_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
152ClassPtr Object::void_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
153ClassPtr Object::type_parameters_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
154ClassPtr Object::type_arguments_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
155ClassPtr Object::patch_class_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
156ClassPtr Object::function_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
157ClassPtr Object::closure_data_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
158ClassPtr Object::ffi_trampoline_data_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
159ClassPtr Object::field_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
160ClassPtr Object::script_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
161ClassPtr Object::library_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
162ClassPtr Object::namespace_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
163ClassPtr Object::kernel_program_info_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
164ClassPtr Object::code_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
165ClassPtr Object::instructions_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
166ClassPtr Object::instructions_section_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
167ClassPtr Object::instructions_table_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
168ClassPtr Object::object_pool_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
169ClassPtr Object::pc_descriptors_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
170ClassPtr Object::code_source_map_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
171ClassPtr Object::compressed_stackmaps_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
172ClassPtr Object::var_descriptors_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
173ClassPtr Object::exception_handlers_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
174ClassPtr Object::context_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
175ClassPtr Object::context_scope_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
176ClassPtr Object::sentinel_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
177ClassPtr Object::singletargetcache_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
178ClassPtr Object::unlinkedcall_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
179ClassPtr Object::monomorphicsmiablecall_class_ =
181ClassPtr Object::icdata_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
182ClassPtr Object::megamorphic_cache_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
183ClassPtr Object::subtypetestcache_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
184ClassPtr Object::loadingunit_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
185ClassPtr Object::api_error_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
186ClassPtr Object::language_error_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
187ClassPtr Object::unhandled_exception_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
188ClassPtr Object::unwind_error_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
189ClassPtr Object::weak_serialization_reference_class_ =
191ClassPtr Object::weak_array_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
197 buffer->Printf(
"%.*s",
static_cast<int>(
len), &
name[start_pos]);
203#if defined(DART_PRECOMPILER)
204#define PRECOMPILER_WSR_FIELD_DEFINITION(Class, Type, Name) \
205 Type##Ptr Class::Name() const { \
206 return Type::RawCast(WeakSerializationReference::Unwrap(untag()->Name())); \
209#define PRECOMPILER_WSR_FIELD_DEFINITION(Class, Type, Name) \
210 void Class::set_##Name(const Type& value) const { \
211 untag()->set_##Name(value.ptr()); \
218#undef PRECOMPILER_WSR_FIELD_DEFINITION
221#define TRACE_TYPE_CHECKS_VERBOSE(format, ...) \
222 if (FLAG_trace_type_checks_verbose) { \
223 OS::PrintErr(format, __VA_ARGS__); \
226#define TRACE_TYPE_CHECKS_VERBOSE(format, ...) \
227 if (FLAG_trace_type_checks_verbose) { \
228 OS::PrintErr(format, ##__VA_ARGS__); \
237 while (
i <
name.Length()) {
238 while (
i <
name.Length()) {
239 uint8_t c =
name.CharAt(
i++);
243 while (
i <
name.Length()) {
244 uint8_t c =
name.CharAt(
i);
245 if ((c <
'0') || (c >
'9'))
break;
293#if !defined(DART_PRECOMPILED_RUNTIME)
294 if (
name.Equals(Symbols::TopLevel())) {
300 const char* cname =
name.ToCString();
301 ASSERT(strlen(cname) ==
static_cast<size_t>(
name.Length()));
302 const intptr_t name_len =
name.Length();
305 intptr_t start_pos = 0;
306 intptr_t sum_segment_len = 0;
307 for (intptr_t
i = 0;
i < name_len;
i++) {
308 if ((cname[
i] ==
'@') && ((
i + 1) < name_len) && (cname[
i + 1] >=
'0') &&
309 (cname[
i + 1] <=
'9')) {
311 const intptr_t segment_len =
i - start_pos;
312 sum_segment_len += segment_len;
317 while ((
i <
name.Length()) && (
name.CharAt(
i) >=
'0') &&
318 (
name.CharAt(
i) <=
'9')) {
323 }
else if (is_extension && cname[
i] ==
'|') {
325 const intptr_t segment_len =
i - start_pos;
331 sum_segment_len += (segment_len + 1);
335 const char* unmangled_name =
nullptr;
336 if (start_pos == 0) {
338 unmangled_name = cname;
339 sum_segment_len = name_len;
340 }
else if (
name.Length() != start_pos) {
342 const intptr_t segment_len =
name.Length() - start_pos;
343 sum_segment_len += segment_len;
346 if (unmangled_name ==
nullptr) {
348 unmangled_name = printer.
buffer();
353 intptr_t
len = sum_segment_len;
354 bool is_setter =
false;
357 for (intptr_t
i = 0;
i <
len;
i++) {
358 if (unmangled_name[
i] ==
'.') {
359 intptr_t slen =
i + 1;
360 intptr_t plen = slen -
start;
362 unmangled_name += slen;
365 }
else if (unmangled_name[
i] ==
':') {
372 if (unmangled_name[0] ==
's') {
379 intptr_t dot_pos = -1;
382 if (unmangled_name[
i] ==
':' ||
383 (is_extension && unmangled_name[
i] ==
'#')) {
391 if (unmangled_name[0] ==
's') {
396 }
else if (unmangled_name[
i] ==
'.') {
408 if (!is_extension && (
start == 0) && (dot_pos == -1)) {
410 return unmangled_name;
414 intptr_t
end = ((dot_pos + 1) ==
len) ? dot_pos :
len;
420 const intptr_t equals_len = strlen(
equals);
429#if !defined(DART_PRECOMPILED_RUNTIME)
432 intptr_t at_pos = -1;
433 bool is_setter =
false;
441 for (intptr_t
i = 0;
i <
len;
i++) {
442 if (
name.CharAt(
i) ==
'|') {
447 }
else if (
name.CharAt(
i) ==
':') {
454 if (
name.CharAt(0) ==
's') {
463 if (
name.CharAt(
i) ==
':' || (is_extension &&
name.CharAt(
i) ==
'#')) {
470 }
else if (
name.CharAt(
i) ==
'@') {
472 ASSERT(!is_setter || (at_pos == -1));
509template <
typename type>
517 return ((0 <= c) && (c < 32)) || (c == 127);
529template <
typename type>
533 }
else if (
value ==
'\n') {
535 }
else if (
value ==
'\f') {
537 }
else if (
value ==
'\b') {
539 }
else if (
value ==
'\t') {
541 }
else if (
value ==
'\v') {
543 }
else if (
value ==
'\r') {
545 }
else if (
value ==
'\\') {
547 }
else if (
value ==
'$') {
558 auto heap = isolate_group->
heap();
570 InitializeObjectVariant<Instance>(address,
kNullCid);
581 InitializeObject<Bool>(address);
588 InitializeObject<Bool>(address);
589 true_->untag()->value_ =
true;
590 true_->untag()->SetCanonical();
596 InitializeObject<Bool>(address);
597 false_->untag()->value_ =
false;
598 false_->untag()->SetCanonical();
618 builtin_vtables_[kObjectCid] = fake_handle.
vtable();
621#define INIT_VTABLE(clazz) \
624 builtin_vtables_[k##clazz##Cid] = fake_handle.vtable(); \
630#define INIT_VTABLE(clazz) \
633 builtin_vtables_[k##clazz##Cid] = fake_handle.vtable(); \
638#define INIT_VTABLE(clazz) \
641 builtin_vtables_[k##clazz##Cid] = fake_handle.vtable(); \
646#define INIT_VTABLE(clazz) \
649 builtin_vtables_[k##clazz##Cid] = fake_handle.vtable(); \
654#define INIT_VTABLE(clazz) \
656 String fake_handle; \
657 builtin_vtables_[k##clazz##Cid] = fake_handle.vtable(); \
664 builtin_vtables_[kFfiNativeTypeCid] = fake_handle.
vtable();
667#define INIT_VTABLE(clazz) \
669 Instance fake_handle; \
670 builtin_vtables_[kFfi##clazz##Cid] = fake_handle.vtable(); \
677 builtin_vtables_[kFfiNativeFunctionCid] = fake_handle.
vtable();
682 builtin_vtables_[kPointerCid] = fake_handle.
vtable();
687 builtin_vtables_[kDynamicLibraryCid] = fake_handle.
vtable();
690#define INIT_VTABLE(clazz) \
692 TypedData fake_internal_handle; \
693 builtin_vtables_[kTypedData##clazz##Cid] = fake_internal_handle.vtable(); \
694 TypedDataView fake_view_handle; \
695 builtin_vtables_[kTypedData##clazz##ViewCid] = fake_view_handle.vtable(); \
696 builtin_vtables_[kUnmodifiableTypedData##clazz##ViewCid] = \
697 fake_view_handle.vtable(); \
698 ExternalTypedData fake_external_handle; \
699 builtin_vtables_[kExternalTypedData##clazz##Cid] = \
700 fake_external_handle.vtable(); \
726 ASSERT(thread !=
nullptr);
733#define INITIALIZE_SHARED_READONLY_HANDLE(Type, name) \
734 name##_ = Type::ReadOnlyHandle();
736#undef INITIALIZE_SHARED_READONLY_HANDLE
752 *bool_false_ = false_;
758 *empty_instantiations_cache_array_ =
Array::null();
768 InitializeObject<Class>(address);
774 cls.
ptr_ = class_class_;
779 const intptr_t host_next_field_offset = Class::NextFieldOffset();
780 const intptr_t target_next_field_offset = RTN::Class::NextFieldOffset();
783 cls.set_state_bits(0);
791 cls.InitEmptyFields();
796 cls = Class::New<Instance, RTN::Instance>(
kNullCid, isolate_group);
801 cls = Class::New<Instance, RTN::Instance>(
kNeverCid, isolate_group);
827 cls = Class::New<Sentinel, RTN::Sentinel>(isolate_group);
828 sentinel_class_ = cls.
ptr();
844 cls = Class::New<TypeParameters, RTN::TypeParameters>(isolate_group);
845 type_parameters_class_ = cls.
ptr();
847 cls = Class::New<TypeArguments, RTN::TypeArguments>(isolate_group);
848 type_arguments_class_ = cls.
ptr();
850 cls = Class::New<PatchClass, RTN::PatchClass>(isolate_group);
851 patch_class_class_ = cls.
ptr();
853 cls = Class::New<Function, RTN::Function>(isolate_group);
854 function_class_ = cls.
ptr();
856 cls = Class::New<ClosureData, RTN::ClosureData>(isolate_group);
857 closure_data_class_ = cls.
ptr();
859 cls = Class::New<FfiTrampolineData, RTN::FfiTrampolineData>(isolate_group);
860 ffi_trampoline_data_class_ = cls.
ptr();
862 cls = Class::New<Field, RTN::Field>(isolate_group);
863 field_class_ = cls.
ptr();
865 cls = Class::New<Script, RTN::Script>(isolate_group);
866 script_class_ = cls.
ptr();
868 cls = Class::New<Library, RTN::Library>(isolate_group);
869 library_class_ = cls.
ptr();
871 cls = Class::New<Namespace, RTN::Namespace>(isolate_group);
872 namespace_class_ = cls.
ptr();
874 cls = Class::New<KernelProgramInfo, RTN::KernelProgramInfo>(isolate_group);
875 kernel_program_info_class_ = cls.
ptr();
877 cls = Class::New<Code, RTN::Code>(isolate_group);
878 code_class_ = cls.
ptr();
880 cls = Class::New<Instructions, RTN::Instructions>(isolate_group);
881 instructions_class_ = cls.
ptr();
884 Class::New<InstructionsSection, RTN::InstructionsSection>(isolate_group);
885 instructions_section_class_ = cls.
ptr();
887 cls = Class::New<InstructionsTable, RTN::InstructionsTable>(isolate_group);
888 instructions_table_class_ = cls.
ptr();
890 cls = Class::New<ObjectPool, RTN::ObjectPool>(isolate_group);
891 object_pool_class_ = cls.
ptr();
893 cls = Class::New<PcDescriptors, RTN::PcDescriptors>(isolate_group);
894 pc_descriptors_class_ = cls.
ptr();
896 cls = Class::New<CodeSourceMap, RTN::CodeSourceMap>(isolate_group);
897 code_source_map_class_ = cls.
ptr();
900 Class::New<CompressedStackMaps, RTN::CompressedStackMaps>(isolate_group);
901 compressed_stackmaps_class_ = cls.
ptr();
904 Class::New<LocalVarDescriptors, RTN::LocalVarDescriptors>(isolate_group);
905 var_descriptors_class_ = cls.
ptr();
907 cls = Class::New<ExceptionHandlers, RTN::ExceptionHandlers>(isolate_group);
908 exception_handlers_class_ = cls.
ptr();
910 cls = Class::New<Context, RTN::Context>(isolate_group);
911 context_class_ = cls.
ptr();
913 cls = Class::New<ContextScope, RTN::ContextScope>(isolate_group);
914 context_scope_class_ = cls.
ptr();
916 cls = Class::New<SingleTargetCache, RTN::SingleTargetCache>(isolate_group);
917 singletargetcache_class_ = cls.
ptr();
919 cls = Class::New<UnlinkedCall, RTN::UnlinkedCall>(isolate_group);
920 unlinkedcall_class_ = cls.
ptr();
922 cls = Class::New<MonomorphicSmiableCall, RTN::MonomorphicSmiableCall>(
924 monomorphicsmiablecall_class_ = cls.
ptr();
926 cls = Class::New<ICData, RTN::ICData>(isolate_group);
927 icdata_class_ = cls.
ptr();
929 cls = Class::New<MegamorphicCache, RTN::MegamorphicCache>(isolate_group);
930 megamorphic_cache_class_ = cls.
ptr();
932 cls = Class::New<SubtypeTestCache, RTN::SubtypeTestCache>(isolate_group);
933 subtypetestcache_class_ = cls.
ptr();
935 cls = Class::New<LoadingUnit, RTN::LoadingUnit>(isolate_group);
936 loadingunit_class_ = cls.
ptr();
938 cls = Class::New<ApiError, RTN::ApiError>(isolate_group);
939 api_error_class_ = cls.
ptr();
941 cls = Class::New<LanguageError, RTN::LanguageError>(isolate_group);
942 language_error_class_ = cls.
ptr();
944 cls = Class::New<UnhandledException, RTN::UnhandledException>(isolate_group);
945 unhandled_exception_class_ = cls.
ptr();
947 cls = Class::New<UnwindError, RTN::UnwindError>(isolate_group);
948 unwind_error_class_ = cls.
ptr();
950 cls = Class::New<WeakSerializationReference, RTN::WeakSerializationReference>(
952 weak_serialization_reference_class_ = cls.
ptr();
954 cls = Class::New<WeakArray, RTN::WeakArray>(isolate_group);
955 weak_array_class_ = cls.
ptr();
961 cls = Class::New<Array, RTN::Array>(isolate_group);
966 cls = Class::New<Array, RTN::Array>(kImmutableArrayCid, isolate_group);
967 isolate_group->
object_store()->set_immutable_array_class(cls);
974 Class::New<GrowableObjectArray, RTN::GrowableObjectArray>(isolate_group);
975 isolate_group->
object_store()->set_growable_object_array_class(cls);
981 isolate_group->
object_store()->set_one_byte_string_class(cls);
983 isolate_group->
object_store()->set_two_byte_string_class(cls);
984 cls = Class::New<Mint, RTN::Mint>(isolate_group);
986 cls = Class::New<Double, RTN::Double>(isolate_group);
988 cls = Class::New<Float32x4, RTN::Float32x4>(isolate_group);
989 isolate_group->
object_store()->set_float32x4_class(cls);
990 cls = Class::New<Float64x2, RTN::Float64x2>(isolate_group);
991 isolate_group->
object_store()->set_float64x2_class(cls);
992 cls = Class::New<Int32x4, RTN::Int32x4>(isolate_group);
1007 InitializeObjectVariant<Array>(address, kImmutableArrayCid, 0);
1008 Array::initializeHandle(empty_array_,
1010 empty_array_->untag()->set_length(
Smi::New(0));
1011 empty_array_->SetCanonical();
1019 const intptr_t array_size =
1023 InitializeObjectVariant<Array>(address, kImmutableArrayCid, array_size);
1024 Array::initializeHandle(empty_instantiations_cache_array_,
1026 empty_instantiations_cache_array_->untag()->set_length(
1030 empty_instantiations_cache_array_->SetAt(
1038 empty_instantiations_cache_array_->SetCanonical();
1047 InitializeObjectVariant<Array>(address, kImmutableArrayCid, array_size);
1048 Array::initializeHandle(empty_subtype_test_cache_array_,
1050 empty_subtype_test_cache_array_->untag()->set_length(
Smi::New(array_size));
1053 empty_subtype_test_cache_array_->SetAt(
1058 Object::null_object());
1060 empty_subtype_test_cache_array_->SetCanonical();
1067 InitializeObject<ContextScope>(address, 0);
1068 ContextScope::initializeHandle(
1069 empty_context_scope_,
1071 empty_context_scope_->StoreNonPointer(
1072 &empty_context_scope_->untag()->num_variables_, 0);
1073 empty_context_scope_->StoreNonPointer(
1074 &empty_context_scope_->untag()->is_implicit_,
true);
1075 empty_context_scope_->SetCanonical();
1082 InitializeObject<ObjectPool>(address, 0);
1083 ObjectPool::initializeHandle(
1086 empty_object_pool_->StoreNonPointer(&empty_object_pool_->untag()->length_,
1088 empty_object_pool_->SetCanonical();
1095 InitializeObject<CompressedStackMaps>(address, 0);
1096 CompressedStackMaps::initializeHandle(
1097 empty_compressed_stackmaps_,
1099 empty_compressed_stackmaps_->untag()->payload()->set_flags_and_size(0);
1100 empty_compressed_stackmaps_->SetCanonical();
1107 InitializeObject<PcDescriptors>(address, 0);
1108 PcDescriptors::initializeHandle(
1111 empty_descriptors_->StoreNonPointer(&empty_descriptors_->untag()->length_,
1113 empty_descriptors_->SetCanonical();
1120 InitializeObject<LocalVarDescriptors>(address, 0);
1121 LocalVarDescriptors::initializeHandle(
1122 empty_var_descriptors_,
1124 empty_var_descriptors_->StoreNonPointer(
1125 &empty_var_descriptors_->untag()->num_entries_, 0);
1126 empty_var_descriptors_->SetCanonical();
1135 InitializeObject<ExceptionHandlers>(address, 0);
1136 ExceptionHandlers::initializeHandle(
1137 empty_exception_handlers_,
1139 empty_exception_handlers_->StoreNonPointer(
1140 &empty_exception_handlers_->untag()->packed_fields_, 0);
1141 empty_exception_handlers_->SetCanonical();
1148 InitializeObject<ExceptionHandlers>(address, 0);
1149 ExceptionHandlers::initializeHandle(
1150 empty_async_exception_handlers_,
1152 empty_async_exception_handlers_->StoreNonPointer(
1153 &empty_async_exception_handlers_->untag()->packed_fields_,
1155 empty_async_exception_handlers_->SetCanonical();
1162 InitializeObject<TypeArguments>(address, 0);
1163 TypeArguments::initializeHandle(
1164 empty_type_arguments_,
1166 empty_type_arguments_->untag()->set_length(
Smi::New(0));
1167 empty_type_arguments_->untag()->set_hash(
Smi::New(0));
1168 empty_type_arguments_->ComputeHash();
1169 empty_type_arguments_->SetCanonical();
1174 *vm_isolate_snapshot_object_table_ = Object::empty_array().ptr();
1176 cls = Class::New<Instance, RTN::Instance>(
kDynamicCid, isolate_group);
1182 dynamic_class_ = cls.
ptr();
1184 cls = Class::New<Instance, RTN::Instance>(
kVoidCid, isolate_group);
1189 void_class_ = cls.
ptr();
1191 cls = Class::New<Type, RTN::Type>(isolate_group);
1196 cls = Class::New<FunctionType, RTN::FunctionType>(isolate_group);
1201 cls = Class::New<RecordType, RTN::RecordType>(isolate_group);
1206 cls = dynamic_class_;
1209 dynamic_type_->SetIsFinalized();
1210 dynamic_type_->ComputeHash();
1211 dynamic_type_->SetCanonical();
1216 void_type_->SetIsFinalized();
1217 void_type_->ComputeHash();
1218 void_type_->SetCanonical();
1224 cls = type_arguments_class_;
1229 cls = Class::New<Bool, RTN::Bool>(isolate_group);
1237 "Callbacks into the Dart VM are currently prohibited. Either there are "
1238 "outstanding pointers from Dart_TypedDataAcquireData that have not been "
1239 "released with Dart_TypedDataReleaseData, or a finalizer is running.",
1241 *no_callbacks_error_ = ApiError::New(error_str,
Heap::kOld);
1243 "No api calls are allowed while unwind is in progress",
Heap::kOld);
1246 *snapshot_writer_error_ =
1249 *branch_offset_error_ =
1252 *speculative_inlining_error_ =
1255 *background_compilation_error_ =
1258 *out_of_memory_error_ =
1263 synthetic_getter_parameter_types_->SetAt(0, Object::dynamic_type());
1274 ASSERT(!null_object_->IsSmi());
1275 ASSERT(!null_class_->IsSmi());
1276 ASSERT(null_class_->IsClass());
1277 ASSERT(!null_array_->IsSmi());
1278 ASSERT(null_array_->IsArray());
1279 ASSERT(!null_string_->IsSmi());
1280 ASSERT(null_string_->IsString());
1281 ASSERT(!null_instance_->IsSmi());
1282 ASSERT(null_instance_->IsInstance());
1283 ASSERT(!null_function_->IsSmi());
1284 ASSERT(null_function_->IsFunction());
1285 ASSERT(!null_function_type_->IsSmi());
1286 ASSERT(null_function_type_->IsFunctionType());
1287 ASSERT(!null_record_type_->IsSmi());
1288 ASSERT(null_record_type_->IsRecordType());
1289 ASSERT(!null_type_arguments_->IsSmi());
1290 ASSERT(null_type_arguments_->IsTypeArguments());
1291 ASSERT(!null_compressed_stackmaps_->IsSmi());
1292 ASSERT(null_compressed_stackmaps_->IsCompressedStackMaps());
1293 ASSERT(!empty_array_->IsSmi());
1294 ASSERT(empty_array_->IsArray());
1295 ASSERT(!empty_instantiations_cache_array_->IsSmi());
1296 ASSERT(empty_instantiations_cache_array_->IsArray());
1297 ASSERT(!empty_subtype_test_cache_array_->IsSmi());
1298 ASSERT(empty_subtype_test_cache_array_->IsArray());
1299 ASSERT(!empty_type_arguments_->IsSmi());
1300 ASSERT(empty_type_arguments_->IsTypeArguments());
1301 ASSERT(!empty_context_scope_->IsSmi());
1302 ASSERT(empty_context_scope_->IsContextScope());
1303 ASSERT(!empty_compressed_stackmaps_->IsSmi());
1304 ASSERT(empty_compressed_stackmaps_->IsCompressedStackMaps());
1305 ASSERT(!empty_descriptors_->IsSmi());
1306 ASSERT(empty_descriptors_->IsPcDescriptors());
1307 ASSERT(!empty_var_descriptors_->IsSmi());
1308 ASSERT(empty_var_descriptors_->IsLocalVarDescriptors());
1309 ASSERT(!empty_exception_handlers_->IsSmi());
1310 ASSERT(empty_exception_handlers_->IsExceptionHandlers());
1311 ASSERT(!empty_async_exception_handlers_->IsSmi());
1312 ASSERT(empty_async_exception_handlers_->IsExceptionHandlers());
1313 ASSERT(!sentinel_->IsSmi());
1314 ASSERT(sentinel_->IsSentinel());
1315 ASSERT(!transition_sentinel_->IsSmi());
1316 ASSERT(transition_sentinel_->IsSentinel());
1317 ASSERT(!unknown_constant_->IsSmi());
1318 ASSERT(unknown_constant_->IsSentinel());
1319 ASSERT(!non_constant_->IsSmi());
1320 ASSERT(non_constant_->IsSentinel());
1321 ASSERT(!optimized_out_->IsSmi());
1322 ASSERT(optimized_out_->IsSentinel());
1323 ASSERT(!bool_true_->IsSmi());
1324 ASSERT(bool_true_->IsBool());
1325 ASSERT(!bool_false_->IsSmi());
1326 ASSERT(bool_false_->IsBool());
1327 ASSERT(smi_illegal_cid_->IsSmi());
1328 ASSERT(smi_zero_->IsSmi());
1329 ASSERT(!no_callbacks_error_->IsSmi());
1330 ASSERT(no_callbacks_error_->IsApiError());
1331 ASSERT(!unwind_in_progress_error_->IsSmi());
1332 ASSERT(unwind_in_progress_error_->IsUnwindError());
1333 ASSERT(!snapshot_writer_error_->IsSmi());
1334 ASSERT(snapshot_writer_error_->IsLanguageError());
1335 ASSERT(!branch_offset_error_->IsSmi());
1336 ASSERT(branch_offset_error_->IsLanguageError());
1337 ASSERT(!speculative_inlining_error_->IsSmi());
1338 ASSERT(speculative_inlining_error_->IsLanguageError());
1339 ASSERT(!background_compilation_error_->IsSmi());
1340 ASSERT(background_compilation_error_->IsLanguageError());
1341 ASSERT(!out_of_memory_error_->IsSmi());
1342 ASSERT(out_of_memory_error_->IsLanguageError());
1343 ASSERT(!vm_isolate_snapshot_object_table_->IsSmi());
1344 ASSERT(vm_isolate_snapshot_object_table_->IsArray());
1345 ASSERT(!synthetic_getter_parameter_types_->IsSmi());
1346 ASSERT(synthetic_getter_parameter_types_->IsArray());
1347 ASSERT(!synthetic_getter_parameter_names_->IsSmi());
1348 ASSERT(synthetic_getter_parameter_names_->IsArray());
1358 dynamic_type_->InitializeTypeTestingStubNonAtomic(
code);
1361 void_type_->InitializeTypeTestingStubNonAtomic(
code);
1366 true_ =
static_cast<BoolPtr
>(
RAW_NULL);
1367 false_ =
static_cast<BoolPtr
>(
RAW_NULL);
1368 class_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1369 dynamic_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1370 void_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1371 type_parameters_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1372 type_arguments_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1373 patch_class_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1374 function_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1375 closure_data_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1376 ffi_trampoline_data_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1377 field_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1378 script_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1379 library_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1380 namespace_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1381 kernel_program_info_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1382 code_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1383 instructions_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1384 instructions_section_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1385 instructions_table_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1386 object_pool_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1387 pc_descriptors_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1388 code_source_map_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1389 compressed_stackmaps_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1390 var_descriptors_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1391 exception_handlers_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1392 context_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1393 context_scope_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1394 singletargetcache_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1395 unlinkedcall_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1396 monomorphicsmiablecall_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1397 icdata_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1398 megamorphic_cache_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1399 subtypetestcache_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1400 loadingunit_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1401 api_error_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1402 language_error_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1403 unhandled_exception_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1404 unwind_error_class_ =
static_cast<ClassPtr
>(
RAW_NULL);
1414#if defined(HASH_IN_OBJECT_HEADER)
1428#if defined(HASH_IN_OBJECT_HEADER)
1432 if (Object::GetCachedHash(obj) == 0) {
1438 }
else if (obj == Object::bool_true().ptr()) {
1440 }
else if (obj == Object::bool_false().ptr()) {
1442 }
else if (!obj->IsMint() && !obj->IsDouble()) {
1444 counter_ &= 0x3fffffff;
1445 if (counter_ == 0) counter_++;
1446 Object::SetCachedHashIfNotSet(obj, counter_);
1450#if !defined(DART_PRECOMPILED_RUNTIME)
1451 if (obj->IsClass()) {
1461#if defined(HASH_IN_OBJECT_HEADER)
1466#define SET_CLASS_NAME(class_name, name) \
1467 cls = class_name##_class(); \
1468 cls.set_name(Symbols::name());
1476 synthetic_getter_parameter_names_->SetAt(0,
Symbols::This());
1524 cls.set_name(Symbols::_List());
1525 cls = isolate_group->
object_store()->one_byte_string_class();
1526 cls.set_name(Symbols::OneByteString());
1528 cls.set_name(Symbols::Never());
1533 cls.set_name(Symbols::FreeListElement());
1535 cls.set_name(Symbols::ForwardingCorpse());
1537#if defined(DART_PRECOMPILER)
1540 function.set_name(Symbols::OptimizedOut());
1558 intptr_t
cid =
object->GetClassId();
1559 if (
cid == kOneByteStringCid) {
1560 OneByteStringPtr str =
static_cast<OneByteStringPtr
>(object);
1568 str->untag()->HeapSize() -
size);
1569 }
else if (
cid == kTwoByteStringCid) {
1570 TwoByteStringPtr str =
static_cast<TwoByteStringPtr
>(object);
1579 str->untag()->HeapSize() -
size);
1580 }
else if (
cid == kCodeSourceMapCid) {
1585 map->untag()->HeapSize() -
size);
1586 }
else if (
cid == kCompressedStackMapsCid) {
1591 maps->untag()->HeapSize() -
size);
1592 }
else if (
cid == kPcDescriptorsCid) {
1603 *vm_isolate_snapshot_object_table_ =
table.ptr();
1611 intptr_t original_size,
1612 intptr_t used_size) {
1615 ASSERT(original_size >= used_size);
1616 if (original_size > used_size) {
1617 intptr_t leftover_size = original_size - used_size;
1619 if (obj.
ptr()->IsNewObject()) {
1648void Object::RegisterClass(
const Class& cls,
1657void Object::RegisterPrivateClass(
const Class& cls,
1658 const String& public_class_name,
1659 const Library& lib) {
1660 ASSERT(public_class_name.Length() > 0);
1661 ASSERT(public_class_name.CharAt(0) ==
'_');
1663 str = lib.PrivateName(public_class_name);
1679 const uint8_t* kernel_buffer,
1680 intptr_t kernel_buffer_size) {
1686#if defined(DART_PRECOMPILED_RUNTIME)
1687 const bool bootstrapping =
false;
1689 const bool is_kernel = (kernel_buffer !=
nullptr);
1690 const bool bootstrapping =
1694 if (bootstrapping) {
1695#if !defined(DART_PRECOMPILED_RUNTIME)
1712 cls = Class::New<Array, RTN::Array>(isolate_group);
1714 object_store->set_array_class(cls);
1728 cls = Class::New<GrowableObjectArray, RTN::GrowableObjectArray>(
1730 object_store->set_growable_object_array_class(cls);
1737 const intptr_t kInitialCanonicalRegExpSize = 4;
1738 weak_array = HashTables::New<CanonicalRegExpSet>(
1740 object_store->set_regexp_table(weak_array);
1743 const intptr_t kInitialCanonicalTypeSize = 16;
1744 array = HashTables::New<CanonicalTypeSet>(kInitialCanonicalTypeSize,
1746 object_store->set_canonical_types(array);
1749 const intptr_t kInitialCanonicalFunctionTypeSize = 16;
1750 array = HashTables::New<CanonicalFunctionTypeSet>(
1751 kInitialCanonicalFunctionTypeSize,
Heap::kOld);
1752 object_store->set_canonical_function_types(array);
1755 const intptr_t kInitialCanonicalRecordTypeSize = 16;
1756 array = HashTables::New<CanonicalRecordTypeSet>(
1757 kInitialCanonicalRecordTypeSize,
Heap::kOld);
1758 object_store->set_canonical_record_types(array);
1761 const intptr_t kInitialCanonicalTypeParameterSize = 4;
1762 array = HashTables::New<CanonicalTypeParameterSet>(
1763 kInitialCanonicalTypeParameterSize,
Heap::kOld);
1764 object_store->set_canonical_type_parameters(array);
1767 const intptr_t kInitialCanonicalTypeArgumentsSize = 4;
1768 array = HashTables::New<CanonicalTypeArgumentsSet>(
1769 kInitialCanonicalTypeArgumentsSize,
Heap::kOld);
1770 object_store->set_canonical_type_arguments(array);
1773 const Class& type_cls =
1774 Class::Handle(zone, Class::New<Type, RTN::Type>(isolate_group));
1776 zone, Class::New<FunctionType, RTN::FunctionType>(isolate_group));
1778 zone, Class::New<RecordType, RTN::RecordType>(isolate_group));
1780 zone, Class::New<TypeParameter, RTN::TypeParameter>(isolate_group));
1782 zone, Class::New<LibraryPrefix, RTN::LibraryPrefix>(isolate_group));
1786 object_store->set_one_byte_string_class(cls);
1790 object_store->set_two_byte_string_class(cls);
1798 object_store->set_libraries(libraries);
1809 object_store->set_pending_classes(pending_classes);
1815 cls = object_store->array_class();
1816 RegisterPrivateClass(cls, Symbols::_List(), core_lib);
1817 pending_classes.
Add(cls);
1825 type.SetIsFinalized();
1827 object_store->set_array_type(
type);
1829 cls = object_store->growable_object_array_class();
1830 RegisterPrivateClass(cls, Symbols::_GrowableList(), core_lib);
1831 pending_classes.
Add(cls);
1833 cls = Class::New<Array, RTN::Array>(kImmutableArrayCid, isolate_group);
1834 object_store->set_immutable_array_class(cls);
1838 ASSERT(object_store->immutable_array_class() !=
1839 object_store->array_class());
1841 RegisterPrivateClass(cls, Symbols::_ImmutableList(), core_lib);
1842 pending_classes.
Add(cls);
1844 cls = object_store->one_byte_string_class();
1845 RegisterPrivateClass(cls, Symbols::OneByteString(), core_lib);
1846 pending_classes.
Add(cls);
1848 cls = object_store->two_byte_string_class();
1849 RegisterPrivateClass(cls, Symbols::TwoByteString(), core_lib);
1850 pending_classes.
Add(cls);
1856 if (isolate_lib.
IsNull()) {
1857 isolate_lib = Library::NewLibraryHelper(Symbols::DartIsolate(),
true);
1865 cls = Class::New<Capability, RTN::Capability>(isolate_group);
1866 RegisterPrivateClass(cls, Symbols::_Capability(), isolate_lib);
1867 pending_classes.
Add(cls);
1869 cls = Class::New<ReceivePort, RTN::ReceivePort>(isolate_group);
1870 RegisterPrivateClass(cls, Symbols::_RawReceivePort(), isolate_lib);
1871 pending_classes.
Add(cls);
1873 cls = Class::New<SendPort, RTN::SendPort>(isolate_group);
1874 RegisterPrivateClass(cls, Symbols::_SendPort(), isolate_lib);
1875 pending_classes.
Add(cls);
1877 cls = Class::New<TransferableTypedData, RTN::TransferableTypedData>(
1879 RegisterPrivateClass(cls, Symbols::_TransferableTypedDataImpl(),
1881 pending_classes.
Add(cls);
1884 zone, Class::New<StackTrace, RTN::StackTrace>(isolate_group));
1885 RegisterPrivateClass(stacktrace_cls, Symbols::_StackTrace(), core_lib);
1886 pending_classes.
Add(stacktrace_cls);
1889 cls = Class::New<RegExp, RTN::RegExp>(isolate_group);
1890 RegisterPrivateClass(cls, Symbols::_RegExp(), core_lib);
1891 pending_classes.
Add(cls);
1898 cls = Class::New<Instance, RTN::Instance>(kInstanceCid, isolate_group);
1899 object_store->set_object_class(cls);
1900 cls.set_name(Symbols::Object());
1905 pending_classes.
Add(cls);
1908 object_store->set_object_type(
type);
1911 object_store->set_non_nullable_object_type(
type);
1914 object_store->set_nullable_object_type(
type);
1916 cls = Class::New<Bool, RTN::Bool>(isolate_group);
1917 object_store->set_bool_class(cls);
1918 RegisterClass(cls, Symbols::Bool(), core_lib);
1919 pending_classes.
Add(cls);
1921 cls = Class::New<Instance, RTN::Instance>(
kNullCid, isolate_group);
1922 object_store->set_null_class(cls);
1926 pending_classes.
Add(cls);
1928 cls = Class::New<Instance, RTN::Instance>(
kNeverCid, isolate_group);
1933 cls.set_name(Symbols::Never());
1934 object_store->set_never_class(cls);
1937 RegisterPrivateClass(library_prefix_cls, Symbols::_LibraryPrefix(),
1939 pending_classes.
Add(library_prefix_cls);
1941 RegisterPrivateClass(type_cls, Symbols::_Type(), core_lib);
1942 pending_classes.
Add(type_cls);
1944 RegisterPrivateClass(function_type_cls, Symbols::_FunctionType(), core_lib);
1945 pending_classes.
Add(function_type_cls);
1947 RegisterPrivateClass(record_type_cls, Symbols::_RecordType(), core_lib);
1948 pending_classes.
Add(record_type_cls);
1950 RegisterPrivateClass(type_parameter_cls, Symbols::_TypeParameter(),
1952 pending_classes.
Add(type_parameter_cls);
1954 cls = Class::New<Integer, RTN::Integer>(isolate_group);
1955 object_store->set_integer_implementation_class(cls);
1956 RegisterPrivateClass(cls, Symbols::_IntegerImplementation(), core_lib);
1957 pending_classes.
Add(cls);
1959 cls = Class::New<Smi, RTN::Smi>(isolate_group);
1960 object_store->set_smi_class(cls);
1961 RegisterPrivateClass(cls, Symbols::_Smi(), core_lib);
1962 pending_classes.
Add(cls);
1964 cls = Class::New<Mint, RTN::Mint>(isolate_group);
1965 object_store->set_mint_class(cls);
1966 RegisterPrivateClass(cls, Symbols::_Mint(), core_lib);
1967 pending_classes.
Add(cls);
1969 cls = Class::New<Double, RTN::Double>(isolate_group);
1970 object_store->set_double_class(cls);
1971 RegisterPrivateClass(cls, Symbols::_Double(), core_lib);
1972 pending_classes.
Add(cls);
1975 cls = Class::New<Closure, RTN::Closure>(isolate_group);
1976 object_store->set_closure_class(cls);
1977 RegisterPrivateClass(cls, Symbols::_Closure(), core_lib);
1978 pending_classes.
Add(cls);
1980 cls = Class::New<Record, RTN::Record>(isolate_group);
1981 RegisterPrivateClass(cls, Symbols::_Record(), core_lib);
1982 pending_classes.
Add(cls);
1984 cls = Class::New<WeakProperty, RTN::WeakProperty>(isolate_group);
1985 object_store->set_weak_property_class(cls);
1986 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib);
1988 cls = Class::New<WeakReference, RTN::WeakReference>(isolate_group);
1993 object_store->set_weak_reference_class(cls);
1994 RegisterPrivateClass(cls, Symbols::_WeakReference(), core_lib);
2000 lib = Library::NewLibraryHelper(Symbols::DartMirrors(),
true);
2008 cls = Class::New<MirrorReference, RTN::MirrorReference>(isolate_group);
2009 RegisterPrivateClass(cls, Symbols::_MirrorReference(), lib);
2015 lib = Library::NewLibraryHelper(Symbols::DartCollection(),
true);
2023 cls = Class::New<Map, RTN::Map>(isolate_group);
2024 object_store->set_map_impl_class(cls);
2028 RegisterPrivateClass(cls, Symbols::_Map(), lib);
2029 pending_classes.
Add(cls);
2031 cls = Class::New<Map, RTN::Map>(kConstMapCid, isolate_group);
2032 object_store->set_const_map_impl_class(cls);
2037 RegisterPrivateClass(cls, Symbols::_ConstMap(), lib);
2038 pending_classes.
Add(cls);
2040 cls = Class::New<Set, RTN::Set>(isolate_group);
2041 object_store->set_set_impl_class(cls);
2045 RegisterPrivateClass(cls, Symbols::_Set(), lib);
2046 pending_classes.
Add(cls);
2048 cls = Class::New<Set, RTN::Set>(kConstSetCid, isolate_group);
2049 object_store->set_const_set_impl_class(cls);
2054 RegisterPrivateClass(cls, Symbols::_ConstSet(), lib);
2055 pending_classes.
Add(cls);
2061 lib = Library::NewLibraryHelper(Symbols::DartAsync(),
true);
2068 cls = Class::New<FutureOr, RTN::FutureOr>(isolate_group);
2072 RegisterClass(cls, Symbols::FutureOr(), lib);
2073 pending_classes.
Add(cls);
2074 object_store->set_future_or_class(cls);
2076 cls = Class::New<SuspendState, RTN::SuspendState>(isolate_group);
2077 RegisterPrivateClass(cls, Symbols::_SuspendState(), lib);
2078 pending_classes.
Add(cls);
2084 lib = Library::NewLibraryHelper(Symbols::DartDeveloper(),
true);
2091 cls = Class::New<UserTag, RTN::UserTag>(isolate_group);
2092 RegisterPrivateClass(cls, Symbols::_UserTag(), lib);
2093 pending_classes.
Add(cls);
2104 lib = Library::NewLibraryHelper(Symbols::DartTypedData(),
true);
2111#define REGISTER_TYPED_DATA_CLASS(clazz) \
2112 cls = Class::NewTypedDataClass(kTypedData##clazz##ArrayCid, isolate_group); \
2113 RegisterPrivateClass(cls, Symbols::_##clazz##List(), lib);
2116#undef REGISTER_TYPED_DATA_CLASS
2117#define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \
2119 Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid, isolate_group); \
2120 RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \
2121 pending_classes.Add(cls); \
2122 cls = Class::NewUnmodifiableTypedDataViewClass( \
2123 kUnmodifiableTypedData##clazz##ViewCid, isolate_group); \
2124 RegisterPrivateClass(cls, Symbols::_Unmodifiable##clazz##View(), lib); \
2125 pending_classes.Add(cls);
2130 RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib);
2131 pending_classes.
Add(cls);
2134 RegisterPrivateClass(cls, Symbols::_UnmodifiableByteDataView(), lib);
2135 pending_classes.
Add(cls);
2137#undef REGISTER_TYPED_DATA_VIEW_CLASS
2138#define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \
2139 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid, \
2141 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib);
2143 cls = Class::New<Instance, RTN::Instance>(
kByteBufferCid, isolate_group,
2148 RegisterPrivateClass(cls, Symbols::_ByteBuffer(), lib);
2149 pending_classes.
Add(cls);
2152#undef REGISTER_EXT_TYPED_DATA_CLASS
2154 cls = Class::New<Float32x4, RTN::Float32x4>(isolate_group);
2155 RegisterPrivateClass(cls, Symbols::_Float32x4(), lib);
2156 pending_classes.
Add(cls);
2157 object_store->set_float32x4_class(cls);
2159 cls = Class::New<Instance, RTN::Instance>(
kIllegalCid, isolate_group,
2162 RegisterClass(cls, Symbols::Float32x4(), lib);
2166 object_store->set_float32x4_type(
type);
2168 cls = Class::New<Int32x4, RTN::Int32x4>(isolate_group);
2169 RegisterPrivateClass(cls, Symbols::_Int32x4(), lib);
2170 pending_classes.
Add(cls);
2171 object_store->set_int32x4_class(cls);
2173 cls = Class::New<Instance, RTN::Instance>(
kIllegalCid, isolate_group,
2176 RegisterClass(cls, Symbols::Int32x4(), lib);
2180 object_store->set_int32x4_type(
type);
2182 cls = Class::New<Float64x2, RTN::Float64x2>(isolate_group);
2183 RegisterPrivateClass(cls, Symbols::_Float64x2(), lib);
2184 pending_classes.
Add(cls);
2185 object_store->set_float64x2_class(cls);
2187 cls = Class::New<Instance, RTN::Instance>(
kIllegalCid, isolate_group,
2190 RegisterClass(cls, Symbols::Float64x2(), lib);
2194 object_store->set_float64x2_type(
type);
2198 type = object_store->object_type();
2203 cls = Class::New<Instance, RTN::Instance>(
kIllegalCid, isolate_group,
2209 pending_classes.
Add(cls);
2211 object_store->set_type_type(
type);
2214 cls = Class::New<Instance, RTN::Instance>(
kIllegalCid, isolate_group,
2219 RegisterClass(cls, Symbols::Function(), core_lib);
2220 pending_classes.
Add(cls);
2222 object_store->set_function_type(
type);
2225 cls = Class::New<Instance, RTN::Instance>(
kIllegalCid, isolate_group,
2228 RegisterClass(cls, Symbols::Record(), core_lib);
2229 pending_classes.
Add(cls);
2230 object_store->set_record_class(cls);
2232 cls = Class::New<Number, RTN::Number>(isolate_group);
2233 RegisterClass(cls, Symbols::Number(), core_lib);
2234 pending_classes.
Add(cls);
2236 object_store->set_number_type(
type);
2238 object_store->set_nullable_number_type(
type);
2240 cls = Class::New<Instance, RTN::Instance>(
kIllegalCid, isolate_group,
2243 RegisterClass(cls, Symbols::Int(), core_lib);
2246 pending_classes.
Add(cls);
2248 object_store->set_int_type(
type);
2250 object_store->set_non_nullable_int_type(
type);
2252 object_store->set_nullable_int_type(
type);
2254 cls = Class::New<Instance, RTN::Instance>(
kIllegalCid, isolate_group,
2257 RegisterClass(cls, Symbols::Double(), core_lib);
2260 pending_classes.
Add(cls);
2262 object_store->set_double_type(
type);
2264 object_store->set_nullable_double_type(
type);
2266 name = Symbols::_String().ptr();
2267 cls = Class::New<Instance, RTN::Instance>(
kIllegalCid, isolate_group,
2270 RegisterClass(cls,
name, core_lib);
2273 pending_classes.
Add(cls);
2275 object_store->set_string_type(
type);
2277 cls = object_store->bool_class();
2279 object_store->set_bool_type(
type);
2281 cls = object_store->smi_class();
2283 object_store->set_smi_type(
type);
2285 cls = object_store->mint_class();
2287 object_store->set_mint_type(
type);
2295 cls = object_store->null_class();
2298 type.SetIsFinalized();
2300 object_store->set_null_type(
type);
2301 cls.set_declaration_type(
type);
2305 type = object_store->object_type();
2308 cls = object_store->never_class();
2311 type.SetIsFinalized();
2313 object_store->set_never_type(
type);
2317 object_store->set_type_argument_never(type_args);
2322 type = object_store->int_type();
2325 object_store->set_type_argument_int(type_args);
2328 type = object_store->double_type();
2331 object_store->set_type_argument_double(type_args);
2334 type = object_store->string_type();
2337 object_store->set_type_argument_string(type_args);
2340 type = object_store->string_type();
2342 type_args.
SetTypeAt(1, Object::dynamic_type());
2344 object_store->set_type_argument_string_dynamic(type_args);
2347 type = object_store->string_type();
2351 object_store->set_type_argument_string_string(type_args);
2355 lib = Library::NewLibraryHelper(Symbols::DartFfi(),
true);
2361 cls = Class::New<Instance, RTN::Instance>(kFfiNativeTypeCid, isolate_group);
2364 pending_classes.
Add(cls);
2365 object_store->set_ffi_native_type_class(cls);
2366 RegisterClass(cls, Symbols::FfiNativeType(), lib);
2368#define REGISTER_FFI_TYPE_MARKER(clazz) \
2369 cls = Class::New<Instance, RTN::Instance>(kFfi##clazz##Cid, isolate_group); \
2370 cls.set_num_type_arguments_unsafe(0); \
2371 cls.set_is_prefinalized(); \
2372 pending_classes.Add(cls); \
2373 RegisterClass(cls, Symbols::Ffi##clazz(), lib);
2375#undef REGISTER_FFI_TYPE_MARKER
2377 cls = Class::New<Instance, RTN::Instance>(kFfiNativeFunctionCid,
2383 pending_classes.
Add(cls);
2384 RegisterClass(cls, Symbols::FfiNativeFunction(), lib);
2387 object_store->set_ffi_pointer_class(cls);
2388 pending_classes.
Add(cls);
2389 RegisterClass(cls, Symbols::FfiPointer(), lib);
2391 cls = Class::New<DynamicLibrary, RTN::DynamicLibrary>(kDynamicLibraryCid,
2397 pending_classes.
Add(cls);
2398 RegisterClass(cls, Symbols::FfiDynamicLibrary(), lib);
2400 cls = Class::New<NativeFinalizer, RTN::NativeFinalizer>(isolate_group);
2401 object_store->set_native_finalizer_class(cls);
2402 RegisterPrivateClass(cls, Symbols::_NativeFinalizer(), lib);
2404 cls = Class::New<Finalizer, RTN::Finalizer>(isolate_group);
2409 object_store->set_finalizer_class(cls);
2410 pending_classes.
Add(cls);
2411 RegisterPrivateClass(cls, Symbols::_FinalizerImpl(), core_lib);
2417 lib = Library::NewLibraryHelper(Symbols::DartInternal(),
true);
2425 cls = Class::New<FinalizerEntry, RTN::FinalizerEntry>(isolate_group);
2426 object_store->set_finalizer_entry_class(cls);
2427 pending_classes.
Add(cls);
2428 RegisterClass(cls, Symbols::FinalizerEntry(), lib);
2434 if (!
error.IsNull()) {
2471 cls = Class::New<Instance, RTN::Instance>(kInstanceCid, isolate_group);
2472 object_store->set_object_class(cls);
2474 cls = Class::New<LibraryPrefix, RTN::LibraryPrefix>(isolate_group);
2475 cls = Class::New<Type, RTN::Type>(isolate_group);
2476 cls = Class::New<FunctionType, RTN::FunctionType>(isolate_group);
2477 cls = Class::New<RecordType, RTN::RecordType>(isolate_group);
2478 cls = Class::New<TypeParameter, RTN::TypeParameter>(isolate_group);
2480 cls = Class::New<Array, RTN::Array>(isolate_group);
2481 object_store->set_array_class(cls);
2483 cls = Class::New<Array, RTN::Array>(kImmutableArrayCid, isolate_group);
2484 object_store->set_immutable_array_class(cls);
2486 cls = Class::New<GrowableObjectArray, RTN::GrowableObjectArray>(
2488 object_store->set_growable_object_array_class(cls);
2490 cls = Class::New<Map, RTN::Map>(isolate_group);
2491 object_store->set_map_impl_class(cls);
2493 cls = Class::New<Map, RTN::Map>(kConstMapCid, isolate_group);
2494 object_store->set_const_map_impl_class(cls);
2496 cls = Class::New<Set, RTN::Set>(isolate_group);
2497 object_store->set_set_impl_class(cls);
2499 cls = Class::New<Set, RTN::Set>(kConstSetCid, isolate_group);
2500 object_store->set_const_set_impl_class(cls);
2502 cls = Class::New<Float32x4, RTN::Float32x4>(isolate_group);
2503 object_store->set_float32x4_class(cls);
2505 cls = Class::New<Int32x4, RTN::Int32x4>(isolate_group);
2506 object_store->set_int32x4_class(cls);
2508 cls = Class::New<Float64x2, RTN::Float64x2>(isolate_group);
2509 object_store->set_float64x2_class(cls);
2511#define REGISTER_TYPED_DATA_CLASS(clazz) \
2512 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid, isolate_group);
2514#undef REGISTER_TYPED_DATA_CLASS
2515#define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \
2517 Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid, isolate_group); \
2518 cls = Class::NewUnmodifiableTypedDataViewClass( \
2519 kUnmodifiableTypedData##clazz##ViewCid, isolate_group);
2521#undef REGISTER_TYPED_DATA_VIEW_CLASS
2525#define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \
2526 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid, \
2529#undef REGISTER_EXT_TYPED_DATA_CLASS
2531 cls = Class::New<Instance, RTN::Instance>(kFfiNativeTypeCid, isolate_group);
2532 object_store->set_ffi_native_type_class(cls);
2534#define REGISTER_FFI_CLASS(clazz) \
2535 cls = Class::New<Instance, RTN::Instance>(kFfi##clazz##Cid, isolate_group);
2537#undef REGISTER_FFI_CLASS
2539 cls = Class::New<Instance, RTN::Instance>(kFfiNativeFunctionCid,
2543 object_store->set_ffi_pointer_class(cls);
2545 cls = Class::New<DynamicLibrary, RTN::DynamicLibrary>(kDynamicLibraryCid,
2548 cls = Class::New<Instance, RTN::Instance>(
kByteBufferCid, isolate_group,
2553 cls = Class::New<Integer, RTN::Integer>(isolate_group);
2554 object_store->set_integer_implementation_class(cls);
2556 cls = Class::New<Smi, RTN::Smi>(isolate_group);
2557 object_store->set_smi_class(cls);
2559 cls = Class::New<Mint, RTN::Mint>(isolate_group);
2560 object_store->set_mint_class(cls);
2562 cls = Class::New<Double, RTN::Double>(isolate_group);
2563 object_store->set_double_class(cls);
2565 cls = Class::New<Closure, RTN::Closure>(isolate_group);
2566 object_store->set_closure_class(cls);
2568 cls = Class::New<Record, RTN::Record>(isolate_group);
2571 object_store->set_one_byte_string_class(cls);
2574 object_store->set_two_byte_string_class(cls);
2576 cls = Class::New<Bool, RTN::Bool>(isolate_group);
2577 object_store->set_bool_class(cls);
2579 cls = Class::New<Instance, RTN::Instance>(
kNullCid, isolate_group);
2580 object_store->set_null_class(cls);
2582 cls = Class::New<Instance, RTN::Instance>(
kNeverCid, isolate_group);
2583 object_store->set_never_class(cls);
2585 cls = Class::New<Capability, RTN::Capability>(isolate_group);
2586 cls = Class::New<ReceivePort, RTN::ReceivePort>(isolate_group);
2587 cls = Class::New<SendPort, RTN::SendPort>(isolate_group);
2588 cls = Class::New<StackTrace, RTN::StackTrace>(isolate_group);
2589 cls = Class::New<SuspendState, RTN::SuspendState>(isolate_group);
2590 cls = Class::New<RegExp, RTN::RegExp>(isolate_group);
2591 cls = Class::New<Number, RTN::Number>(isolate_group);
2593 cls = Class::New<WeakProperty, RTN::WeakProperty>(isolate_group);
2594 object_store->set_weak_property_class(cls);
2595 cls = Class::New<WeakReference, RTN::WeakReference>(isolate_group);
2596 object_store->set_weak_reference_class(cls);
2597 cls = Class::New<Finalizer, RTN::Finalizer>(isolate_group);
2598 object_store->set_finalizer_class(cls);
2599 cls = Class::New<NativeFinalizer, RTN::NativeFinalizer>(isolate_group);
2600 object_store->set_native_finalizer_class(cls);
2601 cls = Class::New<FinalizerEntry, RTN::FinalizerEntry>(isolate_group);
2602 object_store->set_finalizer_entry_class(cls);
2604 cls = Class::New<MirrorReference, RTN::MirrorReference>(isolate_group);
2605 cls = Class::New<UserTag, RTN::UserTag>(isolate_group);
2606 cls = Class::New<FutureOr, RTN::FutureOr>(isolate_group);
2607 object_store->set_future_or_class(cls);
2608 cls = Class::New<TransferableTypedData, RTN::TransferableTypedData>(
2637void Object::InitializeObject(
uword address,
2641 uword ptr_field_start_offset,
2642 uword ptr_field_end_offset) {
2647 uword ptr_field_start = address + ptr_field_start_offset;
2648 uword ptr_field_end = address + ptr_field_end_offset;
2652 ASSERT(cur <= ptr_field_start);
2654 ASSERT(ptr_field_start <= end);
2657 ASSERT(ptr_field_end < end);
2658 bool needs_init =
true;
2674 uword initial_value = 0;
2675 while (cur < ptr_field_start) {
2676 *
reinterpret_cast<uword*
>(cur) = initial_value;
2680 initial_value =
static_cast<uword>(null_);
2681#if defined(DART_COMPRESSED_POINTERS)
2683 initial_value &= 0xFFFFFFFF;
2684 initial_value |= initial_value << 32;
2686 const bool has_pointer_fields = ptr_field_start <= ptr_field_end;
2689 if (compressed && has_pointer_fields &&
2694 while (cur <= ptr_field_end) {
2695 *
reinterpret_cast<uword*
>(cur) = initial_value;
2701#if defined(DART_COMPRESSED_POINTERS)
2709 if (compressed && has_pointer_fields && (ptr_field_end %
kWordSize == 0)) {
2715 *
reinterpret_cast<uword*
>(cur) = initial_value;
2722 const uword initial_value = 0;
2741#if defined(HASH_IN_OBJECT_HEADER)
2742 tags = UntaggedObject::HashTag::update(0, tags);
2744 reinterpret_cast<UntaggedObject*
>(address)->tags_ = tags;
2763 uword ptr_field_start_offset,
2764 uword ptr_field_end_offset) {
2793 InitializeObject(address, cls_id,
size, compressed, ptr_field_start_offset,
2794 ptr_field_end_offset);
2808#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
2818#if !defined(PRODUCT)
2820 if (class_table->ShouldTraceAllocationFor(cls_id)) {
2822 HeapSnapshotWriter::GetHeapSnapshotIdentityHash(thread, raw_obj);
2835 ASSERT(old_obj_->IsOldObject());
2839 if (old_obj_->IsArray()) {
2840 for (
ObjectPtr* slot = from; slot <= to; ++slot) {
2842 if (
value->IsHeapObject()) {
2843 old_obj_->
untag()->CheckArrayPointerStore(slot,
value, thread_);
2847 for (
ObjectPtr* slot = from; slot <= to; ++slot) {
2849 if (
value->IsHeapObject()) {
2850 old_obj_->
untag()->CheckHeapPointerStore(
value, thread_);
2856#if defined(DART_COMPRESSED_POINTERS)
2860 if (old_obj_->IsArray()) {
2863 if (
value->IsHeapObject()) {
2864 old_obj_->
untag()->CheckArrayPointerStore(slot,
value, thread_);
2869 ObjectPtr
value = slot->Decompress(heap_base);
2870 if (
value->IsHeapObject()) {
2871 old_obj_->
untag()->CheckHeapPointerStore(
value, thread_);
2886bool Object::IsZoneHandle()
const {
2887 return VMHandles::IsZoneHandle(
reinterpret_cast<uword>(
this));
2890bool Object::IsReadOnlyHandle()
const {
2894bool Object::IsNotTemporaryScopedHandle()
const {
2895 return (IsZoneHandle() || IsReadOnlyHandle());
2901 bool load_with_relaxed_atomics) {
2903 ASSERT(!orig.IsFunctionType() || !FunctionType::Cast(orig).IsGeneric());
2911 from_offset<Object>(), to_offset<Object>());
2917 if (load_with_relaxed_atomics) {
2918 auto orig_atomics_ptr =
reinterpret_cast<std::atomic<uword>*
>(orig_addr);
2919 auto clone_ptr =
reinterpret_cast<uword*
>(clone_addr);
2923 (orig_atomics_ptr +
i)->load(std::memory_order_relaxed);
2926 memmove(
reinterpret_cast<uint8_t*
>(clone_addr + kHeaderSizeInBytes),
2927 reinterpret_cast<uint8_t*
>(orig_addr + kHeaderSizeInBytes),
2928 size - kHeaderSizeInBytes);
2933 raw_typed_data.untag()->RecomputeDataField();
2937 if (!raw_clone->IsOldObject()) {
2947 const intptr_t
cid =
id();
2951#define HANDLE_CASE(clazz) \
2952 case k##clazz##Cid: \
2953 return dart::clazz::ContainsCompressedPointers();
2956#define HANDLE_CASE(clazz) \
2957 case kTypedData##clazz##Cid: \
2958 return dart::TypedData::ContainsCompressedPointers(); \
2959 case kTypedData##clazz##ViewCid: \
2960 case kUnmodifiableTypedData##clazz##ViewCid: \
2961 return dart::TypedDataView::ContainsCompressedPointers(); \
2962 case kExternalTypedData##clazz##Cid: \
2963 return dart::ExternalTypedData::ContainsCompressedPointers();
2971 FATAL(
"Unsupported class for compressed pointers translation: %s (id=%" Pd
2972 ", kNumPredefinedCids=%" Pd ")\n",
2978 return untag()->name();
2990#if !defined(PRODUCT)
2992 return untag()->user_name();
2999#if !defined(PRODUCT)
3003 return GenerateUserVisibleName();
3007 switch (name_visibility) {
3023 const Type& mixin_type =
3043 const auto& inst_to_bounds =
3045 ASSERT(inst_to_bounds.ptr() != Object::empty_type_arguments().ptr());
3052template <
class FakeObject,
class TargetFakeObject>
3056 Object::VerifyBuiltinVtable<FakeObject>(FakeObject::kClassId);
3059 result.set_instance_size(FakeObject::InstanceSize(),
3061 TargetFakeObject::InstanceSize()));
3069 result.set_id(FakeObject::kClassId);
3071 result.set_num_type_arguments_unsafe(0);
3072 result.set_num_native_fields(0);
3073 result.set_state_bits(0);
3075 (FakeObject::kClassId == kTypeArgumentsCid)) {
3078 result.set_is_declaration_loaded();
3079 result.set_is_type_finalized();
3080 result.set_is_allocate_finalized();
3081 }
else if (FakeObject::kClassId != kClosureCid) {
3084 result.set_is_prefinalized();
3088 result.set_is_deeply_immutable(
true);
3091 result.InitEmptyFields();
3092 if (register_class) {
3098#if !defined(DART_PRECOMPILED_RUNTIME)
3102 "too many type parameters declared in class '%s' or in its "
3110#if defined(DART_PRECOMPILED_RUNTIME)
3118 DEBUG_ONLY(intptr_t old_value = num_type_arguments());
3120 StoreNonPointer<int16_t, int16_t, std::memory_order_relaxed>(
3130 set_state_bits(HasPragmaBit::update(
value, state_bits()));
3135 set_state_bits(IsIsolateUnsendableBit::update(
value, state_bits()));
3141 IsIsolateUnsendableDueToPragmaBit::update(
value, state_bits()));
3146 set_state_bits(IsDeeplyImmutableBit::update(
value, state_bits()));
3151 set_state_bits(IsFutureSubtypeBit::update(
value, state_bits()));
3156 set_state_bits(CanBeFutureBit::update(
value, state_bits()));
3161 set_state_bits(IsDynamicallyExtendableBit::update(
value, state_bits()));
3167 HasDynamicallyExtendableSubtypesBit::update(
value, state_bits()));
3171void Class::InitEmptyFields()
const {
3176 untag()->set_interfaces(Object::empty_array().
ptr());
3177 untag()->set_constants(Object::null_array().
ptr());
3178 set_functions(Object::empty_array());
3179 set_fields(Object::empty_array());
3180 set_invocation_dispatcher_cache(Object::empty_array());
3186 if (
untag()->offset_in_words_to_field<std::memory_order_acquire>() ==
3190 const intptr_t
length =
untag()->host_instance_size_in_words_;
3197 for (intptr_t
i = 0;
i <
fields.Length(); ++
i) {
3199 if (
f.is_instance()) {
3205 untag()->set_offset_in_words_to_field<std::memory_order_release>(
3208 return untag()->offset_in_words_to_field<std::memory_order_acquire>();
3214 for (intptr_t
i = 0;
i < field_array.
Length(); ++
i) {
3215 field ^= field_array.
At(
i);
3226 : name_(
name), tmp_string_(tmp_string) {}
3232 return name_.
Equals(*tmp_string_);
3245 static const char*
Name() {
return "ClassFunctionsTraits"; }
3250 ASSERT(
a.IsFunction() &&
b.IsFunction());
3252 return a.ptr() ==
b.ptr();
3255 return name.Matches(Function::Cast(obj));
3266 const intptr_t
len =
value.Length();
3273 for (intptr_t
i = 0;
i <
len; ++
i) {
3280 set_functions(
value);
3281 if (
len >= kFunctionLookupHashThreshold) {
3284 for (intptr_t
i = 0;
i <
len; ++
i) {
3305 const Array& new_array =
3308 set_functions(new_array);
3310 const intptr_t new_len = new_array.
Length();
3311 if (new_len == kFunctionLookupHashThreshold) {
3314 }
else if (new_len > kFunctionLookupHashThreshold) {
3328 Array& funcs = thread->ArrayHandle();
3333 for (intptr_t
i = 0;
i <
len;
i++) {
3345 if ((idx < 0) || (idx >= funcs.
Length())) {
3349 func ^= funcs.
At(idx);
3371 Array& funcs = thread->ArrayHandle();
3377 for (intptr_t
i = 0;
i <
len;
i++) {
3379 implicit_closure =
function.implicit_closure_function();
3380 if (implicit_closure.
IsNull()) {
3384 if (needle.
ptr() == implicit_closure.
ptr()) {
3400 Array& funcs = thread->ArrayHandle();
3401 Object&
object = thread->ObjectHandle();
3402 funcs = invocation_dispatcher_cache();
3405 for (intptr_t
i = 0;
i <
len;
i++) {
3406 object = funcs.
At(
i);
3409 if (
object.IsFunction()) {
3410 if (Function::Cast(
object).
ptr() == needle.
ptr()) {
3423 Array& dispatcher_cache = thread->ArrayHandle();
3424 Object&
object = thread->ObjectHandle();
3425 dispatcher_cache = invocation_dispatcher_cache();
3426 object = dispatcher_cache.
At(idx);
3427 if (!
object.IsFunction()) {
3430 return Function::Cast(
object).ptr();
3433void Class::set_state_bits(intptr_t
bits)
const {
3434 StoreNonPointer<uint32_t, uint32_t, std::memory_order_release>(
3435 &
untag()->state_bits_,
static_cast<uint32_t
>(
bits));
3443 ASSERT((num_type_arguments() == kUnknownNumTypeArguments) ||
3448void Class::set_functions(
const Array&
value)
const {
3451 untag()->set_functions<std::memory_order_release>(
value.ptr());
3454void Class::set_fields(
const Array&
value)
const {
3457 untag()->set_fields<std::memory_order_release>(
value.ptr());
3460void Class::set_invocation_dispatcher_cache(
const Array&
cache)
const {
3463 untag()->set_invocation_dispatcher_cache<std::memory_order_release>(
3467void Class::set_declaration_instance_type_arguments(
3468 const TypeArguments&
value)
const {
3471 (declaration_instance_type_arguments() ==
value.ptr()));
3472 untag()->set_declaration_instance_type_arguments<std::memory_order_release>(
3478 if (num_type_arguments == 0) {
3482 return declaration_instance_type_arguments();
3487 return declaration_instance_type_arguments();
3493 if (num_type_arguments == num_type_parameters) {
3495 args = Type::Cast(
type).arguments();
3500 if ((num_type_parameters == 0) ||
3501 (!super_args.IsNull() && (super_args.Length() == num_type_arguments))) {
3502 args = super_args.ptr();
3505 const intptr_t
offset = num_type_arguments - num_type_parameters;
3507 type = super_args.TypeAtNullSafe(
i);
3511 const auto& decl_args =
3513 for (intptr_t
i = 0;
i < num_type_parameters; ++
i) {
3514 type = decl_args.TypeAt(
i);
3520 set_declaration_instance_type_arguments(
args);
3527 bool canonicalize)
const {
3529 if (num_type_arguments == 0) {
3536 type_arguments.
Length() == num_type_parameters);
3537 if (num_type_arguments == num_type_parameters) {
3541 if (num_type_parameters == 0) {
3558 const intptr_t
cid =
id();
3559 if ((
cid == kArrayCid) || (
cid == kImmutableArrayCid) ||
3560 (
cid == kGrowableObjectArrayCid)) {
3571 return type_params.
Length();
3574intptr_t Class::ComputeNumTypeArguments()
const {
3582 (
super_type() == isolate_group->object_store()->object_type())) {
3583 return num_type_params;
3587 const auto& sup_class =
Class::Handle(zone, sup_type.type_class());
3588 const intptr_t sup_class_num_type_args = sup_class.NumTypeArguments();
3589 if (num_type_params == 0) {
3590 return sup_class_num_type_args;
3594 if (sup_type_args.IsNull()) {
3597 return sup_class_num_type_args + num_type_params;
3600 const intptr_t sup_type_args_length = sup_type_args.Length();
3610 for (intptr_t num_overlapping_type_args =
3611 (num_type_params < sup_type_args_length) ? num_type_params
3612 : sup_type_args_length;
3613 num_overlapping_type_args > 0; num_overlapping_type_args--) {
3615 for (;
i < num_overlapping_type_args;
i++) {
3616 sup_type_arg = sup_type_args.TypeAt(sup_type_args_length -
3617 num_overlapping_type_args +
i);
3618 ASSERT(!sup_type_arg.IsNull());
3619 if (!sup_type_arg.IsTypeParameter())
break;
3624 ASSERT(!TypeParameter::Cast(sup_type_arg).IsFinalized());
3625 if (TypeParameter::Cast(sup_type_arg).index() !=
i ||
3626 TypeParameter::Cast(sup_type_arg).IsNullable()) {
3630 if (
i == num_overlapping_type_args) {
3632 return sup_class_num_type_args + num_type_params -
3633 num_overlapping_type_args;
3637 return sup_class_num_type_args + num_type_params;
3642 intptr_t num_type_args = num_type_arguments();
3643 if (num_type_args != kUnknownNumTypeArguments) {
3644 return num_type_args;
3647#if defined(DART_PRECOMPILED_RUNTIME)
3651 num_type_args = ComputeNumTypeArguments();
3652 ASSERT(num_type_args != kUnknownNumTypeArguments);
3654 return num_type_args;
3660 return Object::empty_type_arguments().ptr();
3668 if (class_table ==
nullptr) {
3673 if (
id() == kTypeArgumentsCid) {
3675 return class_table->
At(kInstanceCid);
3681 return class_table->
At(type_class_id);
3699 return type_param.
ptr();
3705 return sizeof(UntaggedDouble::value_);
3707 return sizeof(UntaggedFloat32x4::value_);
3709 return sizeof(UntaggedFloat64x2::value_);
3711 return sizeof(UntaggedMint::value_);
3718 intptr_t host_offset = 0;
3721 intptr_t target_offset = 0;
3728 ASSERT(target_offset > 0);
3736 ASSERT(target_offset > 0);
3756 host_type_args_field_offset = host_offset;
3757 target_type_args_field_offset = target_offset;
3766 target_type_args_field_offset);
3768 ASSERT(target_offset > 0);
3771 for (intptr_t
i = 0;
i <
len;
i++) {
3772 field ^= flds.
At(
i);
3774 if (!field.is_static()) {
3775 ASSERT(field.HostOffset() == 0);
3776 ASSERT(field.TargetOffset() == 0);
3777 field.SetOffset(host_offset, target_offset);
3779 if (field.is_unboxed()) {
3780 const intptr_t field_size =
3784 const intptr_t host_next_offset = host_offset + field_size;
3785 const intptr_t host_next_position =
3788 const intptr_t target_next_offset = target_offset + field_size;
3789 const intptr_t target_next_position =
3796 for (intptr_t j = 0; j < host_num_words; j++) {
3803 ASSERT(host_offset == host_next_offset);
3804 target_offset = target_next_offset;
3807 field.set_is_unboxed(
false);
3832 const Array& args_desc,
3833 const Function& dispatcher)
const {
3840 Array::empty_array().
ptr()
3841 ? HashTables::New<DispatcherSet>(4,
Heap::kOld)
3842 : invocation_dispatcher_cache());
3843 dispatchers.
Insert(dispatcher);
3844 set_invocation_dispatcher_cache(dispatchers.
Release());
3848 const Array& args_desc,
3850 bool create_if_absent)
const {
3851 ASSERT(kind == UntaggedFunction::kNoSuchMethodDispatcher ||
3852 kind == UntaggedFunction::kInvokeFieldDispatcher ||
3853 kind == UntaggedFunction::kDynamicInvocationForwarder);
3855 auto Z = thread->
zone();
3860 if (invocation_dispatcher_cache() != Array::empty_array().
ptr()) {
3865 if (!
function.IsNull() || !create_if_absent) {
3873 if (invocation_dispatcher_cache() != Array::empty_array().
ptr()) {
3881 function = CreateInvocationDispatcher(target_name, args_desc, kind);
3886FunctionPtr Class::CreateInvocationDispatcher(
3887 const String& target_name,
3888 const Array& args_desc,
3904 const intptr_t type_args_len =
desc.TypeArgsLen();
3905 if (type_args_len > 0) {
3912 for (intptr_t
i = 0;
i < type_args_len;
i++) {
3934 for (intptr_t
i = 1;
i <
desc.PositionalCount();
i++) {
3943 for (intptr_t
i = 0;
i <
desc.NamedCount();
i++) {
3944 const intptr_t param_index =
desc.PositionAt(
i);
3951 invocation.set_is_debuggable(
false);
3952 invocation.set_is_visible(
false);
3953 invocation.set_is_reflectable(
false);
3959 return invocation.
ptr();
3980 UntaggedFunction::kMethodExtractor,
3986 owner, TokenPosition::kMethodExtractor));
3989 const intptr_t kNumParameters = 1;
3993#if !defined(DART_PRECOMPILED_RUNTIME)
3994 extractor.set_positional_parameter_names(
3995 Object::synthetic_getter_parameter_names());
4002 extractor.set_is_debuggable(
false);
4003 extractor.set_is_visible(
false);
4010 return extractor.
ptr();
4032 ASSERT(
result.kind() == UntaggedFunction::kMethodExtractor);
4038FunctionPtr Class::CreateRecordFieldGetter(
const String& getter_name)
const {
4048 UntaggedFunction::kRecordFieldGetter,
4057 const intptr_t kNumParameters = 1;
4061#if !defined(DART_PRECOMPILED_RUNTIME)
4062 getter.set_positional_parameter_names(
4063 Object::synthetic_getter_parameter_names());
4067 getter.set_is_debuggable(
false);
4068 getter.set_is_visible(
false);
4075 return getter.
ptr();
4086 result = CreateRecordFieldGetter(getter_name);
4088 ASSERT(
result.kind() == UntaggedFunction::kRecordFieldGetter);
4093 const Object& metadata_obj,
4094 const String& pragma_name,
4097 auto IG =
T->isolate_group();
4102 if (metadata_obj.
IsNull() || metadata_obj.IsLanguageError()) {
4105 ASSERT(metadata_obj.IsArray());
4107 auto& metadata = Array::Cast(metadata_obj);
4109 if (pragma_class.IsNull()) {
4113 auto& pragma_name_field =
4115 auto& pragma_options_field =
4126 for (intptr_t
i = 0;
i < metadata.Length(); ++
i) {
4127 pragma = metadata.At(
i);
4128 if (pragma.clazz() != pragma_class.ptr() ||
4129 Instance::Cast(pragma).GetField(pragma_name_field) !=
4130 pragma_name.
ptr()) {
4133 options_value = Instance::Cast(pragma).GetField(pragma_options_field);
4136 results.Add(options_value);
4140 *
options = options_value.ptr();
4145 if (found &&
options !=
nullptr) {
4154 const String& pragma_name,
4160 if (obj.IsLibrary()) {
4161 lib = Library::Cast(obj).ptr();
4162 }
else if (obj.IsClass()) {
4163 auto& klass = Class::Cast(obj);
4164 if (!klass.has_pragma())
return false;
4165 lib = klass.library();
4166 }
else if (obj.IsFunction()) {
4167 auto&
function = Function::Cast(obj);
4168 if (!
function.has_pragma())
return false;
4170 }
else if (obj.IsField()) {
4171 auto& field = Field::Cast(obj);
4172 if (!field.has_pragma())
return false;
4178 if (only_core && !lib.IsAnyCoreLibrary()) {
4183 if (metadata_obj.IsUnwindError()) {
4199 const intptr_t kDynamicPrefixLength = 4;
4200 ASSERT(Symbols::DynamicPrefix().Length() == kDynamicPrefixLength);
4202 name.Length() - kDynamicPrefixLength);
4209#if !defined(DART_PRECOMPILED_RUNTIME)
4211 const String& mangled_name)
const {
4220 forwarder.set_name(mangled_name);
4221 forwarder.set_is_native(
false);
4224 forwarder.set_kind(UntaggedFunction::kDynamicInvocationForwarder);
4226 forwarder.set_is_debuggable(
false);
4232 forwarder.set_is_visible(
false);
4236 forwarder.set_usage_counter(0);
4237 forwarder.set_deoptimization_counter(0);
4238 forwarder.set_optimized_instruction_count(0);
4239 forwarder.set_inlining_depth(0);
4240 forwarder.set_optimized_call_site_count(0);
4245 return forwarder.
ptr();
4249 const String& mangled_name)
const {
4252 auto zone = thread->
zone();
4258 mangled_name, Array::null_array(),
4259 UntaggedFunction::kDynamicInvocationForwarder,
4263 const bool needs_dyn_forwarder =
4265 if (!needs_dyn_forwarder) {
4274 mangled_name, Array::null_array(),
4275 UntaggedFunction::kDynamicInvocationForwarder,
4303ArrayPtr Class::invocation_dispatcher_cache()
const {
4304 return untag()->invocation_dispatcher_cache<std::memory_order_acquire>();
4317 const auto host_bitmap = CalculateFieldOffsets();
4318 if (
ptr() == isolate_group->class_table()->At(
id())) {
4322 isolate_group->class_table()->UpdateClassSize(
id(),
ptr());
4323 isolate_group->class_table()->SetUnboxedFieldsMapAt(
id(), host_bitmap);
4332 auto Z = thread->
zone();
4334 ASSERT(super_class.IsNull() || super_class.is_const());
4337 for (intptr_t
i = 0;
i <
fields.Length(); ++
i) {
4339 ASSERT(field.is_static() || field.is_final());
4348static bool IsMutatorOrAtDeoptSafepoint() {
4354#if !defined(DART_PRECOMPILED_RUNTIME)
4368 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
4370 THR_Print(
"Deoptimizing %s because CHA optimized (%s).\n",
4376 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
4379 "Switching %s to unoptimized code because CHA invalid"
4391 if (FLAG_trace_cha) {
4392 THR_Print(
"RegisterCHACode '%s' depends on class '%s'\n",
4406 if (FLAG_trace_deoptimization &&
a.HasCodes()) {
4413 a.DisableCode(
false);
4423 return untag()->dependent_code();
4429 untag()->set_dependent_code(array.
ptr());
4446 const bool changed = trace_allocation != this->
TraceAllocation(isolate_group);
4448 auto class_table = isolate_group->class_table();
4449 class_table->SetTraceAllocationFor(
id(), trace_allocation);
4450#ifdef TARGET_ARCH_IA32
4467 const Array& arguments,
4468 const Array& argument_names,
4471 const Smi& invocation_type =
4475 ASSERT(
level != InvocationMirror::Level::kTopLevel || receiver.IsString());
4477 args.SetAt(0, receiver);
4479 args.SetAt(2, invocation_type);
4480 args.SetAt(3, Object::smi_zero());
4481 args.SetAt(4, Object::null_type_arguments());
4482 args.SetAt(5, arguments);
4483 args.SetAt(6, argument_names);
4499 const String& dst_name) {
4503 args.SetAt(1, src_value);
4504 args.SetAt(2, dst_type);
4505 args.SetAt(3, dst_name);
4518 bool throw_nsm_if_absent,
4519 bool respect_reflectable,
4520 bool check_is_entrypoint)
const {
4529 if (!field.
IsNull() && check_is_entrypoint) {
4534 const String& internal_getter_name =
4539 if (field.
IsNull() && !getter.
IsNull() && check_is_entrypoint) {
4543 if (getter.
IsNull() || (respect_reflectable && !getter.is_reflectable())) {
4547 if (check_is_entrypoint) {
4558 if (throw_nsm_if_absent) {
4561 Object::null_array(), Object::null_array(),
4567 return Object::sentinel().ptr();
4579 bool respect_reflectable,
4580 bool check_is_entrypoint)
const {
4588 const String& internal_setter_name =
4591 if (!field.
IsNull() && check_is_entrypoint) {
4599 if (!setter.
IsNull() && check_is_entrypoint) {
4602 const int kNumArgs = 1;
4605 if (setter.
IsNull() || (respect_reflectable && !setter.is_reflectable())) {
4607 internal_setter_name,
args, Object::null_array(),
4612 if (!
value.RuntimeTypeIsSubtypeOf(parameter_type,
4613 Object::null_type_arguments(),
4614 Object::null_type_arguments())) {
4615 const String& argument_name =
4625 const int kNumArgs = 1;
4629 internal_setter_name,
args, Object::null_array(),
4634 parameter_type = field.
type();
4635 if (!
value.RuntimeTypeIsSubtypeOf(parameter_type,
4636 Object::null_type_arguments(),
4637 Object::null_type_arguments())) {
4655 const Array& static_args,
4656 const Array& arg_names,
4658 const intptr_t num_static_type_args = static_args_descriptor.
TypeArgsLen();
4659 const intptr_t num_static_args = static_args_descriptor.
Count();
4664 num_static_args + (num_static_type_args > 0 ? 1 : 0));
4666 const auto& callable_args =
4668 const intptr_t first_arg_index = static_args_descriptor.
FirstArgIndex();
4671 if (num_static_type_args > 0) {
4672 temp = static_args.
At(0);
4673 callable_args.SetAt(0, temp);
4675 for (intptr_t
i = first_arg_index;
i < static_args.
Length();
i++) {
4676 temp = static_args.
At(
i);
4677 callable_args.SetAt(
i + 1, temp);
4680 callable_args.SetAt(first_arg_index, receiver);
4681 return callable_args.ptr();
4686 const Array& arg_names,
4687 bool respect_reflectable,
4688 bool check_is_entrypoint)
const {
4695 const int kTypeArgsLen = 0;
4704 if (!
function.IsNull() && check_is_entrypoint) {
4712 check_is_entrypoint));
4713 if (getter_result.
ptr() != Object::sentinel().ptr()) {
4714 if (check_is_entrypoint) {
4719 args_descriptor.
Count() + 1,
4724 args, arg_names, args_descriptor));
4726 call_args_descriptor_array);
4731 !
function.AreValidArguments(args_descriptor,
nullptr) ||
4732 (respect_reflectable && !
function.is_reflectable())) {
4740 args, args_descriptor, Object::empty_type_arguments());
4747#if !defined(DART_PRECOMPILED_RUNTIME)
4752 const String& library_url,
4754 std::unique_ptr<kernel::Program> kernel_pgm =
4757 if (kernel_pgm ==
nullptr) {
4759 zone,
String::New(
"Kernel isolate returned ill-formed kernel.")));
4770 return Function::Cast(
result).ptr();
4778 parsed_function->EnsureKernelScopes();
4779 return parsed_function->is_receiver_used();
4785 const Array& type_definitions,
4786 const Array& arguments,
4789 if (type_definitions.
Length() == 0 || type_arguments.
IsNull()) {
4793 intptr_t num_type_args = type_arguments.
Length();
4794 const auto& real_arguments =
4796 real_arguments.SetAt(0, type_arguments);
4798 for (intptr_t
i = 0;
i < arguments.
Length(); ++
i) {
4799 arg = arguments.
At(
i);
4800 real_arguments.SetAt(
i + 1, arg);
4803 const Array& args_desc =
4813 const Array& type_definitions,
4814 const Array& arguments,
4817 return klass.EvaluateCompiledExpression(kernel_buffer, type_definitions,
4818 arguments, type_arguments);
4823 const Array& type_definitions,
4824 const Array& arguments,
4829 thread, Instance::null_object(),
library, *
this, kernel_buffer,
4830 type_definitions, arguments, type_arguments);
4836 const Array& type_definitions,
4837 const Array& arguments,
4840 auto zone = thread->
zone();
4843 kernel_buffer, type_definitions,
4844 arguments, type_arguments);
4853 const Array& type_definitions,
4854 const Array& arguments,
4857#if defined(DART_PRECOMPILED_RUNTIME)
4860 String::New(
"Expression evaluation not available in precompiled mode."));
4861 return ApiError::New(error_str);
4865 zone,
String::New(
"Expressions can be evaluated only with regular Dart "
4866 "instances/classes."));
4872 ? String::null_string()
4880 const auto& eval_function = Function::Cast(
result);
4883 for (intptr_t
i = 0;
i < arguments.
Length(); ++
i) {
4884 ASSERT(arguments.
At(
i) != Object::optimized_out().ptr());
4889 if (!eval_function.is_static()) {
4893 if (receiver.
IsNull() || receiver.
ptr() == Object::optimized_out().ptr()) {
4895 return Object::optimized_out().ptr();
4901 all_arguments.SetAt(0, receiver);
4902 for (intptr_t
i = 0;
i < arguments.
Length();
i++) {
4903 param = arguments.
At(
i);
4904 all_arguments.SetAt(
i + 1, param);
4909 all_arguments, type_arguments);
4915#if defined(DART_PRECOMPILED_RUNTIME)
4918 FATAL(
"Unable to use class %s which is not loaded yet.",
ToCString());
4929#if defined(DART_PRECOMPILED_RUNTIME)
4938 ASSERT(thread !=
nullptr);
4941 if (!
error.IsNull()) {
4963 ASSERT(thread !=
nullptr);
4965 if (!
error.IsNull()) {
4976#if defined(DART_PRECOMPILED_RUNTIME)
4992 for (intptr_t
i = 0;
i <
len;
i++) {
5018 const intptr_t num_new_fields = new_fields.
length();
5019 if (num_new_fields == 0)
return;
5021 const intptr_t num_old_fields = arr.
Length();
5024 for (intptr_t
i = 0;
i < num_new_fields;
i++) {
5025 new_arr.
SetAt(
i + num_old_fields, *new_fields.
At(
i));
5038 Field& field = thread->FieldHandle();
5041 for (intptr_t
i = 0, n =
fields.Length();
i < n; ++
i) {
5043 if (needle.
ptr() == field.
ptr()) {
5053 if ((idx < 0) || (idx >=
fields.Length())) {
5061 Name() != Symbols::ClassID().
ptr()) {
5067 auto zone = thread->
zone();
5073 static const struct {
5074 const char*
const field_name;
5077#define CLASS_LIST_WITH_NULL(V) \
5079 CLASS_LIST_NO_OBJECT(V)
5080#define ADD_SET_FIELD(clazz) \
5081 {"cid" #clazz, k##clazz##Cid},
5084#undef CLASS_LIST_WITH_NULL
5085#define ADD_SET_FIELD(clazz) \
5086 {"cid" #clazz, kTypedData##clazz##Cid}, \
5087 {"cid" #clazz "View", kTypedData##clazz##ViewCid}, \
5088 {"cidExternal" #clazz, kExternalTypedData##clazz##Cid}, \
5089 {"cidUnmodifiable" #clazz "View", kUnmodifiableTypedData##clazz##ViewCid}, \
5090 CLASS_LIST_TYPED_DATA(ADD_SET_FIELD)
5100 field_name =
Symbols::New(thread, cid_fields[
i].field_name);
5101 field = Field::New(field_name,
true,
5105 false, *
this, field_type,
5108 isolate_group->RegisterStaticField(field,
value);
5115template <
class FakeInstance,
class TargetFakeInstance>
5116ClassPtr Class::NewCommon(intptr_t index) {
5120 Object::VerifyBuiltinVtable<FakeInstance>(index ==
kIllegalCid ? kInstanceCid
5126 TargetFakeInstance::InstanceSize());
5132 TargetFakeInstance::NextFieldOffset();
5137 result.set_num_type_arguments_unsafe(kUnknownNumTypeArguments);
5138 result.set_num_native_fields(0);
5139 result.set_state_bits(0);
5141 result.InitEmptyFields();
5145template <
class FakeInstance,
class TargetFakeInstance>
5147 IsolateGroup* isolate_group,
5148 bool register_class,
5151 Class::Handle(NewCommon<FakeInstance, TargetFakeInstance>(index));
5153 result.set_is_abstract();
5155 if (register_class) {
5156 isolate_group->class_table()->Register(
result);
5165 bool register_class) {
5176 result.set_instance_size_in_words(0, 0);
5178 if (register_class) {
5184ClassPtr Class::NewInstanceClass() {
5185 return Class::New<Instance, RTN::Instance>(
kIllegalCid,
5203#if defined(DART_PRECOMPILER)
5234 if (class_id == kOneByteStringCid) {
5239 ASSERT(class_id == kTwoByteStringCid);
5245 class_id, isolate_group,
false));
5252 result.set_is_prefinalized();
5254 result.set_is_deeply_immutable(
true);
5266 class_id, isolate_group,
false));
5273 result.set_is_prefinalized();
5285 class_id, isolate_group,
false));
5290 RTN::TypedDataView::NextFieldOffset();
5293 result.set_is_prefinalized();
5305 class_id, isolate_group,
false));
5310 RTN::TypedDataView::NextFieldOffset();
5313 result.set_is_prefinalized();
5325 class_id, isolate_group,
false));
5329 RTN::ExternalTypedData::NextFieldOffset();
5333 result.set_is_prefinalized();
5345 class_id, isolate_group,
false));
5355 result.set_is_prefinalized();
5364#if !defined(PRODUCT)
5371 set_user_name(user_name);
5376#if !defined(PRODUCT)
5377void Class::set_user_name(
const String&
value)
const {
5382#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
5386 if (class_table->UserVisibleNameFor(
id()) ==
nullptr) {
5388 class_table->SetUserVisibleNameFor(
id(),
name.ToMallocCString());
5393const char* Class::GenerateUserVisibleName()
const {
5394 if (FLAG_show_internal_names) {
5399 return Symbols::Float32x4().ToCString();
5401 return Symbols::Float64x2().ToCString();
5403 return Symbols::Int32x4().ToCString();
5404 case kTypedDataInt8ArrayCid:
5405 case kExternalTypedDataInt8ArrayCid:
5406 return Symbols::Int8List().ToCString();
5407 case kTypedDataUint8ArrayCid:
5408 case kExternalTypedDataUint8ArrayCid:
5409 return Symbols::Uint8List().ToCString();
5410 case kTypedDataUint8ClampedArrayCid:
5411 case kExternalTypedDataUint8ClampedArrayCid:
5412 return Symbols::Uint8ClampedList().ToCString();
5413 case kTypedDataInt16ArrayCid:
5414 case kExternalTypedDataInt16ArrayCid:
5415 return Symbols::Int16List().ToCString();
5416 case kTypedDataUint16ArrayCid:
5417 case kExternalTypedDataUint16ArrayCid:
5418 return Symbols::Uint16List().ToCString();
5419 case kTypedDataInt32ArrayCid:
5420 case kExternalTypedDataInt32ArrayCid:
5421 return Symbols::Int32List().ToCString();
5422 case kTypedDataUint32ArrayCid:
5423 case kExternalTypedDataUint32ArrayCid:
5424 return Symbols::Uint32List().ToCString();
5425 case kTypedDataInt64ArrayCid:
5426 case kExternalTypedDataInt64ArrayCid:
5427 return Symbols::Int64List().ToCString();
5428 case kTypedDataUint64ArrayCid:
5429 case kExternalTypedDataUint64ArrayCid:
5430 return Symbols::Uint64List().ToCString();
5431 case kTypedDataInt32x4ArrayCid:
5432 case kExternalTypedDataInt32x4ArrayCid:
5433 return Symbols::Int32x4List().ToCString();
5434 case kTypedDataFloat32x4ArrayCid:
5435 case kExternalTypedDataFloat32x4ArrayCid:
5436 return Symbols::Float32x4List().ToCString();
5437 case kTypedDataFloat64x2ArrayCid:
5438 case kExternalTypedDataFloat64x2ArrayCid:
5439 return Symbols::Float64x2List().ToCString();
5440 case kTypedDataFloat32ArrayCid:
5441 case kExternalTypedDataFloat32ArrayCid:
5442 return Symbols::Float32List().ToCString();
5443 case kTypedDataFloat64ArrayCid:
5444 case kExternalTypedDataFloat64ArrayCid:
5445 return Symbols::Float64List().ToCString();
5447 return Symbols::FfiPointer().ToCString();
5448 case kDynamicLibraryCid:
5449 return Symbols::FfiDynamicLibrary().ToCString();
5453 return Symbols::Dynamic().ToCString();
5457 return Symbols::Never().ToCString();
5459 return Symbols::Class().ToCString();
5460 case kTypeParametersCid:
5461 return Symbols::TypeParameters().ToCString();
5462 case kTypeArgumentsCid:
5463 return Symbols::TypeArguments().ToCString();
5464 case kPatchClassCid:
5465 return Symbols::PatchClass().ToCString();
5467 return Symbols::Function().ToCString();
5468 case kClosureDataCid:
5469 return Symbols::ClosureData().ToCString();
5470 case kFfiTrampolineDataCid:
5471 return Symbols::FfiTrampolineData().ToCString();
5473 return Symbols::Field().ToCString();
5475 return Symbols::Script().ToCString();
5478 case kLibraryPrefixCid:
5479 return Symbols::LibraryPrefix().ToCString();
5481 return Symbols::Namespace().ToCString();
5482 case kKernelProgramInfoCid:
5483 return Symbols::KernelProgramInfo().ToCString();
5484 case kWeakSerializationReferenceCid:
5485 return Symbols::WeakSerializationReference().ToCString();
5487 return Symbols::WeakArray().ToCString();
5489 return Symbols::Code().ToCString();
5490 case kInstructionsCid:
5491 return Symbols::Instructions().ToCString();
5492 case kInstructionsSectionCid:
5493 return Symbols::InstructionsSection().ToCString();
5494 case kInstructionsTableCid:
5495 return Symbols::InstructionsTable().ToCString();
5496 case kObjectPoolCid:
5497 return Symbols::ObjectPool().ToCString();
5498 case kCodeSourceMapCid:
5499 return Symbols::CodeSourceMap().ToCString();
5500 case kPcDescriptorsCid:
5501 return Symbols::PcDescriptors().ToCString();
5502 case kCompressedStackMapsCid:
5503 return Symbols::CompressedStackMaps().ToCString();
5504 case kLocalVarDescriptorsCid:
5505 return Symbols::LocalVarDescriptors().ToCString();
5506 case kExceptionHandlersCid:
5507 return Symbols::ExceptionHandlers().ToCString();
5509 return Symbols::Context().ToCString();
5510 case kContextScopeCid:
5511 return Symbols::ContextScope().ToCString();
5513 return Symbols::Sentinel().ToCString();
5514 case kSingleTargetCacheCid:
5515 return Symbols::SingleTargetCache().ToCString();
5517 return Symbols::ICData().ToCString();
5518 case kMegamorphicCacheCid:
5519 return Symbols::MegamorphicCache().ToCString();
5520 case kSubtypeTestCacheCid:
5521 return Symbols::SubtypeTestCache().ToCString();
5522 case kLoadingUnitCid:
5523 return Symbols::LoadingUnit().ToCString();
5525 return Symbols::ApiError().ToCString();
5526 case kLanguageErrorCid:
5527 return Symbols::LanguageError().ToCString();
5528 case kUnhandledExceptionCid:
5529 return Symbols::UnhandledException().ToCString();
5530 case kUnwindErrorCid:
5531 return Symbols::UnwindError().ToCString();
5535 return Symbols::Int().ToCString();
5537 return Symbols::Double().ToCString();
5538 case kOneByteStringCid:
5539 case kTwoByteStringCid:
5540 return Symbols::_String().ToCString();
5542 case kImmutableArrayCid:
5543 case kGrowableObjectArrayCid:
5548 if (
name.ptr() == Symbols::_Future().ptr() &&
5550 return Symbols::Future().ToCString();
5552 return name.ToCString();
5559#if !defined(DART_PRECOMPILED_RUNTIME)
5562 return lib.kernel_program_info();
5575void Class::set_implementor_cid(intptr_t
value)
const {
5588 set_implementor_cid(implementor.
id());
5605#if !defined(DART_PRECOMPILED_RUNTIME)
5619 set_state_bits(ImplementedBit::update(
true, state_bits()));
5624 set_state_bits(AbstractBit::update(
true, state_bits()));
5652 set_state_bits(SynthesizedClassBit::update(
true, state_bits()));
5657 set_state_bits(EnumBit::update(
true, state_bits()));
5662 set_state_bits(ConstBit::update(
true, state_bits()));
5667 set_state_bits(TransformedMixinApplicationBit::update(
true, state_bits()));
5672 set_state_bits(SealedBit::update(
true, state_bits()));
5677 set_state_bits(MixinClassBit::update(
true, state_bits()));
5682 set_state_bits(BaseClassBit::update(
true, state_bits()));
5687 set_state_bits(InterfaceClassBit::update(
true, state_bits()));
5692 set_state_bits(FinalBit::update(
true, state_bits()));
5697 set_state_bits(FieldsMarkedNullableBit::update(
true, state_bits()));
5706 set_state_bits(IsAllocatedBit::update(
value, state_bits()));
5711 set_state_bits(IsLoadedBit::update(
value, state_bits()));
5744#if !defined(DART_PRECOMPILED_RUNTIME)
5747 bool is_mixin)
const {
5775 untag()->set_direct_implementors(implementors.
ptr());
5801 untag()->set_direct_subclasses(subclasses.
ptr());
5807 return untag()->constants();
5814void Class::set_declaration_type(
const Type&
value)
const {
5818 (declaration_type() ==
value.ptr()));
5824 untag()->set_declaration_type<std::memory_order_release>(
value.ptr());
5839 return declaration_type();
5845 return declaration_type();
5853 if (num_type_params > 0) {
5856 for (intptr_t
i = 0;
i < num_type_params;
i++) {
5864 set_declaration_type(
type);
5869#if !defined(DART_PRECOMPILED_RUNTIME)
5880#if defined(DART_PRECOMPILED_RUNTIME)
5885 if (existing_stub.
IsNull()) {
5892 if (existing_stub.
IsNull()) {
5911 return (
Name() == Symbols::Future().
ptr()) &&
5952 if (other_cid == kObjectCid) {
5971 if (this_cid == kFutureOrCid) {
5974 const Class& future_class =
5981 function_type_equivalence)) {
5985 if (type_arg.
IsSubtypeOf(other, space, function_type_equivalence)) {
5998 if (other_cid == kFutureOrCid) {
6004 " - result: true (right is FutureOr top)\n");
6013 function_type_equivalence)) {
6015 " - result: true (left is Future, right is FutureOr)\n");
6023 other_type_arg, space,
6024 function_type_equivalence)) {
6026 " - result: true (right is FutureOr, subtype of arg)\n");
6032 if (this_class.
ptr() == other_class.
ptr()) {
6034 if (num_type_params == 0) {
6036 " - result: true (same non-generic class)\n");
6040 if (other_type_arguments.
IsNull()) {
6042 " - result: true (same class, dynamic type args)\n");
6046 const intptr_t from_index = num_type_args - num_type_params;
6047 ASSERT(other_type_arguments.
Length() == num_type_params);
6050 for (intptr_t
i = 0;
i < num_type_params; ++
i) {
6052 other_type = other_type_arguments.
TypeAt(
i);
6054 if (!
type.IsSubtypeOf(other_type, space, function_type_equivalence)) {
6056 " - result: false (same class, type args mismatch)\n");
6061 " - result: true (same class, matching type args)\n");
6068 " - result: true (left is closure, right is Function)\n");
6080 ASSERT(interface.IsFinalized());
6081 interface_class = interface.type_class();
6082 interface_args = interface.arguments();
6093 type_arguments, Object::null_type_arguments(),
kNoneFree, space);
6095 interface_args = interface_class.GetInstanceTypeArguments(
6096 thread, interface_args,
false);
6099 if (interface_class.IsDartFunctionClass()) {
6104 function_type_equivalence)) {
6111 if (this_class.
IsNull()) {
6115 this_cid = this_class.
id();
6122 return Name() == Symbols::TopLevel().ptr();
6178 intptr_t prefix_length,
6179 const String& accessor_name) {
6180 intptr_t name_len =
name.Length();
6181 intptr_t accessor_name_len = accessor_name.
Length();
6183 if (name_len != (accessor_name_len + prefix_length)) {
6186 for (intptr_t
i = 0;
i < prefix_length;
i++) {
6191 for (intptr_t
i = 0, j = prefix_length;
i < accessor_name_len;
i++, j++) {
6199FunctionPtr Class::CheckFunctionType(
const Function& func, MemberKind kind) {
6200 if ((kind == kInstance) || (kind == kInstanceAllowAbstract)) {
6201 if (func.IsDynamicFunction(kind == kInstanceAllowAbstract)) {
6204 }
else if (kind == kStatic) {
6205 if (func.IsStaticFunction()) {
6208 }
else if (kind == kConstructor) {
6209 if (func.IsGenerativeConstructor()) {
6210 ASSERT(!func.is_static());
6213 }
else if (kind == kFactory) {
6214 if (func.IsFactory()) {
6215 ASSERT(func.is_static());
6218 }
else if (kind ==
kAny) {
6225 MemberKind kind)
const {
6232 ASSERT(thread->isolate_group()->program_lock()->IsCurrentThreadReader());
6237 Array& funcs = thread->ArrayHandle();
6239 const intptr_t
len = funcs.Length();
6240 Function&
function = thread->FunctionHandle();
6241 if (
len >= kFunctionLookupHashThreshold) {
6246 const Array& hash_table =
6248 if (!hash_table.IsNull()) {
6251 function ^=
set.GetOrNull(FunctionName(
name, &(thread->StringHandle())));
6255 : CheckFunctionType(
function, kind);
6258 if (
name.IsSymbol()) {
6260 NoSafepointScope no_safepoint;
6261 for (intptr_t
i = 0;
i <
len;
i++) {
6264 return CheckFunctionType(
function, kind);
6270 for (intptr_t
i = 0;
i <
len;
i++) {
6274 return CheckFunctionType(
function, kind);
6283 MemberKind kind)
const {
6287 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
6291 Array& funcs = thread->ArrayHandle();
6294 const intptr_t
len = funcs.Length();
6295 Function&
function = thread->FunctionHandle();
6297 for (intptr_t
i = 0;
i <
len;
i++) {
6301 return CheckFunctionType(
function, kind);
6316FunctionPtr Class::LookupAccessorFunction(
const char*
prefix,
6317 intptr_t prefix_length,
6327 Array& funcs = thread->ArrayHandle();
6329 intptr_t
len = funcs.Length();
6330 Function&
function = thread->FunctionHandle();
6332 for (intptr_t
i = 0;
i <
len;
i++) {
6365 Array& flds = thread->ArrayHandle();
6368 intptr_t
len = flds.Length();
6369 Field& field = thread->FieldHandle();
6370 if (
name.IsSymbol()) {
6372 for (intptr_t
i = 0;
i <
len;
i++) {
6373 field ^= flds.At(
i);
6374 if (
name.ptr() == field.name()) {
6375 if (kind == kInstance) {
6377 }
else if (kind == kStatic) {
6378 return field.is_static() ? field.ptr() :
Field::null();
6385 String& field_name = thread->StringHandle();
6386 for (intptr_t
i = 0;
i <
len;
i++) {
6387 field ^= flds.At(
i);
6388 field_name = field.name();
6389 if (
name.Equals(field_name)) {
6390 if (kind == kInstance) {
6392 }
else if (kind == kStatic) {
6393 return field.is_static() ? field.ptr() :
Field::null();
6404 bool instance_only)
const {
6414 Array& flds = thread->ArrayHandle();
6418 Field& field = thread->FieldHandle();
6419 String& field_name = thread->StringHandle();
6420 for (intptr_t
i = 0;
i <
len;
i++) {
6421 field ^= flds.
At(
i);
6422 field_name = field.
name();
6423 if (field.
is_static() && instance_only) {
6469 return static_cast<uint32_t
>(v);
6482 return canonical_value.
ptr();
6492 HashTables::New<CanonicalInstancesSet>(128,
Heap::kOld));
6501 return canonical_value.
ptr();
6513 : zone_(zone), parent_(*mapping), from_(from), to_(to) {
6519 if (!from.IsFunctionType()) {
6523 scope = scope->parent_) {
6524 if (scope->from_.ptr() == from.
ptr()) {
6525 return &(scope->to_);
6535 if (new_owner !=
nullptr) {
6539 return type_param.
ptr();
6546 if (to !=
nullptr) {
6551 if (to !=
nullptr) {
6569void TypeParameters::set_names(
const Array&
value)
const {
6584void TypeParameters::set_flags(
const Array&
value)
const {
6588void TypeParameters::set_bounds(
const TypeArguments&
value)
const {
6596 : upper_bounds.
TypeAt(index);
6617 : default_type_args.
TypeAt(index);
6630void TypeParameters::AllocateFlags(
Heap::Space space)
const {
6635 for (intptr_t
i = 0;
i <
len;
i++) {
6636 flags_array.
SetAt(
i, zero);
6638 set_flags(flags_array);
6641void TypeParameters::OptimizeFlags()
const {
6646 for (intptr_t
i = 0;
i <
len;
i++) {
6647 if (flags_array.At(
i) != zero.ptr())
return;
6649 set_flags(Object::null_array());
6673 bool are_class_type_parameters,
6679 const intptr_t num_type_params =
Length();
6680 for (intptr_t
i = 0;
i < num_type_params;
i++) {
6681 if (are_class_type_parameters) {
6686 are_class_type_parameters,
base,
base +
i));
6691 if (!
type.IsNull() && (FLAG_show_internal_names || !
type.IsObjectType() ||
6692 type.IsNonNullable())) {
6694 type.PrintName(name_visibility, printer);
6697 if (!
type.IsNull() &&
6698 (FLAG_show_internal_names || !
type.IsDynamicType())) {
6700 type.PrintName(name_visibility, printer);
6705 if (
i != num_type_params - 1) {
6713 return "TypeParameters: null";
6716 auto zone = thread->
zone();
6717 ZoneTextBuffer
buffer(zone);
6718 buffer.AddString(
"TypeParameters: ");
6725 return Object::Allocate<TypeParameters>(space);
6736 result.set_names(names_array);
6739 result.set_bounds(type_args);
6741 result.set_defaults(type_args);
6742 result.AllocateFlags(space);
6746intptr_t TypeArguments::ComputeNullability()
const {
6748 const intptr_t num_types =
Length();
6752 for (intptr_t
i = 0;
i < num_types;
i++) {
6754 intptr_t type_bits = 0;
6755 if (!
type.IsNull()) {
6756 switch (
type.nullability()) {
6774void TypeArguments::set_nullability(intptr_t
value)
const {
6783 for (intptr_t
i = 0;
i <
len;
i++) {
6792uword TypeArguments::ComputeHash()
const {
6802 intptr_t other_length,
6803 intptr_t total_length)
const {
6804 if (other_length == 0) {
6807 }
else if (other_length == total_length) {
6816 for (intptr_t
i = 0;
i < other_length;
i++) {
6820 for (intptr_t
i = other_length;
i < total_length;
i++) {
6831 const intptr_t this_len =
Length();
6832 const intptr_t other_len = other.
Length();
6836 for (intptr_t
i = 0;
i < this_len; ++
i) {
6840 for (intptr_t
i = 0;
i < other_len; ++
i) {
6849 const Class* cls)
const {
6857 if (cls ==
nullptr) {
6861 if (cls !=
nullptr) {
6889 for (intptr_t
i = 0;
i <
len;
i++) {
6890 if (from_index +
i <
Length()) {
6892 if (
type.IsNull()) {
6895 type.PrintName(name_visibility, printer);
6908 buffer->AddString(
"TypeArguments: ");
6910 return buffer->AddString(
"null");
6914 for (intptr_t
i = 0;
i <
Length();
i++) {
6916 buffer->Printf(
" [%s]", type_at.IsNull() ?
"null" : type_at.ToCString());
6922 intptr_t from_index,
6926 if (this->
ptr() == other.
ptr()) {
6939 for (intptr_t
i = from_index;
i < from_index +
len;
i++) {
6944 if (!
type.IsEquivalent(other_type, kind, function_type_equivalence)) {
6951bool TypeArguments::IsDynamicTypes(
bool raw_instantiated,
6952 intptr_t from_index,
6953 intptr_t
len)
const {
6957 for (intptr_t
i = 0;
i <
len;
i++) {
6959 if (
type.IsNull()) {
6962 if (!
type.HasTypeClass()) {
6963 if (raw_instantiated &&
type.IsTypeParameter()) {
6969 type_class =
type.type_class();
6979 cache_container_(&
source),
6981 smi_handle_(
Smi::Handle(zone)) {
6983 ->type_arguments_canonicalization_mutex()
6984 ->IsOwnedByCurrentThread());
6989 cache_container_(nullptr),
6993 ->type_arguments_canonicalization_mutex()
6994 ->IsOwnedByCurrentThread());
6998 return array.
Length() > kMaxLinearCacheSize;
7007bool TypeArguments::Cache::IsValidStorageLocked(
const Array& array) {
7011 ->type_arguments_canonicalization_mutex()
7012 ->IsOwnedByCurrentThread());
7014 if (array.ptr() == EmptyStorage().
ptr())
return true;
7015 const intptr_t num_occupied = NumOccupied(array);
7017 if (num_occupied == 0)
return false;
7018 const intptr_t storage_len = array.Length();
7020 if ((storage_len % kEntrySize) !=
kHeaderSize)
return false;
7021 const intptr_t num_entries =
NumEntries(array);
7024 if (num_occupied >= num_entries)
return false;
7027 const bool is_linear_cache = IsLinear(array);
7030 if (!is_linear_cache) {
7032 const intptr_t metadata =
7038 for (intptr_t
i = 0;
i < num_entries;
i++) {
7040 if (array.At(index + kSentinelIndex) == Sentinel()) {
7041 if (is_linear_cache &&
i < num_occupied)
return false;
7044 if (is_linear_cache &&
i >= num_occupied)
return false;
7046 for (intptr_t j = index; j < index + kEntrySize; j++) {
7047 if (!array.At(j)->IsHeapObject())
return false;
7049 if (!array.At(j)->IsTypeArguments())
return false;
7063 ASSERT(IsOccupied(entry));
7065 return table.At(entry).Get<kInstantiatedTypeArgsIndex>();
7070 return table.Length();
7077 const bool is_hash = IsHash(array);
7079 const intptr_t num_entries =
table.Length();
7084 intptr_t probe_distance = 1;
7090 probe =
hash & (num_entries - 1);
7093 const auto& tuple =
table.At(probe);
7094 if (tuple.Get<kSentinelIndex>() == Sentinel())
break;
7095 if ((tuple.Get<kInstantiatorTypeArgsIndex>() == instantiator_tav.
ptr()) &&
7096 (tuple.Get<kFunctionTypeArgsIndex>() == function_tav.
ptr())) {
7097 return {probe,
true};
7100 probe = probe + probe_distance;
7103 probe = probe & (num_entries - 1);
7110 ASSERT(is_hash || probe == NumOccupied(array));
7111 return {probe,
false};
7120 ASSERT(cache_container_ !=
nullptr);
7122 auto loc = FindKeyOrUnused(instantiator_tav, function_tav);
7127 ASSERT(!IsLinear() || entry == NumOccupied());
7128 const intptr_t new_occupied = NumOccupied() + 1;
7129 const bool storage_changed = EnsureCapacity(new_occupied);
7132 if (storage_changed && !IsLinear()) {
7136 auto loc = FindKeyOrUnused(instantiator_tav, function_tav);
7144 smi_handle_ =
Smi::New(NumOccupiedBits::update(new_occupied, metadata));
7145 data_.SetAtRelease(kMetadataIndex, smi_handle_);
7148 const auto& tuple =
table.At(entry);
7153 tuple.Set<kFunctionTypeArgsIndex>(function_tav);
7154 tuple.Set<kInstantiatedTypeArgsIndex>(instantiated_tav);
7157 kSentinelIndex == kInstantiatorTypeArgsIndex,
7158 "the sentinel position is not protected with a store-release barrier");
7159 tuple.Set<kInstantiatorTypeArgsIndex, std::memory_order_release>(
7162 if (storage_changed) {
7167 cache_container_->set_instantiations(data_);
7170 return {entry,
true};
7177bool TypeArguments::Cache::EnsureCapacity(intptr_t new_occupied)
const {
7178 ASSERT(new_occupied > NumOccupied());
7180 const intptr_t current_capacity =
NumEntries();
7186 if (current_capacity > new_occupied)
return false;
7188 if (LoadFactor(new_occupied, current_capacity) < kMaxLoadFactor) {
7193 if (new_occupied <= kMaxLinearCacheEntries) {
7199 const intptr_t new_capacity =
7201 kMaxLinearCacheEntries) +
7203 const intptr_t cache_size =
kHeaderSize + new_capacity * kEntrySize;
7204 ASSERT(cache_size <= kMaxLinearCacheSize);
7209 smi_handle_ = Sentinel();
7211 for (intptr_t
i = current_capacity;
i < new_capacity;
i++) {
7212 const auto& tuple =
table.At(
i);
7213 tuple.Set<kSentinelIndex>(smi_handle_);
7221 const intptr_t new_capacity =
7222 is_linear ? kNumInitialHashCacheEntries : 2 * current_capacity;
7229 ASSERT(LoadFactor(new_occupied, new_capacity) < kMaxLoadFactor);
7230 const intptr_t new_size =
kHeaderSize + new_capacity * kEntrySize;
7231 const auto& new_data =
7233 ASSERT(!new_data.IsNull());
7236 smi_handle_ =
Smi::New(EntryCountLog2Bits::update(
7238 new_data.SetAt(kMetadataIndex, smi_handle_);
7240 smi_handle_ = Sentinel();
7242 for (
const auto& tuple : to_table) {
7243 tuple.Set<kSentinelIndex>(smi_handle_);
7250 for (
const auto& from_tuple : from_table) {
7252 if (from_tuple.Get<kSentinelIndex>() == Sentinel())
continue;
7253 instantiator_tav ^= from_tuple.Get<kInstantiatorTypeArgsIndex>();
7254 function_tav = from_tuple.Get<kFunctionTypeArgsIndex>();
7255 result_tav = from_tuple.Get<kInstantiatedTypeArgsIndex>();
7258 auto loc = FindKeyOrUnused(new_data, instantiator_tav, function_tav);
7260 const auto& to_tuple = to_table.At(loc.entry);
7261 to_tuple.Set<kInstantiatorTypeArgsIndex>(instantiator_tav);
7262 to_tuple.Set<kFunctionTypeArgsIndex>(function_tav);
7263 to_tuple.Set<kInstantiatedTypeArgsIndex>(result_tav);
7265 data_ = new_data.ptr();
7273ArrayPtr TypeArguments::instantiations()
const {
7276 return untag()->instantiations();
7279void TypeArguments::set_instantiations(
const Array&
value)
const {
7284 untag()->set_instantiations<std::memory_order_release>(
value.ptr());
7311 return untag()->element(index);
7317 return Type::dynamic_type().ptr();
7326 return untag()->set_element(index,
value.ptr());
7330 intptr_t from_index,
7333 intptr_t num_free_fun_type_params)
const {
7336 for (intptr_t
i = 0;
i <
len;
i++) {
7344 if (!
type.IsNull() &&
7345 !
type.IsInstantiated(genericity, num_free_fun_type_params)) {
7354 const intptr_t num_types =
Length();
7355 for (intptr_t
i = 0;
i < num_types;
i++) {
7357 if (
type.IsNull()) {
7360 if (!
type.IsTypeParameter()) {
7385 const Class& instantiator_class,
7386 bool* with_runtime_check)
const {
7388 if (with_runtime_check !=
nullptr) {
7389 *with_runtime_check =
false;
7391 const intptr_t num_type_args =
Length();
7392 const intptr_t num_instantiator_type_args =
7394 if (num_type_args > num_instantiator_type_args) {
7398 const intptr_t num_instantiator_type_params =
7400 const intptr_t first_type_param_offset =
7401 num_instantiator_type_args - num_instantiator_type_params;
7418 for (intptr_t
i = first_type_param_offset;
i < num_type_args;
i++) {
7420 if (!type_arg.IsTypeParameter()) {
7423 const TypeParameter& type_param = TypeParameter::Cast(type_arg);
7439 *with_runtime_check =
true;
7445 if (first_type_param_offset == 0) {
7452 if (super_type_args.
IsNull()) {
7457 for (intptr_t
i = 0; (
i < first_type_param_offset) && (
i < num_type_args);
7460 super_type_arg = super_type_args.
TypeAt(
i);
7461 if (!type_arg.
Equals(super_type_arg)) {
7474 bool* with_runtime_check)
const {
7476 if (with_runtime_check !=
nullptr) {
7477 *with_runtime_check =
false;
7479 const intptr_t num_type_args =
Length();
7480 const intptr_t num_parent_type_args =
function.NumParentTypeArguments();
7481 const intptr_t num_function_type_params =
function.NumTypeParameters();
7482 const intptr_t num_function_type_args =
7483 num_parent_type_args + num_function_type_params;
7484 if (num_type_args > num_function_type_args) {
7489 for (intptr_t
i = 0;
i < num_type_args;
i++) {
7491 if (!type_arg.IsTypeParameter()) {
7494 const TypeParameter& type_param = TypeParameter::Cast(type_arg);
7508 *with_runtime_check =
true;
7524 return result.Canonicalize(thread);
7530 const intptr_t num_types =
Length();
7531 for (intptr_t
i = 0;
i < num_types;
i++) {
7533 if (!
type.IsFinalized()) {
7543 intptr_t num_free_fun_type_params,
7546 intptr_t num_parent_type_args_adjustment)
const {
7548 if ((instantiator_type_arguments.
IsNull() ||
7551 return instantiator_type_arguments.
ptr();
7553 const intptr_t num_types =
Length();
7557 for (intptr_t
i = 0;
i < num_types;
i++) {
7565 if (!
type.IsNull() && !
type.IsInstantiated()) {
7567 instantiator_type_arguments, function_type_arguments,
7568 num_free_fun_type_params, space, function_type_mapping,
7569 num_parent_type_args_adjustment);
7572 if (
type.IsNull()) {
7573 return Object::empty_type_arguments().ptr();
7578 return instantiated_array.
ptr();
7582 intptr_t num_parent_type_args_adjustment,
7583 intptr_t num_free_fun_type_params,
7590 for (intptr_t
i = 0, n =
Length();
i < n; ++
i) {
7592 updated =
type.UpdateFunctionTypes(num_parent_type_args_adjustment,
7593 num_free_fun_type_params, space,
7594 function_type_mapping);
7595 if (
type.ptr() != updated.
ptr()) {
7596 if (updated_args ==
nullptr) {
7599 for (intptr_t j = 0; j <
i; ++j) {
7605 if (updated_args !=
nullptr) {
7609 return (updated_args !=
nullptr) ? updated_args->
ptr() :
ptr();
7612#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
7624 auto zone = thread->
zone();
7635 auto const loc =
cache.FindKeyOrUnused(instantiator_type_arguments,
7636 function_type_arguments);
7638#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
7643 buffer.Printf(
" * instantiation type arguments: %s (hash: %" Pu ")\n",
7644 instantiator_type_arguments.
ToCString(),
7645 instantiator_type_arguments.
Hash());
7646 buffer.Printf(
" * function type arguments: %s (hash: %" Pu ")\n",
7648 function_type_arguments.
Hash());
7649 buffer.Printf(
" * number of occupied entries in cache: %" Pd "\n",
7650 cache.NumOccupied());
7651 buffer.Printf(
" * number of total entries in cache: %" Pd "\n",
7652 cache.NumEntries());
7653 buffer.Printf(
"expected to find entry %" Pd
7654 " of cache in stub, but reached runtime",
7659 return cache.Retrieve(loc.entry);
7670 cache.AddEntry(loc.entry, instantiator_type_arguments,
7671 function_type_arguments,
result);
7678 FATAL(
"Fatal error in TypeArguments::New: invalid len %" Pd "\n",
len);
7682 auto raw = Object::Allocate<TypeArguments>(space,
len);
7688 result.set_nullability(0);
7696void TypeArguments::SetLength(intptr_t
value)
const {
7708 const intptr_t num_types =
Length();
7709 if (num_types == 0) {
7710 return TypeArguments::empty_type_arguments().ptr();
7711 }
else if (
IsRaw(0, num_types)) {
7716 ObjectStore* object_store = isolate_group->object_store();
7721 object_store->canonical_type_arguments());
7723 object_store->set_canonical_type_arguments(
table.Release());
7730 for (intptr_t
i = 0;
i < num_types;
i++) {
7733 canonicalized_types.
Add(type_arg);
7737 object_store->canonical_type_arguments());
7743 for (intptr_t
i = 0;
i < num_types;
i++) {
7747 if (this->
IsNew()) {
7753 result.ComputeNullability();
7759 object_store->set_canonical_type_arguments(
table.Release());
7770 const Class& cls)
const {
7777 if (
Length() == num_type_parameters) {
7780 if (num_type_parameters == 0) {
7786 const intptr_t
offset = num_type_arguments - num_type_parameters;
7788 for (intptr_t
i = 0;
i < num_type_parameters; ++
i) {
7797 const Class& cls)
const {
7804 if (num_type_arguments == num_type_parameters) {
7810 const intptr_t
offset = num_type_arguments - num_type_parameters;
7812 for (intptr_t
i = 0;
i < num_type_parameters; ++
i) {
7826 const intptr_t num_types =
Length();
7827 for (intptr_t
i = 0;
i < num_types;
i++) {
7829 type.EnumerateURIs(uris);
7835 return "TypeArguments: null";
7844 const char* cls_name = cls.ToCString();
7848PatchClassPtr PatchClass::New(
const Class& wrapped_class,
7852 result.set_wrapped_class(wrapped_class);
7854 result.untag()->set_kernel_program_info(
info.ptr()));
7856 result.set_kernel_library_index(-1);
7860PatchClassPtr PatchClass::New() {
7862 return Object::Allocate<PatchClass>(
Heap::kOld);
7865void PatchClass::set_wrapped_class(
const Class&
value)
const {
7869#if !defined(DART_PRECOMPILED_RUNTIME)
7871 untag()->set_kernel_program_info(
info.ptr());
7875void PatchClass::set_script(
const Script&
value)
const {
7881 if (IsClosureFunction()) {
7884 if (Owner()->IsClass()) {
7903 if (HasCode() && !
Code::Handle(CurrentCode()).IsDisabled()) {
7913 SetInstructionsSafe(
value);
7916 SetInstructionsSafe(
value);
7921 untag()->set_code<std::memory_order_release>(
value.ptr());
7924 value.UncheckedEntryPoint());
7930 value.set_owner(*
this);
7931 SetInstructions(
value);
7933 (
value.function() == this->ptr()));
7939 return untag()->code() != StubCode::LazyCompile().ptr();
7945 return function->untag()->code() != StubCode::LazyCompile().ptr();
7949#if defined(DART_PRECOMPILED_RUNTIME)
7954 SetInstructions(StubCode::LazyCompile());
7959#if defined(DART_PRECOMPILED_RUNTIME)
7964 SetInstructionsSafe(StubCode::LazyCompile());
7969 ASSERT(!ForceOptimize());
7977 if (!
error.IsNull()) {
7983 ASSERT(HasOptimizedCode());
7984 ASSERT(!ForceOptimize());
7992 if (FLAG_trace_deoptimization_verbose) {
7993 THR_Print(
"Disabling optimized code: '%s' entry: %#" Px "\n",
7994 ToFullyQualifiedCString(), current_code.
EntryPoint());
7999 if (!
error.IsNull()) {
8004 AttachCode(unopt_code);
8008#if defined(DART_PRECOMPILED_RUNTIME)
8011 if (!HasOptimizedCode()) {
8024 if (unopt_code.
IsNull()) {
8027 SetInstructions(StubCode::LazyCompile());
8033 AttachCode(unopt_code);
8039#if defined(DART_PRECOMPILED_RUNTIME)
8049 if (IsClosureFunction()) {
8052 return ClosureData::Cast(obj).context_scope();
8058 if (IsClosureFunction()) {
8061 ClosureData::Cast(obj).set_context_scope(
value);
8068 if (IsClosureFunction()) {
8071 return ClosureData::Cast(obj).awaiter_link();
8078 if (IsClosureFunction()) {
8081 ClosureData::Cast(obj).set_awaiter_link(
link);
8087ClosurePtr Function::implicit_static_closure()
const {
8088 if (IsImplicitStaticClosureFunction()) {
8091 return ClosureData::Cast(obj).implicit_static_closure();
8096void Function::set_implicit_static_closure(
const Closure&
closure)
const {
8097 if (IsImplicitStaticClosureFunction()) {
8100 ClosureData::Cast(obj).set_implicit_static_closure(
closure);
8106ScriptPtr Function::eval_script()
const {
8108 if (obj.IsScript()) {
8109 return Script::Cast(obj).ptr();
8114void Function::set_eval_script(
const Script&
script)
const {
8121 ASSERT(kind() == UntaggedFunction::kMethodExtractor);
8123 ASSERT(obj.IsFunction());
8124 return Function::Cast(obj).ptr();
8128 ASSERT(kind() == UntaggedFunction::kMethodExtractor);
8134 if (kind() == UntaggedFunction::kDynamicInvocationForwarder) {
8137 ASSERT(kind() == UntaggedFunction::kNoSuchMethodDispatcher ||
8138 kind() == UntaggedFunction::kInvokeFieldDispatcher);
8143 ASSERT(kind() == UntaggedFunction::kNoSuchMethodDispatcher ||
8144 kind() == UntaggedFunction::kInvokeFieldDispatcher);
8150 ASSERT(kind() == UntaggedFunction::kImplicitGetter ||
8151 kind() == UntaggedFunction::kImplicitSetter ||
8152 kind() == UntaggedFunction::kImplicitStaticGetter ||
8153 kind() == UntaggedFunction::kFieldInitializer);
8158 ASSERT(kind() == UntaggedFunction::kImplicitGetter ||
8159 kind() == UntaggedFunction::kImplicitSetter ||
8160 kind() == UntaggedFunction::kImplicitStaticGetter ||
8161 kind() == UntaggedFunction::kFieldInitializer);
8171 return ClosureData::Cast(obj).parent_function();
8174void Function::set_parent_function(
const Function&
value)
const {
8175 ASSERT(IsClosureFunction());
8178 ClosureData::Cast(obj).set_parent_function(
value);
8183 return Object::empty_type_arguments().ptr();
8189 if (!IsClosureFunction()) {
8192 return ClosureData::DefaultTypeArgumentsInstantiationMode(
8198 if (!IsClosureFunction()) {
8202 ASSERT(!closure_data.IsNull());
8203 closure_data.set_default_type_arguments_instantiation_mode(
value);
8208 FunctionPtr parent = parent_function();
8215 parent =
function.parent_function();
8220FunctionPtr Function::implicit_closure_function()
const {
8221 if (IsClosureFunction() || IsDispatcherOrImplicitAccessor() ||
8222 IsFieldInitializer() || IsFfiCallbackTrampoline() ||
8223 IsMethodExtractor()) {
8227 ASSERT(obj.IsNull() || obj.IsScript() || obj.IsFunction() || obj.IsArray());
8228 if (obj.IsNull() || obj.IsScript()) {
8231 if (obj.IsFunction()) {
8232 return Function::Cast(obj).ptr();
8240void Function::set_implicit_closure_function(
const Function&
value)
const {
8243 ASSERT(!IsClosureFunction());
8245 if (is_old_native()) {
8246 ASSERT(old_data.IsArray());
8247 const auto& pair = Array::Cast(old_data);
8250 pair.SetAtRelease(NativeFunctionData::kTearOff,
value);
8258 ASSERT(IsFfiCallbackTrampoline());
8261 FfiTrampolineData::Cast(obj).set_c_signature(sig);
8266 if (IsFfiCallbackTrampoline()) {
8269 return FfiTrampolineData::Cast(obj).c_signature();
8272 if (is_ffi_native()) {
8273 pragma_value = GetNativeAnnotation();
8274 }
else if (IsFfiCallClosure()) {
8275 pragma_value = GetFfiCallClosurePragmaValue();
8279 const auto& type_args =
8281 ASSERT(type_args.Length() == 1);
8282 const auto& native_type =
8284 return native_type.ptr();
8293 const intptr_t num_params = num_fixed_parameters();
8294 for (intptr_t
i = 0;
i < num_params;
i++) {
8295 const bool is_handle =
8307 ASSERT(IsFfiCallbackTrampoline());
8315 const auto& superClass =
Class::Handle(zone, cls.SuperClass());
8316 const bool is_abi_specific_int =
8318 .Equals(Symbols::AbiSpecificInteger());
8319 if (is_abi_specific_int) {
8323 const bool is_struct =
String::Handle(zone, superClass.UserVisibleName())
8324 .Equals(Symbols::Struct());
8325 const bool is_union =
String::Handle(zone, superClass.UserVisibleName())
8327 ASSERT(is_struct || is_union);
8333 ASSERT(IsFfiCallbackTrampoline());
8337 const auto& trampoline_data = FfiTrampolineData::Cast(obj);
8339 ASSERT(trampoline_data.callback_id() != -1);
8341 return trampoline_data.callback_id();
8345 ASSERT(IsFfiCallbackTrampoline());
8349 const auto& trampoline_data = FfiTrampolineData::Cast(obj);
8351 ASSERT(trampoline_data.callback_id() == -1);
8352 trampoline_data.set_callback_id(callback_id);
8358 if (is_ffi_native()) {
8359 pragma_value = GetNativeAnnotation();
8360 }
else if (IsFfiCallClosure()) {
8361 pragma_value = GetFfiCallClosurePragmaValue();
8365 const auto& pragma_value_class =
Class::Handle(zone, pragma_value.clazz());
8366 const auto& pragma_value_fields =
8368 ASSERT(pragma_value_fields.Length() >= 1);
8371 Field::RawCast(pragma_value_fields.At(pragma_value_fields.Length() - 1)));
8372 ASSERT(is_leaf_field.name() == Symbols::isLeaf().ptr());
8378 ASSERT(IsFfiCallbackTrampoline());
8381 return FfiTrampolineData::Cast(obj).callback_target();
8385 ASSERT(IsFfiCallbackTrampoline());
8388 FfiTrampolineData::Cast(obj).set_callback_target(
target);
8392 ASSERT(IsFfiCallbackTrampoline());
8395 return FfiTrampolineData::Cast(obj).callback_exceptional_return();
8399 ASSERT(IsFfiCallbackTrampoline());
8402 FfiTrampolineData::Cast(obj).set_callback_exceptional_return(
value);
8406 ASSERT(IsFfiCallbackTrampoline());
8409 return FfiTrampolineData::Cast(obj).ffi_function_kind();
8413 ASSERT(IsFfiCallbackTrampoline());
8416 FfiTrampolineData::Cast(obj).set_ffi_function_kind(
value);
8424 ASSERT(kind() == UntaggedFunction::kDynamicInvocationForwarder);
8429 ASSERT(kind() == UntaggedFunction::kDynamicInvocationForwarder);
8455void Function::set_data(
const Object&
value)
const {
8456 untag()->set_data<std::memory_order_release>(
value.ptr());
8459void Function::set_name(
const String&
value)
const {
8470 ASSERT(kind() == UntaggedFunction::kIrregexpFunction);
8477 :
public BitField<intptr_t, intptr_t, 1, UntaggedObject::kClassIdTagSize> {
8481 ASSERT(kind() == UntaggedFunction::kIrregexpFunction);
8487 ASSERT(kind() == UntaggedFunction::kIrregexpFunction);
8493 intptr_t string_specialization_cid,
8494 bool sticky)
const {
8495 ASSERT(kind() == UntaggedFunction::kIrregexpFunction);
8499 pair.
SetAt(0, regexp);
8502 string_specialization_cid))));
8517 pair.SetAt(NativeFunctionData::kNativeName,
value);
8527 false, &pragma_value);
8528 auto const& native_instance = Instance::Cast(pragma_value);
8529 ASSERT(!native_instance.IsNull());
8531 const auto& native_class =
Class::Handle(zone, native_instance.clazz());
8533 .Equals(Symbols::FfiNative()));
8535 return native_instance.ptr();
8539 return is_native() && !is_external();
8543 return is_native() && is_external();
8547 set_signature(
value);
8548 ASSERT(NumImplicitParameters() ==
value.num_implicit_parameters());
8549 if (IsClosureFunction() &&
value.IsGeneric()) {
8556 set_default_type_arguments_instantiation_mode(
mode);
8562 ASSERT(index >= 0 && index < NumTypeParameters());
8566 zone, TypeParameter::New(*
this, NumParentTypeArguments(),
8572 return type_param.
ptr();
8603#if defined(DART_PRECOMPILED_RUNTIME)
8606 return Symbols::OptimizedOut().ptr();
8609 const intptr_t num_fixed = num_fixed_parameters();
8610 if (HasOptionalNamedParameters() && index >= num_fixed) {
8611 const Array& parameter_names =
8615#if defined(DART_PRECOMPILED_RUNTIME)
8616 return Symbols::OptimizedOut().ptr();
8624#if defined(DART_PRECOMPILED_RUNTIME)
8628 if (HasOptionalNamedParameters() && index >= num_fixed_parameters()) {
8632 const Array& parameter_names =
8638#if !defined(DART_PRECOMPILED_RUNTIME)
8639void Function::set_positional_parameter_names(
const Array&
value)
const {
8641 untag()->set_positional_parameter_names(
value.ptr());
8646 const intptr_t num_fixed = num_fixed_parameters();
8647 if (!HasOptionalNamedParameters() || index < num_fixed) {
8651 const Array& parameter_names =
8658#if defined(DART_PRECOMPILED_RUNTIME)
8662 const intptr_t num_fixed = num_fixed_parameters();
8663 if (!HasOptionalNamedParameters() || index < num_fixed) {
8666 const Array& parameter_names =
8668 parameter_names.
SetAt(index - num_fixed,
value);
8674 untag()->set_named_parameter_names(
value.ptr());
8678#if defined(DART_PRECOMPILED_RUNTIME)
8681 const intptr_t num_positional_params =
8682 num_fixed_parameters() + NumOptionalPositionalParameters();
8683 if (num_positional_params == 0) {
8684 set_positional_parameter_names(Object::empty_array());
8686 set_positional_parameter_names(
8693#if defined(DART_PRECOMPILED_RUNTIME)
8696 const intptr_t num_named_parameters = NumOptionalNamedParameters();
8697 if (num_named_parameters == 0) {
8698 return set_named_parameter_names(Object::empty_array());
8701 const intptr_t last_index = (num_named_parameters - 1) /
8703 const intptr_t num_flag_slots = last_index + 1;
8704 intptr_t num_total_slots = num_named_parameters + num_flag_slots;
8708 for (intptr_t
i = num_named_parameters;
i < num_total_slots;
i++) {
8709 array.
SetAt(
i, empty_flags_smi);
8711 set_named_parameter_names(array);
8716 intptr_t* flag_mask)
const {
8719 ASSERT(HasOptionalNamedParameters());
8720 ASSERT(flag_mask !=
nullptr);
8721 ASSERT(index >= num_fixed_parameters());
8722 index -= num_fixed_parameters();
8724 << ((
static_cast<uintptr_t
>(index) %
8727 return NumOptionalNamedParameters() +
8732#if defined(DART_PRECOMPILED_RUNTIME)
8742#if defined(DART_PRECOMPILED_RUNTIME)
8748 if (!HasOptionalNamedParameters() || index < num_fixed_parameters()) {
8756 if (!HasOptionalNamedParameters() || index < num_fixed_parameters()) {
8760 const intptr_t flag_index = GetRequiredFlagIndex(index, &flag_mask);
8761 const Array& parameter_names =
8763 if (flag_index >= parameter_names.
Length()) {
8766 const intptr_t
flags =
8768 return (
flags & flag_mask) != 0;
8772#if defined(DART_PRECOMPILER_RUNTIME)
8776 const intptr_t flag_index = GetRequiredFlagIndex(index, &flag_mask);
8777 const Array& parameter_names =
8780 const intptr_t
flags =
8787#if defined(DART_PRECOMPILER_RUNTIME)
8790 const intptr_t num_named_parameters = NumOptionalNamedParameters();
8791 if (num_named_parameters == 0) {
8792 ASSERT(
untag()->named_parameter_names() == Object::empty_array().
ptr());
8795 const Array& parameter_names =
8798 intptr_t last_used = parameter_names.
Length() - 1;
8799 for (; last_used >= num_named_parameters; --last_used) {
8804 parameter_names.
Truncate(last_used + 1);
8809 const intptr_t num_named_params = NumOptionalNamedParameters();
8810 if (num_named_params == 0)
return false;
8812 const auto& parameter_names =
Array::Handle(named_parameter_names());
8813 ASSERT(!parameter_names.IsNull());
8814 return parameter_names.Length() > num_named_params;
8820 "too many type parameters declared in signature '%s' or in "
8821 "its enclosing signatures",
8902#if defined(DART_PRECOMPILED_RUNTIME)
8910void Function::set_kind_tag(uint32_t
value)
const {
8914bool Function::is_eval_function()
const {
8915 if (
data()->IsArray()) {
8923#if defined(DART_PRECOMPILED_RUNTIME)
8931 if (FLAG_precompiled_mode) {
8934 if (ForceOptimize())
return true;
8935 if (is_old_native()) {
8943 FLAG_huge_method_cutoff_in_code_size);
8950 set_is_optimizable(
value);
8952 set_is_inlinable(
false);
8953 set_usage_counter(INT32_MIN);
8958 switch (recognized_kind()) {
8959 case MethodRecognizer::kTypedData_ByteDataView_factory:
8960 case MethodRecognizer::kTypedData_Int8ArrayView_factory:
8961 case MethodRecognizer::kTypedData_Uint8ArrayView_factory:
8962 case MethodRecognizer::kTypedData_Uint8ClampedArrayView_factory:
8963 case MethodRecognizer::kTypedData_Int16ArrayView_factory:
8964 case MethodRecognizer::kTypedData_Uint16ArrayView_factory:
8965 case MethodRecognizer::kTypedData_Int32ArrayView_factory:
8966 case MethodRecognizer::kTypedData_Uint32ArrayView_factory:
8967 case MethodRecognizer::kTypedData_Int64ArrayView_factory:
8968 case MethodRecognizer::kTypedData_Uint64ArrayView_factory:
8969 case MethodRecognizer::kTypedData_Float32ArrayView_factory:
8970 case MethodRecognizer::kTypedData_Float64ArrayView_factory:
8971 case MethodRecognizer::kTypedData_Float32x4ArrayView_factory:
8972 case MethodRecognizer::kTypedData_Int32x4ArrayView_factory:
8973 case MethodRecognizer::kTypedData_Float64x2ArrayView_factory:
8981 switch (recognized_kind()) {
8982 case MethodRecognizer::kTypedData_UnmodifiableByteDataView_factory:
8983 case MethodRecognizer::kTypedData_UnmodifiableInt8ArrayView_factory:
8984 case MethodRecognizer::kTypedData_UnmodifiableUint8ArrayView_factory:
8985 case MethodRecognizer::kTypedData_UnmodifiableUint8ClampedArrayView_factory:
8986 case MethodRecognizer::kTypedData_UnmodifiableInt16ArrayView_factory:
8987 case MethodRecognizer::kTypedData_UnmodifiableUint16ArrayView_factory:
8988 case MethodRecognizer::kTypedData_UnmodifiableInt32ArrayView_factory:
8989 case MethodRecognizer::kTypedData_UnmodifiableUint32ArrayView_factory:
8990 case MethodRecognizer::kTypedData_UnmodifiableInt64ArrayView_factory:
8991 case MethodRecognizer::kTypedData_UnmodifiableUint64ArrayView_factory:
8992 case MethodRecognizer::kTypedData_UnmodifiableFloat32ArrayView_factory:
8993 case MethodRecognizer::kTypedData_UnmodifiableFloat64ArrayView_factory:
8994 case MethodRecognizer::kTypedData_UnmodifiableFloat32x4ArrayView_factory:
8995 case MethodRecognizer::kTypedData_UnmodifiableInt32x4ArrayView_factory:
8996 case MethodRecognizer::kTypedData_UnmodifiableFloat64x2ArrayView_factory:
9011 const bool in_vm_tests =
9012 strstr(url.ToCString(),
"runtime/tests/vm/") !=
nullptr;
9018 if (RecognizedKindForceOptimize() || IsFfiCallClosure() ||
9019 IsFfiCallbackTrampoline() || is_ffi_native() ||
9020 IsTypedDataViewFactory() || IsUnmodifiableTypedDataViewFactory()) {
9024 if (!has_pragma())
return false;
9028 if (!has_vm_pragma)
return false;
9036 if (!has_pragma())
return false;
9039 Symbols::vm_prefer_inline());
9043 if (!has_pragma())
return false;
9046 const bool kAllowOnlyForCoreLibFunctions =
false;
9048 const bool kAllowOnlyForCoreLibFunctions =
true;
9052 *
this, Symbols::vm_idempotent());
9056 if (!has_pragma())
return false;
9058 const bool has_vm_pragma =
9060 Symbols::vm_cachable_idempotent());
9061 if (!has_vm_pragma)
return false;
9068 if (!IsNonImplicitClosureFunction())
return false;
9069 if (!has_pragma())
return false;
9071 Symbols::vm_ffi_call_closure());
9075 ASSERT(IsFfiCallClosure());
9080 Symbols::vm_ffi_call_closure(),
9081 false, &pragma_value);
9082 ASSERT(!pragma_value.IsNull());
9083 return Instance::Cast(pragma_value).ptr();
9087 switch (recognized_kind()) {
9091 case MethodRecognizer::kObjectArrayGetIndexed:
9092 case MethodRecognizer::kGrowableArrayGetIndexed:
9093#define TYPED_DATA_GET_INDEXED_CASES(clazz) \
9094 case MethodRecognizer::k##clazz##ArrayGetIndexed: \
9096 case MethodRecognizer::kExternal##clazz##ArrayGetIndexed: \
9098 case MethodRecognizer::k##clazz##ArrayViewGetIndexed: \
9101#undef TYPED_DATA_GET_INDEXED_CASES
9102 case MethodRecognizer::kCopyRangeFromUint8ListToOneByteString:
9103 case MethodRecognizer::kFinalizerBase_getIsolateFinalizers:
9104 case MethodRecognizer::kFinalizerBase_setIsolate:
9105 case MethodRecognizer::kFinalizerBase_setIsolateFinalizers:
9106 case MethodRecognizer::kFinalizerEntry_getExternalSize:
9107 case MethodRecognizer::kExtensionStreamHasListener:
9108 case MethodRecognizer::kFfiLoadInt8:
9109 case MethodRecognizer::kFfiLoadInt16:
9110 case MethodRecognizer::kFfiLoadInt32:
9111 case MethodRecognizer::kFfiLoadInt64:
9112 case MethodRecognizer::kFfiLoadUint8:
9113 case MethodRecognizer::kFfiLoadUint16:
9114 case MethodRecognizer::kFfiLoadUint32:
9115 case MethodRecognizer::kFfiLoadUint64:
9116 case MethodRecognizer::kFfiLoadFloat:
9117 case MethodRecognizer::kFfiLoadFloatUnaligned:
9118 case MethodRecognizer::kFfiLoadDouble:
9119 case MethodRecognizer::kFfiLoadDoubleUnaligned:
9120 case MethodRecognizer::kFfiLoadPointer:
9121 case MethodRecognizer::kFfiStoreInt8:
9122 case MethodRecognizer::kFfiStoreInt16:
9123 case MethodRecognizer::kFfiStoreInt32:
9124 case MethodRecognizer::kFfiStoreInt64:
9125 case MethodRecognizer::kFfiStoreUint8:
9126 case MethodRecognizer::kFfiStoreUint16:
9127 case MethodRecognizer::kFfiStoreUint32:
9128 case MethodRecognizer::kFfiStoreUint64:
9129 case MethodRecognizer::kFfiStoreFloat:
9130 case MethodRecognizer::kFfiStoreFloatUnaligned:
9131 case MethodRecognizer::kFfiStoreDouble:
9132 case MethodRecognizer::kFfiStoreDoubleUnaligned:
9133 case MethodRecognizer::kFfiStorePointer:
9134 case MethodRecognizer::kFfiFromAddress:
9135 case MethodRecognizer::kFfiGetAddress:
9136 case MethodRecognizer::kFfiAsExternalTypedDataInt8:
9137 case MethodRecognizer::kFfiAsExternalTypedDataInt16:
9138 case MethodRecognizer::kFfiAsExternalTypedDataInt32:
9139 case MethodRecognizer::kFfiAsExternalTypedDataInt64:
9140 case MethodRecognizer::kFfiAsExternalTypedDataUint8:
9141 case MethodRecognizer::kFfiAsExternalTypedDataUint16:
9142 case MethodRecognizer::kFfiAsExternalTypedDataUint32:
9143 case MethodRecognizer::kFfiAsExternalTypedDataUint64:
9144 case MethodRecognizer::kFfiAsExternalTypedDataFloat:
9145 case MethodRecognizer::kFfiAsExternalTypedDataDouble:
9146 case MethodRecognizer::kGetNativeField:
9147 case MethodRecognizer::kRecord_fieldNames:
9148 case MethodRecognizer::kRecord_numFields:
9149 case MethodRecognizer::kStringBaseCodeUnitAt:
9150 case MethodRecognizer::kUtf8DecoderScan:
9151 case MethodRecognizer::kDouble_hashCode:
9152 case MethodRecognizer::kTypedList_GetInt8:
9153 case MethodRecognizer::kTypedList_SetInt8:
9154 case MethodRecognizer::kTypedList_GetUint8:
9155 case MethodRecognizer::kTypedList_SetUint8:
9156 case MethodRecognizer::kTypedList_GetInt16:
9157 case MethodRecognizer::kTypedList_SetInt16:
9158 case MethodRecognizer::kTypedList_GetUint16:
9159 case MethodRecognizer::kTypedList_SetUint16:
9160 case MethodRecognizer::kTypedList_GetInt32:
9161 case MethodRecognizer::kTypedList_SetInt32:
9162 case MethodRecognizer::kTypedList_GetUint32:
9163 case MethodRecognizer::kTypedList_SetUint32:
9164 case MethodRecognizer::kTypedList_GetInt64:
9165 case MethodRecognizer::kTypedList_SetInt64:
9166 case MethodRecognizer::kTypedList_GetUint64:
9167 case MethodRecognizer::kTypedList_SetUint64:
9168 case MethodRecognizer::kTypedList_GetFloat32:
9169 case MethodRecognizer::kTypedList_SetFloat32:
9170 case MethodRecognizer::kTypedList_GetFloat64:
9171 case MethodRecognizer::kTypedList_SetFloat64:
9172 case MethodRecognizer::kTypedList_GetInt32x4:
9173 case MethodRecognizer::kTypedList_SetInt32x4:
9174 case MethodRecognizer::kTypedList_GetFloat32x4:
9175 case MethodRecognizer::kTypedList_SetFloat32x4:
9176 case MethodRecognizer::kTypedList_GetFloat64x2:
9177 case MethodRecognizer::kTypedList_SetFloat64x2:
9178 case MethodRecognizer::kTypedData_memMove1:
9179 case MethodRecognizer::kTypedData_memMove2:
9180 case MethodRecognizer::kTypedData_memMove4:
9181 case MethodRecognizer::kTypedData_memMove8:
9182 case MethodRecognizer::kTypedData_memMove16:
9183 case MethodRecognizer::kMemCopy:
9189 case MethodRecognizer::kFinalizerBase_exchangeEntriesCollectedWithNull:
9191 case MethodRecognizer::kFinalizerEntry_allocate:
9198#if !defined(DART_PRECOMPILED_RUNTIME)
9200 if (ForceOptimize()) {
9201 if (IsFfiCallClosure() || IsFfiCallbackTrampoline() || is_ffi_native()) {
9216 ASSERT(!IsPreferInline() || IsIdempotent());
9217 return IsIdempotent();
9220 if (HasBreakpoint()) {
9224 return is_inlinable();
9230 if (k == UntaggedFunction::kConstructor) {
9234 if ((k == UntaggedFunction::kClosureFunction) ||
9235 (k == UntaggedFunction::kImplicitClosureFunction) ||
9236 (k == UntaggedFunction::kFfiTrampoline)) {
9243 ASSERT((k != UntaggedFunction::kClosureFunction) &&
9244 (k != UntaggedFunction::kImplicitClosureFunction));
9251 intptr_t num_arguments,
9252 intptr_t num_named_arguments,
9253 String* error_message)
const {
9254 if ((num_type_arguments != 0) &&
9255 (num_type_arguments != NumTypeParameters())) {
9256 if (error_message !=
nullptr) {
9257 const intptr_t kMessageBufferSize = 64;
9258 char message_buffer[kMessageBufferSize];
9260 "%" Pd " type arguments passed, but %" Pd " expected",
9261 num_type_arguments, NumTypeParameters());
9268 if (num_named_arguments > NumOptionalNamedParameters()) {
9269 if (error_message !=
nullptr) {
9270 const intptr_t kMessageBufferSize = 64;
9271 char message_buffer[kMessageBufferSize];
9273 "%" Pd " named passed, at most %" Pd " expected",
9274 num_named_arguments, NumOptionalNamedParameters());
9281 const intptr_t num_pos_args = num_arguments - num_named_arguments;
9282 const intptr_t num_opt_pos_params = NumOptionalPositionalParameters();
9283 const intptr_t num_pos_params = num_fixed_parameters() + num_opt_pos_params;
9284 if (num_pos_args > num_pos_params) {
9285 if (error_message !=
nullptr) {
9286 const intptr_t kMessageBufferSize = 64;
9287 char message_buffer[kMessageBufferSize];
9289 const intptr_t num_hidden_params = NumImplicitParameters();
9291 "%" Pd "%s passed, %s%" Pd " expected",
9292 num_pos_args - num_hidden_params,
9293 num_opt_pos_params > 0 ?
" positional" :
"",
9294 num_opt_pos_params > 0 ?
"at most " :
"",
9295 num_pos_params - num_hidden_params);
9302 if (num_pos_args < num_fixed_parameters()) {
9303 if (error_message !=
nullptr) {
9304 const intptr_t kMessageBufferSize = 64;
9305 char message_buffer[kMessageBufferSize];
9307 const intptr_t num_hidden_params = NumImplicitParameters();
9309 "%" Pd "%s passed, %s%" Pd " expected",
9310 num_pos_args - num_hidden_params,
9311 num_opt_pos_params > 0 ?
" positional" :
"",
9312 num_opt_pos_params > 0 ?
"at least " :
"",
9313 num_fixed_parameters() - num_hidden_params);
9324 intptr_t num_arguments,
9325 const Array& argument_names,
9326 String* error_message)
const {
9328 num_type_arguments, num_arguments, argument_names,
Heap::kNew));
9330 return AreValidArguments(args_desc, error_message);
9334 String* error_message)
const {
9335 const intptr_t num_type_arguments = args_desc.
TypeArgsLen();
9336 const intptr_t num_arguments = args_desc.
Count();
9337 const intptr_t num_named_arguments = args_desc.
NamedCount();
9339 if (!AreValidArgumentCounts(num_type_arguments, num_arguments,
9340 num_named_arguments, error_message)) {
9348 const intptr_t num_positional_args = num_arguments - num_named_arguments;
9349 const intptr_t num_parameters = NumParameters();
9350 for (intptr_t
i = 0;
i < num_named_arguments;
i++) {
9351 argument_name = args_desc.
NameAt(
i);
9354 for (intptr_t j = num_positional_args; j < num_parameters; j++) {
9355 parameter_name = ParameterNameAt(j);
9357 if (argument_name.
Equals(parameter_name)) {
9363 if (error_message !=
nullptr) {
9364 const intptr_t kMessageBufferSize = 64;
9365 char message_buffer[kMessageBufferSize];
9367 "no optional formal parameter named '%s'",
9375 for (intptr_t j = num_parameters - NumOptionalNamedParameters();
9376 j < num_parameters; j++) {
9377 if (IsRequiredAt(j)) {
9378 parameter_name = ParameterNameAt(j);
9381 for (intptr_t
i = 0;
i < num_named_arguments;
i++) {
9382 argument_name = args_desc.
NameAt(
i);
9384 if (argument_name.
Equals(parameter_name)) {
9390 if (error_message !=
nullptr) {
9391 const intptr_t kMessageBufferSize = 64;
9392 char message_buffer[kMessageBufferSize];
9394 "missing required named parameter '%s'",
9419 const intptr_t kNumCurrentTypeArgs =
function.NumTypeParameters();
9420 const intptr_t kNumParentTypeArgs =
function.NumParentTypeArguments();
9421 const intptr_t kNumTypeArgs = kNumCurrentTypeArgs + kNumParentTypeArgs;
9423 if (kNumTypeArgs == 0)
return Object::empty_type_arguments().ptr();
9429 const auto& parent_type_args =
9432 zone, Closure::Cast(receiver).function_type_arguments())
9433 : Object::empty_type_arguments();
9437 if (kNumCurrentTypeArgs == 0)
return parent_type_args.ptr();
9442 bool has_delayed_type_args =
false;
9443 if (
function.IsClosureFunction()) {
9444 const auto&
closure = Closure::Cast(receiver);
9445 function_type_args =
closure.delayed_type_arguments();
9446 has_delayed_type_args =
9447 function_type_args.ptr() != Object::empty_type_arguments().ptr();
9455 ASSERT(!has_delayed_type_args);
9456 function_type_args ^=
args.At(0);
9457 }
else if (!has_delayed_type_args) {
9460 function_type_args =
function.DefaultTypeArguments(zone);
9463 ?
function.default_type_arguments_instantiation_mode()
9464 : function_type_args.GetInstantiationMode(zone, &
function);
9470 function_type_args = function_type_args.InstantiateAndCanonicalizeFrom(
9471 instantiator_type_args, parent_type_args);
9474 function_type_args = instantiator_type_args.
ptr();
9477 function_type_args = parent_type_args.ptr();
9482 return function_type_args.Prepend(zone, parent_type_args, kNumParentTypeArgs,
9491 if (
function.IsClosureFunction()) {
9492 ASSERT(receiver.IsClosure());
9493 const auto&
closure = Closure::Cast(receiver);
9494 return closure.instantiator_type_arguments();
9496 if (!receiver.
IsNull()) {
9498 if (cls.NumTypeArguments() > 0) {
9502 return Object::empty_type_arguments().ptr();
9508#if defined(DART_PRECOMPILED_RUNTIME)
9518 if (IsClosureFunction() || HasThisParameter()) {
9524 instantiator_type_arguments);
9531#if defined(DART_PRECOMPILED_RUNTIME)
9541 if (IsClosureFunction() || HasThisParameter()) {
9547 instantiator_type_arguments,
args,
9550 args, args_desc, instantiator_type_arguments, function_type_arguments);
9558#if defined(DART_PRECOMPILED_RUNTIME)
9569 const intptr_t kNumLocalTypeArgs = NumTypeParameters();
9570 if (kNumLocalTypeArgs > 0) {
9571 const intptr_t kNumParentTypeArgs = NumParentTypeArguments();
9573 kNumLocalTypeArgs));
9576 if (!
params.AllDynamicBounds()) {
9579 for (intptr_t
i = 0;
i < kNumLocalTypeArgs;
i++) {
9583 if (
params.IsGenericCovariantImplAt(
i) ||
9584 bound.IsTopTypeForSubtyping()) {
9587 param = TypeParameterAt(
i);
9589 ¶m, &bound, instantiator_type_arguments,
9590 function_type_arguments)) {
9600 ASSERT(function_type_arguments.
HasCount(NumParentTypeArguments()));
9610 if (
type.IsTopTypeForSubtyping())
return true;
9613 function_type_args);
9616 function_type_args);
9622 const intptr_t arg_start = arg_offset + NumImplicitParameters();
9623 const intptr_t end_positional_args = arg_offset + args_desc.
PositionalCount();
9624 for (intptr_t arg_index = arg_start; arg_index < end_positional_args;
9626 argument ^=
args.At(arg_index);
9628 const intptr_t param_index = arg_index - arg_offset;
9629 type = ParameterTypeAt(param_index);
9630 if (!check_argument(argument,
type, instantiator_type_arguments,
9631 function_type_arguments)) {
9633 if (!
type.IsInstantiated()) {
9635 type.InstantiateFrom(instantiator_type_arguments,
9642 const intptr_t num_named_arguments = args_desc.
NamedCount();
9643 if (num_named_arguments == 0) {
9647 const int num_parameters = NumParameters();
9648 const int num_fixed_params = num_fixed_parameters();
9654 for (intptr_t named_index = 0; named_index < num_named_arguments;
9656 argument_name = args_desc.
NameAt(named_index);
9658 argument ^=
args.At(arg_offset + args_desc.
PositionAt(named_index));
9665 intptr_t param_index = num_fixed_params;
9666 for (; param_index < num_parameters; param_index++) {
9667 parameter_name = ParameterNameAt(param_index);
9670 if (!parameter_name.
Equals(argument_name))
continue;
9672 type = ParameterTypeAt(param_index);
9673 if (!check_argument(argument,
type, instantiator_type_arguments,
9674 function_type_arguments)) {
9676 if (!
type.IsInstantiated()) {
9677 type =
type.InstantiateFrom(instantiator_type_arguments,
9686 ASSERT(param_index < num_parameters);
9704 intptr_t reserve_len,
9709 const char* function_format = (reserve_len == 0) ?
"%s" :
"%s_";
9719 const char* library_name =
nullptr;
9720 const char* lib_class_format =
nullptr;
9734 ASSERT(library_name !=
nullptr);
9735 lib_class_format = (library_name[0] ==
'\0') ?
"%s%s_" :
"%s_%s_";
9738 lib_class_format =
"%s%s.";
9742 ASSERT(chars !=
nullptr);
9743 *chars = zone->
Alloc<
char>(reserve_len + 1);
9748 with_lib, lib_kind);
9750 ASSERT(*chars !=
nullptr);
9756 if (
next ==
nullptr)
break;
9763 char* chars =
nullptr;
9770 char* chars =
nullptr;
9777 char* chars =
nullptr;
9786 intptr_t num_free_fun_type_params,
9789 intptr_t num_parent_type_args_adjustment)
const {
9792 const intptr_t num_parent_type_args = NumParentTypeArguments();
9793 bool delete_type_parameters =
false;
9797 num_free_fun_type_params =
kAllFree;
9798 delete_type_parameters =
true;
9803 if (num_parent_type_args < num_free_fun_type_params) {
9804 num_free_fun_type_params = num_parent_type_args;
9809 const intptr_t remaining_parent_type_params =
9810 num_free_fun_type_params < num_parent_type_args
9811 ? num_parent_type_args - num_free_fun_type_params
9815 num_parent_type_args_adjustment =
9816 remaining_parent_type_params +
9817 (delete_type_parameters ? 0 : NumTypeParameters());
9826 if (!delete_type_parameters) {
9829 if (!type_params.
IsNull()) {
9834 sig_type_params.set_names(
Array::Handle(zone, type_params.names()));
9835 sig_type_params.set_flags(
Array::Handle(zone, type_params.flags()));
9836 sig.SetTypeParameters(sig_type_params);
9838 type_args = type_params.bounds();
9841 instantiator_type_arguments, function_type_arguments,
9842 num_free_fun_type_params, space, function_type_mapping,
9843 num_parent_type_args_adjustment);
9845 sig_type_params.set_bounds(type_args);
9846 type_args = type_params.defaults();
9849 instantiator_type_arguments, function_type_arguments,
9850 num_free_fun_type_params, space, function_type_mapping,
9851 num_parent_type_args_adjustment);
9853 sig_type_params.set_defaults(type_args);
9857 type = result_type();
9858 if (!
type.IsInstantiated()) {
9860 instantiator_type_arguments, function_type_arguments,
9861 num_free_fun_type_params, space, function_type_mapping,
9862 num_parent_type_args_adjustment);
9865 if (
type.IsNull()) {
9869 sig.set_result_type(
type);
9870 const intptr_t num_params = NumParameters();
9871 sig.set_num_implicit_parameters(num_implicit_parameters());
9872 sig.set_num_fixed_parameters(num_fixed_parameters());
9873 sig.SetNumOptionalParameters(NumOptionalParameters(),
9874 HasOptionalPositionalParameters());
9876 for (intptr_t
i = 0;
i < num_params;
i++) {
9877 type = ParameterTypeAt(
i);
9878 if (!
type.IsInstantiated()) {
9880 instantiator_type_arguments, function_type_arguments,
9881 num_free_fun_type_params, space, function_type_mapping,
9882 num_parent_type_args_adjustment);
9885 if (
type.IsNull()) {
9889 sig.SetParameterTypeAt(
i,
type);
9891 sig.set_named_parameter_names(
Array::Handle(zone, named_parameter_names()));
9893 if (delete_type_parameters) {
9897 sig.SetIsFinalized();
9904 intptr_t num_parent_type_args_adjustment,
9905 intptr_t num_free_fun_type_params,
9908 ASSERT(num_parent_type_args_adjustment >= 0);
9912 const intptr_t old_num_parent_type_args = NumParentTypeArguments();
9915 if (num_free_fun_type_params > old_num_parent_type_args) {
9916 num_free_fun_type_params = old_num_parent_type_args;
9921 NumParentTypeArguments() + num_parent_type_args_adjustment,
9929 if (!type_params.
IsNull()) {
9934 new_type_params.set_names(
Array::Handle(zone, type_params.names()));
9935 new_type_params.set_flags(
Array::Handle(zone, type_params.flags()));
9937 type_args = type_params.bounds();
9938 if (!type_args.
IsNull()) {
9940 num_free_fun_type_params, space,
9941 function_type_mapping);
9943 new_type_params.set_bounds(type_args);
9944 type_args = type_params.defaults();
9945 if (!type_args.
IsNull()) {
9947 num_free_fun_type_params, space,
9948 function_type_mapping);
9950 new_type_params.set_defaults(type_args);
9954 type = result_type();
9955 type =
type.UpdateFunctionTypes(num_parent_type_args_adjustment,
9956 num_free_fun_type_params, space,
9957 function_type_mapping);
9960 const intptr_t num_params = NumParameters();
9964 HasOptionalPositionalParameters());
9966 for (intptr_t
i = 0;
i < num_params;
i++) {
9967 type = ParameterTypeAt(
i);
9968 type =
type.UpdateFunctionTypes(num_parent_type_args_adjustment,
9969 num_free_fun_type_params, space,
9970 function_type_mapping);
9977 return new_type.
ptr();
9985 intptr_t parameter_position,
9987 intptr_t other_parameter_position,
9997 return other_param_type.
IsSubtypeOf(param_type, space,
9998 function_type_equivalence);
10007 " FunctionType::HasSameTypeParametersAndBounds(%s, %s)\n",
ToCString(),
10010 const intptr_t num_type_params = NumTypeParameters();
10013 " - result: false (number of type parameters)\n");
10016 if (num_type_params > 0) {
10028 for (intptr_t
i = 0;
i < num_type_params;
i++) {
10030 other_bound = other_type_params.
BoundAt(
i);
10033 function_type_equivalence) ||
10035 function_type_equivalence)) {
10037 " - result: false (bounds are not mutual subtypes)\n");
10045 " - result: false (mismatch in number of type arguments)\n");
10052 if (!
bounds.IsEquivalent(other_bounds, kind, function_type_equivalence)) {
10054 " - result: false (bounds are not equivalent)\n");
10063 if (defaults.
IsNull()) {
10064 if (!other_defaults.
IsNull()) {
10066 " - result: false (mismatch in defaults)\n");
10069 }
else if (!defaults.
IsEquivalent(other_defaults, kind,
10070 function_type_equivalence)) {
10072 " - result: false (default types are not equivalent)\n");
10079 if (!
Array::Equals(type_params.flags(), other_type_params.flags())) {
10095 const intptr_t num_fixed_params = num_fixed_parameters();
10096 const intptr_t num_opt_pos_params = NumOptionalPositionalParameters();
10097 const intptr_t num_opt_named_params = NumOptionalNamedParameters();
10099 const intptr_t other_num_opt_pos_params =
10101 const intptr_t other_num_opt_named_params =
10105 const intptr_t num_ignored_params = num_implicit_parameters();
10107 if (((num_fixed_params - num_ignored_params) >
10108 (other_num_fixed_params - other_num_ignored_params)) ||
10109 ((num_fixed_params - num_ignored_params + num_opt_pos_params) <
10110 (other_num_fixed_params - other_num_ignored_params +
10111 other_num_opt_pos_params)) ||
10112 (num_opt_named_params < other_num_opt_named_params)) {
10114 " - result: false (mismatch in number of parameters)\n");
10123 function_type_equivalence)) {
10125 " - result: false (mismatch in type parameters)\n");
10135 function_type_equivalence)) {
10141 for (intptr_t
i = 0;
i < (other_num_fixed_params - other_num_ignored_params +
10142 other_num_opt_pos_params);
10144 if (!IsContravariantParameter(
i + num_ignored_params, other,
10145 i + other_num_ignored_params, space,
10146 function_type_equivalence)) {
10156 const int num_params = num_fixed_params + num_opt_named_params;
10157 const int other_num_params =
10158 other_num_fixed_params + other_num_opt_named_params;
10159 bool found_param_name;
10161 for (intptr_t
i = other_num_fixed_params;
i < other_num_params;
i++) {
10164 found_param_name =
false;
10165 for (intptr_t j = num_fixed_params; j < num_params; j++) {
10167 if (ParameterNameAt(j) == other_param_name.
ptr()) {
10168 found_param_name =
true;
10169 if (!IsContravariantParameter(j, other,
i, space,
10170 function_type_equivalence)) {
10172 " - result: false (optional parameter type)\n");
10178 if (!found_param_name) {
10180 " - result: false (named parameter not found)\n");
10186 String& param_name = other_param_name;
10187 for (intptr_t j = num_params - num_opt_named_params; j < num_params; j++) {
10188 if (IsRequiredAt(j)) {
10189 param_name = ParameterNameAt(j);
10191 bool found =
false;
10192 for (intptr_t
i = other_num_fixed_params;
i < other_num_params;
i++) {
10198 " - result: false (mismatch in required named "
10206 " - result: false (required named parameter not found)\n");
10219 return IsGenerativeConstructor() && (token_pos() == end_token_pos());
10224 uint32_t kind_tag = func->untag()->kind_tag_.load(std::memory_order_relaxed);
10226 UntaggedFunction::kImplicitClosureFunction) &&
10232 uint32_t kind_tag = func->untag()->kind_tag_.load(std::memory_order_relaxed);
10234 UntaggedFunction::kImplicitClosureFunction) &&
10240 return Object::Allocate<Function>(space);
10258 result.set_packed_fields(0);
10264 result.set_is_static(is_static);
10265 result.set_is_const(is_const);
10266 result.set_is_abstract(is_abstract);
10267 result.set_is_external(is_external);
10268 result.set_is_native(is_native);
10269 result.set_is_reflectable(
true);
10270 result.set_is_visible(
true);
10271 result.set_is_debuggable(
true);
10272 result.set_is_intrinsic(
false);
10273 result.set_has_pragma(
false);
10274 result.set_is_polymorphic_target(
false);
10275 result.set_is_synthetic(
false);
10277 result.set_owner(owner);
10286 result.set_is_optimizable(is_native ?
false :
true);
10287 result.set_is_inlinable(
true);
10288 result.reset_unboxed_parameters_and_return();
10289 result.SetInstructionsSafe(StubCode::LazyCompile());
10292 if (kind == UntaggedFunction::kClosureFunction ||
10293 kind == UntaggedFunction::kImplicitClosureFunction) {
10296 data.set_awaiter_link({});
10298 }
else if (kind == UntaggedFunction::kFfiTrampoline) {
10302 }
else if (
result.is_old_native()) {
10314 if (
result.ForceOptimize()) {
10315 result.set_is_debuggable(
false);
10318 result.SetSignature(signature);
10320 result.set_positional_parameter_names(Object::empty_array()));
10330 ASSERT((kind == UntaggedFunction::kClosureFunction) ||
10331 (kind == UntaggedFunction::kImplicitClosureFunction));
10343 false, owner, token_pos));
10344 result.set_parent_function(parent);
10353 return NewClosureFunctionWithKind(UntaggedFunction::kClosureFunction,
name,
10354 parent, parent.is_static(), token_pos,
10363 return NewClosureFunctionWithKind(
10364 UntaggedFunction::kImplicitClosureFunction,
name, parent,
10365 parent.is_static() || parent.
IsConstructor(), token_pos, parent_owner);
10369#if defined(DART_PRECOMPILED_RUNTIME)
10370 return HasImplicitClosureFunction();
10377 if (!IsInvokeFieldDispatcher())
return false;
10382 return handle.Equals(Symbols::DynamicCall());
10388 return implicit_closure_function();
10391#if defined(DART_PRECOMPILED_RUNTIME)
10393 FATAL(
"Cannot create implicit closure in AOT!");
10396 ASSERT(!IsClosureFunction());
10401 return implicit_closure_function();
10408 zone, NewImplicitClosureFunction(closure_name, *
this, token_pos()));
10411 if (is_static() || IsConstructor()) {
10424 if (!is_static() && !IsConstructor() &&
10429 const intptr_t num_type_params =
10430 IsConstructor() ? cls.NumTypeParameters() : NumTypeParameters();
10438 closure_signature);
10441 if (num_type_params > 0) {
10442 if (IsConstructor()) {
10447 instantiator_type_arguments, function_type_arguments,
10452 function_type_mapping);
10458 ASSERT(num_type_params > 0);
10459 if (!type_args.IsNull()) {
10460 if (IsConstructor()) {
10461 type_args = type_args.UpdateFunctionTypes(num_type_params,
kAllFree,
10464 type_args = type_args.InstantiateFrom(
10465 instantiator_type_arguments, function_type_arguments,
10470 function_type_mapping);
10476 if (num_type_params > 0) {
10478 zone, IsConstructor() ? cls.type_parameters() : type_parameters());
10483 new_type_params.set_names(
Array::Handle(zone, old_type_params.names()));
10484 new_type_params.set_flags(
Array::Handle(zone, old_type_params.flags()));
10492 for (intptr_t
i = 0;
i < num_type_params;
i++) {
10497 if (IsConstructor()) {
10498 instantiator_type_arguments =
10502 function_type_arguments = type_args.
ptr();
10505 type_args = old_type_params.bounds();
10506 transform_type_args(type_args);
10507 new_type_params.set_bounds(type_args);
10509 type_args = old_type_params.defaults();
10510 transform_type_args(type_args);
10511 new_type_params.set_defaults(type_args);
10516 if (IsConstructor()) {
10517 result_type = cls.DeclarationType();
10519 result_type = this->result_type();
10521 transform_type(result_type);
10529 closure_function.set_is_debuggable(
false);
10530 closure_function.set_is_visible(
false);
10535 const int kClosure = 1;
10536 const int num_implicit_params = NumImplicitParameters();
10537 const int num_fixed_params =
10538 kClosure - num_implicit_params + num_fixed_parameters();
10539 const int num_opt_params = NumOptionalParameters();
10540 const bool has_opt_pos_params = HasOptionalPositionalParameters();
10541 const int num_params = num_fixed_params + num_opt_params;
10542 const int num_pos_params = has_opt_pos_params ? num_params : num_fixed_params;
10545 has_opt_pos_params);
10556 for (
int i = kClosure;
i < num_pos_params;
i++) {
10557 param_type = ParameterTypeAt(num_implicit_params - kClosure +
i);
10558 transform_type(param_type);
10560 param_name = ParameterNameAt(num_implicit_params - kClosure +
i);
10564 for (
int i = num_pos_params;
i < num_params;
i++) {
10565 param_type = ParameterTypeAt(num_implicit_params - kClosure +
i);
10566 transform_type(param_type);
10568 param_name = ParameterNameAt(num_implicit_params - kClosure +
i);
10571 if (IsRequiredAt(num_implicit_params - kClosure +
i)) {
10578 if (!is_static() && !IsConstructor()) {
10580 BitVector is_covariant(zone, NumParameters());
10581 BitVector is_generic_covariant_impl(zone, NumParameters());
10583 &is_generic_covariant_impl);
10586 const auto& object_type =
10587 Type::Handle(zone, object_store->nullable_object_type());
10588 ASSERT(object_type.IsCanonical());
10589 for (intptr_t
i = kClosure;
i < num_params; ++
i) {
10590 const intptr_t original_param_index = num_implicit_params - kClosure +
i;
10591 if (is_covariant.
Contains(original_param_index) ||
10592 is_generic_covariant_impl.
Contains(original_param_index)) {
10600 set_implicit_closure_function(closure_function);
10602 ASSERT(HasImplicitClosureFunction());
10603 return closure_function.
ptr();
10617#if defined(DART_PRECOMPILED_RUNTIME)
10630#if defined(DART_PRECOMPILED_RUNTIME)
10647 const intptr_t num_params = NumParameters();
10648 const intptr_t num_fixed_params = num_fixed_parameters();
10649 const intptr_t num_opt_pos_params = NumOptionalPositionalParameters();
10650 const intptr_t num_opt_named_params = NumOptionalNamedParameters();
10651 const intptr_t num_opt_params = num_opt_pos_params + num_opt_named_params;
10652 ASSERT((num_fixed_params + num_opt_params) == num_params);
10656 i = num_implicit_parameters();
10659 while (
i < num_fixed_params) {
10660 param_type = ParameterTypeAt(
i);
10662 param_type.
PrintName(name_visibility, printer);
10663 if (
i != (num_params - 1)) {
10668 if (num_opt_params > 0) {
10669 if (num_opt_pos_params > 0) {
10674 for (intptr_t
i = num_fixed_params;
i < num_params;
i++) {
10675 if (num_opt_named_params > 0 && IsRequiredAt(
i)) {
10678 param_type = ParameterTypeAt(
i);
10680 param_type.
PrintName(name_visibility, printer);
10683 if (num_opt_named_params > 0) {
10684 name = ParameterNameAt(
i);
10688 if (
i != (num_params - 1)) {
10692 if (num_opt_pos_params > 0) {
10701 ASSERT(IsImplicitStaticClosureFunction());
10703 return implicit_static_closure();
10710 return implicit_static_closure();
10716 Object::null_type_arguments(), *
this,
10718 set_implicit_static_closure(
closure);
10719 return implicit_static_closure();
10723 ASSERT(IsImplicitClosureFunction());
10729 ASSERT(!HasGenericParent());
10731 Object::null_type_arguments(), *
this, receiver);
10739 const auto&
error = owner.EnsureIsFinalized(thread);
10744 if (!
target.IsNull() && (
target.ptr() != parent.ptr())) {
10746 if ((
target.is_static() != parent.is_static()) ||
10747 (
target.kind() != parent.kind())) {
10765 if (!type_params.
IsNull()) {
10767 const intptr_t
base = NumParentTypeArguments();
10768 const bool kIsClassTypeParameter =
false;
10770 type_params.
Print(thread, zone, kIsClassTypeParameter,
base,
10771 name_visibility, printer);
10775 PrintParameters(thread, zone, name_visibility, printer);
10778 if (!res_type.
IsNull()) {
10779 res_type.
PrintName(name_visibility, printer);
10787 intptr_t num_free_fun_type_params)
const {
10789 .IsInstantiated(genericity, num_free_fun_type_params);
10793 intptr_t num_free_fun_type_params)
const {
10795 num_free_fun_type_params =
kAllFree;
10797 const intptr_t num_parent_type_args = NumParentTypeArguments();
10798 if (num_parent_type_args > 0 && num_free_fun_type_params > 0) {
10807 if (num_free_fun_type_params > num_parent_type_args) {
10808 num_free_fun_type_params = num_parent_type_args;
10812 if (!
type.IsInstantiated(genericity, num_free_fun_type_params)) {
10815 const intptr_t num_parameters = NumParameters();
10816 for (intptr_t
i = 0;
i < num_parameters;
i++) {
10817 type = ParameterTypeAt(
i);
10818 if (!
type.IsInstantiated(genericity, num_free_fun_type_params)) {
10822 const intptr_t num_type_params = NumTypeParameters();
10823 if (num_type_params > 0) {
10826 for (intptr_t
i = 0;
i < type_params.
Length(); ++
i) {
10828 if (!
type.IsInstantiated(genericity, num_free_fun_type_params)) {
10843 if (
untag()->owner()->IsClass()) {
10847 ASSERT(obj.IsPatchClass());
10848 return PatchClass::Cast(obj).wrapped_class();
10852#if defined(DART_PRECOMPILED_RUNTIME)
10860#if defined(DART_PRECOMPILED_RUNTIME)
10863 set_kernel_offset(
src.kernel_offset());
10870 intptr_t index)
const {
10873 data_field.
SetAt(
static_cast<intptr_t
>(EvalFunctionData::kScript),
script);
10874 data_field.
SetAt(
static_cast<intptr_t
>(EvalFunctionData::kKernelProgramInfo),
10875 kernel_program_info);
10876 data_field.
SetAt(
static_cast<intptr_t
>(EvalFunctionData::kKernelLibraryIndex),
10878 set_data(data_field);
10884 if (IsDynamicInvocationForwarder()) {
10888 if (IsImplicitGetterOrSetter()) {
10890 return field.IsNull() ?
Script::null() : field.Script();
10892 if (is_eval_function()) {
10895 fdata.At(
static_cast<intptr_t
>(EvalFunctionData::kScript)));
10906 if (obj.IsPatchClass()) {
10907 return PatchClass::Cast(obj).script();
10909 if (IsClosureFunction()) {
10915 return Class::Cast(obj).script();
10918#if !defined(DART_PRECOMPILED_RUNTIME)
10920 if (is_eval_function()) {
10923 fdata.At(
static_cast<intptr_t
>(EvalFunctionData::kKernelProgramInfo)));
10925 if (IsClosureFunction()) {
10927 return parent.KernelProgramInfo();
10930 if (owner.IsClass()) {
10931 return Class::Cast(owner).KernelProgramInfo();
10933 return PatchClass::Cast(owner).kernel_program_info();
10938 return info.KernelLibrary(KernelLibraryIndex());
10942 const intptr_t kernel_library_index = KernelLibraryIndex();
10943 if (kernel_library_index == -1)
return 0;
10945 return info.KernelLibraryStartOffset(kernel_library_index);
10949 if (IsNoSuchMethodDispatcher() || IsInvokeFieldDispatcher() ||
10950 IsFfiCallbackTrampoline()) {
10953 if (is_eval_function()) {
10955 return Smi::Value(
static_cast<SmiPtr
>(fdata.At(
10956 static_cast<intptr_t
>(EvalFunctionData::kKernelLibraryIndex))));
10958 if (IsClosureFunction()) {
10960 ASSERT(!parent.IsNull());
10961 return parent.KernelLibraryIndex();
10965 if (obj.IsClass()) {
10969 ASSERT(obj.IsPatchClass());
10970 return PatchClass::Cast(obj).kernel_library_index();
10975 return HasCode() &&
Code::Handle(CurrentCode()).is_optimized();
10979 switch (name_visibility) {
10984 return UserVisibleNameCString();
10991 if (FLAG_show_internal_names) {
10994 is_extension_type_member();
10996 is_extension_member() || is_extension_type_member());
11000 if (FLAG_show_internal_names) {
11006 is_extension_member() || is_extension_type_member()));
11020 return printer.
buffer();
11034 return printer.
buffer();
11041 if (
params.include_parent_name) {
11043 if (parent.IsNull()) {
11046 parent.PrintName(
params, printer);
11051 if (
params.disambiguate_names &&
11052 fun.
name() == Symbols::AnonymousClosure().ptr()) {
11056 printer->
Printf(
"<anonymous closure @no position>");
11060 if (
params.disambiguate_names) {
11064 printer->
Printf(
"@<no position>");
11070 if (
params.disambiguate_names) {
11075 printer->
AddString(
"[no-such-method] ");
11081 printer->
AddString(
"[tear-off-extractor] ");
11085 if (fun.
kind() == UntaggedFunction::kConstructor) {
11087 }
else if (
params.include_class_name) {
11111 if (!IsLocalFunction()) {
11120 if (IsImplicitConstructor() || is_synthetic()) {
11130 intptr_t from_line, from_col;
11134 intptr_t to_line, to_col;
11138 intptr_t to_length = func_script.
GetTokenLength(end_token_pos());
11139 if (to_length < 0) {
11143 if (to_length == 1) {
11151 if (
src.IsNull() ||
src.Length() == 0) {
11152 return Symbols::OptimizedOut().ptr();
11154 uint16_t end_char =
src.CharAt(end_token_pos().Pos());
11155 if ((end_char ==
',') ||
11156 (end_char ==
')') ||
11158 .
Equals(
"<anonymous closure>"))) {
11163 return func_script.
GetSnippet(from_line, from_col, to_line,
11164 to_col + to_length);
11170#if !defined(DART_PRECOMPILED_RUNTIME)
11180 const Array& edge_counters_array,
11181 const Array& coverage_array)
const {
11182#if !defined(DART_PRECOMPILED_RUNTIME)
11185 ASSERT(coverage_array.
ptr() == GetCoverageArray());
11190 intptr_t
count = 0;
11191 for (intptr_t
i = 0;
i < deopt_id_to_ic_data.
length();
i++) {
11192 if (deopt_id_to_ic_data[
i] !=
nullptr) {
11201 for (intptr_t
i = 0,
pos = ICDataArrayIndices::kFirstICData;
11202 i < deopt_id_to_ic_data.
length();
i++) {
11203 if (deopt_id_to_ic_data[
i] !=
nullptr) {
11204 ASSERT(
i == deopt_id_to_ic_data[
i]->deopt_id());
11205 array.
SetAt(
pos++, *deopt_id_to_ic_data[
i]);
11208 array.
SetAt(ICDataArrayIndices::kEdgeCounters, edge_counters_array);
11210 array.
SetAt(ICDataArrayIndices::kCoverageData, coverage_array);
11211 set_ic_data_array(array);
11219 bool clone_ic_data)
const {
11220#if !defined(DART_PRECOMPILED_RUNTIME)
11221 if (FLAG_force_clone_compiler_objects) {
11222 clone_ic_data =
true;
11227 if (saved_ic_data.
IsNull()) {
11232 const intptr_t saved_length = saved_ic_data.
Length();
11233 ASSERT(saved_length > 0);
11234 if (saved_length > ICDataArrayIndices::kFirstICData) {
11235 const intptr_t restored_length =
11239 deopt_id_to_ic_data->
SetLength(restored_length);
11240 for (intptr_t
i = 0;
i < restored_length;
i++) {
11241 (*deopt_id_to_ic_data)[
i] =
nullptr;
11243 for (intptr_t
i = ICDataArrayIndices::kFirstICData;
i < saved_length;
i++) {
11245 ic_data ^= saved_ic_data.
At(
i);
11246 if (clone_ic_data) {
11252 (*deopt_id_to_ic_data)[ic_data.
deopt_id()] = &ic_data;
11268void Function::set_ic_data_array(
const Array&
value)
const {
11269 untag()->set_ic_data_array<std::memory_order_release>(
value.ptr());
11273 return untag()->ic_data_array<std::memory_order_acquire>();
11277 set_ic_data_array(Array::null_array());
11283 for (intptr_t
i = ICDataArrayIndices::kFirstICData;
i < array.
Length();
i++) {
11284 ic_data ^= array.
At(
i);
11285 if (ic_data.
deopt_id() == deopt_id) {
11286 return ic_data.
ptr();
11296 for (intptr_t
i = ICDataArrayIndices::kFirstICData;
i < array.
Length();
i++) {
11297 ic_data ^= array.
At(
i);
11298 if (ic_data.
deopt_id() == deopt_id) {
11309#if !defined(DART_PRECOMPILED_RUNTIME)
11315 "Recognized method %s should be marked with: "
11316 "@pragma(\"vm:recognized\", \"%s\")\n",
11317 ToQualifiedCString(), kind);
11327 if (SourceFingerprint() !=
fp) {
11332 THR_Print(
"s/0x%08x/0x%08x/\n",
fp, SourceFingerprint());
11339 if (HasCode())
return CurrentCode();
11347 if (
result.ptr() == Object::out_of_memory_error().ptr()) {
11351 if (
result.IsLanguageError()) {
11360 ASSERT(ForceOptimize() || unoptimized_code() ==
result.ptr());
11361 return CurrentCode();
11365#if !defined(DART_PRECOMPILED_RUNTIME)
11366 if (!IsDynamicFunction()) {
11375 if (PrologueNeedsArgumentsDescriptor()) {
11388 if (!FLAG_precompiled_mode) {
11395 if (
Class::Handle(zone, Owner()).has_dynamically_extendable_subtypes()) {
11401 return HasDynamicCallers(zone) &&
11410#if !defined(DART_PRECOMPILED_RUNTIME)
11423 if (IsGetterFunction() || IsImplicitGetterFunction() || IsMethodExtractor()) {
11440 if (HasSavedArgumentsDescriptor()) {
11445 return IsGeneric() || HasOptionalParameters();
11449 return FLAG_enable_multiple_entrypoints &&
11450 (NeedsTypeArgumentTypeChecks() || NeedsArgumentTypeChecks());
11456 if (!
end.IsReal() ||
start.IsNoSource() ||
start.IsClassifying()) {
11460 if (
start.IsSynthetic()) {
11463 ASSERT(!parent.IsNull());
11464 const intptr_t parent_size = parent.SourceSize();
11465 if (parent_size == 0) {
11466 return parent_size;
11469 return parent_size - (parent.end_token_pos().Pos() -
end.Pos());
11476 return "Function: null";
11479 ZoneTextBuffer
buffer(zone);
11482 buffer.AddString(
" static");
11484 if (is_abstract()) {
11485 buffer.AddString(
" abstract");
11488 case UntaggedFunction::kRegularFunction:
11489 case UntaggedFunction::kClosureFunction:
11490 case UntaggedFunction::kImplicitClosureFunction:
11491 case UntaggedFunction::kGetterFunction:
11492 case UntaggedFunction::kSetterFunction:
11494 case UntaggedFunction::kConstructor:
11495 buffer.AddString(is_static() ?
" factory" :
" constructor");
11497 case UntaggedFunction::kImplicitGetter:
11498 buffer.AddString(
" getter");
11500 case UntaggedFunction::kImplicitSetter:
11501 buffer.AddString(
" setter");
11503 case UntaggedFunction::kImplicitStaticGetter:
11504 buffer.AddString(
" static-getter");
11506 case UntaggedFunction::kFieldInitializer:
11507 buffer.AddString(
" field-initializer");
11509 case UntaggedFunction::kMethodExtractor:
11510 buffer.AddString(
" method-extractor");
11512 case UntaggedFunction::kNoSuchMethodDispatcher:
11513 buffer.AddString(
" no-such-method-dispatcher");
11515 case UntaggedFunction::kDynamicInvocationForwarder:
11516 buffer.AddString(
" dynamic-invocation-forwarder");
11518 case UntaggedFunction::kInvokeFieldDispatcher:
11519 buffer.AddString(
" invoke-field-dispatcher");
11521 case UntaggedFunction::kIrregexpFunction:
11522 buffer.AddString(
" irregexp-function");
11524 case UntaggedFunction::kFfiTrampoline:
11525 buffer.AddString(
" ffi-trampoline-function");
11527 case UntaggedFunction::kRecordFieldGetter:
11528 buffer.AddString(
" record-field-getter");
11533 if (HasSavedArgumentsDescriptor()) {
11534 const auto& args_desc_array =
Array::Handle(zone, saved_args_desc());
11535 const ArgumentsDescriptor args_desc(args_desc_array);
11537 args_desc.PrintTo(&
buffer);
11541 buffer.AddString(
" const");
11548 uint32_t packed_parameter_counts)
const {
11549 untag()->packed_parameter_counts_ = packed_parameter_counts;
11553 uint16_t packed_type_parameter_counts)
const {
11554 untag()->packed_type_parameter_counts_ = packed_type_parameter_counts;
11562void ClosureData::set_default_type_arguments_instantiation_mode(
11564 untag()->packed_fields_.Update<PackedInstantiationMode>(
value);
11567Function::AwaiterLink ClosureData::awaiter_link()
const {
11568 const uint8_t depth =
11570 ->packed_fields_.Read<UntaggedClosureData::PackedAwaiterLinkDepth>();
11571 const uint8_t index =
11573 ->packed_fields_.Read<UntaggedClosureData::PackedAwaiterLinkIndex>();
11574 return {depth, index};
11577void ClosureData::set_awaiter_link(Function::AwaiterLink
link)
const {
11578 untag()->packed_fields_.Update<UntaggedClosureData::PackedAwaiterLinkDepth>(
11580 untag()->packed_fields_.Update<UntaggedClosureData::PackedAwaiterLinkIndex>(
11584ClosureDataPtr ClosureData::New() {
11586 return Object::Allocate<ClosureData>(
Heap::kOld);
11591 return "ClosureData: null";
11594 ZoneTextBuffer
buffer(zone);
11595 buffer.Printf(
"ClosureData: context_scope: 0x%" Px "",
11596 static_cast<uword>(context_scope()));
11597 buffer.AddString(
" parent_function: ");
11599 buffer.AddString(
"null");
11603 buffer.Printf(
" implicit_static_closure: 0x%" Px "",
11604 static_cast<uword>(implicit_static_closure()));
11613void FfiTrampolineData::set_callback_target(
const Function&
value)
const {
11619 bool are_optional_positional)
const {
11623 (
value > 0) && !are_optional_positional);
11628 return Object::Allocate<FunctionType>(space);
11637 result.set_packed_parameter_counts(0);
11638 result.set_packed_type_parameter_counts(0);
11639 result.set_named_parameter_names(Object::empty_array());
11640 result.SetNumParentTypeArguments(num_parent_type_arguments);
11645 result.InitializeTypeTestingStubNonAtomic(
11665 return printer.
buffer();
11677 return "FunctionType: null";
11680 ZoneTextBuffer printer(zone);
11682 if (
suffix[0] !=
'\0') {
11683 printer.AddString(
"(");
11686 if (
suffix[0] !=
'\0') {
11687 printer.AddString(
")");
11688 printer.AddString(
suffix);
11690 return printer.buffer();
11693void ClosureData::set_context_scope(
const ContextScope&
value)
const {
11697void ClosureData::set_implicit_static_closure(
const Closure&
closure)
const {
11700 untag()->set_closure<std::memory_order_release>(
closure.ptr());
11703void FfiTrampolineData::set_c_signature(
const FunctionType&
value)
const {
11707void FfiTrampolineData::set_callback_id(int32_t callback_id)
const {
11711void FfiTrampolineData::set_callback_exceptional_return(
11712 const Instance&
value)
const {
11713 untag()->set_callback_exceptional_return(
value.ptr());
11716void FfiTrampolineData::set_ffi_function_kind(
FfiCallbackKind kind)
const {
11720FfiTrampolineDataPtr FfiTrampolineData::New() {
11723 Object::Allocate<FfiTrampolineData>(
Heap::kOld));
11724 data.set_callback_id(-1);
11731 "TrampolineData: c_signature=%s",
11732 c_sig.ToUserVisibleCString());
11736 return this->
Clone(*
this);
11743 if (
untag()->owner()->IsField()) {
11744 return static_cast<FieldPtr
>(
untag()->owner());
11746 return this->
ptr();
11758#if defined(DART_PRECOMPILED_RUNTIME)
11759 ASSERT(!thread->IsInsideCompiler() || is_static());
11761 ASSERT(!thread->IsInsideCompiler() ||
11766 return LoadNonPointer<ClassIdTagType, std::memory_order_relaxed>(
11767 &
untag()->guarded_cid_);
11775#if defined(DART_PRECOMPILED_RUNTIME)
11776 ASSERT(!thread->IsInsideCompiler() || is_static());
11778 ASSERT(!thread->IsInsideCompiler() ||
11783 return is_nullable_unsafe();
11850 if (IsOriginal()) {
11851 return untag()->owner();
11856 return field.untag()->owner();
11864 if (obj.IsClass()) {
11865 return Class::Cast(obj).ptr();
11867 ASSERT(obj.IsPatchClass());
11868 return PatchClass::Cast(obj).wrapped_class();
11877 if (obj.IsClass()) {
11878 return Class::Cast(obj).script();
11880 ASSERT(obj.IsPatchClass());
11881 return PatchClass::Cast(obj).script();
11884#if !defined(DART_PRECOMPILED_RUNTIME)
11887 if (owner.IsClass()) {
11888 return Class::Cast(owner).KernelProgramInfo();
11890 return PatchClass::Cast(owner).kernel_program_info();
11899#if defined(DART_PRECOMPILED_RUNTIME)
11906#if !defined(DART_PRECOMPILED_RUNTIME)
11909 return info.KernelLibrary(KernelLibraryIndex());
11913 const intptr_t kernel_library_index = KernelLibraryIndex();
11914 if (kernel_library_index == -1)
return 0;
11916 return info.KernelLibraryStartOffset(kernel_library_index);
11923 if (obj.IsField()) {
11924 return Field::Cast(obj).KernelLibraryIndex();
11925 }
else if (obj.IsClass()) {
11929 ASSERT(obj.IsPatchClass());
11930 return PatchClass::Cast(obj).kernel_library_index();
11946 SetFieldTypeSafe(
value);
11949FieldPtr Field::New() {
11954void Field::InitializeNew(
const Field&
result,
11955 const String&
name,
11959 bool is_reflectable,
11962 TokenPosition token_pos,
11963 TokenPosition end_token_pos) {
11964 result.set_kind_bits(0);
11966 result.set_is_static(is_static);
11968 result.set_field_id_unsafe(-1);
11972 result.set_is_final(is_final);
11973 result.set_is_const(is_const);
11974 result.set_is_reflectable(is_reflectable);
11975 result.set_is_late(is_late);
11976 result.set_owner(owner);
11977 result.set_token_pos(token_pos);
11978 result.set_end_token_pos(end_token_pos);
11979 result.set_has_nontrivial_initializer_unsafe(
false);
11980 result.set_has_initializer_unsafe(
false);
11983 result.set_is_unboxed_unsafe(
false);
11984 result.set_initializer_changed_after_initialization(
false);
11986 result.set_has_pragma(
false);
11987 result.set_static_type_exactness_state_unsafe(
11997#if defined(PRODUCT)
11998 const bool use_guarded_cid =
11999 FLAG_precompiled_mode || (isolate_group->use_field_guards() && !is_late);
12001 const bool use_guarded_cid =
12002 FLAG_precompiled_mode ||
12003 (isolate_group->use_field_guards() &&
12004 !isolate_group->HasAttemptedReload() && !is_late);
12007 result.set_is_nullable_unsafe(use_guarded_cid ?
false :
true);
12008 result.set_guarded_list_length_in_object_offset_unsafe(
12011 if (is_final && use_guarded_cid) {
12022 bool is_reflectable,
12030 InitializeNew(
result,
name, is_static, is_final, is_const, is_reflectable,
12031 is_late, owner, token_pos, end_token_pos);
12033#if !defined(DART_PRECOMPILED_RUNTIME)
12049 is_final, is_const,
true,
12050 is_late, owner, token_pos, end_token_pos);
12055 if (original.
IsNull()) {
12065 return clone.
ptr();
12069#if !defined(DART_PRECOMPILED_RUNTIME)
12084 if (FLAG_show_internal_names) {
12088 is_extension_member() || is_extension_type_member());
12092 if (FLAG_show_internal_names) {
12098 is_extension_member() || is_extension_type_member()));
12115 intptr_t list_length_offset)
const {
12117 StoreNonPointer<int8_t, int8_t, std::memory_order_relaxed>(
12118 &
untag()->guarded_list_length_in_object_offset_,
12120 ASSERT(guarded_list_length_in_object_offset() == list_length_offset);
12129 if (is_late() && !has_initializer()) {
12136 if (!is_static()) {
12147 if (!is_static())
return true;
12151 if (has_nontrivial_initializer())
return true;
12155 return is_late() && !has_initializer();
12161 return "Field: null";
12163 const char* kF0 = is_static() ?
" static" :
"";
12164 const char* kF1 = is_late() ?
" late" :
"";
12165 const char* kF2 = is_final() ?
" final" :
"";
12166 const char* kF3 = is_const() ?
" const" :
"";
12167 const char* kF4 = is_shared() ?
" shared" :
"";
12172 cls_name, field_name, kF0, kF1, kF2, kF3, kF4);
12193 if (!closure_field.
IsNull()) {
12207 return AccessorClosure(
false);
12211 return AccessorClosure(
true);
12217 return untag()->dependent_code();
12224 untag()->set_dependent_code(array.
ptr());
12234 field_.set_dependent_code(
value);
12238 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
12240 THR_Print(
"Deoptimizing %s because guard on field %s failed.\n",
12241 function.ToFullyQualifiedCString(), field_.ToCString());
12246 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
12249 "Switching '%s' to unoptimized code because guard"
12250 " on field '%s' was violated.\n",
12251 function.ToFullyQualifiedCString(), field_.ToCString());
12256 const Field& field_;
12273 if (FLAG_trace_deoptimization &&
a.HasCodes()) {
12276 a.DisableCode(are_mutators_stopped);
12280 return (
untag()->guarded_cid_ == other.untag()->guarded_cid_) &&
12281 (
untag()->is_nullable_ == other.untag()->is_nullable_) &&
12282 (
untag()->guarded_list_length() ==
12285 (static_type_exactness_state().Encode() ==
12294 return raw_value == Object::sentinel().ptr();
12298 ASSERT(has_nontrivial_initializer());
12304#if defined(DART_PRECOMPILED_RUNTIME)
12320#if defined(DART_PRECOMPILED_RUNTIME)
12325 ->initializer_functions_mutex()
12326 ->IsOwnedByCurrentThread());
12330 untag()->set_initializer_function<std::memory_order_release>(
12345 if (has_nontrivial_initializer()) {
12351 return Error::Cast(
value).ptr();
12354 if (is_late() && !has_initializer()) {
12358#if defined(DART_PRECOMPILED_RUNTIME)
12367 if (is_late() && is_final() &&
12368 (
instance.GetField(*
this) != Object::sentinel().ptr())) {
12380 if (StaticValue() == Object::sentinel().
ptr()) {
12383 if (!has_initializer()) {
12387 value = EvaluateInitializer();
12388 if (
value.IsError()) {
12389 return Error::Cast(
value).ptr();
12391 if (is_final() && (StaticValue() != Object::sentinel().
ptr())) {
12397 SetStaticValue(Object::transition_sentinel());
12398 value = EvaluateInitializer();
12399 if (
value.IsError()) {
12400 SetStaticValue(Object::null_instance());
12401 return Error::Cast(
value).ptr();
12405 SetStaticValue(
value.IsNull() ? Instance::null_instance()
12406 : Instance::Cast(
value));
12408 }
else if (StaticValue() == Object::transition_sentinel().
ptr()) {
12412 ctor_args.
SetAt(0, field_name);
12421 (is_const() || (is_final() && has_trivial_initializer())));
12424 auto zone = thread->
zone();
12431 zone, initial_field_table->At(field_id(),
true));
12432 if (
value.ptr() == Object::sentinel().ptr()) {
12436 ASSERT(has_initializer());
12437 ASSERT(has_nontrivial_initializer());
12438 value = EvaluateInitializer();
12439 if (!
value.IsError()) {
12441 SetStaticConstFieldValue(
value.IsNull() ? Instance::null_instance()
12442 : Instance::Cast(
value));
12445 return value.ptr();
12449 bool assert_initializing_store)
const {
12456 ASSERT(initial_field_table->At(field_id()) == Object::sentinel().
ptr() ||
12457 initial_field_table->At(field_id()) ==
value.ptr() ||
12458 !assert_initializing_store);
12459 initial_field_table->SetAt(field_id(),
12460 value.IsNull() ? Instance::null_instance().ptr()
12461 : Instance::Cast(
value).ptr(),
12468#if !defined(DART_PRECOMPILED_RUNTIME)
12469 if (is_static() && is_const()) {
12479 if (
value.IsTypedDataBase()) {
12480 return TypedDataBase::Cast(
value).Length();
12481 }
else if (
value.IsArray()) {
12482 return Array::Cast(
value).Length();
12483 }
else if (
value.IsGrowableObjectArray()) {
12495 }
else if (
cid == kArrayCid ||
cid == kImmutableArrayCid) {
12497 }
else if (
cid == kGrowableObjectArrayCid) {
12508 ASSERT(!static_type_exactness_state().IsExactOrUninitialized());
12514 const char* exactness =
"";
12515 if (static_type_exactness_state().IsTracking()) {
12525 ASSERT(guarded_list_length() != kUnknownFixedLength);
12526 if (guarded_list_length() == kNoFixedLength) {
12531 guarded_list_length_in_object_offset(), exactness);
12536 is_nullable() ?
"nullable" :
"not-nullable",
12544 if (needs_length_check() &&
12547 (this->*setter)(
offset);
12559 return does_guarded_cid_need_update_ || does_is_nullable_need_update_ ||
12560 does_list_length_and_offset_need_update_ ||
12561 does_static_type_exactness_state_need_update_;
12566 void ReviewExactnessState();
12567 void ReviewGuards();
12569 intptr_t guarded_cid() {
return guarded_cid_; }
12570 void set_guarded_cid(intptr_t guarded_cid) {
12571 guarded_cid_ = guarded_cid;
12572 does_guarded_cid_need_update_ =
true;
12575 bool is_nullable() {
return is_nullable_; }
12576 void set_is_nullable(
bool is_nullable) {
12577 is_nullable_ = is_nullable;
12578 does_is_nullable_need_update_ =
true;
12581 intptr_t guarded_list_length() {
return list_length_; }
12582 void set_guarded_list_length_and_offset(
12583 intptr_t list_length,
12584 intptr_t list_length_in_object_offset) {
12585 list_length_ = list_length;
12586 list_length_in_object_offset_ = list_length_in_object_offset;
12587 does_list_length_and_offset_need_update_ =
true;
12590 StaticTypeExactnessState static_type_exactness_state() {
12591 return static_type_exactness_state_;
12593 void set_static_type_exactness_state(StaticTypeExactnessState
state) {
12594 static_type_exactness_state_ =
state;
12595 does_static_type_exactness_state_need_update_ =
true;
12598 const Field* field_;
12601 intptr_t guarded_cid_;
12603 intptr_t list_length_;
12604 intptr_t list_length_in_object_offset_;
12605 StaticTypeExactnessState static_type_exactness_state_;
12607 bool does_guarded_cid_need_update_ =
false;
12608 bool does_is_nullable_need_update_ =
false;
12609 bool does_list_length_and_offset_need_update_ =
false;
12610 bool does_static_type_exactness_state_need_update_ =
false;
12613void FieldGuardUpdater::ReviewGuards() {
12614 ASSERT(field_->IsOriginal());
12615 const intptr_t
cid = value_.GetClassId();
12618 set_guarded_cid(
cid);
12624 if (field_->needs_length_check()) {
12630 if (FLAG_trace_field_guards) {
12631 THR_Print(
" => %s\n", field_->GuardedPropertiesAsCString());
12636 if ((
cid == guarded_cid()) || ((
cid ==
kNullCid) && is_nullable())) {
12640 if (field_->needs_length_check() &&
12654 set_is_nullable(
true);
12659 set_guarded_cid(
cid);
12664 set_is_nullable(
true);
12668 if (field_->needs_length_check()) {
12678 bool consider_only_super_classes)
const {
12680 if (cls.
ptr() ==
ptr()) {
12688 if (
path !=
nullptr) {
12692 consider_only_super_classes)) {
12695 if (
path !=
nullptr) {
12696 path->RemoveLast();
12700 if (!consider_only_super_classes) {
12702 for (intptr_t
i = 0;
i < super_interfaces.
Length();
i++) {
12703 super ^= super_interfaces.
At(
i);
12705 if (
path !=
nullptr) {
12711 if (
path !=
nullptr) {
12712 path->RemoveLast();
12723 bool consider_only_super_classes)
const {
12725 consider_only_super_classes);
12729 if (
ptr() == cls.
ptr()) {
12730 return DeclarationType();
12732 if (FindInstantiationOf(zone, cls,
true)) {
12736 const auto& decl_type =
Type::Handle(zone, DeclarationType());
12738 if (!FindInstantiationOf(zone, cls, &
path)) {
12743 auto& calculated_type =
Type::Handle(zone, decl_type.ptr());
12744 auto& calculated_type_class =
12746 auto& calculated_type_args =
12748 calculated_type_args = calculated_type_args.ToInstantiatorTypeArguments(
12749 thread, calculated_type_class);
12751 calculated_type ^=
type->ptr();
12752 if (!calculated_type.IsInstantiated()) {
12753 calculated_type ^= calculated_type.InstantiateFrom(
12754 calculated_type_args, Object::null_type_arguments(),
kAllFree,
12757 calculated_type_class = calculated_type.type_class();
12758 calculated_type_args = calculated_type.arguments();
12759 calculated_type_args = calculated_type_args.ToInstantiatorTypeArguments(
12760 thread, calculated_type_class);
12763 return calculated_type.ptr();
12777 const intptr_t
id = field_id();
12801 const Type& static_type,
12803 bool print_trace ) {
12806 ASSERT(
value.ptr() != Object::transition_sentinel().ptr());
12809 Zone*
const zone = thread->
zone();
12819 bool is_super_class =
true;
12822 is_super_class =
false;
12823 bool found_super_interface =
12825 ASSERT(found_super_interface);
12830 if (
path.is_empty()) {
12836 if (
args.ptr() == static_type_args.
ptr()) {
12841 THR_Print(
" expected %s got %s type arguments\n",
12857 for (intptr_t
i =
path.length() - 2; (
i >= 0) && !
type.IsInstantiated();
12859 args =
path[
i]->GetInstanceTypeArguments(thread,
false);
12860 type ^=
type.InstantiateFrom(
args, TypeArguments::null_type_arguments(),
12864 if (
type.IsInstantiated()) {
12867 args =
type.GetInstanceTypeArguments(thread,
false);
12868 if (
args.Equals(static_type_args)) {
12874 THR_Print(
" expected %s got %s type arguments\n",
12892 bool trivial_case =
12893 (num_type_params ==
12895 (
value.GetTypeArguments() == static_type_args.
ptr());
12896 if (!trivial_case && FLAG_trace_field_guards) {
12898 " type parameters, %s vs %s type arguments\n",
12907 args =
type.GetInstanceTypeArguments(thread,
false);
12908 for (intptr_t
i = 0; (
i < num_type_params) && trivial_case;
i++) {
12909 type_arg =
args.TypeAt(
i);
12910 if (!type_arg.IsTypeParameter() ||
12911 (TypeParameter::Cast(type_arg).index() !=
i)) {
12912 if (FLAG_trace_field_guards) {
12913 THR_Print(
" => encountered %s at index % " Pd "\n",
12916 trivial_case =
false;
12925 if (!IsTracking()) {
12926 return "not-tracking";
12927 }
else if (!IsExactOrUninitialized()) {
12928 return "not-exact";
12929 }
else if (IsTriviallyExact()) {
12931 "trivially-exact(%hhu)", GetTypeArgumentsOffsetInWords());
12932 }
else if (IsHasExactSuperType()) {
12933 return "has-exact-super-type";
12934 }
else if (IsHasExactSuperClass()) {
12935 return "has-exact-super-class";
12937 ASSERT(IsUninitialized());
12938 return "uninitialized-exactness";
12942void FieldGuardUpdater::ReviewExactnessState() {
12943 if (!static_type_exactness_state().IsExactOrUninitialized()) {
12949 if (FLAG_trace_field_guards) {
12951 " => switching off exactness tracking because guarded cid is "
12960 if (value_.IsNull() || static_type_exactness_state().IsHasExactSuperType() ||
12961 static_type_exactness_state().IsHasExactSuperClass()) {
12971 const Instance&
instance = Instance::Cast(value_);
12973 if (static_type_exactness_state().IsTriviallyExact()) {
12974 const TypeArguments&
args =
12978 if (
args.ptr() == field_type_args.ptr()) {
12982 if (FLAG_trace_field_guards) {
12983 THR_Print(
" expected %s got %s type arguments\n",
12984 field_type_args.ToCString(),
args.ToCString());
12991 ASSERT(static_type_exactness_state().IsUninitialized());
12993 field_type,
instance, FLAG_trace_field_guards));
13000 guarded_cid_(field->guarded_cid()),
13001 is_nullable_(field->is_nullable()),
13002 list_length_(field->guarded_list_length()),
13003 list_length_in_object_offset_(
13004 field->guarded_list_length_in_object_offset()),
13005 static_type_exactness_state_(field->static_type_exactness_state()) {
13007 ReviewExactnessState();
13011 if (does_guarded_cid_need_update_) {
13014 if (does_is_nullable_need_update_) {
13017 if (does_list_length_and_offset_need_update_) {
13020 list_length_in_object_offset_);
13022 if (does_static_type_exactness_state_need_update_) {
13045 if (FLAG_trace_field_guards) {
13047 value.ToCString());
13052 if (FLAG_trace_field_guards) {
13059 isolate_group->RunWithStoppedMutators([&]() {
13066void Field::ForceDynamicGuardedCidAndLength()
const {
13081#if defined(DART_PRECOMPILER)
13085 return untag()->resolved_url();
13094 return untag()->source();
13099 return (script_url.
StartsWith(Symbols::DartScheme()) ||
13100 script_url.
StartsWith(Symbols::DartSchemePrivate()));
13103#if !defined(DART_PRECOMPILED_RUNTIME)
13105 intptr_t kernel_buffer_len)
const {
13108 kernel_buffer, kernel_buffer_len, uri));
13114 intptr_t script_index,
13118 untag()->set_kernel_program_info(
info.ptr());
13120 untag()->set_debug_positions(Array::null_array().
ptr());
13133 info.Add(line_separator);
13136#if !defined(DART_PRECOMPILED_RUNTIME)
13139 intptr_t line_count = line_starts_data.
Length();
13141 intptr_t token_count = debug_positions_array.
Length();
13142 int token_index = 0;
13145 for (
int line_index = 0; line_index < line_count; ++line_index) {
13146 intptr_t
start = line_starts_reader.
At(line_index);
13149 if (line_index + 1 < line_count) {
13150 end = line_starts_reader.
At(line_index + 1);
13153 while (token_index < token_count) {
13154 value ^= debug_positions_array.
At(token_index);
13155 intptr_t debug_position =
value.Value();
13156 if (debug_position >=
end)
break;
13159 info.Add(line_separator);
13165 value ^= debug_positions_array.
At(token_index);
13177#if !defined(DART_PRECOMPILED_RUNTIME)
13178 if (HasCachedMaxPosition()) {
13181 untag()->flags_and_max_position_));
13187 const intptr_t max_position = reader.
MaxPosition();
13188 SetCachedMaxPosition(max_position);
13189 SetHasCachedMaxPosition(
true);
13193 return TokenPosition::kNoSource;
13200void Script::set_resolved_url(
const String&
value)
const {
13204void Script::set_source(
const String&
value)
const {
13208#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
13210 return untag()->constant_coverage();
13214void Script::set_debug_positions(
const Array&
value)
const {
13219 return untag()->line_starts();
13222ArrayPtr Script::debug_positions()
const {
13223#if !defined(DART_PRECOMPILED_RUNTIME)
13225 if (debug_positions_array.
IsNull()) {
13230 return untag()->debug_positions();
13233#if !defined(DART_PRECOMPILED_RUNTIME)
13234bool Script::HasCachedMaxPosition()
const {
13236 untag()->flags_and_max_position_);
13239void Script::SetHasCachedMaxPosition(
bool value)
const {
13245void Script::SetCachedMaxPosition(intptr_t
value)
const {
13252void Script::set_load_timestamp(int64_t
value)
const {
13261 return !max_position.
IsReal() || !token_pos.
IsReal() ||
13262 max_position.
Pos() == 0 || token_pos <= max_position;
13265#if !defined(DART_PRECOMPILED_RUNTIME)
13267 return ((
'A' <= c) && (c <=
'Z')) || ((
'a' <= c) && (c <=
'z'));
13271 return '0' <= c && c <=
'9';
13275 return IsLetter(c) || (c ==
'_') || (c ==
'$');
13285 intptr_t* column)
const {
13287#if defined(DART_PRECOMPILED_RUNTIME)
13291 if (!token_pos.
IsReal())
return false;
13295 if (line_starts_data.
IsNull())
return false;
13302#if defined(DART_PRECOMPILED_RUNTIME)
13310 const intptr_t
start = token_pos.
Pos();
13325 ASSERT(first_token_index !=
nullptr && last_token_index !=
nullptr);
13326#if defined(DART_PRECOMPILED_RUNTIME)
13331 if (line_number <= 0)
return false;
13336 last_token_index)) {
13340 intptr_t source_length;
13344 value ^= debug_positions_array.
At(debug_positions_array.
Length() - 1);
13345 source_length =
value.Value();
13348 source_length =
source.Length();
13365 intptr_t line_offset = 0,
13366 intptr_t column = 1,
13367 intptr_t column_offset = 0,
13368 intptr_t starting_index = 0) {
13369 if (starting_index < 0 ||
line < 1 || column < 1 ||
line <= line_offset ||
13370 (
line == line_offset + 1 && column <= column_offset)) {
13373 intptr_t
len =
src.Length();
13374 intptr_t current_line = line_offset + 1;
13375 intptr_t current_index = starting_index;
13376 for (; current_index <
len; current_index++) {
13377 if (current_line ==
line) {
13380 const uint16_t c =
src.CharAt(current_index);
13381 if (c ==
'\n' || c ==
'\r') {
13384 if (c ==
'\r' && current_index + 1 <
len &&
13385 src.CharAt(current_index + 1) ==
'\n') {
13390 if (current_line !=
line) {
13394 intptr_t current_column = 1 + (
line == line_offset + 1 ? column_offset : 0);
13395 for (; current_index <
len; current_index++, current_column++) {
13396 if (current_column == column) {
13397 return current_index;
13399 const uint16_t c =
src.CharAt(current_index);
13400 if (c ==
'\n' || c ==
'\r') {
13405 if (current_column == column) {
13406 return current_index;
13413 return Symbols::OptimizedOut().ptr();
13416 const intptr_t
start =
13423 const uint16_t c =
src.CharAt(
end);
13424 if (c ==
'\n' || c ==
'\r') {
13432 intptr_t from_column,
13434 intptr_t to_column)
const {
13436 return Symbols::OptimizedOut().ptr();
13443 src, to_line, from_line - 1, to_column, from_column - 1,
start);
13456 const String& resolved_url,
13464 result.set_resolved_url(
13469 if (FLAG_remove_script_timestamps_for_test) {
13487 zone, isolate_group->object_store()->libraries());
13490 for (intptr_t
i = 0;
i <
libs.Length();
i++) {
13493 for (intptr_t j = 0; j <
scripts.Length(); j++) {
13503 : array_(
Array::Handle(library.dictionary())),
13505 size_(
Array::Handle(library.dictionary()).Length() - 1),
13507 MoveToNextObject();
13512 int ix = next_ix_++;
13513 MoveToNextObject();
13515 return array_.
At(ix);
13518void DictionaryIterator::MoveToNextObject() {
13522 obj = array_.
At(next_ix_);
13529 toplevel_class_(
Class::Handle((kind == kIteratePrivate)
13530 ? library.toplevel_class()
13531 :
Class::null())) {
13538 if (next_ix_ < size_) {
13539 int ix = next_ix_++;
13540 cls ^= array_.At(ix);
13545 cls = toplevel_class_.
ptr();
13550void ClassDictionaryIterator::MoveToNextClass() {
13552 while (next_ix_ < size_) {
13553 obj = array_.At(next_ix_);
13554 if (obj.IsClass()) {
13565 "too many imports in library '%s'", url.
ToCString());
13572 return url_str.
StartsWith(Symbols::DartScheme()) ||
13573 url_str.
StartsWith(Symbols::DartSchemePrivate());
13576void Library::set_num_imports(intptr_t
value)
const {
13583void Library::set_name(
const String&
name)
const {
13588void Library::set_url(
const String& url)
const {
13592void Library::set_private_key(
const String&
key)
const {
13593 untag()->set_private_key(
key.ptr());
13596#if !defined(DART_PRECOMPILED_RUNTIME)
13598 untag()->set_kernel_program_info(
info.ptr());
13624 ASSERT(
untag()->load_state_ <= UntaggedLibrary::kLoadRequested);
13630 ASSERT(
untag()->load_state_ == UntaggedLibrary::kAllocated);
13641 intptr_t kernel_offset)
const {
13642#if defined(DART_PRECOMPILED_RUNTIME)
13650 set_metadata(
map.Release());
13655#if defined(DART_PRECOMPILED_RUNTIME)
13656 return Object::empty_array().ptr();
13658 RELEASE_ASSERT(declaration.IsClass() || declaration.IsField() ||
13659 declaration.IsFunction() || declaration.IsLibrary() ||
13660 declaration.IsTypeParameter() || declaration.IsNamespace());
13663 auto zone = thread->
zone();
13665 if (declaration.IsLibrary()) {
13669 if (!cls.IsNull()) {
13670 cls.EnsureDeclarationLoaded();
13677 value =
map.GetOrNull(declaration);
13678 set_metadata(
map.Release());
13680 if (
value.IsNull()) {
13682 return Object::empty_array().ptr();
13684 if (!
value.IsSmi()) {
13687 return value.ptr();
13689 const auto& smi_value = Smi::Cast(
value);
13690 intptr_t kernel_offset = smi_value.Value();
13691 ASSERT(kernel_offset > 0);
13694 *
this, kernel_offset,
13695 declaration.IsLibrary() ||
13696 declaration.IsNamespace()));
13697 if (evaluated_value.IsArray() || evaluated_value.IsNull()) {
13698 ASSERT(evaluated_value.ptr() != Object::empty_array().ptr());
13701 if (
map.GetOrNull(declaration) == smi_value.ptr()) {
13702 map.UpdateOrInsert(declaration, evaluated_value);
13704 ASSERT(
map.GetOrNull(declaration) == evaluated_value.ptr());
13706 set_metadata(
map.Release());
13708 return evaluated_value.ptr();
13712#if !defined(DART_PRECOMPILED_RUNTIME)
13714 return (declaration.IsClass() && Class::Cast(declaration).has_pragma()) ||
13715 (declaration.IsFunction() &&
13716 Function::Cast(declaration).has_pragma()) ||
13717 (declaration.IsField() && Field::Cast(declaration).has_pragma());
13728 MetadataMap::Iterator it(&
map);
13729 while (it.MoveNext()) {
13730 const intptr_t entry = it.Current();
13732 declaration =
map.GetKey(entry);
13737 set_metadata(
map.Release());
13752 MetadataMap::Iterator it(&old_map);
13753 while (it.MoveNext()) {
13754 const intptr_t entry = it.Current();
13756 declaration = old_map.
GetKey(entry);
13766 old_lib.set_metadata(old_map.
Release());
13767 set_metadata(new_map.
Release());
13772 return (
name.Length() >= 1 &&
name.CharAt(0) ==
'_') ||
13773 (
name.Length() >= 5 &&
13774 (
name.CharAt(4) ==
'_' &&
13775 (
name.CharAt(0) ==
'g' ||
name.CharAt(0) ==
's') &&
13776 name.CharAt(1) ==
'e' &&
name.CharAt(2) ==
't' &&
13777 name.CharAt(3) ==
':'));
13780void Library::RehashDictionary(
const Array& old_dict,
13781 intptr_t new_dict_size)
const {
13782 intptr_t old_dict_size = old_dict.Length() - 1;
13783 const Array& new_dict =
13791 for (intptr_t
i = 0;
i < old_dict_size;
i++) {
13792 entry = old_dict.At(
i);
13793 if (!entry.IsNull()) {
13794 entry_name = entry.DictionaryName();
13795 ASSERT(!entry_name.IsNull());
13796 const intptr_t
hash = entry_name.Hash();
13798 new_entry = new_dict.At(
index);
13799 while (!new_entry.IsNull()) {
13801 new_entry = new_dict.At(
index);
13803 new_dict.SetAt(
index, entry);
13808 ASSERT(used < new_dict_size);
13810 new_dict.SetAt(new_dict_size, new_entry);
13812 untag()->set_dictionary(new_dict.ptr());
13817 ASSERT(obj.IsClass() || obj.IsFunction() || obj.IsField() ||
13818 obj.IsLibraryPrefix());
13822 intptr_t dict_size = dict.
Length() - 1;
13823 intptr_t
index =
name.Hash() % dict_size;
13828 while (!entry.
IsNull()) {
13838 dict.
SetAt(dict_size, used);
13841 if (used_elements > ((dict_size / 4) * 3)) {
13843 RehashDictionary(dict, 2 * dict_size);
13857 if (!HasExports()) {
13861 if (trail ==
nullptr) {
13866 const intptr_t lib_id = this->
index();
13868 trail->
Add(lib_id);
13871 for (
int i = 0;
i <
exports.Length();
i++) {
13894 Array& dict = thread->ArrayHandle();
13895 dict = dictionary();
13896 intptr_t dict_size = dict.
Length() - 1;
13898 Object& entry = thread->ObjectHandle();
13899 String& entry_name = thread->StringHandle();
13902 while (!entry.
IsNull()) {
13906 return entry.
ptr();
13923 const Script& candidate) {
13924 if (candidate.
IsNull()) {
13929 for (
int i = 0;
i <
scripts.Length();
i++) {
13931 if (script_obj.
ptr() == candidate.
ptr()) {
13957 if (entry.IsClass()) {
13958 owner_script = Class::Cast(entry).script();
13959 }
else if (entry.IsFunction()) {
13960 owner_script = Function::Cast(entry).script();
13961 }
else if (entry.IsField()) {
13962 owner_script = Field::Cast(entry).Script();
13971 for (intptr_t
i = 0;
i < patches.
Length();
i++) {
13972 entry = patches.
At(
i);
13973 if (entry.IsClass()) {
13974 owner_script = Class::Cast(entry).script();
13976 ASSERT(entry.IsScript());
13977 owner_script = Script::Cast(entry).
ptr();
13984 owner_script = cls.
script();
13991 for (intptr_t j = 0; j < functions.
Length(); j++) {
13992 func ^= functions.
At(j);
13993 if (func.is_external()) {
13994 owner_script = func.
script();
14002 untag()->set_loaded_scripts(scripts_array.
ptr());
14004 return loaded_scripts();
14010 bool useResolvedUri )
const {
14011 const intptr_t url_length =
url.Length();
14012 if (url_length == 0) {
14018 const intptr_t num_scripts =
scripts.Length();
14019 for (
int i = 0;
i < num_scripts;
i++) {
14021 if (useResolvedUri) {
14023 script_url =
script.resolved_url();
14026 script_url =
script.url();
14028 const intptr_t start_idx = script_url.
Length() - url_length;
14029 if ((start_idx == 0) &&
url.Equals(script_url)) {
14031 }
else if (start_idx > 0) {
14034 if (((
url.CharAt(0) ==
'/') ||
14035 (script_url.
CharAt(start_idx - 1) ==
'/')) &&
14036 url.Equals(script_url, start_idx, url_length)) {
14055 if (!
error.IsNull()) {
14078 if (obj.IsField()) {
14079 return Field::Cast(obj).ptr();
14087 if (obj.IsFunction()) {
14088 return Function::Cast(obj).ptr();
14097 obj = LookupLocalObject(
name);
14100 obj = LookupLocalObject(private_name);
14107 if (obj.IsClass()) {
14108 return Class::Cast(obj).ptr();
14115 if (obj.IsClass()) {
14116 return Class::Cast(obj).ptr();
14123 if (obj.IsLibraryPrefix()) {
14124 return LibraryPrefix::Cast(obj).ptr();
14135 untag()->set_dependencies(deps.
ptr());
14138void Library::set_metadata(
const Array&
value)
const {
14151 return import.target();
14163 untag()->set_imports(Object::empty_array().
ptr());
14164 untag()->set_exports(Object::empty_array().
ptr());
14168#if defined(PRODUCT)
14176 intptr_t capacity =
imports.Length();
14178 capacity = capacity + kImportsCapacityIncrement + (capacity >> 2);
14184 set_num_imports(
index + 1);
14189bool Library::HasExports()
const {
14190 return exports() != Object::empty_array().ptr();
14198 intptr_t num_exports =
exports.Length();
14201 exports.SetAt(num_exports, ns);
14207 dict.
SetAt(initial_size, Object::smi_zero());
14211void Library::InitClassDictionary()
const {
14213 ASSERT(thread->IsDartMutatorThread());
14215 Array& dictionary = thread->ArrayHandle();
14217 const int kInitialElementCount = 16;
14219 untag()->set_dictionary(dictionary.ptr());
14222void Library::InitImportList()
const {
14229LibraryPtr Library::New() {
14231 return Object::Allocate<Library>(
Heap::kOld);
14234LibraryPtr Library::NewLibraryHelper(
const String& url,
bool import_core_lib) {
14236 Zone* zone = thread->zone();
14237 ASSERT(thread->IsDartMutatorThread());
14240 const bool dart_scheme =
url.StartsWith(Symbols::DartScheme());
14244 result.untag()->set_dictionary(Object::empty_array().
ptr());
14246 array = HashTables::New<MetadataMap>(4,
Heap::kOld);
14247 result.untag()->set_metadata(array.ptr());
14251 result.untag()->set_used_scripts(list.ptr());
14252 result.untag()->set_imports(Object::empty_array().
ptr());
14253 result.untag()->set_exports(Object::empty_array().
ptr());
14257 result.set_native_entry_resolver(
nullptr);
14258 result.set_native_entry_symbol_resolver(
nullptr);
14259 result.set_ffi_native_resolver(
nullptr);
14261 result.set_is_in_fullsnapshot(
false);
14269 result.set_debuggable(FLAG_show_invisible_frames);
14272 result.set_debuggable(
true);
14274 result.set_is_dart_scheme(dart_scheme);
14276 result.StoreNonPointer(&
result.untag()->kernel_library_index_, -1));
14278 UntaggedLibrary::kAllocated);
14280 result.InitClassDictionary();
14281 result.InitImportList();
14282 result.AllocatePrivateKey();
14283 if (import_core_lib) {
14285 ASSERT(!core_lib.IsNull());
14288 Object::null_array(),
result));
14295 return NewLibraryHelper(
url,
false);
14298void Library::set_flags(uint8_t
flags)
const {
14305 const String& core_lib_url = Symbols::DartCore();
14307 Library::Handle(zone, Library::NewLibraryHelper(core_lib_url,
false));
14320 const String& target_name,
14322 const Array& args_descriptor_array,
14323 bool respect_reflectable,
14329 !
function.AreValidArguments(args_descriptor,
nullptr) ||
14330 (respect_reflectable && !
function.is_reflectable())) {
14332 args_descriptor_array);
14335 instantiator_type_args);
14343 bool throw_nsm_if_absent,
14344 bool respect_reflectable,
14345 bool check_is_entrypoint)
const {
14348 if (obj.IsField()) {
14349 const Field& field = Field::Cast(obj);
14350 if (check_is_entrypoint) {
14359 const String& internal_getter_name =
14364 const String& internal_getter_name =
14367 if (obj.IsFunction()) {
14368 getter = Function::Cast(obj).
ptr();
14369 if (check_is_entrypoint) {
14377 if (obj.IsFunction() && check_is_entrypoint) {
14380 CHECK_ERROR(Function::Cast(obj).VerifyClosurizedEntryPoint());
14383 if (obj.IsFunction() && Function::Cast(obj).SafeToClosurize()) {
14385 const Function& closure_function =
14392 if (getter.
IsNull() || (respect_reflectable && !getter.is_reflectable())) {
14393 if (throw_nsm_if_absent) {
14395 Object::null_array(), Object::null_array(),
14403 return Object::sentinel().ptr();
14412 bool respect_reflectable,
14413 bool check_is_entrypoint)
const {
14415 const String& internal_setter_name =
14419 if (obj.IsField()) {
14420 const Field& field = Field::Cast(obj);
14421 if (check_is_entrypoint) {
14424 setter_type = field.
type();
14426 !
value.IsInstanceOf(setter_type, Object::null_type_arguments(),
14427 Object::null_type_arguments())) {
14431 const int kNumArgs = 1;
14436 args, Object::null_array(),
14441 return value.ptr();
14446 if (obj.IsFunction()) {
14447 setter ^= obj.
ptr();
14450 if (!setter.
IsNull() && check_is_entrypoint) {
14454 const int kNumArgs = 1;
14457 if (setter.
IsNull() || (respect_reflectable && !setter.is_reflectable())) {
14465 !
value.IsInstanceOf(setter_type, Object::null_type_arguments(),
14466 Object::null_type_arguments())) {
14475 const Array& arg_names,
14476 bool respect_reflectable,
14477 bool check_is_entrypoint)
const {
14483 const int kTypeArgsLen = 0;
14492 if (
result.IsFunction()) {
14496 if (!
function.IsNull() && check_is_entrypoint) {
14504 check_is_entrypoint));
14505 if (getter_result.
ptr() != Object::sentinel().ptr()) {
14506 if (check_is_entrypoint) {
14511 args_descriptor.
Count() + 1,
14516 args, arg_names, args_descriptor));
14518 call_args_descriptor_array);
14523 (respect_reflectable && !
function.is_reflectable())) {
14528 if (!
function.AreValidArguments(args_descriptor,
nullptr)) {
14536 args, args_descriptor, Object::empty_type_arguments());
14545 const int kNumNativeWrappersClasses = 4;
14547 (kNumNativeWrappersClasses < 10));
14550 const String& native_flds_lib_url = Symbols::DartNativeWrappers();
14552 zone, Library::NewLibraryHelper(native_flds_lib_url,
false));
14553 const String& native_flds_lib_name = Symbols::DartNativeWrappersLibName();
14554 native_flds_lib.
SetName(native_flds_lib_name);
14558 isolate_group->
object_store()->set_native_wrappers_library(native_flds_lib);
14559 const char*
const kNativeWrappersClass =
"NativeFieldWrapperClass";
14560 const int kNameLength = 25;
14561 ASSERT(kNameLength == (strlen(kNativeWrappersClass) + 1 + 1));
14562 char name_buffer[kNameLength];
14564 for (
int fld_cnt = 1; fld_cnt <= kNumNativeWrappersClasses; fld_cnt++) {
14565 Utils::SNPrint(name_buffer, kNameLength,
"%s%d", kNativeWrappersClass,
14581 static const char*
Name() {
return "LibraryLookupTraits"; }
14585 const String& a_str = String::Cast(
a);
14586 const String& b_str = String::Cast(
b);
14589 return a_str.
Equals(b_str);
14609 if (object_store->libraries_map() ==
Array::null()) {
14613 lib ^=
map.GetOrNull(
url);
14614 ASSERT(
map.Release().ptr() == object_store->libraries_map());
14622 for (intptr_t
i = 1;
i <
name.Length() - 1;
i++) {
14623 if (
name.CharAt(
i) ==
'.') {
14624 if (
name.CharAt(
i + 1) ==
'_') {
14635void Library::AllocatePrivateKey()
const {
14640#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
14641 if (isolate_group->IsReloading()) {
14645 isolate_group->program_reload_context();
14646 const String& original_key =
14647 String::Handle(program_reload_context->FindLibraryPrivateKey(*
this));
14648 if (!original_key.
IsNull()) {
14649 untag()->set_private_key(original_key.
ptr());
14656 const intptr_t hash_mask = 0x7FFFF;
14659 intptr_t hash_value =
url.Hash() & hash_mask;
14662 zone, isolate_group->object_store()->libraries());
14663 intptr_t sequence_value =
libs.Length();
14668 const String&
key =
14671 untag()->set_private_key(
key.ptr());
14677 return private_name;
14685 ASSERT(core_lib.IsPrivate(member));
14721 zone, isolate_group->object_store()->libraries());
14734 ObjectStore* object_store = isolate_group->object_store();
14748 if (object_store->libraries_map() ==
Array::null()) {
14750 object_store->set_libraries_map(
map.Release());
14754 bool present =
map.UpdateOrInsert(lib_url, *
this);
14756 object_store->set_libraries_map(
map.Release());
14768 intptr_t
len =
libs.Length();
14769 for (intptr_t
i = 0;
i <
len;
i++) {
14771 lib_url = lib.
url();
14772 map.InsertNewOrGetValue(lib_url, lib);
14775 isolate_group->object_store()->set_libraries(
libs);
14776 isolate_group->object_store()->set_libraries_map(
map.Release());
14815#if !defined(DART_PRECOMPILED_RUNTIME)
14845 return import.target();
14860 if (num_current_imports >=
length) {
14861 const intptr_t new_length =
length + kIncrementSize + (
length >> 2);
14865 imports.SetAt(num_current_imports,
import);
14866 set_num_imports(num_current_imports + 1);
14869LibraryPrefixPtr LibraryPrefix::New() {
14870 return Object::Allocate<LibraryPrefix>(
Heap::kOld);
14875 bool deferred_load,
14879 result.set_num_imports(0);
14881 result.StoreNonPointer(&
result.untag()->is_deferred_load_, deferred_load);
14883 result.AddImport(
import);
14887void LibraryPrefix::set_name(
const String&
value)
const {
14892void LibraryPrefix::set_imports(
const Array&
value)
const {
14896void LibraryPrefix::set_num_imports(intptr_t
value)
const {
14903void LibraryPrefix::set_importer(
const Library&
value)
const {
14909 return prefix.ToCString();
14934 intptr_t num_names =
names.Length();
14935 for (intptr_t
i = 0;
i < num_names;
i++) {
14937 if (plain_name->
Equals(hidden)) {
14947 intptr_t num_names =
names.Length();
14948 for (intptr_t
i = 0;
i < num_names;
i++) {
14950 if (plain_name->
Equals(shown)) {
14969 if (trail !=
nullptr) {
14971 for (
int i = 0;
i < trail->
length();
i++) {
14972 if (trail->
At(
i) == lib.
index()) {
14973 for (
int j =
i + 1; j < trail->
length(); j++) {
14983 intptr_t ignore = 0;
14987 (obj.
IsNull() || obj.IsLibraryPrefix())) {
14990 if (!accessor_name.
IsNull()) {
14991 obj = lib.LookupEntry(accessor_name, &ignore);
14995 if (!accessor_name.
IsNull()) {
14996 obj = lib.LookupEntry(accessor_name, &ignore);
15002 if (obj.
IsNull() || obj.IsLibraryPrefix()) {
15008 const String& setter_name =
15010 if (!setter_name.
IsNull()) {
15021NamespacePtr Namespace::New() {
15023 return Object::Allocate<Namespace>(
Heap::kOld);
15027 const Array& show_names,
15028 const Array& hide_names,
15040KernelProgramInfoPtr KernelProgramInfo::New() {
15041 return Object::Allocate<KernelProgramInfo>(
Heap::kOld);
15044KernelProgramInfoPtr KernelProgramInfo::New(
15053 const Array& libraries_cache,
15054 const Array& classes_cache) {
15076 return "[KernelProgramInfo]";
15094 intptr_t library_index)
const {
15096 const intptr_t library_count =
15098 blob.DataAddr(blob.LengthInBytes() - 2 * 4))));
15099 const intptr_t library_start =
15101 blob.DataAddr(blob.LengthInBytes() -
15102 (2 + 1 + (library_count - library_index)) * 4))));
15103 return library_start;
15107 intptr_t library_index)
const {
15111 return component.ViewFromTo(start_offset, end_offset);
15115 intptr_t library_index)
const {
15117 const intptr_t library_count =
15119 blob.DataAddr(blob.LengthInBytes() - 2 * 4))));
15122 blob.LengthInBytes() - (2 + (library_count - library_index)) * 4))));
15123 return library_end;
15135 const Smi& name_index)
const {
15157 const Smi& name_index,
15173 result ^=
table.InsertOrGetValue(name_index, lib);
15184 const Smi& name_index)
const {
15206 const Smi& name_index,
15207 const Class& klass)
const {
15222 result ^=
table.InsertOrGetValue(name_index, klass);
15236 for (
int i = 0;
i <
libs.Length();
i++) {
15242 if (!
error.IsNull()) {
15243 if (ignore_error)
continue;
15244 return error.ptr();
15247 if (!
error.IsNull()) {
15248 if (ignore_error)
continue;
15249 return error.ptr();
15257 result = Compiler::CompileFunction(thread, func);
15258 if (result.IsError()) {
15259 error = Error::Cast(result).ptr();
15265 return error.ptr();
15268#if !defined(DART_PRECOMPILED_RUNTIME)
15270ErrorPtr Library::FinalizeAllClasses() {
15271 Thread* thread = Thread::Current();
15276 IsolateGroup::Current()->object_store()->libraries());
15277 Library& lib = Library::Handle(zone);
15278 Class& cls = Class::Handle(zone);
15279 for (
int i = 0;
i <
libs.Length();
i++) {
15282 String& uri = String::Handle(zone, lib.
url());
15283 String& msg = String::Handle(
15285 String::NewFormatted(
"Library '%s' is not loaded. "
15286 "Did you forget to call Dart_FinalizeLoading?",
15288 return ApiError::New(msg);
15294 if (!
error.IsNull()) {
15295 return error.ptr();
15299 return Error::null();
15308 Thread* thread = Thread::Current();
15310 Function& func = Function::Handle(zone);
15311 String& class_str = String::Handle(zone);
15312 String& func_str = String::Handle(zone);
15313 Class& cls = Class::Handle(zone);
15314 for (intptr_t l = 0; l <
libs.length(); l++) {
15335 return Function::null();
15339 Thread* thread = Thread::Current();
15341 Function& func = Function::Handle(zone, LookupFunctionAllowPrivate(
name));
15344 const Object& obj = Object::Handle(zone, LookupReExport(
name));
15345 if (obj.IsFunction()) {
15350 const String& getter_name = String::Handle(zone, Field::GetterName(
name));
15351 func = LookupFunctionAllowPrivate(getter_name);
15353 return Closure::null();
15363#if defined(DEBUG) && !defined(DART_PRECOMPILED_RUNTIME)
15364void Library::CheckFunctionFingerprints() {
15366 Function& func = Function::Handle();
15367 bool fingerprints_match =
true;
15369#define CHECK_FINGERPRINTS_INNER(class_name, function_name, dest, fp, kind) \
15370 func = GetFunction(all_libs, #class_name, #function_name); \
15371 if (func.IsNull()) { \
15372 fingerprints_match = false; \
15373 OS::PrintErr("Function not found %s.%s\n", #class_name, #function_name); \
15375 fingerprints_match = \
15376 func.CheckSourceFingerprint(fp, kind) && fingerprints_match; \
15379#define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \
15380 CHECK_FINGERPRINTS_INNER(class_name, function_name, dest, fp, nullptr)
15381#define CHECK_FINGERPRINTS_ASM_INTRINSIC(class_name, function_name, dest, fp) \
15382 CHECK_FINGERPRINTS_INNER(class_name, function_name, dest, fp, "asm-intrinsic")
15383#define CHECK_FINGERPRINTS_GRAPH_INTRINSIC(class_name, function_name, dest, \
15385 CHECK_FINGERPRINTS_INNER(class_name, function_name, dest, fp, \
15387#define CHECK_FINGERPRINTS_OTHER(class_name, function_name, dest, fp) \
15388 CHECK_FINGERPRINTS_INNER(class_name, function_name, dest, fp, "other")
15390 all_libs.
Add(&Library::ZoneHandle(Library::CoreLibrary()));
15395 all_libs.
Add(&Library::ZoneHandle(Library::AsyncLibrary()));
15396 all_libs.
Add(&Library::ZoneHandle(Library::MathLibrary()));
15397 all_libs.
Add(&Library::ZoneHandle(Library::TypedDataLibrary()));
15398 all_libs.
Add(&Library::ZoneHandle(Library::CollectionLibrary()));
15399 all_libs.
Add(&Library::ZoneHandle(Library::ConvertLibrary()));
15400 all_libs.
Add(&Library::ZoneHandle(Library::InternalLibrary()));
15401 all_libs.
Add(&Library::ZoneHandle(Library::IsolateLibrary()));
15402 all_libs.
Add(&Library::ZoneHandle(Library::FfiLibrary()));
15403 all_libs.
Add(&Library::ZoneHandle(Library::NativeWrappersLibrary()));
15404 all_libs.
Add(&Library::ZoneHandle(Library::DeveloperLibrary()));
15411 all_libs.
Add(&Library::ZoneHandle(Library::DeveloperLibrary()));
15414#undef CHECK_FINGERPRINTS_INNER
15415#undef CHECK_FINGERPRINTS
15416#undef CHECK_FINGERPRINTS_ASM_INTRINSIC
15417#undef CHECK_FINGERPRINTS_GRAPH_INTRINSIC
15418#undef CHECK_FINGERPRINTS_OTHER
15420#define CHECK_FACTORY_FINGERPRINTS(symbol, class_name, factory_name, cid, fp) \
15421 func = GetFunction(all_libs, #class_name, #factory_name); \
15422 if (func.IsNull()) { \
15423 fingerprints_match = false; \
15424 OS::PrintErr("Function not found %s.%s\n", #class_name, #factory_name); \
15426 fingerprints_match = \
15427 func.CheckSourceFingerprint(fp) && fingerprints_match; \
15431 all_libs.
Add(&Library::ZoneHandle(Library::CoreLibrary()));
15432 all_libs.
Add(&Library::ZoneHandle(Library::TypedDataLibrary()));
15435#undef CHECK_FACTORY_FINGERPRINTS
15437 if (!fingerprints_match) {
15441 "FP mismatch while recognizing methods. If the behavior of "
15442 "these functions has changed, then changes are also needed in "
15443 "the VM's compiler. Otherwise the fingerprint can simply be "
15444 "updated in recognized_methods_list.h\n");
15449InstructionsPtr Instructions::New(intptr_t
size,
15450 bool has_monomorphic_entry,
15451 bool should_be_aligned) {
15453 ASSERT(Object::instructions_class() != Class::null());
15454 if (size < 0 || size > kMaxElements) {
15456 FATAL(
"Fatal error in Instructions::New: invalid size %" Pd "\n",
size);
15458 Instructions&
result = Instructions::Handle();
15460 auto raw = Object::Allocate<Instructions>(Heap::kCode,
size);
15461 NoSafepointScope no_safepoint;
15466 result.SetHasMonomorphicEntry(has_monomorphic_entry);
15467 result.SetShouldBeAligned(should_be_aligned);
15473const char* Instructions::ToCString()
const {
15474 return "Instructions";
15478#if defined(DART_PRECOMPILER)
15480 Thread::Current()->heap()->GetPeer(ptr()));
15487#if defined(DART_PRECOMPILER)
15488 Thread::Current()->heap()->SetPeer(ptr(),
stats);
15492const char* InstructionsSection::ToCString()
const {
15493 return "InstructionsSection";
15496void InstructionsTable::set_length(intptr_t
value)
const {
15500void InstructionsTable::set_start_pc(
uword value)
const {
15501 StoreNonPointer(&
untag()->start_pc_,
value);
15504void InstructionsTable::set_end_pc(
uword value)
const {
15508void InstructionsTable::set_code_objects(
const Array&
value)
const {
15512void InstructionsTable::set_rodata(
uword value)
const {
15518InstructionsTablePtr InstructionsTable::New(intptr_t
length,
15522 ASSERT(Object::instructions_table_class() != Class::null());
15524 ASSERT(start_pc <= end_pc);
15525 auto*
const zone = Thread::Current()->zone();
15526 const Array& code_objects =
15527 (
length == 0) ? Object::empty_array()
15529 const auto&
result = InstructionsTable::Handle(
15530 zone, Object::Allocate<InstructionsTable>(
Heap::kOld));
15531 result.set_code_objects(code_objects);
15533 result.set_start_pc(start_pc);
15534 result.set_end_pc(end_pc);
15535 result.set_rodata(rodata);
15539void InstructionsTable::SetCodeAt(intptr_t index, CodePtr
code)
const {
15541 (index < Smi::Value(code_objects()->
untag()->
length())));
15542 code_objects()->untag()->set_element(index,
code);
15545bool InstructionsTable::ContainsPc(InstructionsTablePtr
table,
uword pc) {
15546 return (InstructionsTable::start_pc(
table) <= pc) &&
15547 (pc < InstructionsTable::end_pc(
table));
15550uint32_t InstructionsTable::ConvertPcToOffset(InstructionsTablePtr
table,
15552 ASSERT(InstructionsTable::ContainsPc(
table, pc));
15553 const uint32_t pc_offset =
15554 static_cast<uint32_t
>(pc - InstructionsTable::start_pc(
table));
15555 ASSERT(InstructionsTable::start_pc(
table) + pc_offset == pc);
15559intptr_t InstructionsTable::FindEntry(InstructionsTablePtr
table,
15561 intptr_t start_index ) {
15563 NoSafepointScope no_safepoint;
15564 if (!InstructionsTable::ContainsPc(
table, pc))
return -1;
15565 const uint32_t pc_offset = InstructionsTable::ConvertPcToOffset(
table, pc);
15567 const auto rodata =
table.untag()->rodata_;
15568 const auto entries = rodata->entries();
15569 intptr_t lo = start_index;
15570 intptr_t hi = rodata->length - 1;
15572 intptr_t mid = (hi - lo + 1) / 2 + lo;
15575 if (pc_offset < entries[mid].pc_offset) {
15577 }
else if ((mid != hi) && (pc_offset >= entries[mid + 1].pc_offset)) {
15586const UntaggedCompressedStackMaps::Payload*
15587InstructionsTable::GetCanonicalStackMap(InstructionsTablePtr
table) {
15588 const auto rodata =
table.untag()->rodata_;
15589 return rodata->canonical_stack_map_entries_offset != 0
15590 ? rodata->StackMapAt(rodata->canonical_stack_map_entries_offset)
15595 InstructionsTablePtr
table,
15600 const intptr_t idx = FindEntry(
table, pc);
15602 const auto rodata =
table.untag()->rodata_;
15603 const auto entries = rodata->entries();
15604 *start_pc = InstructionsTable::start_pc(
table) + entries[idx].pc_offset;
15605 return rodata->StackMapAt(entries[idx].stack_map_offset);
15610CodePtr InstructionsTable::FindCode(InstructionsTablePtr
table,
uword pc) {
15613 if (!InstructionsTable::ContainsPc(
table, pc))
return Code::null();
15615 const auto rodata =
table.untag()->rodata_;
15617 const auto pc_offset = InstructionsTable::ConvertPcToOffset(
table, pc);
15619 if (pc_offset <= rodata->entries()[rodata->first_entry_with_code].pc_offset) {
15620 return StubCode::UnknownDartCode().ptr();
15624 FindEntry(
table, pc,
table.untag()->rodata_->first_entry_with_code);
15626 const intptr_t code_index = idx - rodata->first_entry_with_code;
15627 ASSERT(code_index >= 0);
15629 Smi::Value(
table.untag()->code_objects()->untag()->length()));
15631 table.untag()->code_objects()->untag()->element(code_index);
15635 return static_cast<CodePtr
>(
result);
15638 return Code::null();
15641uword InstructionsTable::EntryPointAt(intptr_t code_index)
const {
15642 ASSERT(0 <= code_index);
15643 ASSERT(code_index <
static_cast<intptr_t
>(rodata()->
length));
15644 return InstructionsTable::start_pc(this->ptr()) +
15645 rodata()->entries()[code_index].pc_offset;
15648const char* InstructionsTable::ToCString()
const {
15649 return "InstructionsTable";
15652ObjectPoolPtr ObjectPool::New(intptr_t
len) {
15653 ASSERT(Object::object_pool_class() != Class::null());
15654 if (len < 0 || len > kMaxElements) {
15656 FATAL(
"Fatal error in ObjectPool::New: invalid length %" Pd "\n",
len);
15662 raw->untag()->length_ =
len;
15665 for (intptr_t
i = 0;
i <
len;
i++) {
15675#if !defined(DART_PRECOMPILED_RUNTIME)
15676ObjectPoolPtr ObjectPool::NewFromBuilder(
15678 const intptr_t
len =
builder.CurrentLength();
15680 return Object::empty_object_pool().ptr();
15683 for (intptr_t
i = 0;
i <
len;
i++) {
15685 auto type = entry.type();
15686 auto patchable = entry.patchable();
15687 auto snapshot_behavior = entry.snapshot_behavior();
15688 result.SetTypeAt(
i,
type, patchable, snapshot_behavior);
15689 if (
type == EntryType::kTaggedObject) {
15690 result.SetObjectAt(
i, *entry.obj_);
15692#if defined(TARGET_ARCH_IS_32_BIT)
15696 result.SetRawValueAt(
i, entry.imm_);
15704 for (intptr_t
i = 0;
i < Length();
i++) {
15705 auto type = TypeAt(
i);
15706 auto patchable = PatchableAt(
i);
15707 auto snapshot_behavior = SnapshotBehaviorAt(
i);
15709 case compiler::ObjectPoolBuilderEntry::kTaggedObject: {
15711 patchable, snapshot_behavior);
15715 case compiler::ObjectPoolBuilderEntry::kImmediate:
15716 case compiler::ObjectPoolBuilderEntry::kNativeFunction: {
15718 snapshot_behavior);
15730const char* ObjectPool::ToCString()
const {
15731 Zone* zone = Thread::Current()->zone();
15735void ObjectPool::DebugPrint()
const {
15736 THR_Print(
"ObjectPool len:%" Pd " {\n", Length());
15737 for (intptr_t
i = 0;
i < Length();
i++) {
15738#if defined(DART_PRECOMPILED_RUNTIME)
15739 intptr_t
offset = ObjectPool::element_offset(
i);
15741 intptr_t
offset = compiler::target::ObjectPool::element_offset(
i);
15743#if defined(TARGET_ARCH_RISCV32) || defined(TARGET_ARCH_RISCV64)
15745#elif defined(TARGET_ARCH_ARM64)
15747#elif defined(TARGET_ARCH_ARM32)
15752 if (TypeAt(
i) == EntryType::kTaggedObject) {
15753 const Object& obj = Object::Handle(ObjectAt(
i));
15755 }
else if (TypeAt(
i) == EntryType::kNativeFunction) {
15756 uword pc = RawValueAt(
i);
15757 uintptr_t
start = 0;
15758 const char*
name = NativeSymbolResolver::LookupSymbolName(pc, &
start);
15759 const char* dso_name;
15761 if (
name !=
nullptr) {
15763 NativeSymbolResolver::FreeSymbolName(
name);
15764 }
else if (NativeSymbolResolver::LookupSharedObject(pc, &dso_base,
15766 uword dso_offset = pc - dso_base;
15767 THR_Print(
"%s+0x%" Px " (native function)\n", dso_name, dso_offset);
15768 NativeSymbolResolver::FreeSymbolName(dso_name);
15779intptr_t PcDescriptors::Length()
const {
15780 return untag()->length_;
15783void PcDescriptors::SetLength(intptr_t
value)
const {
15787void PcDescriptors::CopyData(
const void* bytes, intptr_t
size) {
15788 NoSafepointScope no_safepoint;
15789 uint8_t*
data = UnsafeMutableNonPointer(&
untag()->
data()[0]);
15794PcDescriptorsPtr PcDescriptors::New(
const void* delta_encoded_data,
15796 ASSERT(Object::pc_descriptors_class() != Class::null());
15797 Thread* thread = Thread::Current();
15809PcDescriptorsPtr PcDescriptors::New(intptr_t
length) {
15810 ASSERT(Object::pc_descriptors_class() != Class::null());
15811 Thread* thread = Thread::Current();
15824 case UntaggedPcDescriptors::kDeopt:
15826 case UntaggedPcDescriptors::kIcCall:
15828 case UntaggedPcDescriptors::kUnoptStaticCall:
15829 return "unopt-call";
15830 case UntaggedPcDescriptors::kRuntimeCall:
15831 return "runtime-call";
15832 case UntaggedPcDescriptors::kOsrEntry:
15833 return "osr-entry";
15834 case UntaggedPcDescriptors::kRewind:
15836 case UntaggedPcDescriptors::kBSSRelocation:
15837 return "bss reloc";
15838 case UntaggedPcDescriptors::kOther:
15840 case UntaggedPcDescriptors::kAnyKind:
15854 "%-*s kind deopt-id tok-ix try-ix yield-idx\n",
15856 Iterator iter(*
this, UntaggedPcDescriptors::kAnyKind);
15858 buffer->Printf(
"%#-*" Px " %-13s % 8" Pd " %-10s % 8" Pd " % 8" Pd
15866const char* PcDescriptors::ToCString()
const {
15867 if (Length() == 0) {
15868 return "empty PcDescriptors";
15870 ZoneTextBuffer
buffer(Thread::Current()->zone());
15871 WriteToBuffer(&
buffer, 0);
15886 intptr_t max_deopt_id = 0;
15888 *
this, UntaggedPcDescriptors::kDeopt | UntaggedPcDescriptors::kIcCall);
15890 if (max_iter.
DeoptId() > max_deopt_id) {
15891 max_deopt_id = max_iter.
DeoptId();
15895 Zone* zone = Thread::Current()->zone();
15899 UntaggedPcDescriptors::kDeopt | UntaggedPcDescriptors::kIcCall);
15902 if (DeoptId::IsDeoptAfter(iter.
DeoptId())) {
15908 if (iter.
Kind() == UntaggedPcDescriptors::kDeopt) {
15919void CodeSourceMap::SetLength(intptr_t
value)
const {
15923CodeSourceMapPtr CodeSourceMap::New(intptr_t
length) {
15924 ASSERT(Object::code_source_map_class() != Class::null());
15925 Thread* thread = Thread::Current();
15936const char* CodeSourceMap::ToCString()
const {
15937 return "CodeSourceMap";
15942 uint8_t*
data = UnsafeMutableNonPointer(&
untag()->payload()->
data()[0]);
15943 uint8_t*
end =
data + payload_size();
15944 uint32_t
hash = payload_size();
15945 for (uint8_t* cursor =
data; cursor <
end; cursor++) {
15953 const char* separator)
const {
15954 auto it = iterator(Thread::Current());
15955 bool first_entry =
true;
15956 while (it.MoveNext()) {
15957 if (!first_entry) {
15958 buffer->AddString(separator);
15960 buffer->Printf(
"0x%.8" Px ": ",
base + it.pc_offset());
15961 for (intptr_t
i = 0, n = it.Length();
i < n;
i++) {
15962 buffer->AddString(it.IsObject(
i) ?
"1" :
"0");
15964 first_entry =
false;
15969CompressedStackMaps::iterator(
Thread* thread)
const {
15971 *
this, CompressedStackMaps::Handle(
15974 ->canonicalized_stack_map_entries()));
15977CompressedStackMapsPtr CompressedStackMaps::New(
const void* payload,
15979 bool is_global_table,
15980 bool uses_global_table) {
15981 ASSERT(Object::compressed_stackmaps_class() != Class::null());
15983 ASSERT(!is_global_table || !uses_global_table);
15989 "Fatal error in CompressedStackMaps::New: "
15990 "invalid payload size %" Pu "\n",
15994 auto&
result = CompressedStackMaps::Handle();
15998 auto raw = Object::Allocate<CompressedStackMaps>(
Heap::kOld,
size);
15999 NoSafepointScope no_safepoint;
16001 result.untag()->payload()->set_flags_and_size(
16008 result.UnsafeMutableNonPointer(
result.untag()->payload()->data());
16009 memcpy(cursor, payload,
size);
16017const char* CompressedStackMaps::ToCString()
const {
16018 ASSERT(!IsGlobalTable());
16019 if (payload_size() == 0) {
16020 return "CompressedStackMaps()";
16022 auto const t = Thread::Current();
16023 ZoneTextBuffer
buffer(t->zone(), 100);
16024 buffer.AddString(
"CompressedStackMaps(");
16025 WriteToBuffer(&
buffer, 0,
", ");
16030StringPtr LocalVarDescriptors::GetName(intptr_t var_index)
const {
16031 ASSERT(var_index < Length());
16033 return ptr()->untag()->name(var_index);
16036void LocalVarDescriptors::SetVar(
16037 intptr_t var_index,
16040 ASSERT(var_index < Length());
16042 ptr()->untag()->set_name(var_index,
name.ptr());
16043 ptr()->untag()->data()[var_index] = *
info;
16046void LocalVarDescriptors::GetInfo(
16047 intptr_t var_index,
16049 ASSERT(var_index < Length());
16050 *
info = ptr()->untag()->data()[var_index];
16059 const int32_t index =
info.index();
16060 if (kind == UntaggedLocalVarDescriptors::kContextLevel) {
16063 " %-13s level=%-3d"
16064 " begin=%-3d end=%d\n",
16065 i, LocalVarDescriptors::KindToCString(kind), index,
16066 static_cast<int>(
info.begin_pos.Pos()),
16067 static_cast<int>(
info.end_pos.Pos()));
16068 }
else if (kind == UntaggedLocalVarDescriptors::kContextVar) {
16069 return Utils::SNPrint(
16072 " %-13s level=%-3d index=%-3d"
16073 " begin=%-3d end=%-3d name=%s\n",
16074 i, LocalVarDescriptors::KindToCString(kind),
info.scope_id, index,
16075 static_cast<int>(
info.begin_pos.Pos()),
16076 static_cast<int>(
info.end_pos.Pos()), var_name.
ToCString());
16078 return Utils::SNPrint(
16081 " %-13s scope=%-3d index=%-3d"
16082 " begin=%-3d end=%-3d name=%s\n",
16083 i, LocalVarDescriptors::KindToCString(kind),
info.scope_id, index,
16084 static_cast<int>(
info.begin_pos.Pos()),
16085 static_cast<int>(
info.end_pos.Pos()), var_name.
ToCString());
16089const char* LocalVarDescriptors::ToCString()
const {
16091 return "LocalVarDescriptors: null";
16093 if (Length() == 0) {
16094 return "empty LocalVarDescriptors";
16097 String& var_name = String::Handle();
16098 for (intptr_t
i = 0;
i < Length();
i++) {
16099 UntaggedLocalVarDescriptors::VarInfo
info;
16100 var_name = GetName(
i);
16104 char*
buffer = Thread::Current()->zone()->Alloc<
char>(
len + 1);
16106 intptr_t num_chars = 0;
16107 for (intptr_t
i = 0;
i < Length();
i++) {
16108 UntaggedLocalVarDescriptors::VarInfo
info;
16109 var_name = GetName(
i);
16117const char* LocalVarDescriptors::KindToCString(
16120 case UntaggedLocalVarDescriptors::kStackVar:
16122 case UntaggedLocalVarDescriptors::kContextVar:
16123 return "ContextVar";
16124 case UntaggedLocalVarDescriptors::kContextLevel:
16125 return "ContextLevel";
16126 case UntaggedLocalVarDescriptors::kSavedCurrentContext:
16127 return "CurrentCtx";
16134LocalVarDescriptorsPtr LocalVarDescriptors::New(intptr_t num_variables) {
16135 ASSERT(Object::var_descriptors_class() != Class::null());
16136 if (num_variables < 0 || num_variables > kMaxElements) {
16139 "Fatal error in LocalVarDescriptors::New: "
16140 "invalid num_variables %" Pd ". Maximum is: %d\n",
16141 num_variables, UntaggedLocalVarDescriptors::kMaxIndex);
16143 auto raw = Object::Allocate<LocalVarDescriptors>(
Heap::kOld, num_variables);
16145 raw->untag()->num_entries_ = num_variables;
16149intptr_t LocalVarDescriptors::Length()
const {
16150 return untag()->num_entries_;
16153intptr_t ExceptionHandlers::num_entries()
const {
16154 return untag()->num_entries();
16157bool ExceptionHandlers::has_async_handler()
const {
16159 untag()->packed_fields_);
16162void ExceptionHandlers::set_has_async_handler(
bool value)
const {
16163 StoreNonPointer(&
untag()->packed_fields_,
16164 UntaggedExceptionHandlers::AsyncHandlerBit::update(
16168void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
16169 intptr_t outer_try_index,
16170 uword handler_pc_offset,
16171 bool needs_stacktrace,
16172 bool has_catch_all,
16173 bool is_generated)
const {
16174 ASSERT((try_index >= 0) && (try_index < num_entries()));
16177 UnsafeMutableNonPointer(&
untag()->
data()[try_index]);
16178 info->outer_try_index = outer_try_index;
16183 info->handler_pc_offset = handler_pc_offset;
16184 info->needs_stacktrace =
static_cast<int8_t
>(needs_stacktrace);
16185 info->has_catch_all =
static_cast<int8_t
>(has_catch_all);
16186 info->is_generated =
static_cast<int8_t
>(is_generated);
16189void ExceptionHandlers::GetHandlerInfo(intptr_t try_index,
16191 ASSERT((try_index >= 0) && (try_index < num_entries()));
16196uword ExceptionHandlers::HandlerPCOffset(intptr_t try_index)
const {
16197 ASSERT((try_index >= 0) && (try_index < num_entries()));
16198 return untag()->data()[try_index].handler_pc_offset;
16201intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index)
const {
16202 ASSERT((try_index >= 0) && (try_index < num_entries()));
16203 return untag()->data()[try_index].outer_try_index;
16206bool ExceptionHandlers::NeedsStackTrace(intptr_t try_index)
const {
16207 ASSERT((try_index >= 0) && (try_index < num_entries()));
16208 return untag()->data()[try_index].needs_stacktrace != 0;
16211bool ExceptionHandlers::IsGenerated(intptr_t try_index)
const {
16212 ASSERT((try_index >= 0) && (try_index < num_entries()));
16213 return untag()->data()[try_index].is_generated != 0;
16216bool ExceptionHandlers::HasCatchAll(intptr_t try_index)
const {
16217 ASSERT((try_index >= 0) && (try_index < num_entries()));
16218 return untag()->data()[try_index].has_catch_all != 0;
16221void ExceptionHandlers::SetHandledTypes(intptr_t try_index,
16222 const Array& handled_types)
const {
16223 ASSERT((try_index >= 0) && (try_index < num_entries()));
16225 const Array& handled_types_data =
16226 Array::Handle(
untag()->handled_types_data());
16227 handled_types_data.
SetAt(try_index, handled_types);
16230ArrayPtr ExceptionHandlers::GetHandledTypes(intptr_t try_index)
const {
16231 ASSERT((try_index >= 0) && (try_index < num_entries()));
16232 Array& array = Array::Handle(
untag()->handled_types_data());
16233 array ^= array.
At(try_index);
16234 return array.
ptr();
16237void ExceptionHandlers::set_handled_types_data(
const Array&
value)
const {
16238 untag()->set_handled_types_data(
value.ptr());
16241ExceptionHandlersPtr ExceptionHandlers::New(intptr_t num_handlers) {
16242 ASSERT(Object::exception_handlers_class() != Class::null());
16243 if ((num_handlers < 0) || (num_handlers >= kMaxHandlers)) {
16245 "Fatal error in ExceptionHandlers::New(): "
16246 "invalid num_handlers %" Pd "\n",
16249 const Array& handled_types_data =
16250 (num_handlers == 0) ? Object::empty_array()
16251 : Array::Handle(Array::New(num_handlers,
Heap::kOld));
16252 return ExceptionHandlers::New(handled_types_data);
16255ExceptionHandlersPtr ExceptionHandlers::New(
const Array& handled_types_data) {
16256 ASSERT(Object::exception_handlers_class() != Class::null());
16257 const intptr_t num_handlers = handled_types_data.
Length();
16258 if ((num_handlers < 0) || (num_handlers >= kMaxHandlers)) {
16260 "Fatal error in ExceptionHandlers::New(): "
16261 "invalid num_handlers %" Pd "\n",
16266 auto raw = Object::Allocate<ExceptionHandlers>(
Heap::kOld, num_handlers);
16269 result.untag()->packed_fields_ =
16272 result.set_handled_types_data(handled_types_data);
16278 auto& handled_types = Array::Handle();
16279 auto&
type = AbstractType::Handle();
16281 for (intptr_t
i = 0;
i < num_entries();
i++) {
16282 GetHandlerInfo(
i, &
info);
16283 handled_types = GetHandledTypes(
i);
16284 const intptr_t num_types =
16285 handled_types.IsNull() ? 0 : handled_types.Length();
16286 buffer->Printf(
"%" Pd " => %#" Px " (%" Pd " types) (outer %d)%s%s\n",
i,
16287 base +
info.handler_pc_offset, num_types,
16288 info.outer_try_index,
16289 ((
info.needs_stacktrace != 0) ?
" (needs stack trace)" :
""),
16290 ((
info.is_generated != 0) ?
" (generated)" :
""));
16291 for (
int k = 0; k < num_types; k++) {
16292 type ^= handled_types.At(k);
16294 buffer->Printf(
" %d. %s\n", k,
type.ToCString());
16297 if (has_async_handler()) {
16298 buffer->AddString(
"<async handler>\n");
16302const char* ExceptionHandlers::ToCString()
const {
16303 if (num_entries() == 0) {
16304 return has_async_handler()
16305 ?
"empty ExceptionHandlers (with <async handler>)"
16306 :
"empty ExceptionHandlers";
16308 ZoneTextBuffer
buffer(Thread::Current()->zone());
16309 WriteToBuffer(&
buffer, 0);
16317const char* SingleTargetCache::ToCString()
const {
16318 return "SingleTargetCache";
16321SingleTargetCachePtr SingleTargetCache::New() {
16322 return Object::Allocate<SingleTargetCache>(
Heap::kOld);
16325void UnlinkedCall::set_can_patch_to_monomorphic(
bool value)
const {
16326 StoreNonPointer(&
untag()->can_patch_to_monomorphic_,
value);
16330 return String::Handle(target_name()).Hash();
16339const char* UnlinkedCall::ToCString()
const {
16340 return "UnlinkedCall";
16343UnlinkedCallPtr UnlinkedCall::New() {
16345 UnlinkedCall::Handle(Object::Allocate<UnlinkedCall>(
Heap::kOld));
16346 result.set_can_patch_to_monomorphic(!FLAG_precompiled_mode);
16350MonomorphicSmiableCallPtr MonomorphicSmiableCall::New(
classid_t expected_cid,
16352 const auto&
result = MonomorphicSmiableCall::Handle(
16353 Object::Allocate<MonomorphicSmiableCall>(
Heap::kOld));
16354 result.StoreNonPointer(&
result.untag()->expected_cid_, expected_cid);
16359const char* MonomorphicSmiableCall::ToCString()
const {
16360 return "MonomorphicSmiableCall";
16363const char* CallSiteData::ToCString()
const {
16366 return "CallSiteData";
16369void CallSiteData::set_target_name(
const String&
value)
const {
16375void CallSiteData::set_arguments_descriptor(
const Array&
value)
const {
16380#if !defined(DART_PRECOMPILED_RUNTIME)
16381void ICData::SetReceiversStaticType(
const AbstractType&
type)
const {
16382 untag()->set_receivers_static_type(
type.ptr());
16384 if (!
type.IsNull() &&
type.HasTypeClass() && (NumArgsTested() == 1) &&
16385 type.IsInstantiated() && !
type.IsFutureOrType()) {
16386 const Class& cls = Class::Handle(
type.type_class());
16387 if (cls.IsGeneric()) {
16388 set_tracking_exactness(
true);
16394void ICData::SetTargetAtPos(
const Array&
data,
16396 intptr_t num_args_tested,
16397 const Function&
target) {
16398#if !defined(DART_PRECOMPILED_RUNTIME)
16400 data.SetAt(data_pos + TargetIndexFor(num_args_tested),
target);
16404 const Code&
code = Code::Handle(
target.CurrentCode());
16405 data.SetAt(data_pos + CodeIndexFor(num_args_tested),
code);
16406 data.SetAt(data_pos + EntryPointIndexFor(num_args_tested),
target);
16411 return String::HashRawSymbol(target_name()) ^ deopt_id();
16414const char* ICData::ToCString()
const {
16415 Zone* zone = Thread::Current()->zone();
16416 const String&
name = String::Handle(zone, target_name());
16418 " type-args-len: %" Pd ", deopt-id: %" Pd ")",
16419 name.ToCString(), NumArgsTested(),
16420 NumberOfChecks(), TypeArgsLen(), deopt_id());
16423FunctionPtr ICData::Owner()
const {
16426 ASSERT(Dart::vm_snapshot_kind() == Snapshot::kFullAOT);
16427 return Function::null();
16428 }
else if (obj.IsFunction()) {
16429 return Function::Cast(obj).ptr();
16431 ICData& original = ICData::Handle();
16432 original ^= obj.
ptr();
16433 return original.
Owner();
16437ICDataPtr ICData::Original()
const {
16439 return ICData::null();
16441 if (
untag()->owner()->IsICData()) {
16442 return static_cast<ICDataPtr
>(
untag()->owner());
16444 return this->ptr();
16457void ICData::set_deopt_id(intptr_t
value)
const {
16458#if defined(DART_PRECOMPILED_RUNTIME)
16462 StoreNonPointer(&
untag()->deopt_id_,
value);
16466void ICData::set_entries(
const Array&
value)
const {
16468 untag()->set_entries<std::memory_order_release>(
value.ptr());
16471intptr_t ICData::NumArgsTested()
const {
16472 return untag()->state_bits_.Read<NumArgsTestedBits>();
16475void ICData::SetNumArgsTested(intptr_t
value)
const {
16477 untag()->state_bits_.Update<NumArgsTestedBits>(
value);
16480intptr_t CallSiteData::TypeArgsLen()
const {
16485intptr_t CallSiteData::CountWithTypeArgs()
const {
16490intptr_t CallSiteData::CountWithoutTypeArgs()
const {
16492 return args_desc.
Count();
16495intptr_t CallSiteData::SizeWithoutTypeArgs()
const {
16497 return args_desc.
Size();
16500intptr_t CallSiteData::SizeWithTypeArgs()
const {
16505uint32_t ICData::DeoptReasons()
const {
16506 return untag()->state_bits_.Read<DeoptReasonBits>();
16509void ICData::SetDeoptReasons(uint32_t reasons)
const {
16510 untag()->state_bits_.Update<DeoptReasonBits>(reasons);
16514 ASSERT(reason <= kLastRecordedDeoptReason);
16515 return (DeoptReasons() & (1 << reason)) != 0;
16519 if (reason <= kLastRecordedDeoptReason) {
16520 untag()->state_bits_.FetchOr<DeoptReasonBits>(1 << reason);
16526#define RULE_CASE(Name) \
16527 case RebindRule::k##Name: \
16537#define RULE_CASE(Name) \
16538 if (strcmp(str, #Name) == 0) { \
16539 *out = RebindRule::k##Name; \
16551void ICData::set_rebind_rule(uint32_t rebind_rule)
const {
16552 untag()->state_bits_.Update<ICData::RebindRuleBits>(rebind_rule);
16555bool ICData::is_static_call()
const {
16556 return rebind_rule() != kInstance;
16559void ICData::clear_state_bits()
const {
16560 untag()->state_bits_ = 0;
16563intptr_t ICData::TestEntryLengthFor(intptr_t num_args,
16564 bool tracking_exactness) {
16565 return num_args + 1 + 1 +
16566 (tracking_exactness ? 1 : 0) ;
16569intptr_t ICData::TestEntryLength()
const {
16570 return TestEntryLengthFor(NumArgsTested(), is_tracking_exactness());
16573intptr_t ICData::Length()
const {
16574 return (Smi::Value(entries()->
untag()->
length()) / TestEntryLength());
16577intptr_t ICData::NumberOfChecks()
const {
16579 return Length() - 1;
16582bool ICData::NumberOfChecksIs(intptr_t n)
const {
16584 return NumberOfChecks() == n;
16588void ICData::AssertInvariantsAreSatisfied()
const {
16593 auto zone = Thread::Current()->zone();
16594 const auto& array = Array::Handle(zone, entries());
16596 const intptr_t entry_length = TestEntryLength();
16597 const intptr_t num_checks = array.Length() / entry_length - 1;
16598 const intptr_t num_args = NumArgsTested();
16601 ASSERT((array.Length() % entry_length) == 0);
16604 for (intptr_t
i = 0;
i < num_checks; ++
i) {
16606 const intptr_t
start = entry_length *
i;
16607 for (intptr_t
i = 0;
i < num_args; ++
i) {
16609 ASSERT(array.At(
start +
i) != smi_illegal_cid().ptr());
16611 ASSERT(array.At(
start + TargetIndexFor(num_args))->IsHeapObject());
16612 if (is_tracking_exactness()) {
16613 ASSERT(!array.At(
start + ExactnessIndexFor(num_args))->IsHeapObject());
16618 const intptr_t sentinel_start = num_checks * entry_length;
16619 for (intptr_t
i = 0;
i < entry_length - 1; ++
i) {
16620 ASSERT(array.At(sentinel_start +
i) == smi_illegal_cid().ptr());
16622 if (num_checks == 0) {
16623 ASSERT(array.At(sentinel_start + entry_length - 1) ==
16624 smi_illegal_cid().ptr());
16625 ASSERT(ICData::CachedEmptyICDataArray(num_args, is_tracking_exactness()) ==
16628 ASSERT(array.At(sentinel_start + entry_length - 1) == ptr());
16632 if (num_args == 0) {
16634 ASSERT(TestEntryLength() == 2);
16640intptr_t ICData::NumberOfUsedChecks()
const {
16641 const intptr_t n = NumberOfChecks();
16642 intptr_t
count = 0;
16643 for (intptr_t
i = 0;
i < n;
i++) {
16644 if (GetCountAt(
i) > 0) {
16651void ICData::WriteSentinel(
const Array&
data,
16652 intptr_t test_entry_length,
16653 const Object& back_ref) {
16656 const intptr_t entry_start =
data.Length() - test_entry_length;
16657 for (intptr_t
i = 0;
i < test_entry_length - 1;
i++) {
16658 data.SetAt(entry_start +
i, smi_illegal_cid());
16660 data.SetAt(entry_start + test_entry_length - 1, back_ref);
16665bool ICData::HasCheck(
const GrowableArray<intptr_t>& cids)
const {
16666 return FindCheck(cids) != -1;
16671 const intptr_t
len = NumberOfChecks();
16673 for (intptr_t
i = 0;
i <
len;
i++) {
16674 GetClassIdsAt(
i, &class_ids);
16676 for (intptr_t k = 0; k < class_ids.
length(); k++) {
16678 if (class_ids[k] != cids[k]) {
16690void ICData::TruncateTo(intptr_t num_checks,
16692 USE(proof_of_reload);
16695 ASSERT(num_checks <= NumberOfChecks());
16698 if (NumberOfChecks() == num_checks)
return;
16700 auto thread = Thread::Current();
16702 auto& array = thread->ArrayHandle();
16705 const intptr_t num_args = NumArgsTested();
16706 if (num_checks == 0) {
16707 array = ICData::CachedEmptyICDataArray(num_args, is_tracking_exactness());
16708 set_entries(array);
16715 const intptr_t entry_length = TestEntryLength();
16717 array.Truncate((num_checks + 1) * entry_length);
16718 WriteSentinel(array, entry_length, *
this);
16721void ICData::ClearCountAt(intptr_t index,
16723 USE(proof_of_reload);
16726 ASSERT(index < NumberOfChecks());
16727 SetCountAt(index, 0);
16730void ICData::ClearAndSetStaticTarget(
16733 USE(proof_of_reload);
16738 if (IsImmutable())
return;
16739 if (NumberOfChecks() == 0)
return;
16742 TruncateTo(1, proof_of_reload);
16745 const intptr_t num_args = NumArgsTested();
16746 Thread* thread = Thread::Current();
16750 const Smi& object_cid = Smi::Handle(Smi::New(kObjectCid));
16751 for (intptr_t
i = 0;
i < num_args;
i++) {
16752 data.SetAt(
i, object_cid);
16754 data.SetAt(TargetIndexFor(num_args), func);
16755 data.SetAt(CountIndexFor(num_args), Object::smi_zero());
16759#if !defined(DART_PRECOMPILED_RUNTIME)
16760 const String&
name = String::Handle(target_name());
16761 if (Function::IsDynamicInvocationForwarderName(
name)) {
16762 return Function::DemangleDynamicInvocationForwarderName(
name) ==
16766 ObjectStore*
store = IsolateGroup::Current()->object_store();
16768 (
target.ptr() ==
store->simple_instance_of_false_function()));
16769 const String& instance_of_name = String::Handle(
16770 Library::PrivateCoreLibName(Symbols::_simpleInstanceOf()).ptr());
16771 ASSERT(target_name() == instance_of_name.
ptr());
16777 intptr_t
count)
const {
16780 if (FindCheck(class_ids) != -1)
return;
16786 intptr_t
count)
const {
16793 intptr_t
count)
const {
16795 IsolateGroup::Current()->type_feedback_mutex()->IsOwnedByCurrentThread());
16797 ASSERT(!is_tracking_exactness());
16801 ASSERT(NumArgsTested() > 1);
16802 const intptr_t num_args_tested = NumArgsTested();
16804 const intptr_t old_num = NumberOfChecks();
16805 Array&
data = Array::Handle(entries());
16810 if (old_num == 1 && num_args_tested == 2) {
16811 const bool has_dummy_entry =
16812 Smi::Value(Smi::RawCast(
data.At(0))) == kObjectCid &&
16813 Smi::Value(Smi::RawCast(
data.At(1))) == kObjectCid;
16814 if (has_dummy_entry) {
16818 for (intptr_t
i = 0;
i < NumArgsTested();
i++) {
16820 value = Smi::New(class_ids[
i]);
16826 intptr_t index = -1;
16827 data = Grow(&index);
16829 intptr_t data_pos = index * TestEntryLength();
16830 Smi&
value = Smi::Handle();
16831 for (intptr_t
i = 0;
i < class_ids.
length();
i++) {
16834 value = Smi::New(class_ids[
i]);
16838 data.SetAt(data_pos + TargetIndexFor(num_args_tested),
target);
16840 data.SetAt(data_pos + CountIndexFor(num_args_tested),
value);
16846ArrayPtr ICData::Grow(intptr_t* index)
const {
16849 *index = NumberOfChecks();
16850 Array&
data = Array::Handle(entries());
16851 const intptr_t new_len =
data.Length() + TestEntryLength();
16853 WriteSentinel(
data, TestEntryLength(), *
this);
16857void ICData::DebugDump()
const {
16858 const Function& owner = Function::Handle(Owner());
16861 THR_Print(
"NumArgsTested = %" Pd "\n", NumArgsTested());
16863 THR_Print(
"NumberOfChecks = %" Pd "\n", NumberOfChecks());
16866 for (intptr_t
i = 0;
i < NumberOfChecks();
i++) {
16868 GetClassIdsAt(
i, &class_ids);
16869 for (intptr_t c = 0; c < class_ids.
length(); c++) {
16876void ICData::EnsureHasReceiverCheck(intptr_t receiver_class_id,
16883 class_ids.
Add(receiver_class_id);
16884 if (FindCheck(class_ids) != -1)
return;
16886 AddReceiverCheckInternal(receiver_class_id,
target,
count, exactness);
16889void ICData::AddReceiverCheck(intptr_t receiver_class_id,
16894 AddReceiverCheckInternal(receiver_class_id,
target,
count, exactness);
16897void ICData::AddReceiverCheckInternal(
16898 intptr_t receiver_class_id,
16904 class_ids.
Add(receiver_class_id);
16905 ASSERT(!HasCheck(class_ids));
16908 const intptr_t kNumArgsTested = 1;
16909 ASSERT(NumArgsTested() == kNumArgsTested);
16912 intptr_t index = -1;
16913 Array&
data = Array::Handle(Grow(&index));
16914 intptr_t data_pos = index * TestEntryLength();
16915 if ((receiver_class_id == kSmiCid) && (data_pos > 0)) {
16916 ASSERT(GetReceiverClassIdAt(0) != kSmiCid);
16918 for (intptr_t
i = 0;
i < TestEntryLength();
i++) {
16919 data.SetAt(data_pos +
i, Object::Handle(
data.At(
i)));
16924 data.SetAt(data_pos, Smi::Handle(Smi::New(receiver_class_id)));
16925 SetTargetAtPos(
data, data_pos, kNumArgsTested,
target);
16927#if !defined(DART_PRECOMPILED_RUNTIME)
16928 data.SetAt(data_pos + CountIndexFor(kNumArgsTested),
16929 Smi::Handle(Smi::New(
count)));
16930 if (is_tracking_exactness()) {
16931 data.SetAt(data_pos + ExactnessIndexFor(kNumArgsTested),
16932 Smi::Handle(Smi::New(exactness.
Encode())));
16942 if (!is_tracking_exactness()) {
16943 return StaticTypeExactnessState::NotTracking();
16945 Thread* thread = Thread::Current();
16949 intptr_t data_pos =
16950 index * TestEntryLength() + ExactnessIndexFor(NumArgsTested());
16952 Smi::Value(Smi::RawCast(
data.At(data_pos))));
16955void ICData::GetCheckAt(intptr_t index,
16958 ASSERT(index < NumberOfChecks());
16959 ASSERT(class_ids !=
nullptr);
16961 class_ids->
Clear();
16962 Thread* thread = Thread::Current();
16966 intptr_t data_pos = index * TestEntryLength();
16967 for (intptr_t
i = 0;
i < NumArgsTested();
i++) {
16968 class_ids->
Add(Smi::Value(Smi::RawCast(
data.At(data_pos +
i))));
16970 (*target) ^=
data.At(data_pos + TargetIndexFor(NumArgsTested()));
16973void ICData::GetClassIdsAt(intptr_t index,
16975 ASSERT(index < Length());
16976 ASSERT(class_ids !=
nullptr);
16977 ASSERT(IsValidEntryIndex(index));
16978 class_ids->
Clear();
16979 Thread* thread = Thread::Current();
16983 intptr_t data_pos = index * TestEntryLength();
16984 for (intptr_t
i = 0;
i < NumArgsTested();
i++) {
16985 class_ids->
Add(Smi::Value(Smi::RawCast(
data.At(data_pos++))));
16989void ICData::GetOneClassCheckAt(intptr_t index,
16990 intptr_t* class_id,
16992 ASSERT(class_id !=
nullptr);
16994 ASSERT(NumArgsTested() == 1);
16995 Thread* thread = Thread::Current();
16999 const intptr_t data_pos = index * TestEntryLength();
17000 *class_id = Smi::Value(Smi::RawCast(
data.At(data_pos)));
17001 *
target ^=
data.At(data_pos + TargetIndexFor(NumArgsTested()));
17004intptr_t ICData::GetCidAt(intptr_t index)
const {
17005 ASSERT(NumArgsTested() == 1);
17006 Thread* thread = Thread::Current();
17010 const intptr_t data_pos = index * TestEntryLength();
17011 return Smi::Value(Smi::RawCast(
data.At(data_pos)));
17014intptr_t ICData::GetClassIdAt(intptr_t index, intptr_t arg_nr)
const {
17016 GetClassIdsAt(index, &class_ids);
17017 return class_ids[arg_nr];
17020intptr_t ICData::GetReceiverClassIdAt(intptr_t index)
const {
17021 ASSERT(index < Length());
17022 ASSERT(IsValidEntryIndex(index));
17023 const intptr_t data_pos = index * TestEntryLength();
17025 ArrayPtr raw_data = entries();
17026 return Smi::Value(Smi::RawCast(raw_data->untag()->element(data_pos)));
17029FunctionPtr ICData::GetTargetAt(intptr_t index)
const {
17030#if defined(DART_PRECOMPILED_RUNTIME)
17034 const intptr_t data_pos =
17035 index * TestEntryLength() + TargetIndexFor(NumArgsTested());
17036 ASSERT(Object::Handle(Array::Handle(entries()).At(data_pos)).IsFunction());
17039 ArrayPtr raw_data = entries();
17040 return static_cast<FunctionPtr
>(raw_data->untag()->element(data_pos));
17044void ICData::IncrementCountAt(intptr_t index, intptr_t
value)
const {
17047 SetCountAt(index, Utils::Minimum(GetCountAt(index) +
value, Smi::kMaxValue));
17050void ICData::SetCountAt(intptr_t index, intptr_t
value)
const {
17054 Thread* thread = Thread::Current();
17058 const intptr_t data_pos =
17059 index * TestEntryLength() + CountIndexFor(NumArgsTested());
17060 data.SetAt(data_pos, Smi::Handle(Smi::New(
value)));
17063intptr_t ICData::GetCountAt(intptr_t index)
const {
17064#if defined(DART_PRECOMPILED_RUNTIME)
17068 Thread* thread = Thread::Current();
17072 const intptr_t data_pos =
17073 index * TestEntryLength() + CountIndexFor(NumArgsTested());
17074 intptr_t
value = Smi::Value(Smi::RawCast(
data.At(data_pos)));
17079 SetCountAt(index, 0);
17084intptr_t ICData::AggregateCount()
const {
17086 const intptr_t
len = NumberOfChecks();
17087 intptr_t
count = 0;
17088 for (intptr_t
i = 0;
i <
len;
i++) {
17094#if !defined(DART_PRECOMPILED_RUNTIME)
17095ICDataPtr ICData::AsUnaryClassChecksForArgNr(intptr_t arg_nr)
const {
17097 ASSERT(NumArgsTested() > arg_nr);
17098 if ((arg_nr == 0) && (NumArgsTested() == 1)) {
17102 const intptr_t kNumArgsTested = 1;
17103 ICData&
result = ICData::Handle(ICData::NewFrom(*
this, kNumArgsTested));
17104 const intptr_t
len = NumberOfChecks();
17105 for (intptr_t
i = 0;
i <
len;
i++) {
17106 const intptr_t class_id = GetClassIdAt(
i, arg_nr);
17107 const intptr_t
count = GetCountAt(
i);
17111 intptr_t duplicate_class_id = -1;
17112 const intptr_t result_len =
result.NumberOfChecks();
17113 for (intptr_t k = 0; k < result_len; k++) {
17114 if (class_id ==
result.GetReceiverClassIdAt(k)) {
17115 duplicate_class_id = k;
17119 if (duplicate_class_id >= 0) {
17122 (
result.GetTargetAt(duplicate_class_id) == GetTargetAt(
i)));
17123 result.IncrementCountAt(duplicate_class_id,
count);
17126 result.AddReceiverCheckInternal(class_id,
17127 Function::Handle(GetTargetAt(
i)),
count,
17128 StaticTypeExactnessState::NotTracking());
17148 if (
a->count >
b->count) {
17151 return (
a->count <
b->count) ? 1 : 0;
17154ICDataPtr ICData::AsUnaryClassChecksSortedByCount()
const {
17156 const intptr_t kNumArgsTested = 1;
17157 const intptr_t
len = NumberOfChecks();
17160 return AsUnaryClassChecks();
17163 for (intptr_t
i = 0;
i <
len;
i++) {
17164 const intptr_t class_id = GetClassIdAt(
i, 0);
17165 const intptr_t
count = GetCountAt(
i);
17169 bool found =
false;
17170 for (intptr_t r = 0; r < aggregate.
length(); r++) {
17171 if (aggregate[r].
cid == class_id) {
17172 aggregate[r].count +=
count;
17179 CidCount(class_id,
count, &Function::ZoneHandle(GetTargetAt(
i))));
17182 aggregate.
Sort(CidCount::HighestCountFirst);
17184 ICData&
result = ICData::Handle(ICData::NewFrom(*
this, kNumArgsTested));
17187 const intptr_t data_len =
result.TestEntryLength() * (aggregate.
length() + 1);
17192 for (intptr_t
i = 0;
i < aggregate.
length();
i++) {
17193 data.SetAt(
pos + 0, Smi::Handle(Smi::New(aggregate[
i].
cid)));
17195 data.SetAt(
pos + CountIndexFor(1),
17196 Smi::Handle(Smi::New(aggregate[
i].
count)));
17206UnlinkedCallPtr ICData::AsUnlinkedCall()
const {
17207 ASSERT(NumArgsTested() == 1);
17208 ASSERT(!is_tracking_exactness());
17210 result.set_target_name(String::Handle(target_name()));
17211 result.set_arguments_descriptor(Array::Handle(arguments_descriptor()));
17212 result.set_can_patch_to_monomorphic(!FLAG_precompiled_mode ||
17213 receiver_cannot_be_smi());
17217bool ICData::HasReceiverClassId(intptr_t class_id)
const {
17218 ASSERT(NumArgsTested() > 0);
17219 const intptr_t
len = NumberOfChecks();
17220 for (intptr_t
i = 0;
i <
len;
i++) {
17222 const intptr_t test_class_id = GetReceiverClassIdAt(
i);
17223 if (test_class_id == class_id) {
17232bool ICData::IsUsedAt(intptr_t
i)
const {
17233 if (GetCountAt(
i) <= 0) {
17237 if (NumArgsTested() > 0) {
17238 const intptr_t
cid = GetReceiverClassIdAt(
i);
17239 if (
cid == kObjectCid) {
17249 for (
int i = 0;
i <= kCachedICDataMaxArgsTestedWithoutExactnessTracking;
17251 cached_icdata_arrays_
17252 [kCachedICDataZeroArgTestedWithoutExactnessTrackingIdx +
i] =
17253 ICData::NewNonCachedEmptyICDataArray(
i,
false);
17255 cached_icdata_arrays_[kCachedICDataOneArgWithExactnessTrackingIdx] =
17256 ICData::NewNonCachedEmptyICDataArray(1,
true);
17260 for (
int i = 0;
i < kCachedICDataArrayCount; ++
i) {
17261 cached_icdata_arrays_[
i] =
nullptr;
17265ArrayPtr ICData::NewNonCachedEmptyICDataArray(intptr_t num_args_tested,
17266 bool tracking_exactness) {
17268 const intptr_t
len = TestEntryLengthFor(num_args_tested, tracking_exactness);
17271 WriteSentinel(array,
len, smi_illegal_cid());
17273 return array.
ptr();
17276ArrayPtr ICData::CachedEmptyICDataArray(intptr_t num_args_tested,
17277 bool tracking_exactness) {
17278 if (tracking_exactness) {
17279 ASSERT(num_args_tested == 1);
17280 return cached_icdata_arrays_[kCachedICDataOneArgWithExactnessTrackingIdx];
17282 ASSERT(num_args_tested >= 0);
17283 ASSERT(num_args_tested <=
17284 kCachedICDataMaxArgsTestedWithoutExactnessTracking);
17285 return cached_icdata_arrays_
17286 [kCachedICDataZeroArgTestedWithoutExactnessTrackingIdx +
17291bool ICData::IsCachedEmptyEntry(
const Array& array) {
17292 for (
int i = 0;
i < kCachedICDataArrayCount; ++
i) {
17293 if (cached_icdata_arrays_[
i] == array.ptr())
return true;
17299ICDataPtr ICData::NewDescriptor(Zone* zone,
17300 const Function& owner,
17301 const String& target_name,
17302 const Array& arguments_descriptor,
17304 intptr_t num_args_tested,
17305 RebindRule rebind_rule,
17306 const AbstractType& receivers_static_type) {
17307#if !defined(DART_PRECOMPILED_RUNTIME)
17310 ASSERT(!owner.IsNull());
17312 ASSERT(!target_name.IsNull());
17313 ASSERT(!arguments_descriptor.IsNull());
17314 ASSERT(Object::icdata_class() != Class::null());
17315 ASSERT(num_args_tested >= 0);
17318 ICData::Handle(zone, Object::Allocate<ICData>(
Heap::kOld));
17319 result.set_owner(owner);
17320 result.set_target_name(target_name);
17321 result.set_arguments_descriptor(arguments_descriptor);
17324 result.set_rebind_rule(rebind_rule);
17325 result.SetNumArgsTested(num_args_tested);
17330bool ICData::IsImmutable()
const {
17331 return entries()->IsImmutableArray();
17334ICDataPtr ICData::New() {
17336 const auto&
result = ICData::Handle(Object::Allocate<ICData>(
Heap::kOld));
17343 const String& target_name,
17344 const Array& arguments_descriptor,
17346 intptr_t num_args_tested,
17349 Zone* zone = Thread::Current()->zone();
17352 NewDescriptor(zone, owner, target_name, arguments_descriptor, deopt_id,
17353 num_args_tested, rebind_rule, receivers_static_type));
17354 result.set_entries(Array::Handle(
17356 CachedEmptyICDataArray(num_args_tested,
result.is_tracking_exactness())));
17361 const String& target_name,
17362 const Array& arguments_descriptor,
17364 intptr_t num_args_tested,
17372 Zone* zone = Thread::Current()->zone();
17373 const auto&
result = ICData::Handle(
17375 NewDescriptor(zone, owner, target_name, arguments_descriptor, deopt_id,
17376 num_args_tested, rebind_rule, receiver_type));
17378 const intptr_t kNumEntries = 2;
17379 const intptr_t entry_len =
17380 TestEntryLengthFor(num_args_tested,
result.is_tracking_exactness());
17381 const auto& array =
17382 Array::Handle(zone, Array::New(kNumEntries * entry_len,
Heap::kOld));
17384 auto&
cid = Smi::Handle(zone);
17385 for (intptr_t
i = 0;
i < num_args_tested; ++
i) {
17386 cid = Smi::New((*cids)[
i]);
17387 array.SetAt(
i,
cid);
17390 SetTargetAtPos(array, 0, num_args_tested,
target);
17391#if !defined(DART_PRECOMPILED_RUNTIME)
17392 array.SetAt(CountIndexFor(num_args_tested), Object::smi_zero());
17394 WriteSentinel(array, entry_len,
result);
17396 result.set_entries(array);
17403 const Array& arguments_descriptor,
17405 intptr_t num_args_tested,
17408 ASSERT(num_args_tested == 0 || num_args_tested == 2);
17411 Zone* zone = Thread::Current()->zone();
17412 const auto& target_name = String::Handle(zone,
target.name());
17414 if (num_args_tested == 2) {
17415 cids.
Add(kObjectCid);
17416 cids.
Add(kObjectCid);
17418 return ICData::NewWithCheck(owner, target_name, arguments_descriptor,
17419 deopt_id, num_args_tested, rebind_rule, &cids,
17420 target, Object::null_abstract_type());
17423#if !defined(DART_PRECOMPILED_RUNTIME)
17424ICDataPtr ICData::NewFrom(
const ICData& from, intptr_t num_args_tested) {
17426 const bool is_megamorphic = from.is_megamorphic();
17435 result.set_is_megamorphic(is_megamorphic);
17440 Zone* zone = Thread::Current()->zone();
17448 const bool is_megamorphic = from.is_megamorphic();
17451 zone, ICData::NewDescriptor(
17452 zone, Function::Handle(zone, from.
Owner()),
17458 const Array& from_array = Array::Handle(zone, from.
entries());
17459 if (ICData::IsCachedEmptyEntry(from_array)) {
17460 result.set_entries(from_array);
17462 const intptr_t
len = from_array.
Length();
17463 const Array& cloned_array =
17465 Object& obj = Object::Handle(zone);
17466 for (intptr_t
i = 0;
i <
len;
i++) {
17467 obj = from_array.
At(
i);
17468 cloned_array.
SetAt(
i, obj);
17472 result.set_entries(cloned_array);
17476 result.set_is_megamorphic(is_megamorphic);
17484ICDataPtr ICData::ICDataOfEntriesArray(
const Array& array) {
17485 const auto& back_ref = Object::Handle(array.
At(array.
Length() - 1));
17486 if (back_ref.
ptr() == smi_illegal_cid().ptr()) {
17487 ASSERT(IsCachedEmptyEntry(array));
17488 return ICData::null();
17491 const auto& ic_data = ICData::Cast(back_ref);
17492 DEBUG_ONLY(ic_data.AssertInvariantsAreSatisfied());
17493 return ic_data.ptr();
17496const char* WeakSerializationReference::ToCString()
const {
17497 return Object::Handle(
target()).ToCString();
17501 const Object& replacement) {
17502 ASSERT(Object::weak_serialization_reference_class() != Class::null());
17509 if (
target.ptr()->IsHeapObject() &&
target.InVMIsolateHeap()) {
17513 if (
target.IsWeakSerializationReference() &&
17514 WeakSerializationReference::Cast(
target).replacement() ==
17515 replacement.
ptr()) {
17518 const auto&
result = WeakSerializationReference::Handle(
17519 Object::Allocate<WeakSerializationReference>(
Heap::kOld));
17521 result.untag()->set_target(
target.IsWeakSerializationReference()
17522 ? WeakSerializationReference::Unwrap(
target)
17524 result.untag()->set_replacement(replacement.
ptr());
17528const char* WeakArray::ToCString()
const {
17529 return Thread::Current()->zone()->PrintToString(
"WeakArray len:%" Pd,
17534 ASSERT(Object::weak_array_class() != Class::null());
17535 if (!IsValidLength(
length)) {
17537 FATAL(
"Fatal error in WeakArray::New: invalid len %" Pd "\n",
length);
17539 auto raw = Object::Allocate<WeakArray>(space,
length);
17541 raw->untag()->set_length(Smi::New(
length));
17545#if defined(INCLUDE_IL_PRINTER)
17546Code::Comments& Code::Comments::New(intptr_t
count) {
17547 Comments* comments;
17548 if (count < 0 || count > (
kIntptrMax / kNumberOfEntries)) {
17550 FATAL(
"Fatal error in Code::Comments::New: invalid count %" Pd "\n",
count);
17553 comments =
new Comments(Object::empty_array());
17555 const Array&
data =
17557 comments =
new Comments(
data);
17562intptr_t Code::Comments::Length()
const {
17563 if (comments_.IsNull()) {
17566 return comments_.Length() / kNumberOfEntries;
17569intptr_t Code::Comments::PCOffsetAt(intptr_t idx)
const {
17571 Smi::RawCast(comments_.At(idx * kNumberOfEntries + kPCOffsetEntry)));
17574void Code::Comments::SetPCOffsetAt(intptr_t idx, intptr_t pc) {
17575 comments_.SetAt(idx * kNumberOfEntries + kPCOffsetEntry,
17576 Smi::Handle(Smi::New(pc)));
17579const char* Code::Comments::CommentAt(intptr_t idx)
const {
17580 string_ ^= comments_.At(idx * kNumberOfEntries + kCommentEntry);
17581 return string_.ToCString();
17584void Code::Comments::SetCommentAt(intptr_t idx,
const String& comment) {
17585 comments_.SetAt(idx * kNumberOfEntries + kCommentEntry, comment);
17588Code::Comments::Comments(
const Array& comments)
17589 : comments_(comments), string_(String::Handle()) {}
17596 case EntryKind::kUnchecked:
17597 return "Unchecked";
17598 case EntryKind::kMonomorphic:
17599 return "Monomorphic";
17600 case EntryKind::kMonomorphicUnchecked:
17601 return "MonomorphicUnchecked";
17609 if (strcmp(str,
"Normal") == 0) {
17612 }
else if (strcmp(str,
"Unchecked") == 0) {
17613 *
out = EntryKind::kUnchecked;
17615 }
else if (strcmp(str,
"Monomorphic") == 0) {
17616 *
out = EntryKind::kMonomorphic;
17618 }
else if (strcmp(str,
"MonomorphicUnchecked") == 0) {
17619 *
out = EntryKind::kMonomorphicUnchecked;
17630 ASSERT(!
f.IsIrregexpFunction());
17638 const auto& unwrapped_owner =
17640 ASSERT(unwrapped_owner.IsFunction() || unwrapped_owner.IsClass() ||
17641 unwrapped_owner.IsAbstractType());
17646void Code::set_state_bits(intptr_t
bits)
const {
17651 set_state_bits(OptimizedBit::update(
value,
untag()->state_bits_));
17655 set_state_bits(ForceOptimizedBit::update(
value,
untag()->state_bits_));
17659 set_state_bits(AliveBit::update(
value,
untag()->state_bits_));
17663 set_state_bits(DiscardedBit::update(
value,
untag()->state_bits_));
17668 untag()->set_compressed_stackmaps(maps.
ptr());
17671#if !defined(DART_PRECOMPILED_RUNTIME)
17673 ASSERT(!FLAG_precompiled_mode);
17677 ASSERT(!FLAG_precompiled_mode);
17682#if defined(DART_PRECOMPILED_RUNTIME) || defined(DART_PRECOMPILER)
17683TypedDataPtr Code::catch_entry_moves_maps()
const {
17684 ASSERT(FLAG_precompiled_mode);
17687void Code::set_catch_entry_moves_maps(
const TypedData& maps)
const {
17688 ASSERT(FLAG_precompiled_mode);
17689 untag()->set_catch_entry(maps.ptr());
17694#if defined(DART_PRECOMPILED_RUNTIME)
17698 untag()->set_deopt_info_array(array.
ptr());
17703#if defined(DART_PRECOMPILED_RUNTIME)
17706 untag()->set_static_calls_target_table(
value.ptr());
17715 for (intptr_t
i = 0;
i <
count - 1; ++
i) {
17716 auto left =
Smi::Value(entries[
i].Get<kSCallTableKindAndOffset>());
17717 auto right =
Smi::Value(entries[
i + 1].Get<kSCallTableKindAndOffset>());
17724#if defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME)
17725 if (FLAG_precompiled_mode) {
17733#if defined(PRODUCT)
17742 uint32_t* deopt_flags)
const {
17743#if defined(DART_PRECOMPILED_RUNTIME)
17751 if (
table.IsNull()) {
17760 for (intptr_t
i = 0;
i <
length; ++
i) {
17762 if (pc == (code_entry +
offset.Value())) {
17769 *deopt_reason = ICData::kDeoptUnknown;
17774intptr_t Code::BinarySearchInSCallTable(
uword pc)
const {
17775#if defined(DART_PRECOMPILED_RUNTIME)
17784 while (imax >= imin) {
17785 const intptr_t imid = imin + (imax - imin) / 2;
17787 Smi::Value(entries[imid].Get<kSCallTableKindAndOffset>()));
17788 if (
offset < pc_offset) {
17790 }
else if (
offset > pc_offset) {
17801#if defined(DART_PRECOMPILED_RUNTIME)
17805 const intptr_t
i = BinarySearchInSCallTable(pc);
17816#if defined(DART_PRECOMPILED_RUNTIME)
17819 const intptr_t
i = BinarySearchInSCallTable(pc);
17830#if defined(DART_PRECOMPILED_RUNTIME)
17833 const intptr_t
i = BinarySearchInSCallTable(pc);
17838 if (entries[
i].Get<kSCallTableFunctionTarget>() ==
Function::null()) {
17850#if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)
17851 if (!FLAG_support_disassembler) {
17855 if (formatter ==
nullptr) {
17863#if defined(INCLUDE_IL_PRINTER)
17864#if defined(PRODUCT)
17868class MallocCodeComments final :
public CodeComments {
17870 explicit MallocCodeComments(
const CodeComments& comments)
17871 : length_(comments.Length()), comments_(new Comment[comments.Length()]) {
17872 for (intptr_t
i = 0;
i < length_;
i++) {
17873 comments_[
i].pc_offset = comments.PCOffsetAt(
i);
17874 comments_[
i].comment =
17879 intptr_t Length()
const override {
return length_; }
17881 intptr_t PCOffsetAt(intptr_t
i)
const override {
17882 return comments_[
i].pc_offset;
17885 const char* CommentAt(intptr_t
i)
const override {
17886 return comments_[
i].comment.get();
17891 intptr_t pc_offset;
17896 std::unique_ptr<Comment[]> comments_;
17900const CodeComments& Code::comments()
const {
17901#if defined(PRODUCT)
17904 return (comments !=
nullptr) ? *comments : Code::Comments::New(0);
17910void Code::set_comments(
const CodeComments& comments)
const {
17911#if !defined(PRODUCT)
17912 auto& wrapper =
static_cast<const Code::Comments&
>(comments);
17913 ASSERT(wrapper.comments_.IsOld());
17914 untag()->set_comments(wrapper.comments_.ptr());
17916 if (FLAG_code_comments && comments.Length() > 0) {
17926#if defined(PRODUCT)
17935#if defined(PRODUCT)
17945 return Smi::Cast(
object).Value();
17950 return untag()->inlined_id_to_function();
17955 untag()->set_inlined_id_to_function(
value.ptr());
17958CodePtr Code::New(intptr_t pointer_offsets_length) {
17959 if (pointer_offsets_length < 0 || pointer_offsets_length >
kMaxElements) {
17961 FATAL(
"Fatal error in Code::New: invalid pointer_offsets_length %" Pd "\n",
17968 NoSafepointScope no_safepoint;
17974#if defined(INCLUDE_IL_PRINTER)
17975 result.set_comments(Comments::New(0));
17977 result.set_pc_descriptors(Object::empty_descriptors());
17978 result.set_compressed_stackmaps(Object::empty_compressed_stackmaps());
17982#if !defined(DART_PRECOMPILED_RUNTIME)
18013#if defined(DART_PRECOMPILER)
18026 ASSERT(assembler !=
nullptr);
18034 object_pool = ObjectPool::empty_object_pool().ptr();
18037#if defined(DART_PRECOMPILER)
18054#ifdef TARGET_ARCH_IA32
18074 ASSERT(pointer_offsets.length() == pointer_offset_count);
18075 ASSERT(
code.pointer_offsets_length() == pointer_offsets.length());
18079 for (intptr_t
i = 0;
i < pointer_offsets.length();
i++) {
18080 intptr_t offset_in_instrs = pointer_offsets[
i];
18081 code.SetPointerOffsetAt(
i, offset_in_instrs);
18090 object->
ptr(), thread);
18095 if (FLAG_write_protect_code) {
18104 code.SetActiveInstructions(instrs, unchecked_offset);
18105 code.set_instructions(instrs);
18107 code.set_is_alive(
true);
18114#if defined(DART_PRECOMPILER)
18115 if (
stats !=
nullptr) {
18124#if defined(INCLUDE_IL_PRINTER)
18125 code.set_comments(CreateCommentsFrom(assembler));
18142#if !defined(PRODUCT)
18145 if (
code.IsFunctionCode()) {
18159#if !defined(PRODUCT)
18165 const char*
name =
function.ToLibNamePrefixedQualifiedCString();
18174#if !defined(PRODUCT)
18181 code.GetPrologueOffset(), instrs.Size(), optimized,
18191 SlowFindCodeVisitor(
uword pc, int64_t timestamp)
18192 : pc_(pc), timestamp_(timestamp), result_(
Code::null()) {}
18195 if (!obj->IsCode())
return;
18196 CodePtr
code =
static_cast<CodePtr
>(obj);
18198#if !defined(PRODUCT)
18199 if (
code->untag()->compile_timestamp_ != timestamp_)
return;
18205 CodePtr
result()
const {
return result_; }
18209 int64_t timestamp_;
18214 SlowFindCodeVisitor visitor(pc, timestamp);
18217 return visitor.result();
18223 explicit FindCodeUnsafeVisitor(
uword pc) : pc_(pc), result_(
Code::null()) {}
18226 if (obj->IsCode()) {
18227 CodePtr
code =
static_cast<CodePtr
>(obj);
18234 CodePtr
result() {
return result_; }
18243 old_space->MakeIterable();
18244 FindCodeUnsafeVisitor visitor(pc);
18247 return visitor.result();
18255 if (iter.
PcOffset() == pc_offset) {
18259 return TokenPosition::kNoSource;
18267 if (iter.
DeoptId() == deopt_id) {
18282 if (iter.
PcOffset() == pc_offset) {
18301 if (obj.IsClass()) {
18302 return Class::Cast(obj).Hash();
18303 }
else if (obj.IsAbstractType()) {
18304 return AbstractType::Cast(obj).Hash();
18305 }
else if (obj.IsFunction()) {
18306 return Function::Cast(obj).Hash();
18318 if (
name ==
nullptr) {
18319 return "[unknown stub]";
18325 if (obj.IsClass()) {
18328 Class::Cast(obj).ScrubbedNameCString());
18329 }
else if (obj.IsAbstractType()) {
18333 }
else if (obj.IsFunction()) {
18335 const char* opt =
is_optimized() ?
"[Optimized]" :
"[Unoptimized]";
18336 const char*
function_name = Function::Cast(obj).UserVisibleNameCString();
18340 return "[unknown code]";
18348 if (obj.IsFunction()) {
18351 Function::Cast(obj).PrintName(
params, &printer);
18352 return printer.
buffer();
18369 return cid == kAbstractTypeCid ||
cid == kTypeCid ||
18370 cid == kFunctionTypeCid ||
cid == kRecordTypeCid ||
18371 cid == kTypeParameterCid;
18380 (
code == StubCode::UnknownDartCode().ptr());
18387 const Code& new_code = StubCode::FixCallersTarget();
18389 new_code.UncheckedEntryPointOffset());
18396 const Code& new_code = is_cls_parameterized
18397 ? StubCode::FixParameterizedAllocationStubTarget()
18398 : StubCode::FixAllocationStubTarget();
18400 new_code.UncheckedEntryPointOffset());
18403void Code::InitializeCachedEntryPointsFrom(CodePtr
code,
18404 InstructionsPtr instructions,
18405 uint32_t unchecked_offset) {
18408 const uword monomorphic_entry_point =
18410 code->untag()->entry_point_ = entry_point;
18411 code->untag()->monomorphic_entry_point_ = monomorphic_entry_point;
18412 code->untag()->unchecked_entry_point_ = entry_point + unchecked_offset;
18413 code->untag()->monomorphic_unchecked_entry_point_ =
18414 monomorphic_entry_point + unchecked_offset;
18417void Code::SetActiveInstructions(
const Instructions& instructions,
18418 uint32_t unchecked_offset)
const {
18419#if defined(DART_PRECOMPILED_RUNTIME)
18423 SetActiveInstructionsSafe(
instructions, unchecked_offset);
18427void Code::SetActiveInstructionsSafe(
const Instructions& instructions,
18428 uint32_t unchecked_offset)
const {
18429#if defined(DART_PRECOMPILED_RUNTIME)
18440void Code::ResetActiveInstructions()
const {
18441#if defined(DART_PRECOMPILED_RUNTIME)
18445 untag()->unchecked_offset_);
18450 intptr_t pc_offset,
18454 if (
map.IsNull()) {
18465void Code::PrintJSONInlineIntervals(
JSONObject* jsobj)
const {
18472 CodeSourceMapReader reader(
map, id_map,
root);
18473 reader.PrintJSONInlineIntervals(jsobj);
18479 if (
map.IsNull()) {
18491 if (
map.IsNull()) {
18502 intptr_t
level = 0;
18504 while (!parent_ctx.
IsNull()) {
18506 parent_ctx = parent_ctx.
parent();
18517 FATAL(
"Fatal error in Context::New: invalid num_variables %" Pd "\n",
18520 auto raw = Object::Allocate<Context>(space,
num_variables);
18528 return "Context: null";
18532 if (parent_ctx.IsNull()) {
18533 return zone->PrintToString(
"Context num_variables: %" Pd "",
18536 const char* parent_str = parent_ctx.ToCString();
18537 return zone->PrintToString(
"Context num_variables: %" Pd " parent:{ %s }",
18562 if (strlen(
s) > 50) {
18563 THR_Print(
"[%" Pd "] = [first 50 chars:] %.50s...\n",
i,
s);
18570 if (!parent_ctx.
IsNull()) {
18571 parent_ctx.
Dump(indent + 2);
18579 if (num_variables < 0 || num_variables >
kMaxElements) {
18581 FATAL(
"Fatal error in ContextScope::New: invalid num_variables %" Pd "\n",
18591 result.set_is_implicit(is_implicit);
18606 intptr_t scope_index)
const {
18612 intptr_t scope_index,
18614 untag()->set_declaration_token_pos_at(
18619 return untag()->name_at(scope_index);
18623 untag()->set_name_at(scope_index,
name.ptr());
18630bool ContextScope::GetFlagAt(intptr_t scope_index, intptr_t bit_index)
const {
18631 const intptr_t mask = 1 << bit_index;
18635void ContextScope::SetFlagAt(intptr_t scope_index,
18636 intptr_t bit_index,
18637 bool value)
const {
18638 const intptr_t mask = 1 << bit_index;
18640 untag()->set_flags_at(scope_index,
18644#define DEFINE_FLAG_ACCESSORS(Name) \
18645 bool ContextScope::Is##Name##At(intptr_t scope_index) const { \
18646 return GetFlagAt(scope_index, \
18647 UntaggedContextScope::VariableDesc::kIs##Name); \
18650 void ContextScope::SetIs##Name##At(intptr_t scope_index, bool value) const { \
18651 SetFlagAt(scope_index, UntaggedContextScope::VariableDesc::kIs##Name, \
18656#undef DEFINE_FLAG_ACCESSORS
18663 intptr_t late_init_offset)
const {
18664 untag()->set_late_init_offset_at(scope_index,
Smi::New(late_init_offset));
18668 return untag()->type_at(scope_index);
18673 untag()->set_type_at(scope_index,
type.ptr());
18689 intptr_t context_index)
const {
18690 untag()->set_context_index_at(scope_index,
Smi::New(context_index));
18698 intptr_t context_level)
const {
18699 untag()->set_context_level_at(scope_index,
Smi::New(context_level));
18707 intptr_t kernel_offset)
const {
18708 untag()->set_kernel_offset_at(scope_index,
Smi::New(kernel_offset));
18712 const char* prev_cstr =
"ContextScope:";
18716 const char* cname =
name.ToCString();
18722 "%s\nvar %s token-pos %s ctx lvl %" Pd " index %" Pd "",
18723 prev_cstr, cname,
pos.ToCString(), lvl, idx);
18730 return Object::Allocate<Sentinel>(
Heap::kOld);
18734 if (
ptr() == Object::sentinel().
ptr()) {
18736 }
else if (
ptr() == Object::transition_sentinel().
ptr()) {
18737 return "transition_sentinel";
18738 }
else if (
ptr() == Object::unknown_constant().
ptr()) {
18739 return "unknown_constant";
18740 }
else if (
ptr() == Object::non_constant().
ptr()) {
18741 return "non_constant";
18742 }
else if (
ptr() == Object::optimized_out().
ptr()) {
18743 return "<optimized out>";
18745 return "Sentinel(unknown)";
18749 return untag()->buckets();
18768 return untag()->filled_entry_count_;
18775MegamorphicCachePtr MegamorphicCache::New() {
18776 return Object::Allocate<MegamorphicCache>(
Heap::kOld);
18779MegamorphicCachePtr MegamorphicCache::New(
const String& target_name,
18780 const Array& arguments_descriptor) {
18783 zone, Object::Allocate<MegamorphicCache>(
Heap::kOld));
18788 for (intptr_t
i = 0;
i < capacity; ++
i) {
18789 SetEntry(
buckets,
i, smi_illegal_cid(), handler);
18792 result.set_mask(capacity - 1);
18795 result.set_filled_entry_count(0);
18804 InsertLocked(class_id,
target);
18814 return LookupLocked(class_id);
18817ObjectPtr MegamorphicCache::LookupLocked(
const Smi& class_id)
const {
18820 auto zone = thread->
zone();
18822 ASSERT(isolate_group->type_feedback_mutex()->IsOwnedByCurrentThread());
18825 intptr_t id_mask =
mask();
18827 intptr_t
i = index;
18831 if (current_cid == class_id.
Value()) {
18832 return GetTargetFunction(backing_array,
i);
18836 i = (
i + 1) & id_mask;
18837 }
while (
i != index);
18841void MegamorphicCache::InsertLocked(
const Smi& class_id,
18842 const Object&
target)
const {
18844 ASSERT(isolate_group->type_feedback_mutex()->IsOwnedByCurrentThread());
18852 isolate_group->RunWithStoppedMutators(
18854 EnsureCapacityLocked();
18855 InsertEntryLocked(class_id,
target);
18860void MegamorphicCache::EnsureCapacityLocked()
const {
18862 auto zone = thread->
zone();
18864 ASSERT(isolate_group->type_feedback_mutex()->IsOwnedByCurrentThread());
18866 intptr_t old_capacity =
mask() + 1;
18867 double load_limit =
kLoadFactor *
static_cast<double>(old_capacity);
18870 intptr_t new_capacity = old_capacity * 2;
18871 const Array& new_buckets =
18875 for (intptr_t
i = 0;
i < new_capacity; ++
i) {
18876 SetEntry(new_buckets,
i, smi_illegal_cid(),
target);
18884 for (intptr_t
i = 0;
i < old_capacity; ++
i) {
18887 target = GetTargetFunction(old_buckets,
i);
18888 InsertEntryLocked(class_id,
target);
18894void MegamorphicCache::InsertEntryLocked(
const Smi& class_id,
18895 const Object&
target)
const {
18898 ASSERT(isolate_group->type_feedback_mutex()->IsOwnedByCurrentThread());
18904 intptr_t id_mask =
mask();
18905 intptr_t index = (class_id.Value() *
kSpreadFactor) & id_mask;
18906 intptr_t
i = index;
18909 SetEntry(backing_array,
i, class_id,
target);
18913 i = (
i + 1) & id_mask;
18914 }
while (
i != index);
18934 result.set_cache(Object::empty_subtype_test_cache_array());
18939 return untag()->cache<std::memory_order_acquire>();
18942void SubtypeTestCache::set_cache(
const Array&
value)
const {
18946 untag()->set_cache<std::memory_order_release>(
value.ptr());
18949void SubtypeTestCache::set_num_occupied(intptr_t
value)
const {
18966 return table.Length();
18970 if (
IsNull())
return false;
18979 const Object& instance_class_id_or_signature,
18984 const TypeArguments& instance_parent_function_type_arguments,
18986 const Bool& test_result)
const {
18989 ->subtype_test_cache_mutex()
18990 ->IsOwnedByCurrentThread());
18998 data = EnsureCapacity(zone,
data, old_num + 1, &was_grown);
18999 ASSERT(
data.ptr() != Object::empty_subtype_test_cache_array().ptr());
19001 const auto& loc = FindKeyOrUnused(
19002 data,
num_inputs(), instance_class_id_or_signature, destination_type,
19003 instance_type_arguments, instantiator_type_arguments,
19004 function_type_arguments, instance_parent_function_type_arguments,
19005 instance_delayed_type_arguments);
19007 const auto& entry = entries[loc.entry];
19011 FATAL(
"Existing subtype test cache entry has result %s, not %s",
19012 old_result.ToCString(), test_result.
ToCString());
19026 instance_delayed_type_arguments);
19030 instance_parent_function_type_arguments);
19053 instance_class_id_or_signature);
19059 set_num_occupied(old_num + 1);
19068 intptr_t num_inputs,
19069 const Object& instance_class_id_or_signature,
19074 const TypeArguments& instance_parent_function_type_arguments,
19076 switch (num_inputs) {
19079 destination_type.
ptr()) {
19085 instance_delayed_type_arguments.
ptr()) {
19091 instance_parent_function_type_arguments.
ptr()) {
19097 function_type_arguments.
ptr()) {
19103 instantiator_type_arguments.
ptr()) {
19109 instance_type_arguments.
ptr()) {
19118 instance_class_id_or_signature.
ptr();
19124SubtypeTestCache::KeyLocation SubtypeTestCache::FindKeyOrUnused(
19125 const Array& array,
19126 intptr_t num_inputs,
19127 const Object& instance_class_id_or_signature,
19128 const AbstractType& destination_type,
19129 const TypeArguments& instance_type_arguments,
19130 const TypeArguments& instantiator_type_arguments,
19131 const TypeArguments& function_type_arguments,
19132 const TypeArguments& instance_parent_function_type_arguments,
19133 const TypeArguments& instance_delayed_type_arguments) {
19135 if (array.ptr() == Object::empty_subtype_test_cache_array().ptr()) {
19138 const bool is_hash =
IsHash(array);
19140 const intptr_t num_entries =
table.Length();
19144 intptr_t probe = 0;
19145 intptr_t probe_distance = 1;
19152 instance_class_id_or_signature.IsFunctionType()
19153 ? FunctionType::Cast(instance_class_id_or_signature).Hash()
19154 : Smi::Cast(instance_class_id_or_signature).Value();
19181 probe =
hash & (num_entries - 1);
19184 const auto& tuple =
table.At(probe);
19190 tuple,
num_inputs, instance_class_id_or_signature, destination_type,
19191 instance_type_arguments, instantiator_type_arguments,
19192 function_type_arguments, instance_parent_function_type_arguments,
19193 instance_delayed_type_arguments)) {
19194 return {probe,
true};
19197 probe = probe + probe_distance;
19200 probe = probe & (num_entries - 1);
19206 return {probe,
false};
19209ArrayPtr SubtypeTestCache::EnsureCapacity(Zone* zone,
19210 const Array& array,
19211 intptr_t new_occupied,
19212 bool* was_grown)
const {
19214 ASSERT(was_grown !=
nullptr);
19216 const intptr_t current_capacity =
NumEntries(array);
19219 *was_grown =
false;
19220 const bool is_linear = IsLinear(array);
19223 if (current_capacity > new_occupied)
return array.ptr();
19225 if (LoadFactor(new_occupied, current_capacity) < kMaxLoadFactor) {
19226 return array.ptr();
19240 const intptr_t new_capacity =
19246 const auto& new_data =
19248 ASSERT(!new_data.IsNull());
19252 for (intptr_t
i = current_capacity;
i < new_capacity;
i++) {
19253 const auto& tuple =
table.At(
i);
19256 return new_data.ptr();
19262 const intptr_t new_capacity =
19263 is_linear ? kNumInitialHashCacheEntries : 2 * current_capacity;
19276 ASSERT(LoadFactor(new_occupied, new_capacity) < kMaxLoadFactor);
19278 const auto& new_data =
19280 ASSERT(!new_data.IsNull());
19283 for (
const auto& tuple : to_table) {
19296 for (intptr_t
i = 0;
i < current_capacity;
i++) {
19297 const auto& from_tuple = from_table.At(
i);
19300 GetCheckFromArray(array, used_inputs,
i, &instance_cid_or_signature,
19301 &destination_type, &instance_type_arguments,
19302 &instantiator_type_arguments, &function_type_arguments,
19303 &instance_parent_function_type_arguments,
19304 &instance_delayed_type_arguments, &test_result);
19307 auto loc = FindKeyOrUnused(
19308 new_data, used_inputs, instance_cid_or_signature, destination_type,
19309 instance_type_arguments, instantiator_type_arguments,
19310 function_type_arguments, instance_parent_function_type_arguments,
19311 instance_delayed_type_arguments);
19313 const auto& to_tuple = to_table.At(loc.entry);
19315 switch (used_inputs) {
19321 instance_delayed_type_arguments);
19325 instance_parent_function_type_arguments);
19343 return new_data.ptr();
19348 Object* instance_class_id_or_signature,
19355 Bool* test_result)
const {
19358 ->subtype_test_cache_mutex()
19359 ->IsOwnedByCurrentThread());
19360 GetCurrentCheck(ix, instance_class_id_or_signature, destination_type,
19361 instance_type_arguments, instantiator_type_arguments,
19362 function_type_arguments,
19363 instance_parent_function_type_arguments,
19364 instance_delayed_type_arguments, test_result);
19369 Object* instance_class_id_or_signature,
19376 Bool* test_result)
const {
19378 GetCheckFromArray(array,
num_inputs(), ix, instance_class_id_or_signature,
19379 destination_type, instance_type_arguments,
19380 instantiator_type_arguments, function_type_arguments,
19381 instance_parent_function_type_arguments,
19382 instance_delayed_type_arguments, test_result);
19385void SubtypeTestCache::GetCheckFromArray(
19386 const Array& array,
19387 intptr_t num_inputs,
19389 Object* instance_class_id_or_signature,
19396 Bool* test_result) {
19397 ASSERT(array.
ptr() != Object::empty_subtype_test_cache_array().ptr());
19399 auto entry = entries[ix];
19402 *instance_class_id_or_signature =
19411 *instance_delayed_type_arguments =
19415 *instance_parent_function_type_arguments =
19437 Object* instance_class_id_or_signature,
19444 Bool* test_result)
const {
19449 ->subtype_test_cache_mutex()
19450 ->IsOwnedByCurrentThread());
19453 instance_type_arguments, instantiator_type_arguments,
19454 function_type_arguments,
19455 instance_parent_function_type_arguments,
19456 instance_delayed_type_arguments, test_result);
19465 const Object& instance_class_id_or_signature,
19470 const TypeArguments& instance_parent_function_type_arguments,
19475 auto loc = FindKeyOrUnused(
19476 data,
num_inputs(), instance_class_id_or_signature, destination_type,
19477 instance_type_arguments, instantiator_type_arguments,
19478 function_type_arguments, instance_parent_function_type_arguments,
19479 instance_delayed_type_arguments);
19481 if (index !=
nullptr) {
19482 *index = loc.entry;
19484 if (
result !=
nullptr) {
19486 const auto& entry = entries[loc.entry];
19493 return loc.present;
19499 const char* line_prefix)
const {
19502 ->subtype_test_cache_mutex()
19503 ->IsOwnedByCurrentThread());
19504 WriteCurrentEntryToBuffer(zone,
buffer, index, line_prefix);
19509 const char* line_prefix)
const {
19512 ->subtype_test_cache_mutex()
19513 ->IsOwnedByCurrentThread());
19514 WriteToBufferUnlocked(zone,
buffer, line_prefix);
19517void SubtypeTestCache::WriteCurrentEntryToBuffer(
19521 const char* line_prefix)
const {
19522 const char* separator =
19523 line_prefix ==
nullptr ?
", " :
OS::SCreate(zone,
"\n%s", line_prefix);
19532 GetCurrentCheck(index, &instance_class_id_or_signature, &destination_type,
19533 &instance_type_arguments, &instantiator_type_arguments,
19534 &function_type_arguments,
19535 &instance_parent_function_type_arguments,
19536 &instance_delayed_type_arguments, &
result);
19538 "%" Pd ": [ %#" Px ", %#" Px ", %#" Px ", %#" Px ", %#" Px ", %#" Px
19539 ", %#" Px ", %#" Px " ]",
19540 index,
static_cast<uword>(instance_class_id_or_signature.
ptr()),
19541 static_cast<uword>(instance_type_arguments.
ptr()),
19542 static_cast<uword>(instantiator_type_arguments.
ptr()),
19543 static_cast<uword>(function_type_arguments.
ptr()),
19544 static_cast<uword>(instance_parent_function_type_arguments.
ptr()),
19545 static_cast<uword>(instance_delayed_type_arguments.
ptr()),
19546 static_cast<uword>(destination_type.
ptr()),
19548 if (instance_class_id_or_signature.IsSmi()) {
19549 buffer->Printf(
"%sclass id: %" Pd "", separator,
19550 Smi::Cast(instance_class_id_or_signature).
Value());
19553 "%ssignature: %s", separator,
19554 FunctionType::Cast(instance_class_id_or_signature).
ToCString());
19556 if (!instance_type_arguments.
IsNull()) {
19557 if (instance_class_id_or_signature.IsSmi()) {
19558 buffer->Printf(
"%sinstance type arguments: %s", separator,
19561 ASSERT(instance_class_id_or_signature.IsFunctionType());
19562 buffer->Printf(
"%sclosure instantiator function type arguments: %s",
19563 separator, instance_type_arguments.
ToCString());
19566 if (!instantiator_type_arguments.
IsNull()) {
19567 buffer->Printf(
"%sinstantiator type arguments: %s", separator,
19568 instantiator_type_arguments.
ToCString());
19570 if (!function_type_arguments.
IsNull()) {
19571 buffer->Printf(
"%sfunction type arguments: %s", separator,
19574 if (!instance_parent_function_type_arguments.
IsNull()) {
19575 buffer->Printf(
"%sclosure parent function type arguments: %s", separator,
19576 instance_parent_function_type_arguments.
ToCString());
19578 if (!instance_delayed_type_arguments.
IsNull()) {
19579 buffer->Printf(
"%sclosure delayed function type arguments: %s", separator,
19580 instance_delayed_type_arguments.
ToCString());
19582 if (!destination_type.
IsNull()) {
19583 buffer->Printf(
"%sdestination type: %s", separator,
19588 function_type_arguments,
19590 const auto type_class_id = test_type.type_class_id();
19591 buffer->Printf(
"%sinstantiated type: %s", separator,
19592 test_type.ToCString());
19593 buffer->Printf(
"%sinstantiated type class id: %d", separator,
19597 buffer->Printf(
"%sresult: %s", separator,
result.ToCString());
19600void SubtypeTestCache::WriteToBufferUnlocked(Zone* zone,
19602 const char* line_prefix)
const {
19603 const char* separator =
19604 line_prefix ==
nullptr ?
" " :
OS::SCreate(zone,
"\n%s", line_prefix);
19605 const char* internal_line_prefix =
19606 line_prefix ==
nullptr
19608 :
OS::SCreate(zone,
"%s%s", line_prefix, line_prefix);
19612 for (intptr_t
i = 0;
i < num_entries;
i++) {
19614 buffer->Printf(
",%s{", separator);
19615 WriteCurrentEntryToBuffer(zone,
buffer,
i, internal_line_prefix);
19616 buffer->Printf(line_prefix !=
nullptr ?
"}" :
" }");
19618 buffer->AddString(line_prefix !=
nullptr && num_entries != 0 ?
"\n)" :
")");
19622 set_num_occupied(0);
19623 set_cache(Object::empty_subtype_test_cache_array());
19629 ->subtype_test_cache_mutex()
19630 ->IsOwnedByCurrentThread());
19631 if (
ptr() == other.
ptr()) {
19646 Zone*
const zone = thread->
zone();
19652 entry_cache = entry_cache.Copy();
19653 result.set_cache(entry_cache);
19661 const intptr_t cache_index =
19664 return cache()->untag()->element<std::memory_order_acquire>(cache_index) !=
19669 if (
type.IsType()) {
19670 if (
type.IsInstantiated())
return 2;
19677 "destination type is not last input");
19684 WriteToBufferUnlocked(zone, &
buffer);
19705 return "LoadingUnit";
19714 bool transient_error)
const {
19723 args.SetAt(1, error_message);
19736 Class& cls = thread->ClassHandle();
19737 Library& lib = thread->LibraryHandle();
19744 FATAL(
"Unable to find loading unit of %s (class %s, library %s)",
19751 if (
code.IsStubCode() ||
code.IsTypeTestStubCode() ||
19752 code.IsAllocationStubCode()) {
19761 Class& cls = thread->ClassHandle();
19762 Library& lib = thread->LibraryHandle();
19764 Function& func = thread->FunctionHandle();
19766 if (
code.IsFunctionCode()) {
19767 func ^=
code.function();
19768 cls = func.
Owner();
19782 return "Error: null";
19790 return "Error: null";
19797ApiErrorPtr ApiError::New() {
19799 return Object::Allocate<ApiError>(
Heap::kOld);
19804 if (FLAG_print_stacktrace_at_api_error) {
19829LanguageErrorPtr LanguageError::New() {
19831 return Object::Allocate<LanguageError>(
Heap::kOld);
19837 bool report_after_token,
19845 result.set_previous_error(prev_error);
19846 result.set_script(script);
19848 result.set_report_after_token(report_after_token);
19858 bool report_after_token,
19873LanguageErrorPtr LanguageError::New(
const String& formatted_message,
19879 result.set_formatted_message(formatted_message);
19884void LanguageError::set_previous_error(
const Error&
value)
const {
19888void LanguageError::set_script(
const Script&
value)
const {
19892void LanguageError::set_token_pos(TokenPosition token_pos)
const {
19897void LanguageError::set_report_after_token(
bool value)
const {
19901void LanguageError::set_kind(uint8_t
value)
const {
19905void LanguageError::set_message(
const String&
value)
const {
19909void LanguageError::set_formatted_message(
const String&
value)
const {
19910 untag()->set_formatted_message(
value.ptr());
19915 return formatted_message();
19922 if (!prev_error.
IsNull()) {
19926 set_formatted_message(
result);
19936 return "LanguageError";
19952 return Object::Allocate<UnhandledException>(space);
19955void UnhandledException::set_exception(
const Instance& exception)
const {
19959void UnhandledException::set_stacktrace(
const Instance& stacktrace)
const {
19969 const char* exc_str;
19970 if (
exception() == isolate_group->object_store()->out_of_memory()) {
19971 exc_str =
"Out of Memory";
19972 }
else if (
exception() == isolate_group->object_store()->stack_overflow()) {
19973 exc_str =
"Stack Overflow";
19977 if (!strtmp.IsError()) {
19980 exc_str =
"<Received error while converting exception to string>";
19984 const char* stack_str;
19986 stack_str =
"null";
19987 }
else if (stack.IsStackTrace()) {
19988 stack_str = StackTrace::Cast(stack).ToCString();
19991 if (!strtmp.IsError()) {
19994 stack_str =
"<Received error while converting stack trace to string>";
19997 return OS::SCreate(thread->
zone(),
"Unhandled exception:\n%s\n%s", exc_str,
20002 return "UnhandledException";
20014void UnwindError::set_message(
const String&
message)
const {
20028 return "UnwindError";
20032 bool respect_reflectable,
20033 bool check_is_entrypoint)
const {
20039 const auto& inst_type_args =
20042 : Object::null_type_arguments();
20044 const String& internal_getter_name =
20049 !FLAG_precompiled_mode));
20051 if (!
function.IsNull() && check_is_entrypoint) {
20055 if (
function.kind() == UntaggedFunction::kImplicitGetter) {
20056 field =
function.accessor_field();
20066 if (
function.IsNull() && FLAG_precompiled_mode) {
20070 if (!
function.IsNull() && check_is_entrypoint) {
20075 const Function& closure_function =
20081 const int kTypeArgsLen = 0;
20082 const int kNumArgs = 1;
20084 args.SetAt(0, *
this);
20090 args, args_descriptor, respect_reflectable,
20096 bool respect_reflectable,
20097 bool check_is_entrypoint)
const {
20103 const auto& inst_type_args =
20106 : Object::null_type_arguments();
20108 const String& internal_setter_name =
20113 !FLAG_precompiled_mode));
20115 if (check_is_entrypoint) {
20119 if (setter.
kind() == UntaggedFunction::kImplicitSetter) {
20124 }
else if (!setter.
IsNull()) {
20129 const int kTypeArgsLen = 0;
20130 const int kNumArgs = 2;
20132 args.SetAt(0, *
this);
20139 args, args_descriptor, respect_reflectable,
20145 const Array& arg_names,
20146 bool respect_reflectable,
20147 bool check_is_entrypoint)
const {
20156 !FLAG_precompiled_mode));
20158 if (!
function.IsNull() && check_is_entrypoint) {
20164 const int kTypeArgsLen = 0;
20169 const auto& inst_type_args =
20172 : Object::null_type_arguments();
20176 const String& getter_name =
20180 !FLAG_precompiled_mode);
20182 if (check_is_entrypoint) {
20187 const int kNumArgs = 1;
20189 getter_args.
SetAt(0, *
this);
20195 getter_args, getter_args_descriptor,
20196 respect_reflectable, inst_type_args));
20197 if (getter_result.IsError()) {
20198 return getter_result.
ptr();
20201 args.SetAt(0, getter_result);
20208 args_descriptor, respect_reflectable,
20220 if (IsInteger())
return Integer::Cast(*this).ptr();
20222#if defined(HASH_IN_OBJECT_HEADER)
20223 intptr_t
hash = Object::GetCachedHash(
ptr());
20230 }
else if (IsBool()) {
20233 double val = Double::Cast(*this).value();
20236 int64_t ival =
static_cast<int64_t
>(val);
20237 if (
static_cast<double>(ival) == val) {
20242 uint64_t uval = bit_cast<uint64_t>(val);
20247 }
while (
hash == 0);
20250#if defined(HASH_IN_OBJECT_HEADER)
20251 hash = Object::SetCachedHashIfNotSet(
ptr(),
hash);
20260 if (this->
ptr() == other.
ptr()) {
20264 if (other.
IsNull() || (this->clazz() != other.
clazz())) {
20272 ASSERT(instance_size != 0);
20273 const intptr_t other_instance_size = other.
SizeFromClass();
20274 ASSERT(other_instance_size != 0);
20275 if (instance_size != other_instance_size) {
20279 uword other_addr =
reinterpret_cast<uword>(other.untag());
20302 auto zone = thread->
zone();
20305 const auto& symbol_name_field =
20307 ASSERT(!symbol_name_field.IsNull());
20312 const uint32_t arbitrary_prime = 664597;
20313 return 0x1fffffff & (arbitrary_prime *
name.CanonicalizeHash());
20334 const intptr_t class_id = cls.
id();
20341 const auto unboxed_fields_bitmap =
20350 hash, *
reinterpret_cast<uint32_t*
>(this_addr +
offset));
20352 hash, *
reinterpret_cast<uint32_t*
>(this_addr +
offset + 4));
20355 hash, *
reinterpret_cast<uint32_t*
>(this_addr +
offset));
20360 if (obj.IsSentinel()) {
20377 explicit CheckForPointers(
IsolateGroup* isolate_group)
20380 bool has_pointers()
const {
return has_pointers_; }
20382 void VisitPointers(ObjectPtr* first, ObjectPtr* last)
override {
20383 if (last >= first) {
20384 has_pointers_ =
true;
20388#if defined(DART_COMPRESSED_POINTERS)
20389 void VisitCompressedPointers(
uword heap_base,
20392 if (last >= first) {
20393 has_pointers_ =
true;
20399 bool has_pointers_;
20413 ASSERT(instance_size != 0);
20414 const auto unboxed_fields_bitmap =
20422 if (obj.IsInstance()) {
20423 obj = Instance::Cast(obj).CanonicalizeLocked(thread);
20424 this->SetFieldAtOffset(
offset, obj);
20430#if defined(DEBUG) && !defined(DART_COMPRESSED_POINTERS)
20433 CheckForPointers has_pointers(
group);
20435 ASSERT(!has_pointers.has_pointers());
20452 return this->
ptr();
20479 return Double::New(*
reinterpret_cast<double_t*
>(FieldAddr(field)));
20480 case kFloat32x4Cid:
20483 case kFloat64x2Cid:
20487 return Integer::New(*
reinterpret_cast<int64_t*
>(FieldAddr(field)));
20501 case kFloat32x4Cid:
20505 case kFloat64x2Cid:
20511 Integer::Cast(
value).AsInt64Value());
20535 zone, Closure::Cast(*this).GetInstantiatedSignature(zone));
20540 return signature.
ptr();
20544 auto& record_type =
20546 ASSERT(record_type.IsFinalized());
20547 ASSERT(record_type.IsCanonical());
20548 return record_type.ptr();
20554 if (
type.IsNull()) {
20557 if (num_type_arguments > 0) {
20559 if (!type_arguments.
IsNull()) {
20564 type.SetIsFinalized();
20565 type ^=
type.Canonicalize(thread);
20578 return type_arguments.
ptr();
20587 SetFieldAtOffset(field_offset,
value);
20617 const TypeArguments& other_function_type_arguments)
const {
20620 return Instance::NullIsInstanceOf(other, other_instantiator_type_arguments,
20621 other_function_type_arguments);
20625 return RuntimeTypeIsSubtypeOf(other, other_instantiator_type_arguments,
20626 other_function_type_arguments);
20632 const TypeArguments& other_function_type_arguments)
const {
20636 return RuntimeTypeIsSubtypeOf(other, other_instantiator_type_arguments,
20637 other_function_type_arguments);
20644bool Instance::NullIsInstanceOf(
20657 return NullIsInstanceOf(
type, other_instantiator_type_arguments,
20658 other_function_type_arguments);
20662 if (other.IsTypeParameter()) {
20664 other_instantiator_type_arguments, other_function_type_arguments,
20666 return Instance::NullIsInstanceOf(
type, Object::null_type_arguments(),
20667 Object::null_type_arguments());
20697 if (!other.IsTypeParameter())
return false;
20699 other_instantiator_type_arguments, other_function_type_arguments,
20704bool Instance::RuntimeTypeIsSubtypeOf(
20707 const TypeArguments& other_function_type_arguments)
const {
20715 Zone* zone = thread->zone();
20717 if (cls.IsClosureClass()) {
20725 other_instantiator_type_arguments, other_function_type_arguments,
20727 if (instantiated_other.IsTopTypeForSubtyping() ||
20728 instantiated_other.IsObjectType() ||
20729 instantiated_other.IsDartFunctionType()) {
20733 if (RuntimeTypeIsSubtypeOfFutureOr(zone, instantiated_other)) {
20736 if (!instantiated_other.IsFunctionType()) {
20740 Closure::Cast(*this).GetInstantiatedSignature(zone));
20741 return sig.IsSubtypeOf(FunctionType::Cast(instantiated_other),
Heap::kOld);
20743 if (cls.IsRecordClass()) {
20750 other_instantiator_type_arguments, other_function_type_arguments,
20752 if (instantiated_other.IsTopTypeForSubtyping() ||
20753 instantiated_other.IsObjectType() ||
20754 instantiated_other.IsDartRecordType()) {
20758 if (RuntimeTypeIsSubtypeOfFutureOr(zone, instantiated_other)) {
20761 if (!instantiated_other.IsRecordType()) {
20764 const Record& record = Record::Cast(*
this);
20765 const RecordType& record_type = RecordType::Cast(instantiated_other);
20766 if (record.shape() != record_type.shape()) {
20771 const intptr_t num_fields = record.num_fields();
20772 for (intptr_t
i = 0;
i < num_fields; ++
i) {
20773 field_value ^= record.FieldAt(
i);
20774 field_type = record_type.FieldTypeAt(
i);
20775 if (!field_value.RuntimeTypeIsSubtypeOf(field_type,
20776 Object::null_type_arguments(),
20777 Object::null_type_arguments())) {
20784 const intptr_t num_type_arguments = cls.NumTypeArguments();
20785 if (num_type_arguments > 0) {
20787 ASSERT(type_arguments.IsNull() || type_arguments.IsCanonical());
20796 ASSERT(type_arguments.IsNull() ||
20797 (type_arguments.Length() >= num_type_arguments));
20802 other_instantiator_type_arguments, other_function_type_arguments,
20804 if (instantiated_other.IsTopTypeForSubtyping()) {
20809 if (instantiated_other.IsNullType()) {
20812 if (RuntimeTypeIsSubtypeOfFutureOr(zone, instantiated_other)) {
20816 return !instantiated_other.IsNonNullable();
20818 if (!instantiated_other.IsType()) {
20827bool Instance::RuntimeTypeIsSubtypeOfFutureOr(Zone* zone,
20828 const AbstractType& other)
const {
20829 if (other.IsFutureOrType()) {
20830 const TypeArguments& other_type_arguments =
20832 const AbstractType& other_type_arg =
20834 if (other_type_arg.IsTopTypeForSubtyping()) {
20838 const TypeArguments& type_arguments =
20840 const AbstractType& type_arg =
20842 if (type_arg.IsSubtypeOf(other_type_arg,
Heap::kOld)) {
20847 if (RuntimeTypeIsSubtypeOf(other_type_arg, Object::null_type_arguments(),
20848 Object::null_type_arguments())) {
20862 if (
ptr() == other.
ptr())
return true;
20863 if (IsInteger() && other.IsInteger()) {
20864 return Integer::Cast(*this).Equals(other);
20866 if (
IsDouble() && other.IsDouble()) {
20867 double other_value = Double::Cast(other).value();
20868 return Double::Cast(*this).BitwiseEqualsToDouble(other_value);
20875 TypedDataPtr native_fields =
static_cast<TypedDataPtr
>(
20880 return reinterpret_cast<intptr_t*
>(native_fields->untag()->data());
20887 if (native_fields.
IsNull()) {
20892 intptr_t byte_offset = index *
sizeof(intptr_t);
20893 TypedData::Cast(native_fields).SetIntPtr(byte_offset,
value);
20897 const intptr_t* field_values)
const {
20899 ASSERT(field_values !=
nullptr);
20902 if (native_fields.
IsNull()) {
20907 for (uint16_t
i = 0;
i < num_native_fields;
i++) {
20908 intptr_t byte_offset =
i *
sizeof(intptr_t);
20909 TypedData::Cast(native_fields).SetIntPtr(byte_offset, field_values[
i]);
20917 *
function = Closure::Cast(*this).function();
20926 if (call_function.
IsNull()) {
20946 ASSERT(instance_size > 0);
20949 const uword ptr_field_end_offset =
20955 from_offset<Instance>(), ptr_field_end_offset));
20958bool Instance::IsValidFieldOffset(intptr_t
offset)
const {
20961 Class& cls = thread->ClassHandle();
20974 case kImmutableArrayCid:
20976 case kTypeArgumentsCid:
20978 case kOneByteStringCid:
20980 case kTwoByteStringCid:
20998 case kImmutableArrayCid:
21000 case kTypeArgumentsCid:
21002 case kOneByteStringCid:
21004 case kTwoByteStringCid:
21022 return Closure::Cast(*this).ToCString();
21029 type_name.ToCString());
21069 if (IsTypeParameter()) {
21070 const auto& bound =
21072 ASSERT(!bound.IsNull());
21073 return bound.IsStrictlyNonNullable();
21097 if (arg_nullability == result_nullability) {
21101 return Type::Cast(*this).ToNullability(result_nullability, space);
21103 if (IsFunctionType()) {
21104 return FunctionType::Cast(*this).ToNullability(result_nullability, space);
21106 if (IsRecordType()) {
21107 return RecordType::Cast(*this).ToNullability(result_nullability, space);
21109 if (IsTypeParameter()) {
21110 return TypeParameter::Cast(*this).ToNullability(result_nullability, space);
21122 return unwrapped_type.
ptr();
21124 if (
cid == kInstanceCid) {
21126 return unwrapped_type.
ptr();
21129 return Type::Cast(unwrapped_type)
21134 const Type& future_never_type =
21135 Type::Handle(zone, object_store->non_nullable_future_never_type());
21142 return object_store->nullable_future_null_type();
21152 intptr_t num_free_fun_type_params)
const {
21209 if (this_type_nullability != other_type_nullability) {
21219 intptr_t num_free_fun_type_params,
21222 intptr_t num_parent_type_args_adjustment)
const {
21232 intptr_t num_parent_type_args_adjustment,
21233 intptr_t num_free_fun_type_params,
21258 ASSERT(uris !=
nullptr);
21261 bool print_uri =
false;
21262 for (intptr_t
i = 0;
i <
len;
i += 3) {
21263 if (uris->
At(
i).Equals(
name)) {
21264 if (uris->
At(
i + 1).Equals(uri)) {
21284 ASSERT(uris !=
nullptr);
21290 for (intptr_t
i = 0;
i <
len;
i += 3) {
21293 pieces.
Add(Symbols::TwoSpaces());
21294 pieces.
Add(uris->
At(
i));
21295 pieces.
Add(Symbols::SpaceIsFromSpace());
21296 pieces.
Add(uris->
At(
i + 1));
21328 return printer.
buffer();
21339 return printer.
buffer();
21350 return printer.
buffer();
21363 ASSERT(!IsFunctionType() && !IsRecordType());
21384 if (
cid == kInstanceCid) {
21387 if (
cid == kFutureOrCid) {
21401 if (
cid == kInstanceCid) {
21404 if (
cid == kFutureOrCid) {
21420 ->integer_implementation_class());
21463 return ((
cid == kRecordCid) ||
21478 if (
cid == kBoolCid)
return true;
21480 if (
cid == kInstanceCid)
return true;
21489 candidate_type = object_store->int_type();
21491 candidate_type = object_store->double_type();
21493 candidate_type = object_store->number_type();
21495 candidate_type = object_store->string_type();
21499 candidate_cls = object_store->list_class();
21500 if (
cid == candidate_cls.
id())
return true;
21501 candidate_cls = object_store->map_class();
21502 if (
cid == candidate_cls.
id())
return true;
21503 candidate_cls = object_store->set_class();
21504 if (
cid == candidate_cls.
id())
return true;
21505 candidate_cls = object_store->capability_class();
21506 if (
cid == candidate_cls.
id())
return true;
21507 candidate_cls = object_store->send_port_class();
21508 if (
cid == candidate_cls.
id())
return true;
21509 candidate_cls = object_store->transferable_class();
21510 if (
cid == candidate_cls.
id())
return true;
21512 const auto& typed_data_lib =
21515#define IS_CHECK(name) \
21516 candidate_cls = typed_data_lib.LookupClass(Symbols::name##List()); \
21517 if (cid == candidate_cls.id()) { \
21531 return Type::dynamic_type().ptr();
21538 AbstractType& type_arg = thread->AbstractTypeHandle();
21539 type_arg = type_args.
TypeAt(0);
21542 return Type::dynamic_type().ptr();
21545 type_arg = type_args.
TypeAt(0);
21547 return type_arg.
ptr();
21559 if (
ptr() == other.
ptr()) {
21587 (
result ?
"true" :
"false"));
21604 if (IsTypeParameter()) {
21605 const TypeParameter& type_param = TypeParameter::Cast(*
this);
21606 if (other.IsTypeParameter()) {
21607 const TypeParameter& other_type_param = TypeParameter::Cast(other);
21610 function_type_equivalence)) {
21612 " - result: true (equivalent type parameters)\n");
21618 if (bound.
IsSubtypeOf(other, space, function_type_equivalence)) {
21623 if (IsSubtypeOfFutureOr(zone, other, space, function_type_equivalence)) {
21625 " - result: true (type parameter is a subtype of FutureOr)\n");
21629 " - result: false (left is a type parameter)\n");
21632 if (other.IsTypeParameter()) {
21634 " - result: false (right is a type parameter)\n");
21638 if (IsFunctionType()) {
21644 (
result ?
"true" :
"false"));
21647 if (other.IsFunctionType()) {
21651 " - result: false (function nullability)\n");
21654 const bool result = FunctionType::Cast(*this).IsSubtypeOf(
21655 FunctionType::Cast(other), space, function_type_equivalence);
21657 (
result ?
"true" :
"false"));
21661 if (IsSubtypeOfFutureOr(zone, other, space, function_type_equivalence)) {
21663 " - result: true (function type is a subtype of FutureOr)\n");
21669 }
else if (other.IsFunctionType()) {
21673 " - result: false (right is a function type)\n");
21677 if (IsRecordType()) {
21681 (
result ?
"true" :
"false"));
21684 if (other.IsRecordType()) {
21690 const bool result = RecordType::Cast(*this).IsSubtypeOf(
21691 RecordType::Cast(other), space, function_type_equivalence);
21693 (
result ?
"true" :
"false"));
21697 if (IsSubtypeOfFutureOr(zone, other, space, function_type_equivalence)) {
21699 " - result: true (record type is a subtype of FutureOr)\n");
21705 }
else if (other.IsRecordType()) {
21717 nullability(), other, space, function_type_equivalence);
21719 (
result ?
"true" :
"false"));
21723bool AbstractType::IsSubtypeOfFutureOr(
21732 ASSERT(IsFunctionType() || IsRecordType() || IsTypeParameter());
21741 if (
IsSubtypeOf(other_type_arg, space, function_type_equivalence)) {
21758 return "AbstractType: null";
21770 old =
untag()->type_test_stub<std::memory_order_acquire>();
21771 uword old_entry_point = old.IsNull() ? 0 : old.EntryPoint();
21779 if (
untag()->type_test_stub_entry_point_.compare_exchange_strong(
21781 untag()->set_type_test_stub<std::memory_order_release>(stub.
ptr());
21793 untag()->set_type_test_stub(stub.
ptr());
21798 untag()->set_type_test_stub(stub.
ptr());
21806 return Object::dynamic_type().ptr();
21810 return Object::void_type().ptr();
21899 if (
type.IsNull()) {
21902 type.SetIsFinalized();
21934 type.InitializeTypeTestingStubNonAtomic(
21953 type.InitializeTypeTestingStubNonAtomic(
21964 return untag()->type_class_id();
21972 intptr_t num_free_fun_type_params)
const {
21976 if ((genericity ==
kAny) && (num_free_fun_type_params ==
kAllFree) &&
21984 return args.IsSubvectorInstantiated(0,
args.Length(), genericity,
21985 num_free_fun_type_params);
21989 const TypeArguments& instantiator_type_arguments,
21990 const TypeArguments& function_type_arguments,
21991 intptr_t num_free_fun_type_params,
21993 FunctionTypeMapping* function_type_mapping,
21994 intptr_t num_parent_type_args_adjustment)
const {
22003 ASSERT(type_arguments.Length() == cls.NumTypeParameters());
22004 type_arguments = type_arguments.InstantiateFrom(
22005 instantiator_type_arguments, function_type_arguments,
22006 num_free_fun_type_params, space, function_type_mapping,
22007 num_parent_type_args_adjustment);
22010 if (type_arguments.ptr() == Object::empty_type_arguments().ptr()) {
22015 const Type& instantiated_type =
22017 instantiated_type.SetIsFinalized();
22019 return instantiated_type.NormalizeFutureOrType(space);
22023 intptr_t num_parent_type_args_adjustment,
22024 intptr_t num_free_fun_type_params,
22026 FunctionTypeMapping* function_type_mapping)
const {
22028 ASSERT(num_parent_type_args_adjustment >= 0);
22035 zone, type_args.UpdateFunctionTypes(num_parent_type_args_adjustment,
22036 num_free_fun_type_params, space,
22037 function_type_mapping));
22038 if (type_args.ptr() == updated_type_args.ptr()) {
22044 new_type.SetIsFinalized();
22045 return new_type.ptr();
22054 }
else if (
cid == kDoubleCid) {
22067 FunctionTypeMapping* function_type_equivalence)
const {
22069 if (
ptr() == other.ptr()) {
22072 if (!other.IsType()) {
22075 const Type& other_type = Type::Cast(other);
22077 const classid_t other_type_cid = other_type.type_class_id();
22078 if (type_cid != other_type_cid) {
22086 Zone* zone = thread->zone();
22089 Class::Handle(zone, other_type.type_class()).NumTypeParameters(thread));
22094 if (!
IsFinalized() || !other_type.IsFinalized()) {
22098 if (
arguments() == other_type.arguments()) {
22105 return type_args.IsEquivalent(other_type_args, kind,
22106 function_type_equivalence);
22114 if (
ptr() == other.
ptr()) {
22117 if (!other.IsFunctionType()) {
22120 const FunctionType& other_type = FunctionType::Cast(other);
22144 function_type_equivalence)) {
22153 function_type_equivalence)) {
22159 for (intptr_t
i = 0;
i < num_params;
i++) {
22164 function_type_equivalence)) {
22195 Zone* zone = thread->zone();
22200 ASSERT(type_args.IsCanonical());
22201 ASSERT(type_args.IsOld());
22203 return this->
ptr();
22205 auto isolate_group = thread->isolate_group();
22209 return Object::dynamic_type().ptr();
22214 return Object::void_type().ptr();
22223 if (
type.IsNull()) {
22224 ASSERT(!cls.ptr()->untag()->InVMIsolateHeap() ||
22228 type_args = type_args.Canonicalize(thread);
22230 type = cls.declaration_type();
22232 if (
type.IsNull()) {
22233 SafepointMutexLocker ml(isolate_group->type_canonicalization_mutex());
22235 type = cls.declaration_type();
22236 if (
type.IsNull()) {
22237 if (this->
IsNew()) {
22243 type.ComputeHash();
22244 type.SetCanonical();
22245 cls.set_declaration_type(
type);
22252 if (
type.IsCanonical()) {
22258 ObjectStore* object_store = isolate_group->object_store();
22260 SafepointMutexLocker ml(isolate_group->type_canonicalization_mutex());
22262 type ^=
table.GetOrNull(CanonicalTypeKey(*
this));
22263 ASSERT(object_store->canonical_types() ==
table.Release().ptr());
22265 if (
type.IsNull()) {
22270 ASSERT(type_args.IsNull() ||
22271 (type_args.Length() == cls.NumTypeParameters()));
22272 type_args = type_args.Canonicalize(thread);
22274 ASSERT(type_args.IsNull() || type_args.IsOld());
22278 SafepointMutexLocker ml(isolate_group->type_canonicalization_mutex());
22280 type ^=
table.GetOrNull(CanonicalTypeKey(*
this));
22281 if (
type.IsNull()) {
22283 if (this->
IsNew()) {
22289 type.SetCanonical();
22293 object_store->set_canonical_types(
table.Release());
22303 Zone* zone = thread->zone();
22310 type_args.EnumerateURIs(uris);
22314 BaseTextBuffer* printer)
const {
22316 Zone* zone = thread->zone();
22318 const TypeParameters&
params =
22320 printer->AddString(cls.NameCString(name_visibility));
22322 intptr_t num_type_params = 0;
22323 if (cls.is_declaration_loaded()) {
22324 num_type_params = cls.NumTypeParameters(thread);
22326 num_type_params =
args.Length();
22328 if (num_type_params == 0) {
22331 args.PrintSubvectorName(0, num_type_params, name_visibility, printer);
22346 type_args_hash =
args.Hash();
22361 if (num_type_params > 0) {
22372 for (intptr_t
i = 0;
i < num_params;
i++) {
22391 set_type_class_id(
value.id());
22408 bool canonicalize)
const {
22409 Zone* zone = thread->zone();
22412 return cls.GetInstanceTypeArguments(thread,
args, canonicalize);
22416 return Object::Allocate<Type>(space);
22420 const TypeArguments& arguments,
22432 result.InitializeTypeTestingStubNonAtomic(
22437void Type::set_type_class_id(intptr_t
id)
const {
22443 untag()->set_type_class_id(
id);
22448 return "Type: null";
22451 ZoneTextBuffer
args(zone);
22453 const char* args_cstr =
"";
22454 if (!type_args.IsNull()) {
22456 args_cstr =
args.buffer();
22477 type_args = type_params.bounds();
22480 type_args = type_params.defaults();
22491 for (intptr_t
i = 0;
i < num_params;
i++) {
22500 ObjectStore* object_store = isolate_group->object_store();
22505 object_store->canonical_function_types());
22507 ASSERT(object_store->canonical_function_types() ==
table.Release().ptr());
22516 if (this->
IsNew()) {
22519 new_sig ^= this->
ptr();
22528 type_args = type_params.bounds();
22531 type_params.set_bounds(type_args);
22533 type_args = type_params.defaults();
22536 type_params.set_defaults(type_args);
22541 if (!
type.IsCanonical()) {
22548 for (intptr_t
i = 0;
i < num_params;
i++) {
22550 if (!
type.IsCanonical()) {
22559 object_store->canonical_function_types());
22563 sig = new_sig.
ptr();
22566 bool present =
table.Insert(sig);
22569 object_store->set_canonical_function_types(
table.Release());
22579 for (intptr_t
i = 0;
i < num_params;
i++) {
22581 type.EnumerateURIs(uris);
22585 type.EnumerateURIs(uris);
22591 if (
suffix[0] !=
'\0') {
22594 FunctionType::Cast(*this).Print(name_visibility, printer);
22595 if (
suffix[0] !=
'\0') {
22620 return type_parameter.
ptr();
22624 intptr_t num_free_fun_type_params)
const {
22639 static_cast<int>(kind));
22640 if (
ptr() == other.
ptr()) {
22644 if (!other.IsTypeParameter()) {
22646 " - result: false (other is not a type parameter)\n");
22649 const TypeParameter& other_type_param = TypeParameter::Cast(other);
22655 " - result: false (other is not a function type parameter)\n");
22660 ((function_type_equivalence ==
nullptr) ||
22662 *
this, other_type_param))) {
22664 " - result: false (owners are not equivalent)\n");
22670 " - result: false (other is not a class type parameter)\n");
22675 " - result: false (parameterized class id)\n");
22679 if (
base() != other_type_param.
base() ||
22692void TypeParameter::set_owner(
const Object&
value)
const {
22702 return kFunctionCid;
22740 const auto& type_parameters =
22742 return type_parameters.BoundAt(
index() -
base());
22745 if (owner.IsNull()) {
22748 const auto& type_parameters =
22750 return type_parameters.BoundAt(
index() -
base());
22759 ? function_type_arguments
22760 : instantiator_type_arguments;
22767 intptr_t num_free_fun_type_params,
22770 intptr_t num_parent_type_args_adjustment)
const {
22773 bool substituted =
false;
22776 if (
index() >= num_free_fun_type_params) {
22779 ASSERT(function_type_mapping !=
nullptr);
22782 index() - num_free_fun_type_params);
22784 base() - num_free_fun_type_params);
22789 instantiator_type_arguments, function_type_arguments,
22790 num_free_fun_type_params, space, function_type_mapping,
22791 num_parent_type_args_adjustment);
22797 }
else if (function_type_arguments.
IsNull()) {
22801 substituted =
true;
22806 if (instantiator_type_arguments.
IsNull()) {
22809 if (instantiator_type_arguments.
Length() <=
index()) {
22819 substituted =
true;
22824 result =
result.SetInstantiatedNullability(*
this, space);
22825 if (substituted && (num_parent_type_args_adjustment != 0)) {
22830 result =
result.UpdateFunctionTypes(num_parent_type_args_adjustment,
22831 kAllFree, space, function_type_mapping);
22834 return result.NormalizeFutureOrType(space);
22838 intptr_t num_parent_type_args_adjustment,
22839 intptr_t num_free_fun_type_params,
22843 ASSERT(num_parent_type_args_adjustment >= 0);
22846 ASSERT(function_type_mapping !=
nullptr);
22849 ASSERT(new_tp.base() ==
base() + num_parent_type_args_adjustment);
22850 ASSERT(new_tp.index() ==
index() + num_parent_type_args_adjustment);
22852 ASSERT(new_tp.IsFinalized());
22853 return new_tp.ptr();
22868 return this->
ptr();
22871 ObjectStore* object_store = isolate_group->object_store();
22876 object_store->canonical_type_parameters());
22878 if (type_parameter.
IsNull()) {
22880 if (this->
IsNew()) {
22883 type_parameter = this->
ptr();
22887 bool present =
table.Insert(type_parameter);
22890 object_store->set_canonical_type_parameters(
table.Release());
22892 return type_parameter.
ptr();
22897 const TypeParameter& type_param = TypeParameter::Cast(*
this);
22914TypeParameterPtr TypeParameter::New() {
22915 return Object::Allocate<TypeParameter>(
Heap::kOld);
22918TypeParameterPtr TypeParameter::New(
const Object& owner,
22922 ASSERT(owner.
IsNull() || owner.IsClass() || owner.IsFunctionType());
22923 const bool is_function_type_parameter = owner.IsFunctionType();
22925 is_function_type_parameter);
22929 if (is_function_type_parameter) {
22930 result.set_owner(owner);
22933 : Class::Cast(owner).id());
22941 result.InitializeTypeTestingStubNonAtomic(
22951 const char* base_fmt = is_class_type_parameter ?
"C%" Pd :
"F%" Pd;
22952 const char* index_fmt = is_class_type_parameter ?
"X%" Pd :
"Y%" Pd;
22957 return printer.
buffer();
22962 return "TypeParameter: null";
22965 ZoneTextBuffer printer(thread->zone());
22966 printer.Printf(
"TypeParameter: ");
22969 return printer.buffer();
22981 return "nullptr Integer";
23117 if (
IsSmi() && other.IsSmi()) {
23128 static_cast<int64_t
>(right_value)),
23130 case Token::kTRUNCDIV:
23132 case Token::kMOD: {
23133 const intptr_t remainder = left_value % right_value;
23134 if (remainder < 0) {
23135 if (right_value < 0) {
23162 case Token::kTRUNCDIV:
23170 case Token::kMOD: {
23176 const int64_t remainder = left_value % right_value;
23177 if (remainder < 0) {
23178 if (right_value < 0) {
23195 if (
IsSmi() && other.IsSmi()) {
23200 case Token::kBIT_AND:
23201 result = op1_value & op2_value;
23203 case Token::kBIT_OR:
23204 result = op1_value | op2_value;
23206 case Token::kBIT_XOR:
23207 result = op1_value ^ op2_value;
23218 case Token::kBIT_AND:
23220 case Token::kBIT_OR:
23222 case Token::kBIT_XOR:
23252 if (other.
IsNull() || !other.IsSmi()) {
23255 return (this->
Value() == Smi::Cast(other).
Value());
23259 return static_cast<double>(this->
Value());
23263 return this->
Value();
23267 return this->
Value() & 0xFFFFFFFF;
23271 if (other.IsSmi()) {
23272 const Smi& other_smi = Smi::Cast(other);
23275 }
else if (this->
Value() > other_smi.
Value()) {
23282 if (other.IsMint()) {
23300void Mint::set_value(int64_t
value)
const {
23322 if (this->
ptr() == other.
ptr()) {
23326 if (!other.IsMint() || other.
IsNull()) {
23329 return value() == Mint::Cast(other).value();
23333 return static_cast<double>(this->
value());
23337 return this->
value();
23341 return this->
value() & 0xFFFFFFFF;
23350 ASSERT(other.IsMint() || other.IsSmi());
23355 }
else if (
a >
b) {
23366void Double::set_value(
double value)
const {
23372 void* this_addr =
reinterpret_cast<void*
>(
23373 reinterpret_cast<uword>(this->
untag()) + value_offset);
23374 void* other_addr =
reinterpret_cast<void*
>(&
value);
23375 return (memcmp(this_addr, other_addr,
sizeof(
value)) == 0);
23382 if (!other.IsDouble()) {
23385 return this->
value() == Double::Cast(other).value();
23389 if (this->
ptr() == other.
ptr()) {
23392 if (other.
IsNull() || !other.IsDouble()) {
23411 double double_value;
23415 return New(double_value, space);
23426 double double_value;
23436 intptr_t
len = strlen(cstr);
23439 for (intptr_t
i = 0;
i <
len; ++
i) {
23440 ASSERT(
static_cast<uint8_t
>(cstr[
i]) < 128);
23448 if (isnan(
value())) {
23451 if (isinf(
value())) {
23452 return value() < 0 ?
"-Infinity" :
"Infinity";
23462 ASSERT(begin_index >= 0);
23470 Add(OneByteString::CharAddr(str, begin_index),
len);
23473 Add(TwoByteString::CharAddr(str, begin_index),
len);
23481 hasher.
Add(str, begin_index,
len);
23495 if (raw->IsOneByteString()) {
23496 const uint8_t*
data =
static_cast<OneByteStringPtr
>(raw)->
untag()->data();
23499 const uint16_t*
data =
static_cast<TwoByteStringPtr
>(raw)->
untag()->data();
23506 hasher.
Add(
reinterpret_cast<const uint8_t*
>(characters),
len);
23512 hasher.
Add(characters,
len);
23518 hasher.
Add(characters,
len);
23524 if (class_id == kOneByteStringCid) {
23527 ASSERT(class_id == kTwoByteStringCid);
23532 if (this->
ptr() == other.
ptr()) {
23537 if (!other.IsString()) {
23541 const String& other_string = String::Cast(other);
23542 return Equals(other_string);
23546 intptr_t begin_index,
23547 intptr_t
len)
const {
23548 ASSERT(begin_index >= 0);
23549 ASSERT((begin_index == 0) || (begin_index < str.
Length()));
23556 for (intptr_t
i = 0;
i <
len;
i++) {
23566 ASSERT(cstr !=
nullptr);
23568 intptr_t
len = strlen(cstr);
23569 while (it.
Next()) {
23570 if (*cstr ==
'\0') {
23575 intptr_t consumed =
23577 if (consumed == 0 || it.
Current() != ch) {
23583 return *cstr ==
'\0';
23592 for (intptr_t
i = 0;
i <
len;
i++) {
23593 if (this->
CharAt(i) != latin1_array[
i]) {
23606 for (intptr_t
i = 0;
i <
len;
i++) {
23615 if (
len < 0)
return false;
23617 for (intptr_t
i = 0;
i <
len; ++
i) {
23619 uint16_t encoded[2];
23621 if (j + 1 >=
Length())
return false;
23622 if (
CharAt(j++) != encoded[0])
return false;
23623 if (
CharAt(j++) != encoded[1])
return false;
23625 if (j >=
Length())
return false;
23626 if (
CharAt(j++) != utf32_array[
i])
return false;
23639 const intptr_t this_len = this->
Length();
23640 const intptr_t other_len = other.
IsNull() ? 0 : other.
Length();
23641 const intptr_t
len = (this_len < other_len) ? this_len : other_len;
23642 for (intptr_t
i = 0;
i <
len;
i++) {
23643 uint16_t this_code_unit = this->
CharAt(i);
23644 uint16_t other_code_unit = other.
CharAt(
i);
23645 if (this_code_unit < other_code_unit) {
23648 if (this_code_unit > other_code_unit) {
23652 if (this_len < other_len)
return -1;
23653 if (this_len > other_len)
return 1;
23662 if (prefix_length >
length)
return false;
23664 for (intptr_t
i = 0;
i < prefix_length;
i++) {
23677 const intptr_t other_len = other.
Length();
23678 const intptr_t
offset =
len - other_len;
23680 if ((other_len == 0) || (other_len >
len)) {
23693 return this->
ptr();
23699 ASSERT(cstr !=
nullptr);
23700 intptr_t array_len = strlen(cstr);
23701 const uint8_t* utf8_array =
reinterpret_cast<const uint8_t*
>(cstr);
23706 intptr_t array_len,
23715 OneByteString::DataStart(strobj),
len)) {
23720 return strobj.
ptr();
23726 TwoByteString::DataStart(strobj),
len)) {
23730 return strobj.
ptr();
23734 intptr_t array_len,
23740 intptr_t array_len,
23742 bool is_one_byte_string =
true;
23743 for (intptr_t
i = 0;
i < array_len; ++
i) {
23745 is_one_byte_string =
false;
23749 if (is_one_byte_string) {
23756 intptr_t array_len,
23758 bool is_one_byte_string =
true;
23759 intptr_t utf16_len = array_len;
23760 for (intptr_t
i = 0;
i < array_len; ++
i) {
23762 is_one_byte_string =
false;
23768 if (is_one_byte_string) {
23781 intptr_t char_size = str.
CharSize();
23793 intptr_t dst_offset,
23794 const uint8_t* characters,
23796 ASSERT(dst_offset >= 0);
23799 if (
dst.IsOneByteString()) {
23802 memmove(OneByteString::CharAddr(
dst, dst_offset), characters,
len);
23804 }
else if (
dst.IsTwoByteString()) {
23805 for (intptr_t
i = 0;
i <
len; ++
i) {
23806 *TwoByteString::CharAddr(
dst,
i + dst_offset) = characters[
i];
23812 intptr_t dst_offset,
23813 const uint16_t* utf16_array,
23814 intptr_t array_len) {
23815 ASSERT(dst_offset >= 0);
23817 ASSERT(array_len <= (
dst.Length() - dst_offset));
23818 if (
dst.IsOneByteString()) {
23820 for (intptr_t
i = 0;
i < array_len; ++
i) {
23822 *OneByteString::CharAddr(
dst,
i + dst_offset) = utf16_array[
i];
23827 if (array_len > 0) {
23828 memmove(TwoByteString::CharAddr(
dst, dst_offset), utf16_array,
23835 intptr_t dst_offset,
23837 intptr_t src_offset,
23839 ASSERT(dst_offset >= 0);
23840 ASSERT(src_offset >= 0);
23845 intptr_t char_size =
src.CharSize();
23874 if (c >=
'0' && c <=
'9') {
23877 if (c >=
'A' && c <=
'F') {
23884 if ((c >=
'0') && (c <=
'9')) {
23887 if ((c >=
'a') && (c <=
'z')) {
23890 if ((c >=
'A') && (c <=
'Z')) {
23893 return (c ==
'-') || (c ==
'_') || (c ==
'.') || (c ==
'~');
23899 const char* hex =
"0123456789ABCDEF";
23904 if (c >=
'0' && c <=
'9') {
23907 if (c >=
'A' && c <=
'F') {
23908 return c -
'A' + 10;
23923 intptr_t num_escapes = 0;
23924 for (
int i = 0;
i <
len; ++
i) {
23925 uint8_t
byte =
utf8[
i];
23930 intptr_t cstr_len =
len + num_escapes + 1;
23931 char* cstr = zone->
Alloc<
char>(cstr_len);
23932 intptr_t index = 0;
23933 for (
int i = 0;
i <
len; ++
i) {
23934 uint8_t
byte =
utf8[
i];
23936 cstr[index++] =
'%';
23941 cstr[index++] = byte;
23944 cstr[index] =
'\0';
23950 intptr_t num_escapes = 0;
23954 while (cpi.
Next()) {
23955 int32_t code_point = cpi.
Current();
23961 int32_t code_point = cpi.
Current();
23976 intptr_t utf8_len =
len - num_escapes;
23979 uint8_t*
utf8 = zone->
Alloc<uint8_t>(utf8_len);
23981 intptr_t index = 0;
23983 while (cpi.
Next()) {
23984 ASSERT(index < utf8_len);
23985 int32_t code_point = cpi.
Current();
23992 ASSERT(merged >= 0 && merged < 256);
23993 utf8[index] =
static_cast<uint8_t
>(merged);
23995 ASSERT(code_point >= 0 && code_point < 256);
23996 utf8[index] =
static_cast<uint8_t
>(code_point);
24026 va_copy(args_copy,
args);
24059 intptr_t result_len = 0;
24064 str ^= strings.
At(
i);
24065 const intptr_t str_len = str.
Length();
24070 result_len += str_len;
24081 intptr_t begin_index,
24084 if (begin_index >= str.
Length()) {
24093 intptr_t begin_index,
24097 ASSERT(begin_index >= 0);
24102 if (begin_index > str.
Length()) {
24105 bool is_one_byte_string =
true;
24106 intptr_t char_size = str.
CharSize();
24108 for (intptr_t
i = begin_index;
i < begin_index +
length; ++
i) {
24110 is_one_byte_string =
false;
24117 if (is_one_byte_string) {
24128 return "String: null";
24135 return reinterpret_cast<const char*
>(
result);
24143 return reinterpret_cast<char*
>(
result);
24148 Utf8::Encode(*
this,
reinterpret_cast<char*
>(utf8_array), array_len);
24152 if (
ptr ==
nullptr)
return nullptr;
24162 intptr_t external_size) {
24168 ASSERT(finalizable_ref !=
nullptr);
24169 return finalizable_ref;
24176 bool has_mapping =
false;
24177 int32_t dst_max = 0;
24179 while (it.
Next()) {
24181 int32_t
dst = mapping(
src);
24183 has_mapping =
true;
24187 if (!has_mapping) {
24216 const uint8_t* startChar;
24218 startChar = OneByteString::CharAddr(str,
start);
24221 for (intptr_t
i = 0;
i <
length;
i++) {
24246template <
typename T1,
typename T2>
24249 intptr_t str2_len = str2.
Length();
24250 if (
len == str2_len) {
24251 for (intptr_t
i = 0;
i <
len;
i++) {
24252 if (T1::CharAt(str1,
i) != T2::CharAt(str2,
i)) {
24258 if (
len < str2_len) {
24262 intptr_t str2_pos = 0;
24264 int32_t ch = T1::CharAt(str1,
pos);
24267 if ((str2_pos < str2_len) && (ch == T2::CharAt(str2, str2_pos))) {
24274 while ((
pos <
len) && (T1::CharAt(str1,
pos) !=
'.') &&
24275 (T1::CharAt(str1,
pos) !=
'&')) {
24287 return (str2_pos == str2_len);
24290#define EQUALS_IGNORING_PRIVATE_KEY(class_id, type, str1, str2) \
24291 switch (class_id) { \
24292 case kOneByteStringCid: \
24293 return dart::EqualsIgnoringPrivateKey<type, OneByteString>(str1, str2); \
24294 case kTwoByteStringCid: \
24295 return dart::EqualsIgnoringPrivateKey<type, TwoByteString>(str1, str2); \
24300 if (str1.
ptr() == str2.
ptr()) {
24306 switch (str1_class_id) {
24307 case kOneByteStringCid:
24310 case kTwoByteStringCid:
24321 if (index_ < (end_ -
length)) {
24323 ch_ = str_.
CharAt(index_);
24325 int32_t ch2 = str_.
CharAt(index_ + 1);
24339 intptr_t num_escapes = 0;
24340 for (intptr_t
i = 0;
i <
len;
i++) {
24345 intptr_t index = 0;
24346 for (intptr_t
i = 0;
i <
len;
i++) {
24349 SetCharAt(dststr, index,
'\\');
24353 SetCharAt(dststr, index,
'\\');
24354 SetCharAt(dststr, index + 1,
'x');
24359 SetCharAt(dststr, index, ch);
24363 return OneByteString::raw(dststr);
24375 FATAL(
"Fatal error in OneByteString::New: invalid len %" Pd "\n",
len);
24377 auto result = Object::Allocate<OneByteString>(space,
len);
24380#if !defined(HASH_IN_OBJECT_HEADER)
24396 memmove(DataStart(
result), characters,
len);
24398 return OneByteString::raw(
result);
24406 for (intptr_t
i = 0;
i <
len; ++
i) {
24408 *CharAddr(
result,
i) = characters[
i];
24410 return OneByteString::raw(
result);
24418 for (intptr_t
i = 0;
i <
len; ++
i) {
24420 *CharAddr(
result,
i) = characters[
i];
24422 return OneByteString::raw(
result);
24429 return OneByteString::raw(
result);
24433 intptr_t other_start_index,
24434 intptr_t other_len,
24438 if (other_len > 0) {
24440 memmove(OneByteString::DataStart(
result),
24441 OneByteString::CharAddr(other_one_byte_string, other_start_index),
24444 return OneByteString::raw(
result);
24448 intptr_t other_start_index,
24449 intptr_t other_len,
24453 if (other_len > 0) {
24455 memmove(OneByteString::DataStart(
result),
24456 other_typed_data.
DataAddr(other_start_index), other_len);
24458 return OneByteString::raw(
result);
24464 intptr_t len1 = str1.
Length();
24465 intptr_t len2 = str2.
Length();
24466 intptr_t
len = len1 + len2;
24470 return OneByteString::raw(
result);
24485 str ^= strings.
At(
i);
24486 const intptr_t str_len = str.
Length();
24491 return OneByteString::raw(
result);
24501 for (intptr_t
i = 0;
i <
len; ++
i) {
24502 int32_t ch = mapping(str.
CharAt(
i));
24506 return OneByteString::raw(
result);
24510 intptr_t begin_index,
24514 ASSERT(begin_index >= 0);
24523 uint8_t*
dest = &
result->untag()->data()[0];
24524 const uint8_t*
src = &
untag(str)->data()[begin_index];
24533 intptr_t num_escapes = 0;
24534 for (intptr_t
i = 0;
i <
len;
i++) {
24539 intptr_t index = 0;
24540 for (intptr_t
i = 0;
i <
len;
i++) {
24541 uint16_t ch =
CharAt(str,
i);
24543 SetCharAt(dststr, index,
'\\');
24547 SetCharAt(dststr, index,
'\\');
24548 SetCharAt(dststr, index + 1,
'x');
24553 SetCharAt(dststr, index, ch);
24557 return TwoByteString::raw(dststr);
24567 FATAL(
"Fatal error in TwoByteString::New: invalid len %" Pd "\n",
len);
24569 auto s = Object::Allocate<TwoByteString>(space,
len);
24572#if !defined(HASH_IN_OBJECT_HEADER)
24578 s->untag()->HeapSize() -
size);
24583 intptr_t array_len,
24589 memmove(
reinterpret_cast<void*
>(DataStart(
result)),
24590 reinterpret_cast<const void*
>(utf16_array), (array_len * 2));
24592 return TwoByteString::raw(
result);
24596 const int32_t* utf32_array,
24597 intptr_t array_len,
24599 ASSERT((array_len > 0) && (utf16_len >= array_len));
24604 for (intptr_t
i = 0;
i < array_len; ++
i) {
24606 ASSERT(j < (utf16_len - 1));
24611 *CharAddr(
result, j) = utf32_array[
i];
24616 return TwoByteString::raw(
result);
24623 return TwoByteString::raw(
result);
24627 intptr_t other_start_index,
24628 intptr_t other_len,
24631 if (other_len > 0) {
24633 memmove(TwoByteString::DataStart(
result),
24634 other_typed_data.
DataAddr(other_start_index),
24635 other_len *
sizeof(uint16_t));
24637 return TwoByteString::raw(
result);
24643 intptr_t len1 = str1.
Length();
24644 intptr_t len2 = str2.
Length();
24645 intptr_t
len = len1 + len2;
24649 return TwoByteString::raw(
result);
24664 str ^= strings.
At(
i);
24665 const intptr_t str_len = str.
Length();
24670 return TwoByteString::raw(
result);
24682 while (it.
Next()) {
24684 int32_t
dst = mapping(
src);
24695 return TwoByteString::raw(
result);
24699 return value() ?
"true" :
"false";
24703 if (this->
ptr() == other.
ptr()) {
24709 if (!other.IsArray() || other.
IsNull()) {
24714 const Array& other_arr = Array::Cast(other);
24717 if (len != other_arr.
Length()) {
24721 for (intptr_t
i = 0;
i <
len;
i++) {
24722 if (this->At(
i) != other_arr.
At(
i)) {
24734 if (!type_args.
Equals(other_type_args)) {
24753 for (intptr_t
i = 0;
i <
len;
i++) {
24770 result.SetTypeArguments(type_args);
24778 if (!IsValidLength(
len)) {
24780 FATAL(
"Fatal error in Array::New: invalid len %" Pd "\n",
len);
24782 auto raw = Object::AllocateVariant<Array>(class_id, space,
len);
24785 if (UseCardMarkingForAllocation(
len)) {
24786 ASSERT(raw->IsOldObject());
24787 raw->untag()->SetCardRememberedBitUnsynchronized();
24793 if (!UseCardMarkingForAllocation(
len)) {
24794 return NewUninitialized(class_id,
len, space);
24800 result.SetTypeArguments(Object::null_type_arguments());
24801 for (intptr_t
i = 0;
i <
len;
i++) {
24802 result.SetAt(
i, Object::null_object(), thread);
24812 bool with_type_argument)
const {
24816 if (with_type_argument) {
24819 dest.SetTypeArguments(Object::null_type_arguments());
24821 if (!UseCardMarkingForAllocation(
count)) {
24840 untag()->SetClassId(kImmutableArrayCid);
24845 return IsImmutable() ?
"_ImmutableList nullptr" :
"_List nullptr";
24854 intptr_t new_length,
24860 intptr_t old_length = 0;
24862 old_length =
source.Length();
24863 result.SetTypeArguments(
24866 result.SetTypeArguments(Object::null_type_arguments());
24868 ASSERT(new_length > old_length);
24869 if (!UseCardMarkingForAllocation(new_length)) {
24871 for (intptr_t
i = 0;
i < old_length;
i++) {
24872 result.untag()->set_element(
i,
source.untag()->element(
i), thread);
24874 for (intptr_t
i = old_length;
i < new_length;
i++) {
24878 for (intptr_t
i = 0;
i < old_length;
i++) {
24879 result.untag()->set_element(
i,
source.untag()->element(
i), thread);
24884 for (intptr_t
i = old_length;
i < new_length;
i++) {
24902 intptr_t old_len = array.
Length();
24903 ASSERT(new_len <= old_len);
24904 if (old_len == new_len) {
24920 uword old_tags = array.untag()->tags_;
24925 }
while (!array.untag()->tags_.compare_exchange_weak(
24926 old_tags, new_tags, std::memory_order_release));
24932 array.SetLengthRelease(new_len);
24940 intptr_t used_len = growable_array.
Length();
24944 if (used_len == 0) {
24945 if (type_arguments.
IsNull() && !unique) {
24948 return Object::empty_array().ptr();
24956 return array.
ptr();
24959 ASSERT(array.IsArray());
24964 growable_array.
SetData(Object::empty_array());
24968 return array.
ptr();
24977 for (intptr_t
i = 0;
i <
len;
i++) {
24980 this->SetAt(
i, obj);
24993 if (
Length() == Capacity()) {
24995 intptr_t new_capacity = (Capacity() * 2) | 3;
24996 if (new_capacity <= Capacity()) {
25000 Grow(new_capacity, space);
25003 intptr_t index =
Length();
25005 SetAt(index,
value);
25009 ASSERT(new_capacity > Capacity());
25011 const Array& new_contents =
25013 untag()->set_data(new_contents.
ptr());
25019 intptr_t index =
Length() - 1;
25022 contents.
SetAt(index, Object::null_object());
25029 ArrayPtr raw_data = (capacity == 0) ? Object::empty_array().ptr()
25049 return "_GrowableList: null";
25052 "Instance(length:%" Pd ") of '_GrowableList'",
Length());
25058 static const char*
Name() {
return "DefaultHashTraits"; }
25062 if (
a.IsNull() ||
b.IsNull()) {
25063 return (
a.IsNull() &&
b.IsNull());
25065 return Instance::Cast(
a).OperatorEquals(Instance::Cast(
b));
25076 Instance& hash_code = thread->InstanceHandle();
25077 hash_code ^= Instance::Cast(obj).
HashCode();
25078 if (hash_code.IsSmi()) {
25080 return static_cast<uword>(Smi::Cast(hash_code).AsTruncatedUint32Value());
25081 }
else if (hash_code.IsInteger()) {
25082 return static_cast<uword>(
25083 Integer::Cast(hash_code).AsTruncatedUint32Value());
25093 TypedData::New(kTypedDataUint32ArrayCid, kInitialIndexSize, space));
25096 const intptr_t kInitialHashMask =
25097 (1 << (kAvailableBits - kInitialIndexBits)) - 1;
25098 return Map::New(class_id,
data, index, kInitialHashMask, 0, 0, space);
25104 intptr_t hash_mask,
25105 intptr_t used_data,
25106 intptr_t deleted_keys,
25108 ASSERT(class_id == kMapCid || class_id == kConstMapCid);
25113 result.set_index(index);
25114 result.set_hash_mask(hash_mask);
25115 result.set_used_data(used_data);
25116 result.set_deleted_keys(deleted_keys);
25120MapPtr Map::NewUninitialized(intptr_t class_id,
Heap::Space space) {
25123 return Object::AllocateVariant<Map>(class_id, space);
25129 "%s len:%" Pd,
GetClassId() == kConstMapCid ?
"_ConstMap" :
"_Map",
25137 Zone*
const zone = thread->
zone();
25141 const intptr_t index_size_mult = IsMap() ? 1 : 2;
25143 data_length * index_size_mult);
25146 const intptr_t hash_mask = IndexSizeToHashMask(index_size);
25147 set_hash_mask(hash_mask);
25153 if (this->
ptr() == other.
ptr()) {
25188 return type_args.
Equals(other_type_args);
25205 hash = member.CanonicalizeHash();
25208 member = used_data();
25221 if (!type_args.
IsNull()) {
25227 data_array.MakeImmutable();
25228 data_array ^= data_array.CanonicalizeLocked(thread);
25229 set_data(data_array);
25244 return static_cast<ConstMapPtr
>(Map::NewUninitialized(
kClassId, space));
25250 intptr_t hash_mask,
25251 intptr_t used_data,
25252 intptr_t deleted_keys,
25254 ASSERT(class_id == kSetCid || class_id == kConstSetCid);
25259 result.set_index(index);
25260 result.set_hash_mask(hash_mask);
25261 result.set_used_data(used_data);
25262 result.set_deleted_keys(deleted_keys);
25269 TypedData::New(kTypedDataUint32ArrayCid, kInitialIndexSize, space));
25272 const intptr_t kInitialHashMask =
25273 (1 << (kAvailableBits - kInitialIndexBits)) - 1;
25274 return Set::New(class_id,
data, index, kInitialHashMask, 0, 0, space);
25277SetPtr Set::NewUninitialized(intptr_t class_id,
Heap::Space space) {
25280 return Object::AllocateVariant<Set>(class_id, space);
25292 return static_cast<ConstSetPtr
>(Set::NewUninitialized(
kClassId, space));
25298 "%s len:%" Pd,
GetClassId() == kConstSetCid ?
"_ConstSet" :
"_Set",
25357 return untag()->value_[0];
25361 return untag()->value_[1];
25365 return untag()->value_[2];
25369 return untag()->value_[3];
25373 return memcmp(&
untag()->value_, Float32x4::Cast(other).
untag()->value_,
25378 return HashBytes(
reinterpret_cast<const uint8_t*
>(&
untag()->value_),
25431 return untag()->value_[0];
25435 return untag()->value_[1];
25439 return untag()->value_[2];
25443 return untag()->value_[3];
25457 return memcmp(&
untag()->value_, Int32x4::Cast(other).
untag()->value_,
25462 return HashBytes(
reinterpret_cast<const uint8_t*
>(&
untag()->value_),
25493 return untag()->value_[0];
25497 return untag()->value_[1];
25517 return memcmp(&
untag()->value_, Float64x2::Cast(other).
untag()->value_,
25522 return HashBytes(
reinterpret_cast<const uint8_t*
>(&
untag()->value_),
25533 TypedDataBase::element_size_table[TypedDataBase::kNumElementSizes] = {
25551 if (this->
ptr() == other.
ptr()) {
25556 if (!other.IsTypedData() || other.
IsNull()) {
25560 const TypedData& other_typed_data = TypedData::Cast(other);
25562 if (this->ElementType() != other_typed_data.
ElementType()) {
25566 const intptr_t
len = this->LengthInBytes();
25571 return (
len == 0) ||
25572 (memcmp(DataAddr(0), other_typed_data.
DataAddr(0),
len) == 0);
25576 const intptr_t
len = this->LengthInBytes();
25581 for (intptr_t
i = 0;
i <
len;
i++) {
25591 FATAL(
"Fatal error in TypedData::New: invalid len %" Pd "\n",
len);
25593 auto raw = Object::AllocateVariant<TypedData>(
25594 class_id, space,
len * ElementSizeInBytes(class_id));
25597 raw->untag()->RecomputeDataField();
25605 const auto& new_td =
25611 return new_td.ptr();
25622 intptr_t external_size)
const {
25631 bool perform_eager_msan_initialization_check) {
25633 FATAL(
"Fatal error in ExternalTypedData::New: invalid len %" Pd "\n",
len);
25636 if (perform_eager_msan_initialization_check) {
25643 Object::AllocateVariant<ExternalTypedData>(class_id, space));
25654 data, [](
void* isolate_callback_data,
void*
data) { free(
data); },
len);
25659 return Object::AllocateVariant<TypedDataView>(class_id, space);
25664 intptr_t offset_in_bytes,
25668 result.InitializeWith(typed_data, offset_in_bytes,
length);
25673 if (IsExternalTypedData())
return true;
25674 if (IsTypedDataView()) {
25675 const auto& backing =
25677 return backing.IsExternalTypedData();
25692 if (IsTypedDataView()) {
25693 const auto& view = TypedDataView::Cast(*
this);
25695 const intptr_t view_offset =
Smi::Value(view.offset_in_bytes());
25699 }
else if (IsExternalTypedData()) {
25718 return cls.ScrubbedNameCString();
25723 return cls.ScrubbedNameCString();
25738 result.SetTypeArguments(type_args);
25739 result.SetNativeAddress(native_address);
25755 result.SetHandle(handle);
25756 result.SetCanBeClosed(canBeClosed);
25770 reinterpret_cast<uintptr_t
>(GetHandle()));
25780 return "Capability";
25784 const String& debug_name,
25791#if !defined(PRODUCT)
25798 result.untag()->set_send_port(send_port.
ptr());
25799 result.untag()->set_bitfield(
25801#if !defined(PRODUCT)
25802 result.untag()->set_debug_name(debug_name.
ptr());
25803 result.untag()->set_allocation_location(allocation_location_.
ptr());
25809 return "ReceivePort";
25822 result.StoreNonPointer(&
result.untag()->origin_id_, origin_id);
25851 ASSERT(finalizable_ref !=
nullptr);
25852 peer->set_handle(finalizable_ref);
25858 return "TransferableTypedData";
25862 if (!other.IsClosure())
return false;
25864 const Closure& other_closure = Closure::Cast(other);
25865 return (instantiator_type_arguments() ==
25867 (function_type_arguments() ==
25871 (RawContext() == other_closure.
RawContext());
25876 type_args = instantiator_type_arguments();
25877 if (!type_args.
IsNull()) {
25879 set_instantiator_type_arguments(type_args);
25881 type_args = function_type_arguments();
25882 if (!type_args.
IsNull()) {
25884 set_function_type_arguments(type_args);
25886 type_args = delayed_type_arguments();
25887 if (!type_args.
IsNull()) {
25889 set_delayed_type_arguments(type_args);
25896 auto const zone = thread->
zone();
25898 buffer.AddString(
"Closure: ");
25919 result =
static_cast<uint32_t
>(func.
Hash());
25928 const Integer& receiverHash =
25935 const Integer& identityHash =
25951 return Closure::New(instantiator_type_arguments, function_type_arguments,
25952 function.IsGeneric() ? Object::empty_type_arguments()
25953 : Object::null_type_arguments(),
25968 (
function.IsImplicitInstanceClosureFunction() && context.IsInstance()) ||
25969 (
function.IsNonImplicitClosureFunction() && context.IsContext()) ||
25972 result.untag()->set_instantiator_type_arguments(
25973 instantiator_type_arguments.
ptr());
25974 result.untag()->set_function_type_arguments(function_type_arguments.
ptr());
25975 result.untag()->set_delayed_type_arguments(delayed_type_arguments.
ptr());
25977 result.untag()->set_context(context.
ptr());
25978#if defined(DART_PRECOMPILED_RUNTIME)
25996 intptr_t num_free_params;
25999 fn_type_args = delayed_type_args.
Prepend(
26006 sig ^= sig.
InstantiateFrom(inst_type_args, fn_type_args, num_free_params,
26013 return untag()->skip_sync_start_in_parent_stack;
26022 return code_array.
Length();
26027 return code_array.
At(frame_index);
26039 return pc_offset_array.GetUintPtr(frame_index *
kWordSize);
26043 uword pc_offset)
const {
26046 pc_offset_array.SetUintPtr(frame_index *
kWordSize, pc_offset);
26050 untag()->set_async_link(async_link.
ptr());
26053void StackTrace::set_code_array(
const Array& code_array)
const {
26054 untag()->set_code_array(code_array.
ptr());
26057void StackTrace::set_pc_offset_array(
const TypedData& pc_offset_array)
const {
26058 untag()->set_pc_offset_array(pc_offset_array.ptr());
26065bool StackTrace::expand_inlined()
const {
26066 return untag()->expand_inlined_;
26073 result.set_code_array(code_array);
26074 result.set_pc_offset_array(pc_offset_array);
26075 result.set_expand_inlined(
true);
26083 bool skip_sync_start_in_parent_stack,
26086 result.set_async_link(async_link);
26087 result.set_code_array(code_array);
26088 result.set_pc_offset_array(pc_offset_array);
26089 result.set_expand_inlined(
true);
26090 result.set_skip_sync_start_in_parent_stack(skip_sync_start_in_parent_stack);
26094#if defined(DART_PRECOMPILED_RUNTIME)
26095static bool TryPrintNonSymbolicStackFrameBodyRelative(
26098 uword instructions,
26101 const Image image(
reinterpret_cast<const uint8_t*
>(instructions));
26102 if (!
image.contains(call_addr))
return false;
26103 if (unit !=
nullptr) {
26104 ASSERT(!unit->IsNull());
26107 buffer->Printf(
" unit %" Pd "", unit->id());
26109 auto const offset = call_addr - instructions;
26113 if (!vm &&
image.compiled_to_elf()) {
26114 const uword relocated_section_start =
26115 image.instructions_relocated_address();
26116 buffer->Printf(
" virt %" Pp "", relocated_section_start +
offset);
26125static void PrintNonSymbolicStackFrameBody(BaseTextBuffer*
buffer,
26127 uword isolate_instructions,
26128 uword vm_instructions,
26129 const Array& loading_units,
26130 LoadingUnit* unit) {
26131 if (TryPrintNonSymbolicStackFrameBodyRelative(
buffer, call_addr,
26137 if (!loading_units.IsNull()) {
26139 const intptr_t unit_count = loading_units.Length();
26141 *unit ^= loading_units.At(
i);
26142 if (!unit->has_instructions_image())
continue;
26143 auto const instructions =
26144 reinterpret_cast<uword>(unit->instructions_image());
26145 if (TryPrintNonSymbolicStackFrameBodyRelative(
buffer, call_addr,
26152 if (TryPrintNonSymbolicStackFrameBodyRelative(
buffer, call_addr,
26153 isolate_instructions,
26162 buffer->Printf(
" <invalid Dart instruction address>\n");
26167 intptr_t frame_index) {
26168 buffer->Printf(
"#%-6" Pd "", frame_index);
26174 intptr_t
line = -1,
26175 intptr_t column = -1) {
26180 buffer->Printf(
":%" Pd "", column);
26190 intptr_t frame_index,
26191 bool is_line =
false) {
26195 const char* url =
script.IsNull()
26201 if (strstr(url,
"data:application/dart;") == url) {
26202 url =
"<data:application/dart>";
26205 intptr_t
line = -1;
26206 intptr_t column = -1;
26209 if (token_pos_or_line.
IsReal()) {
26210 line = token_pos_or_line.
Pos();
26214 script.GetTokenLocation(token_pos_or_line, &
line, &column);
26225 if (
function.IsImplicitClosureFunction()) {
26233#if defined(DART_PRECOMPILED_RUNTIME)
26234static void WriteImageBuildId(BaseTextBuffer*
buffer,
26236 uword image_address) {
26238 if (build_id.data !=
nullptr) {
26239 ASSERT(build_id.len > 0);
26242 for (intptr_t
i = 0;
i < build_id.len;
i++) {
26243 buffer->Printf(
"%2.2x", build_id.data[
i]);
26249void WriteStackTraceHeaderLoadingUnitEntry(BaseTextBuffer*
buffer,
26252 uword instructions) {
26253 buffer->Printf(
"loading_unit: %" Pd "",
id);
26254 WriteImageBuildId(
buffer,
", build_id: ", instructions);
26255 buffer->Printf(
", dso_base: %" Px ", instructions: %" Px "\n", dso_base,
26262 auto const zone =
T->zone();
26269#if defined(DART_PRECOMPILED_RUNTIME)
26270 const Array& loading_units =
26271 Array::Handle(
T->isolate_group()->object_store()->loading_units());
26276 NoSafepointScope no_allocation;
26277 GrowableArray<const Function*> inlined_functions;
26278 GrowableArray<TokenPosition> inlined_token_positions;
26280#if defined(DART_PRECOMPILED_RUNTIME)
26281 GrowableArray<void*> addresses(10);
26282 const bool have_footnote_callback =
26283 FLAG_dwarf_stack_traces_mode &&
26287 ZoneTextBuffer
buffer(zone, 1024);
26289#if defined(DART_PRECOMPILED_RUNTIME)
26290 auto const isolate_instructions =
reinterpret_cast<uword>(
26291 T->isolate_group()->source()->snapshot_instructions);
26293 if (!loading_units.IsNull()) {
26295 ASSERT(!unit->IsNull());
26296 ASSERT(unit->has_instructions_image());
26297 ASSERT(
reinterpret_cast<uword>(unit->instructions_image()) ==
26298 isolate_instructions);
26301 auto const vm_instructions =
reinterpret_cast<uword>(
26303 if (FLAG_dwarf_stack_traces_mode) {
26307 "*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n");
26311#if defined(DART_COMPRESSED_POINTERS)
26312 const char kCompressedPointers[] =
"yes";
26314 const char kCompressedPointers[] =
"no";
26316#if defined(USING_SIMULATOR)
26317 const char kUsingSimulator[] =
"yes";
26319 const char kUsingSimulator[] =
"no";
26321 buffer.Printf(
"os: %s arch: %s comp: %s sim: %s\n",
26322 kHostOperatingSystemName, kTargetArchitectureName,
26323 kCompressedPointers, kUsingSimulator);
26324 WriteImageBuildId(&
buffer,
"build_id: ", isolate_instructions);
26326 if (!loading_units.IsNull()) {
26327 const intptr_t unit_count = loading_units.Length();
26329 *unit ^= loading_units.At(
i);
26330 if (!unit->has_instructions_image())
continue;
26331 const uword instructions =
26332 reinterpret_cast<uword>(unit->instructions_image());
26334 WriteStackTraceHeaderLoadingUnitEntry(&
buffer,
i, dso_base,
26341 buffer.Printf(
"isolate_dso_base: %" Px "", isolate_dso_base);
26343 buffer.Printf(
", vm_dso_base: %" Px "\n", vm_dso_base);
26344 buffer.Printf(
"isolate_instructions: %" Px "", isolate_instructions);
26345 buffer.Printf(
", vm_instructions: %" Px "\n", vm_instructions);
26351 intptr_t frame_index = 0;
26352 uint32_t frame_skip = 0;
26354 bool in_gap =
false;
26356 for (intptr_t
i = frame_skip;
i < stack_trace.Length();
i++) {
26357 code_object = stack_trace.CodeAtFrame(
i);
26358 if (code_object.IsNull()) {
26361 if ((
i < (stack_trace.Length() - 1)) &&
26362 (stack_trace.CodeAtFrame(
i + 1) !=
Code::null())) {
26363 buffer.AddString(
"...\n...\n");
26365 frame_index += stack_trace.PcOffsetAtFrame(
i);
26370 if (code_object.ptr() == StubCode::AsynchronousGapMarker().ptr()) {
26372 buffer.AddString(
"<asynchronous suspension>\n");
26378 const uword pc_offset = stack_trace.PcOffsetAtFrame(
i);
26379 ASSERT(code_object.IsCode());
26380 code ^= code_object.ptr();
26382 owner =
code.owner();
26383 if (owner.IsFunction()) {
26388 const uword pc =
code.PayloadStart() + pc_offset;
26390 const bool is_future_listener =
26396#if defined(DART_PRECOMPILED_RUNTIME)
26406 const uword call_addr = pc - 1;
26408 if (FLAG_dwarf_stack_traces_mode) {
26409 if (have_footnote_callback) {
26410 addresses.Add(
reinterpret_cast<void*
>(call_addr));
26415 buffer.Printf(
" #%02" Pd " abs %" Pp "", frame_index, call_addr);
26416 PrintNonSymbolicStackFrameBody(&
buffer, call_addr, isolate_instructions,
26417 vm_instructions, loading_units, unit);
26428 PrintNonSymbolicStackFrameBody(&
buffer, call_addr, isolate_instructions,
26429 vm_instructions, loading_units, unit);
26435 if (
code.is_optimized() && stack_trace.expand_inlined() &&
26436 (FLAG_precompiled_mode || !is_future_listener)) {
26440 code.GetInlinedFunctionsAtReturnAddress(
26441 is_future_listener ? 0 : pc_offset, &inlined_functions,
26442 &inlined_token_positions);
26443 ASSERT(inlined_functions.length() >= 1);
26444 for (intptr_t j = inlined_functions.length() - 1; j >= 0; j--) {
26445 function = inlined_functions[j]->ptr();
26446 auto const pos = inlined_token_positions[j];
26447 if (is_future_listener &&
function.IsImplicitClosureFunction()) {
26450 if (FLAG_show_invisible_frames ||
function.is_visible()) {
26452 FLAG_precompiled_mode);
26459 if (FLAG_show_invisible_frames ||
function.is_visible() ||
26461 auto const pos = is_future_listener ?
function.token_pos()
26462 :
code.GetTokenIndexOfPC(pc);
26469 frame_skip = stack_trace.skip_sync_start_in_parent_stack()
26472 stack_trace = stack_trace.async_link();
26473 }
while (!stack_trace.IsNull());
26475#if defined(DART_PRECOMPILED_RUNTIME)
26476 if (have_footnote_callback) {
26478 &addresses[0], addresses.length());
26479 if (footnote !=
nullptr) {
26480 buffer.AddString(footnote);
26490 FLAG_dwarf_stack_traces_mode =
value;
26492#if defined(PRODUCT)
26497 FLAG_retain_function_objects =
false;
26498 FLAG_retain_code_objects =
false;
26504 dwarf_stack_traces,
26505 "Omit CodeSourceMaps in precompiled snapshots and don't "
26506 "symbolize stack traces in the precompiled runtime.");
26511 ASSERT(frame_size >= 0);
26513#if !defined(DART_PRECOMPILED_RUNTIME)
26516 const intptr_t frame_capacity =
26519 ASSERT(frame_size <= frame_capacity);
26521 auto raw = Object::Allocate<SuspendState>(space, num_elements);
26524#if !defined(DART_PRECOMPILED_RUNTIME)
26525 raw->untag()->frame_capacity_ = frame_capacity;
26527 raw->untag()->frame_size_ = frame_size;
26528 raw->untag()->set_function_data(function_data.
ptr());
26537 const intptr_t frame_size =
src.frame_size();
26546 memmove(
dst.payload(),
src.payload(), frame_size);
26548 const uword fp =
reinterpret_cast<uword>(
dst.payload() + frame_size);
26551 kSuspendStateVarIndex))) =
dst.ptr();
26554 if (
dst.ptr()->IsOldObject()) {
26555 dst.untag()->EnsureInRememberedSet(thread);
26564#if !defined(DART_PRECOMPILED_RUNTIME)
26565void SuspendState::set_frame_capacity(intptr_t frame_capcity)
const {
26566 ASSERT(frame_capcity >= 0);
26571void SuspendState::set_frame_size(intptr_t frame_size)
const {
26572 ASSERT(frame_size >= 0);
26576void SuspendState::set_pc(
uword pc)
const {
26580void SuspendState::set_function_data(
const Instance& function_data)
const {
26581 untag()->set_function_data(function_data.ptr());
26584void SuspendState::set_then_callback(
const Closure& then_callback)
const {
26585 untag()->set_then_callback(then_callback.ptr());
26588void SuspendState::set_error_callback(
const Closure& error_callback)
const {
26589 untag()->set_error_callback(error_callback.ptr());
26593 return "SuspendState";
26598#if defined(DART_PRECOMPILED_RUNTIME)
26613 untag()->set_pattern(pattern.
ptr());
26621 case kOneByteStringCid:
26622 return untag()->set_one_byte_sticky(
value.ptr());
26623 case kTwoByteStringCid:
26624 return untag()->set_two_byte_sticky(
value.ptr());
26628 case kOneByteStringCid:
26630 case kTwoByteStringCid:
26641 untag()->set_one_byte_sticky<std::memory_order_release>(bytecode.
ptr());
26643 untag()->set_two_byte_sticky<std::memory_order_release>(bytecode.
ptr());
26647 untag()->set_one_byte<std::memory_order_release>(bytecode.
ptr());
26649 untag()->set_two_byte<std::memory_order_release>(bytecode.
ptr());
26659 untag()->set_capture_name_map(array.
ptr());
26666 result.set_num_bracket_expressions(-1);
26667 result.set_num_registers(
false, -1);
26668 result.set_num_registers(
true, -1);
26670 if (!FLAG_interpret_irregexp) {
26673 const Class& owner =
26676 for (intptr_t
cid = kOneByteStringCid;
cid <= kTwoByteStringCid;
cid++) {
26687 switch (value_ & ~kGlobal) {
26688 case kIgnoreCase | kMultiLine | kDotAll | kUnicode:
26690 case kIgnoreCase | kMultiLine | kDotAll:
26692 case kIgnoreCase | kMultiLine | kUnicode:
26694 case kIgnoreCase | kUnicode | kDotAll:
26696 case kMultiLine | kDotAll | kUnicode:
26698 case kIgnoreCase | kMultiLine:
26700 case kIgnoreCase | kDotAll:
26702 case kIgnoreCase | kUnicode:
26704 case kMultiLine | kDotAll:
26706 case kMultiLine | kUnicode:
26708 case kDotAll | kUnicode:
26725 if (this->
ptr() == other.
ptr()) {
26728 if (other.
IsNull() || !other.IsRegExp()) {
26731 const RegExp& other_js = RegExp::Cast(other);
26735 if (!str1.
Equals(str2)) {
26759 return Object::Allocate<WeakProperty>(space);
26763 return "_WeakProperty";
26769 return Object::Allocate<WeakReference>(space);
26779 return "FinalizerBase";
26788 return Object::Allocate<Finalizer>(space);
26804 return Object::Allocate<NativeFinalizer>(space);
26812 const char* trace_context)
const {
26814 Zone*
const zone = thread->
zone();
26820 callback_pointer.NativeAddress());
26821 if (token_object.IsFinalizerEntry()) {
26823 ASSERT(token_object.ptr() == entry.
ptr());
26824 ASSERT(external_size == 0);
26825 if (FLAG_trace_finalizers) {
26827 "%s: Not running native finalizer %p callback %p, "
26832 const auto& token = Pointer::Cast(token_object);
26833 void* peer =
reinterpret_cast<void*
>(token.NativeAddress());
26834 if (FLAG_trace_finalizers) {
26836 "%s: Running native finalizer %p callback %p "
26842 if (external_size > 0) {
26846 if (FLAG_trace_finalizers) {
26847 THR_Print(
"%s: Clearing external size %" Pd " bytes in %s space\n",
26848 trace_context, external_size, space == 0 ?
"new" :
"old");
26850 group->heap()->FreedExternal(external_size, space);
26859 pointer.ToCString());
26866 const auto& entry =
26869 entry.set_finalizer(finalizer);
26870 return entry.
ptr();
26878 return "FinalizerEntry";
26920 result.set_referent(referent);
26925 return "_MirrorReference";
26930 ASSERT(isolate !=
nullptr);
26934#if !defined(PRODUCT)
26939 event.set_previous_tag(
name.ToCString());
26941 event.set_updated_tag(
name.ToCString());
26959 if (TagTableIsFull(thread)) {
26967 result = Object::Allocate<UserTag>(space);
26968 result.set_label(label);
26970 AddTagToIsolate(thread,
result);
26978 ASSERT(isolate !=
nullptr);
27002 for (intptr_t
i = 0;
i < tag_table.
Length();
i++) {
27003 other ^= tag_table.
At(
i);
27005 tag_label = other.
label();
27007 if (tag_label.
Equals(label)) {
27008 return other.
ptr();
27016 return FindTagInIsolate(isolate, thread, label);
27019void UserTag::AddTagToIsolate(
Thread* thread,
const UserTag& tag) {
27020 Isolate* isolate = thread->isolate();
27021 Zone* zone = thread->zone();
27023 const GrowableObjectArray& tag_table =
27025 ASSERT(!TagTableIsFull(thread));
27029 for (intptr_t
i = 0;
i < tag_table.Length();
i++) {
27030 other ^= tag_table.At(
i);
27031 ASSERT(!other.IsNull());
27032 ASSERT(tag.tag() != other.tag());
27040 tag.set_tag(tag_id);
27041 tag_table.Add(tag);
27054 ASSERT(isolate !=
nullptr);
27061 for (intptr_t
i = 0;
i < tag_table.
Length();
i++) {
27062 tag ^= tag_table.
At(
i);
27063 if (tag.
tag() == tag_id) {
27099 OS::PrintErr(
"canonical type parameters (cloned from declarations):\n");
27115 const Array& metadata,
27116 Field* reusable_field_handle,
27118 for (intptr_t
i = 0;
i < metadata.
Length();
i++) {
27119 *pragma = metadata.
At(
i);
27120 if (pragma->
clazz() !=
IG->object_store()->pragma_class()) {
27123 *reusable_field_handle =
IG->object_store()->pragma_name();
27124 const auto pragma_name =
27125 Instance::Cast(*pragma).GetField(*reusable_field_handle);
27126 if ((pragma_name != Symbols::vm_entry_point().
ptr()) &&
27127 (pragma_name != Symbols::dyn_module_callable().
ptr()) &&
27128 (pragma_name != Symbols::dyn_module_extendable().
ptr())) {
27131 *reusable_field_handle =
IG->object_store()->pragma_options();
27132 *pragma = Instance::Cast(*pragma).GetField(*reusable_field_handle);
27155 std::initializer_list<EntryPointPragma> allowed_kinds) {
27156#if defined(DART_PRECOMPILED_RUNTIME)
27160 bool is_marked_entrypoint =
true;
27162 is_marked_entrypoint =
false;
27164 is_marked_entrypoint =
false;
27166 !Function::Cast(
annotated).has_pragma()) {
27167 is_marked_entrypoint =
false;
27180 if (!is_marked_entrypoint) {
27181 for (
const auto allowed_kind : allowed_kinds) {
27182 if (pragma == allowed_kind) {
27183 is_marked_entrypoint =
true;
27189 if (!is_marked_entrypoint) {
27197 if (!FLAG_verify_entry_points)
return Error::null();
27201 "ERROR: Entry-points do not allow invoking fields "
27202 "(failure to resolve '%s')\n"
27204 "https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/"
27205 "aot/entry_point_pragma.md\n",
27213 const char* member_cstring =
27214 member.IsFunction()
27217 Function::Cast(member).ToLibNamePrefixedQualifiedCString(),
27220 if (!FLAG_verify_entry_points) {
27224 "WARNING: '%s' is accessed through Dart C API without being marked as "
27225 "an entry point; its tree-shaken signature cannot be verified.\n"
27227 "https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/"
27228 "aot/entry_point_pragma.md\n",
27235 "ERROR: It is illegal to access '%s' through Dart C API.\n"
27237 "https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/"
27238 "aot/entry_point_pragma.md\n",
27244#if !defined(DART_PRECOMPILED_RUNTIME)
27249#if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64) || \
27250 defined(TARGET_ARCH_ARM)
27251 if (!FLAG_precompiled_mode) {
27255 if (!FLAG_use_register_cc) {
27264 case UntaggedFunction::kClosureFunction:
27265 case UntaggedFunction::kImplicitClosureFunction:
27266 case UntaggedFunction::kNoSuchMethodDispatcher:
27267 case UntaggedFunction::kInvokeFieldDispatcher:
27268 case UntaggedFunction::kDynamicInvocationForwarder:
27269 case UntaggedFunction::kMethodExtractor:
27270 case UntaggedFunction::kFfiTrampoline:
27271 case UntaggedFunction::kFieldInitializer:
27272 case UntaggedFunction::kIrregexpFunction:
27280 if (unboxing_metadata !=
nullptr &&
27281 unboxing_metadata->must_use_stack_calling_convention) {
27287 case UntaggedFunction::kGetterFunction:
27288 case UntaggedFunction::kImplicitGetter:
27289 case UntaggedFunction::kSetterFunction:
27290 case UntaggedFunction::kImplicitSetter:
27291 return num_fixed_parameters();
27297 if (unboxing_metadata !=
nullptr &&
27298 unboxing_metadata->has_overrides_with_less_direct_parameters) {
27301 return unboxing_metadata->unboxed_args_info.length() + 1;
27304 return num_fixed_parameters();
27311 if (!FLAG_verify_entry_points)
return Error::null();
27316 case UntaggedFunction::kRegularFunction:
27317 case UntaggedFunction::kSetterFunction:
27318 case UntaggedFunction::kConstructor:
27322 case UntaggedFunction::kGetterFunction:
27327 case UntaggedFunction::kImplicitGetter:
27331 case UntaggedFunction::kImplicitSetter:
27334 case UntaggedFunction::kMethodExtractor:
27336 .VerifyClosurizedEntryPoint();
27345 if (!FLAG_verify_entry_points)
return Error::null();
27350 case UntaggedFunction::kRegularFunction:
27353 case UntaggedFunction::kImplicitClosureFunction: {
27364 if (!FLAG_verify_entry_points)
return Error::null();
27371 if (!FLAG_verify_entry_points)
return Error::null();
27392void RecordType::set_field_types(
const Array&
value)
const {
27397void RecordType::set_shape(RecordShape shape)
const {
27398 untag()->set_shape(shape.AsSmi());
27402 return shape().GetFieldNames(thread);
27415 const intptr_t num_fields = NumFields();
27417 const intptr_t num_positional_fields = num_fields - field_names.
Length();
27419 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27423 if (
i == num_positional_fields) {
27426 type = FieldTypeAt(
i);
27427 type.PrintName(name_visibility, printer);
27428 if (
i >= num_positional_fields) {
27430 name ^= field_names.
At(
i - num_positional_fields);
27434 if (num_positional_fields < num_fields) {
27438 printer->
AddString(NullabilitySuffix(name_visibility));
27445 return printer.buffer();
27449 intptr_t num_free_fun_type_params)
const {
27451 const intptr_t num_fields = NumFields();
27452 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27453 type = FieldTypeAt(
i);
27454 if (!
type.IsInstantiated(genericity, num_free_fun_type_params)) {
27462 return Object::Allocate<RecordType>(space);
27466 const Array& field_types,
27471 result.set_shape(shape);
27472 result.set_field_types(field_types);
27475 result.set_nullability(nullability);
27477 result.InitializeTypeTestingStubNonAtomic(
27484 if (nullability() ==
value) {
27495 if (IsFinalized()) {
27496 type.SetIsFinalized();
27501 return RecordType::Cast(
type).ptr();
27509 if (
ptr() == other.
ptr()) {
27512 if (!other.IsRecordType()) {
27515 const RecordType& other_type = RecordType::Cast(other);
27518 if (shape() != other_type.
shape()) {
27523 if (!IsNullabilityEquivalent(thread, other_type, kind)) {
27529 const intptr_t num_fields = NumFields();
27530 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27531 field_type = FieldTypeAt(
i);
27534 function_type_equivalence)) {
27547 const intptr_t num_fields = NumFields();
27548 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27549 type = FieldTypeAt(
i);
27565 const intptr_t num_fields = NumFields();
27566 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27567 type = FieldTypeAt(
i);
27575 ObjectStore* object_store = isolate_group->object_store();
27581 ASSERT(object_store->canonical_record_types() ==
table.Release().ptr());
27585 const intptr_t num_fields = NumFields();
27586 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27587 type = FieldTypeAt(
i);
27588 if (!
type.IsCanonical()) {
27590 SetFieldTypeAt(
i,
type);
27600 if (this->
IsNew()) {
27607 bool present =
table.Insert(rec);
27610 object_store->set_canonical_record_types(
table.Release());
27617 const intptr_t num_fields = NumFields();
27618 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27619 type = FieldTypeAt(
i);
27620 type.EnumerateURIs(uris);
27626 RecordType::Cast(*this).Print(name_visibility, printer);
27632 intptr_t num_free_fun_type_params,
27635 intptr_t num_parent_type_args_adjustment)
const {
27639 const intptr_t num_fields = NumFields();
27641 const Array& new_field_types =
27644 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27645 type ^= old_field_types.
At(
i);
27646 if (!
type.IsInstantiated()) {
27648 instantiator_type_arguments, function_type_arguments,
27649 num_free_fun_type_params, space, function_type_mapping,
27650 num_parent_type_args_adjustment);
27653 if (
type.IsNull()) {
27661 zone,
RecordType::New(shape(), new_field_types, nullability(), space));
27663 rec.SetIsFinalized();
27670 intptr_t num_parent_type_args_adjustment,
27671 intptr_t num_free_fun_type_params,
27675 ASSERT(num_parent_type_args_adjustment >= 0);
27678 Array* updated_types =
nullptr;
27681 for (intptr_t
i = 0, n = NumFields();
i < n; ++
i) {
27682 type ^= types.At(
i);
27683 updated =
type.UpdateFunctionTypes(num_parent_type_args_adjustment,
27684 num_free_fun_type_params, space,
27685 function_type_mapping);
27686 if (
type.ptr() != updated.ptr()) {
27687 if (updated_types ==
nullptr) {
27689 for (intptr_t j = 0; j <
i; ++j) {
27690 type ^= types.At(j);
27695 if (updated_types !=
nullptr) {
27696 updated_types->
SetAt(
i, updated);
27699 if (updated_types ==
nullptr) {
27703 zone,
RecordType::New(shape(), *updated_types, nullability(), space));
27704 new_rt.SetIsFinalized();
27705 return new_rt.ptr();
27712 if (
ptr() == other.
ptr()) {
27717 const intptr_t num_fields = NumFields();
27718 if (shape() != other.
shape()) {
27727 Zone*
const zone = thread->
zone();
27730 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27731 field_type = FieldTypeAt(
i);
27733 if (!field_type.
IsSubtypeOf(other_field_type, space,
27734 function_type_equivalence)) {
27742 const intptr_t num_fields = shape.
num_fields();
27743 ASSERT(num_fields >= 0);
27744 auto raw = Object::Allocate<Record>(space, num_fields);
27746 raw->untag()->set_shape(shape.
AsSmi());
27752 return "Record: null";
27755 Zone* zone = thread->zone();
27756 ZoneTextBuffer printer(zone);
27757 const intptr_t num_fields = this->num_fields();
27758 const Array& field_names =
Array::Handle(zone, GetFieldNames(thread));
27759 const intptr_t num_positional_fields = num_fields - field_names.Length();
27761 printer.AddString(
"Record (");
27762 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27764 printer.AddString(
", ");
27766 if (
i >= num_positional_fields) {
27767 obj = field_names.At(
i - num_positional_fields);
27768 printer.AddString(obj.ToCString());
27769 printer.AddString(
": ");
27772 printer.AddString(obj.ToCString());
27774 printer.AddString(
")");
27775 return printer.buffer();
27779 if (this->
ptr() == other.
ptr()) {
27783 if (!other.IsRecord() || other.
IsNull()) {
27787 const Record& other_rec = Record::Cast(other);
27788 if (shape() != other_rec.
shape()) {
27792 const intptr_t num_fields = this->num_fields();
27793 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27794 if (this->FieldAt(
i) != other_rec.
FieldAt(
i)) {
27807 hash = shape().AsInt();
27809 const intptr_t num_fields = this->num_fields();
27810 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27811 element ^= FieldAt(
i);
27822 const intptr_t num_fields = this->num_fields();
27823 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27826 SetFieldAt(
i, obj);
27832 const intptr_t num_fields = this->num_fields();
27833 const Array& field_types =
27837 for (intptr_t
i = 0;
i < num_fields; ++
i) {
27844 return RecordType::Cast(
type).ptr();
27848 const String& field_name) {
27850 field_name.
CharAt(0) ==
'$') {
27852 const char* cstr = field_name.
ToCString();
27855 return static_cast<intptr_t
>(
value - 1);
27863 const String& field_name)
const {
27865 const intptr_t field_index =
27868 const intptr_t num_positional_fields = num_fields() - field_names.
Length();
27869 if ((field_index >= 0) && (field_index < num_positional_fields)) {
27870 return field_index;
27872 for (intptr_t
i = 0, n = field_names.
Length();
i < n; ++
i) {
27873 if (field_names.
At(
i) == field_name.
ptr()) {
27874 return num_positional_fields +
i;
27883 static const char*
Name() {
return "RecordFieldNamesMapTraits"; }
27887 return Array::Cast(
a).CanonicalizeEquals(Array::Cast(
b));
27891 return Array::Cast(
key).CanonicalizeHash();
27899 intptr_t num_fields,
27900 const Array& field_names) {
27903 ASSERT(field_names.
ptr() == Object::empty_array().ptr() ||
27904 field_names.
Length() > 0);
27910 if (object_store->record_field_names<std::memory_order_acquire>() ==
27914 if (object_store->record_field_names() ==
Array::null()) {
27917 HashTables::New<RecordFieldNamesMap>(16,
Heap::kOld));
27918 map.InsertOrGetValue(Object::empty_array(),
27921 object_store->set_record_field_names_map(
map.Release());
27923 table.SetAt(0, Object::empty_array());
27924 object_store->set_record_field_names<std::memory_order_release>(
table);
27928#if defined(DART_PRECOMPILER)
27930 const intptr_t kMaxFieldNamesIndex =
27937 if (num_fields > kMaxNumFields) {
27938 FATAL(
"Too many record fields");
27940 if (field_names.
ptr() == Object::empty_array().ptr()) {
27948 index ^=
map.GetOrNull(field_names);
27949 ASSERT(
map.Release().ptr() == object_store->record_field_names_map());
27957 const intptr_t new_index =
map.NumOccupied();
27958 if (new_index > kMaxFieldNamesIndex) {
27959 FATAL(
"Too many record shapes");
27966 if (index == new_index) {
27967 ASSERT(
map.NumOccupied() == (new_index + 1));
27969 intptr_t capacity =
table.Length();
27970 if (index >=
table.Length()) {
27971 capacity = capacity + (capacity >> 2);
27973 object_store->set_record_field_names(
table);
27975 table.SetAt(index, field_names);
27977 ASSERT(index < new_index);
27979 object_store->set_record_field_names_map(
map.Release());
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static struct Initializer initializer
static float next(float f)
static void Union(SkRegion *rgn, const SkIRect &rect)
static constexpr size_t kHeaderSize
SkIDChangeListener::List List
static void operation(T operation, uint32_t &a, uint32_t b, uint32_t c, uint32_t d, uint32_t x, uint8_t s, uint32_t t)
static void encode(uint8_t output[16], const uint32_t input[4])
static uint32_t hash(const SkShaderBase::GradientInfo &v)
bool equals(SkDrawable *a, SkDrawable *b)
static const size_t kBufferSize
static bool is_valid(SkISize dim)
#define DEBUG_ASSERT(cond)
#define ASSERT_EQUAL(expected, actual)
#define RELEASE_ASSERT(cond)
#define ASSERT_NOTNULL(ptr)
#define CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY_NOR_MAP(V)
#define CLASS_LIST_MAPS(V)
#define CLASS_LIST_STRINGS(V)
#define CLASS_LIST_SETS(V)
#define CLASS_LIST_FIXED_LENGTH_ARRAYS(V)
#define CLASS_LIST_FFI_TYPE_MARKER(V)
#define CLASS_LIST_TYPED_DATA(V)
#define DART_CLASS_LIST_TYPED_DATA(V)
bool IsSubtypeOf(const AbstractType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr) const
bool IsNonNullable() const
void SetTypeTestingStub(const Code &stub) const
UntaggedAbstractType::TypeState type_state() const
virtual AbstractTypePtr UpdateFunctionTypes(intptr_t num_parent_type_args_adjustment, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping) const
virtual classid_t type_class_id() const
virtual const char * NullabilitySuffix(NameVisibility name_visibility) const
bool IsDartFunctionType() const
bool IsTopTypeForSubtyping() const
StringPtr UserVisibleName() const
bool IsStringType() const
bool IsNullabilityEquivalent(Thread *thread, const AbstractType &other_type, TypeEquality kind) const
virtual AbstractTypePtr Canonicalize(Thread *thread) const
bool IsIntegerImplementationType() const
void set_flags(uint32_t value) const
virtual bool HasTypeClass() const
virtual AbstractTypePtr SetInstantiatedNullability(const TypeParameter &type_param, Heap::Space space) const
void SetHash(intptr_t value) const
virtual bool IsEquivalent(const Instance &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
virtual TypeArgumentsPtr arguments() const
bool IsDartRecordType() const
virtual AbstractTypePtr InstantiateFrom(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping=nullptr, intptr_t num_parent_type_args_adjustment=0) const
const char * ScrubbedNameCString() const
Nullability nullability() const
virtual bool Equals(const Instance &other) const
bool IsFfiPointerType() const
bool IsInt32x4Type() const
bool IsObjectType() const
virtual void PrintName(NameVisibility visibility, BaseTextBuffer *printer) const
virtual AbstractTypePtr NormalizeFutureOrType(Heap::Space space) const
static void AddURI(URIs *uris, const String &name, const String &uri)
bool IsTopTypeForInstanceOf() const
static StringPtr PrintURIs(URIs *uris)
bool IsFloat64x2Type() const
bool IsFutureOrType() const
virtual bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
StringPtr ScrubbedName() const
static bool InstantiateAndTestSubtype(AbstractType *subtype, AbstractType *supertype, const TypeArguments &instantiator_type_args, const TypeArguments &function_type_args)
bool IsDartClosureType() const
virtual ClassPtr type_class() const
bool IsTypeClassAllowedBySpawnUri() const
const char * NameCString() const
StringPtr ClassName() const
bool IsDynamicType() const
void SetIsFinalized() const
bool IsSentinelType() const
bool IsDoubleType() const
const char * UserVisibleNameCString() const
bool IsStrictlyNonNullable() const
AbstractTypePtr UnwrapFutureOr() const
virtual uword ComputeHash() const
virtual void EnumerateURIs(URIs *uris) const
void set_nullability(Nullability value) const
bool IsFloat32x4Type() const
void InitializeTypeTestingStubNonAtomic(const Code &stub) const
void set_type_state(UntaggedAbstractType::TypeState value) const
StringPtr message() const
virtual const char * ToErrorCString() const
intptr_t PositionalCount() const
intptr_t NamedCount() const
void PrintTo(BaseTextBuffer *buffer, bool show_named_positions=false) const
intptr_t SizeWithTypeArgs() const
static ArrayPtr NewBoxed(intptr_t type_args_len, intptr_t num_arguments, const Array &optional_arguments_names, Heap::Space space=Heap::kOld)
intptr_t CountWithTypeArgs() const
intptr_t FirstArgIndex() const
intptr_t TypeArgsLen() const
intptr_t PositionAt(intptr_t i) const
StringPtr NameAt(intptr_t i) const
std::tuple_element< kElement, TupleT >::type::ObjectPtrType Get() const
static intptr_t type_arguments_offset()
static intptr_t InstanceSize()
ArrayPtr Slice(intptr_t start, intptr_t count, bool with_type_argument) const
static bool Equals(ArrayPtr a, ArrayPtr b)
virtual uint32_t CanonicalizeHash() const
ObjectPtr AtAcquire(intptr_t index) const
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
void Truncate(intptr_t new_length) const
static constexpr intptr_t kBytesPerElement
virtual bool CanonicalizeEquals(const Instance &other) const
void MakeImmutable() const
virtual void SetTypeArguments(const TypeArguments &value) const
static intptr_t LengthOf(const ArrayPtr array)
ObjectPtr At(intptr_t index) const
static ArrayPtr NewUninitialized(intptr_t len, Heap::Space space=Heap::kNew)
static ArrayPtr MakeFixedLength(const GrowableObjectArray &growable_array, bool unique=false)
static intptr_t data_offset()
void SetAt(intptr_t index, const Object &value) const
static intptr_t length_offset()
static ArrayPtr Grow(const Array &source, intptr_t new_length, Heap::Space space=Heap::kNew)
virtual void CanonicalizeFieldsLocked(Thread *thread) const
const T & At(intptr_t index) const
void SetLength(intptr_t new_length)
void Sort(int compare(const T *, const T *))
void SetAt(intptr_t index, const T &t)
const T & At(intptr_t index) const
void AddString(const char *s)
intptr_t Printf(const char *format,...) PRINTF_ATTRIBUTE(2
static constexpr int bitsize()
static constexpr ClassIdTagType decode(uword value)
static constexpr S update(T value, S original)
static constexpr intptr_t encode(bool value)
static constexpr bool is_valid(T value)
bool Contains(intptr_t i) const
static intptr_t InstanceSize()
static const Bool & Get(bool value)
static const Bool & True()
static ErrorPtr DoBootstrapping(const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
static constexpr bool ContainsCompressedPointers()
virtual void ReportSwitchingCode(const Code &code)
virtual void UpdateArrayTo(const WeakArray &value)
virtual void ReportDeoptimization(const Code &code)
CHACodeArray(const Class &cls)
static void FlushICache(uword start, uword size)
StringPtr target_name() const
ArrayPtr arguments_descriptor() const
static CapabilityPtr New(uint64_t id, Heap::Space space=Heap::kNew)
static int32_t ToLower(int32_t code_point)
static int32_t ToUpper(int32_t code_point)
static AbstractTypePtr FinalizeType(const AbstractType &type, FinalizationKind finalization=kCanonicalize)
static void VerifyBootstrapClasses()
static ErrorPtr AllocateFinalizeClass(const Class &cls)
static ErrorPtr LoadClassMembers(const Class &cls)
static bool IsMatch(const FunctionName &name, const Object &obj)
static bool ReportStats()
static uword Hash(const FunctionName &name)
static bool IsMatch(const Object &a, const Object &b)
static uword Hash(const Object &key)
static const char * Name()
void Register(const Class &cls)
void CopySizesFromClassObjects()
ClassPtr At(intptr_t cid) const
bool ShouldTraceAllocationFor(intptr_t cid)
UnboxedFieldBitmap GetUnboxedFieldsMapAt(intptr_t cid) const
static bool IsTopLevelCid(intptr_t cid)
void AddFields(const GrowableArray< const Field * > &fields) const
TypeArgumentsPtr DefaultTypeArguments(Zone *zone) const
void AddFunction(const Function &function) const
void set_is_implemented_unsafe() const
void set_num_type_arguments(intptr_t value) const
void set_is_transformed_mixin_application() const
void set_is_implemented() const
FieldPtr LookupInstanceField(const String &name) const
void set_has_pragma(bool value) const
const char * NameCString(NameVisibility name_visibility) const
void set_is_finalized_unsafe() const
intptr_t FindImplicitClosureFunctionIndex(const Function &needle) const
intptr_t NumTypeParameters() const
const char * ScrubbedNameCString() const
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
ObjectPtr InvokeSetter(const String &selector, const Instance &argument, bool respect_reflectable=true, bool check_is_entrypoint=false) const
CodePtr allocation_stub() const
void set_is_deeply_immutable(bool value) const
FunctionPtr LookupDynamicFunctionAllowPrivate(const String &name) const
void set_instance_size(intptr_t host_value_in_bytes, intptr_t target_value_in_bytes) const
LibraryPtr library() const
void set_is_isolate_unsendable_due_to_pragma(bool value) const
void set_super_type(const Type &value) const
bool TraceAllocation(IsolateGroup *isolate_group) const
FunctionPtr InvocationDispatcherFunctionFromIndex(intptr_t idx) const
void set_is_allocate_finalized() const
FunctionPtr LookupConstructorAllowPrivate(const String &name) const
static ClassPtr NewTypedDataViewClass(intptr_t class_id, IsolateGroup *isolate_group)
void set_is_enum_class() const
void set_is_synthesized_class() const
ObjectPtr Invoke(const String &selector, const Array &arguments, const Array &argument_names, bool respect_reflectable=true, bool check_is_entrypoint=false) const
FunctionPtr LookupGetterFunction(const String &name) const
bool IsRecordClass() const
bool IsInFullSnapshot() const
ObjectPtr InvokeGetter(const String &selector, bool throw_nsm_if_absent, bool respect_reflectable=true, bool check_is_entrypoint=false) const
FieldPtr LookupInstanceFieldAllowPrivate(const String &name) const
void set_is_allocated_unsafe(bool value) const
void AddDirectImplementor(const Class &subclass, bool is_mixin) const
TypePtr GetInstantiationOf(Zone *zone, const Class &cls) const
bool is_declaration_loaded() const
intptr_t target_type_arguments_field_offset() const
void SetFields(const Array &value) const
void set_is_prefinalized() const
void set_is_interface_class() const
bool IsDartFunctionClass() const
StringPtr ScrubbedName() const
static intptr_t InstanceSize()
GrowableObjectArrayPtr direct_subclasses() const
TypeArgumentsPtr GetDeclarationInstanceTypeArguments() const
TypePtr super_type() const
FunctionPtr GetInvocationDispatcher(const String &target_name, const Array &args_desc, UntaggedFunction::Kind kind, bool create_if_absent) const
intptr_t host_next_field_offset() const
FunctionPtr LookupStaticFunction(const String &name) const
static intptr_t UnboxedFieldSizeInBytesByCid(intptr_t cid)
void set_is_declaration_loaded() const
static ClassPtr NewExternalTypedDataClass(intptr_t class_id, IsolateGroup *isolate)
void set_num_type_arguments_unsafe(intptr_t value) const
intptr_t target_instance_size() const
void set_is_fields_marked_nullable() const
intptr_t NumTypeArguments() const
void set_is_abstract() const
void set_is_mixin_class() const
FunctionPtr LookupConstructor(const String &name) const
void set_type_arguments_field_offset_in_words(intptr_t host_value, intptr_t target_value) const
void set_num_native_fields(uint16_t value) const
static ClassPtr NewTypedDataClass(intptr_t class_id, IsolateGroup *isolate_group)
void set_type_arguments_field_offset(intptr_t host_value_in_bytes, intptr_t target_value_in_bytes) const
WeakArrayPtr dependent_code() const
void set_dependent_code(const WeakArray &array) const
intptr_t target_next_field_offset() const
ObjectPtr EvaluateCompiledExpression(const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array ¶m_values, const TypeArguments &type_param_values) const
FunctionPtr LookupSetterFunction(const String &name) const
FunctionPtr GetRecordFieldGetter(const String &getter_name) const
void set_is_sealed() const
void set_direct_subclasses(const GrowableObjectArray &subclasses) const
intptr_t host_type_arguments_field_offset() const
ArrayPtr interfaces() const
bool IsObjectClass() const
bool InjectCIDFields() const
void set_interfaces(const Array &value) const
bool is_type_finalized() const
void SetUserVisibleNameInClassTable()
InstancePtr InsertCanonicalConstant(Zone *zone, const Instance &constant) const
void set_script(const Script &value) const
static bool IsSubtypeOf(const Class &cls, const TypeArguments &type_arguments, Nullability nullability, const AbstractType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr)
void DisableAllocationStub() const
void SetTraceAllocation(bool trace_allocation) const
ArrayPtr constants() const
bool HasInstanceFields() const
void set_is_future_subtype(bool value) const
void set_is_declaration_loaded_unsafe() const
InstancePtr LookupCanonicalInstance(Zone *zone, const Instance &value) const
uint16_t num_native_fields() const
intptr_t implementor_cid() const
void set_is_finalized() const
ArrayPtr OffsetToFieldMap(ClassTable *class_table=nullptr) const
intptr_t host_instance_size() const
static bool IsDeeplyImmutable(ClassPtr clazz)
void DisableAllCHAOptimizedCode()
FunctionPtr LookupFunctionReadLocked(const String &name) const
void AddField(const Field &field) const
void DisableCHAOptimizedCode(const Class &subclass)
bool HasCompressedPointers() const
void set_is_allocated(bool value) const
void set_allocation_stub(const Code &value) const
int32_t SourceFingerprint() const
FunctionPtr LookupDynamicFunctionUnsafe(const String &name) const
bool IsDynamicClass() const
bool IsClosureClass() const
static constexpr intptr_t kNoTypeArguments
FunctionPtr LookupStaticFunctionAllowPrivate(const String &name) const
void set_token_pos(TokenPosition value) const
TypePtr DeclarationType() const
FieldPtr LookupStaticFieldAllowPrivate(const String &name) const
FunctionPtr LookupFactory(const String &name) const
TokenPosition token_pos() const
void set_instance_size_in_words(intptr_t host_value, intptr_t target_value) const
ErrorPtr EnsureIsFinalized(Thread *thread) const
void set_is_synthesized_class_unsafe() const
bool FindInstantiationOf(Zone *zone, const Class &cls, GrowableArray< const Type * > *path, bool consider_only_super_classes=false) const
void set_is_base_class() const
static ClassPtr New(IsolateGroup *isolate_group, bool register_class=true)
bool is_prefinalized() const
void RegisterCHACode(const Code &code)
bool IsFutureClass() const
KernelProgramInfoPtr KernelProgramInfo() const
FieldPtr LookupField(const String &name) const
void set_library(const Library &value) const
void set_end_token_pos(TokenPosition value) const
ErrorPtr EnsureIsAllocateFinalized(Thread *thread) const
FunctionPtr LookupFactoryAllowPrivate(const String &name) const
ClassPtr SuperClass(ClassTable *class_table=nullptr) const
void set_is_loaded(bool value) const
static ClassPtr NewStringClass(intptr_t class_id, IsolateGroup *isolate_group)
void set_constants(const Array &value) const
intptr_t FindFieldIndex(const Field &needle) const
StringPtr UserVisibleName() const
void AddInvocationDispatcher(const String &target_name, const Array &args_desc, const Function &dispatcher) const
void AddDirectSubclass(const Class &subclass) const
void set_id(intptr_t value) const
FieldPtr FieldFromIndex(intptr_t idx) const
void set_has_dynamically_extendable_subtypes(bool value) const
bool NoteImplementor(const Class &implementor) const
TypeParametersPtr type_parameters() const
void set_is_type_finalized() const
const char * UserVisibleNameCString() const
void set_is_final() const
GrowableObjectArrayPtr direct_implementors() const
intptr_t FindFunctionIndex(const Function &needle) const
bool is_implemented() const
TypeParameterPtr TypeParameterAt(intptr_t index, Nullability nullability=Nullability::kNonNullable) const
static ClassPtr NewPointerClass(intptr_t class_id, IsolateGroup *isolate_group)
void set_next_field_offset(intptr_t host_value_in_bytes, intptr_t target_value_in_bytes) const
void set_is_const() const
bool is_allocate_finalized() const
bool is_transformed_mixin_application() const
FunctionPtr ImplicitClosureFunctionFromIndex(intptr_t idx) const
FunctionPtr FunctionFromIndex(intptr_t idx) const
static ClassPtr NewNativeWrapper(const Library &library, const String &name, int num_fields)
void SetFunctions(const Array &value) const
void set_type_parameters(const TypeParameters &value) const
static ClassPtr NewUnmodifiableTypedDataViewClass(intptr_t class_id, IsolateGroup *isolate_group)
DART_WARN_UNUSED_RESULT ErrorPtr VerifyEntryPoint() const
FieldPtr LookupFieldAllowPrivate(const String &name, bool instance_only=false) const
intptr_t NumTypeParameters(Thread *thread) const
bool is_isolate_unsendable_due_to_pragma() const
void set_direct_implementors(const GrowableObjectArray &implementors) const
intptr_t FindInvocationDispatcherFunctionIndex(const Function &needle) const
bool is_finalized() const
ArrayPtr current_functions() const
ArrayPtr functions() const
FieldPtr LookupStaticField(const String &name) const
void EnsureDeclarationLoaded() const
TypeArgumentsPtr GetInstanceTypeArguments(Thread *thread, const TypeArguments &type_arguments, bool canonicalize=true) const
void set_is_isolate_unsendable(bool value) const
void set_is_dynamically_extendable(bool value) const
void set_can_be_future(bool value) const
static void ForAllClosureFunctions(std::function< bool(const Function &)> callback)
ObjectPtr RawContext() const
virtual bool CanonicalizeEquals(const Instance &other) const
static ClosurePtr New(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const Function &function, const Object &context, Heap::Space space=Heap::kNew)
FunctionTypePtr GetInstantiatedSignature(Zone *zone) const
TypeArgumentsPtr instantiator_type_arguments() const
TypeArgumentsPtr delayed_type_arguments() const
TypeArgumentsPtr function_type_arguments() const
FunctionPtr function() const
virtual void CanonicalizeFieldsLocked(Thread *thread) const
uword ComputeHash() const
static void NotifyAll(const char *name, uword base, uword prologue_offset, uword size, bool optimized, const CodeComments *comments)
void DumpInlineIntervals(uword start)
void GetInlinedFunctionsAt(int32_t pc_offset, GrowableArray< const Function * > *function_stack, GrowableArray< TokenPosition > *token_positions)
void DumpSourcePositions(uword start)
static intptr_t UnroundedSize(CodeSourceMapPtr map)
void set_is_force_optimized(bool value) const
void DisableDartCode() const
FunctionPtr function() const
static CodePtr FindCode(uword pc, int64_t timestamp)
static bool ParseEntryKind(const char *str, EntryKind *out)
LocalVarDescriptorsPtr var_descriptors() const
ArrayPtr deopt_info_array() const
bool HasBreakpoint() const
void set_compressed_stackmaps(const CompressedStackMaps &maps) const
void SetStaticCallTargetCodeAt(uword pc, const Code &code) const
void SetPrologueOffset(intptr_t offset) const
PcDescriptorsPtr pc_descriptors() const
void set_inlined_id_to_function(const Array &value) const
uword GetPcForDeoptId(intptr_t deopt_id, UntaggedPcDescriptors::Kind kind) const
bool is_optimized() const
classid_t OwnerClassId() const
CodeSourceMapPtr code_source_map() const
intptr_t GetDeoptIdForOsr(uword pc) const
intptr_t GetPrologueOffset() const
void SetStubCallTargetCodeAt(uword pc, const Code &code) const
ObjectPoolPtr object_pool() const
static CodePtr FindCodeUnsafe(uword pc)
ArrayPtr inlined_id_to_function() const
void set_num_variables(intptr_t num_variables) const
bool ContainsInstructionAt(uword addr) const
const char * QualifiedName(const NameFormattingParams ¶ms) const
static CodePtr FinalizeCodeAndNotify(const Function &function, FlowGraphCompiler *compiler, compiler::Assembler *assembler, PoolAttachment pool_attachment, bool optimized=false, CodeStatistics *stats=nullptr)
static uword PayloadStartOf(const CodePtr code)
void DumpInlineIntervals() const
LocalVarDescriptorsPtr GetLocalVarDescriptors() const
void DumpSourcePositions(bool relative_addresses=false) const
ArrayPtr static_calls_target_table() const
void Disassemble(DisassemblyFormatter *formatter=nullptr) const
const char * Name() const
void set_is_alive(bool value) const
static void NotifyCodeObservers(const Code &code, bool optimized)
bool IsTypeTestStubCode() const
bool IsAllocationStubCode() const
@ kSCallTableFunctionTarget
@ kSCallTableCodeOrTypeTarget
ObjectPoolPtr GetObjectPool() const
static constexpr intptr_t kMaxElements
void DisableStubCode(bool is_cls_parameterized) const
void set_static_calls_target_table(const Array &value) const
bool IsFunctionCode() const
static CodePtr FinalizeCode(FlowGraphCompiler *compiler, compiler::Assembler *assembler, PoolAttachment pool_attachment, bool optimized, CodeStatistics *stats)
TokenPosition GetTokenIndexOfPC(uword pc) const
intptr_t pointer_offsets_length() const
InstructionsPtr active_instructions() const
intptr_t num_variables() const
ObjectPtr return_address_metadata() const
void set_is_discarded(bool value) const
FunctionPtr GetStaticCallTargetFunctionAt(uword pc) const
bool IsUnknownDartCode() const
InstructionsPtr instructions() const
void set_is_optimized(bool value) const
static const char * EntryKindToCString(EntryKind kind)
uword PayloadStart() const
TypedDataPtr GetDeoptInfoAtPc(uword pc, ICData::DeoptReasonId *deopt_reason, uint32_t *deopt_flags) const
void set_deopt_info_array(const Array &array) const
void set_owner(const Object &owner) const
void GetInlinedFunctionsAtInstruction(intptr_t pc_offset, GrowableArray< const Function * > *functions, GrowableArray< TokenPosition > *token_positions) const
bool should_clone_fields()
static CompilerState & Current()
static bool IsBackgroundCompilation()
static ErrorPtr EnsureUnoptimizedCode(Thread *thread, const Function &function)
static ObjectPtr CompileFunction(Thread *thread, const Function &function)
static ErrorPtr CompileAllFunctions(const Class &cls)
static void ComputeLocalVarDescriptors(const Code &code)
static intptr_t InstanceSize()
static intptr_t UnroundedSize(CompressedStackMapsPtr maps)
static ConstMapPtr NewUninitialized(Heap::Space space=Heap::kNew)
static ConstMapPtr NewDefault(Heap::Space space=Heap::kNew)
static ConstSetPtr NewUninitialized(Heap::Space space=Heap::kNew)
static ConstSetPtr NewDefault(Heap::Space space=Heap::kNew)
intptr_t KernelOffsetAt(intptr_t scope_index) const
StringPtr NameAt(intptr_t scope_index) const
AbstractTypePtr TypeAt(intptr_t scope_index) const
intptr_t LateInitOffsetAt(intptr_t scope_index) const
static intptr_t InstanceSize()
intptr_t ContextLevelAt(intptr_t scope_index) const
void SetCidAt(intptr_t scope_index, intptr_t cid) const
TokenPosition DeclarationTokenIndexAt(intptr_t scope_index) const
intptr_t CidAt(intptr_t scope_index) const
void ClearFlagsAt(intptr_t scope_index) const
intptr_t ContextIndexAt(intptr_t scope_index) const
TokenPosition TokenIndexAt(intptr_t scope_index) const
void SetContextLevelAt(intptr_t scope_index, intptr_t context_level) const
void SetTypeAt(intptr_t scope_index, const AbstractType &type) const
void SetContextIndexAt(intptr_t scope_index, intptr_t context_index) const
void SetTokenIndexAt(intptr_t scope_index, TokenPosition token_pos) const
static constexpr intptr_t kMaxElements
void SetLateInitOffsetAt(intptr_t scope_index, intptr_t late_init_offset) const
void SetNameAt(intptr_t scope_index, const String &name) const
intptr_t num_variables() const
void SetKernelOffsetAt(intptr_t scope_index, intptr_t kernel_offset) const
void SetDeclarationTokenIndexAt(intptr_t scope_index, TokenPosition declaration_token_pos) const
static ContextScopePtr New(intptr_t num_variables, bool is_implicit)
void Dump(int indent=0) const
intptr_t GetLevel() const
static ContextPtr New(intptr_t num_variables, Heap::Space space=Heap::kNew)
static bool IsValidLength(intptr_t len)
ObjectPtr At(intptr_t context_index) const
intptr_t num_variables() const
ContextPtr parent() const
static ObjectPtr InvokeNoSuchMethod(Thread *thread, const Instance &receiver, const String &target_name, const Array &arguments, const Array &arguments_descriptor)
static ObjectPtr InvokeClosure(Thread *thread, const Array &arguments)
static ObjectPtr InvokeFunction(const Function &function, const Array &arguments)
static ObjectPtr HashCode(const Instance &receiver)
static ObjectPtr Equals(const Instance &left, const Instance &right)
static ObjectPtr ToString(const Instance &receiver)
static bool IsReadOnlyHandle(uword address)
static IsolateGroup * vm_isolate_group()
static Dart_DwarfStackTraceFootnoteCallback dwarf_stacktrace_footnote_callback()
static Isolate * vm_isolate()
static Snapshot::Kind vm_snapshot_kind()
static const char * Name()
static uword Hash(const Object &obj)
static bool IsMatch(const Object &a, const Object &b)
static bool ReportStats()
static constexpr intptr_t kNone
static void GetEntry(const Array &table, intptr_t index, Smi *offset, TypedData *info, Smi *reason_and_flags)
static intptr_t GetLength(const Array &table)
friend class ClassDictionaryIterator
DictionaryIterator(const Library &library)
static void Disassemble(uword start, uword end, DisassemblyFormatter *formatter, const Code &code, const CodeComments *comments=nullptr)
static intptr_t value_offset()
virtual bool OperatorEquals(const Instance &other) const
virtual bool CanonicalizeEquals(const Instance &other) const
bool BitwiseEqualsToDouble(double value) const
static DoublePtr New(double d, Heap::Space space=Heap::kNew)
virtual uint32_t CanonicalizeHash() const
static DoublePtr NewCanonical(double d)
static DynamicLibraryPtr New(void *handle, bool canBeClosed, Heap::Space space=Heap::kNew)
static intptr_t InstanceSize()
virtual const char * ToErrorCString() const
static intptr_t InstanceSize()
static DART_NORETURN void ThrowByType(ExceptionType type, const Array &arguments)
static DART_NORETURN void ThrowOOM()
static DART_NORETURN void ThrowLateFieldAssignedDuringInitialization(const String &name)
@ kCyclicInitializationError
static DART_NORETURN void ThrowLateFieldNotInitialized(const String &name)
static DART_NORETURN void ThrowCompileTimeError(const LanguageError &error)
static DART_NORETURN void PropagateError(const Error &error)
static intptr_t InstanceSize()
static ExternalTypedDataPtr New(intptr_t class_id, uint8_t *data, intptr_t len, Heap::Space space=Heap::kNew, bool perform_eager_msan_initialization_check=true)
static intptr_t MaxElements(intptr_t class_id)
FinalizablePersistentHandle * AddFinalizer(void *peer, Dart_HandleFinalizer callback, intptr_t external_size) const
static ExternalTypedDataPtr NewFinalizeWithFree(uint8_t *data, intptr_t len)
FieldDependentArray(const Field &field)
virtual void UpdateArrayTo(const WeakArray &value)
virtual void ReportSwitchingCode(const Code &code)
virtual void ReportDeoptimization(const Code &code)
FieldGuardUpdater(const Field *field, const Object &value)
void SetAt(intptr_t index, ObjectPtr raw_instance, bool concurrent_use=false)
ObjectPtr At(intptr_t index, bool concurrent_use=false) const
void SetFieldType(const AbstractType &value) const
static StringPtr GetterSymbol(const String &field_name)
DART_WARN_UNUSED_RESULT ErrorPtr InitializeInstance(const Instance &instance) const
InstancePtr SetterClosure() const
static StringPtr NameFromSetter(const String &setter_name)
const char * UserVisibleNameCString() const
ObjectPtr StaticConstFieldValue() const
void InheritKernelOffsetFrom(const Field &src) const
StringPtr UserVisibleName() const
static bool IsInitName(const String &function_name)
FieldPtr CloneFromOriginal() const
intptr_t KernelLibraryOffset() const
void SetOriginal(const Field &value) const
void RegisterDependentCode(const Code &code) const
FieldPtr Original() const
bool HasInitializerFunction() const
bool IsUninitialized() const
ObjectPtr RawOwner() const
static bool IsGetterName(const String &function_name)
void SetInitializerFunction(const Function &initializer) const
bool is_reflectable() const
InstancePtr GetterClosure() const
DART_WARN_UNUSED_RESULT ErrorPtr InitializeStatic() const
void set_static_type_exactness_state(StaticTypeExactnessState state) const
static bool IsSetterName(const String &function_name)
void InitializeGuardedListLengthInObjectOffset(bool unsafe=false) const
static StringPtr NameFromInit(const String &init_name)
StaticTypeExactnessState static_type_exactness_state() const
FieldPtr Clone(const Field &original) const
intptr_t guarded_list_length_in_object_offset() const
void set_guarded_list_length_in_object_offset_unsafe(intptr_t offset) const
static StringPtr LookupSetterSymbol(const String &field_name)
DART_WARN_UNUSED_RESULT ObjectPtr EvaluateInitializer() const
bool IsConsistentWith(const Field &field) const
const char * GuardedPropertiesAsCString() const
void set_guarded_cid(intptr_t cid) const
StringPtr InitializingExpression() const
void SetStaticConstFieldValue(const Instance &value, bool assert_initializing_store=true) const
void set_guarded_list_length_in_object_offset(intptr_t offset) const
ObjectPtr StaticValue() const
static StringPtr LookupGetterSymbol(const String &field_name)
TypedDataViewPtr KernelLibrary() const
intptr_t guarded_cid() const
static FieldPtr NewTopLevel(const String &name, bool is_final, bool is_const, bool is_late, const Object &owner, TokenPosition token_pos, TokenPosition end_token_pos)
void set_is_nullable(bool val) const
FunctionPtr EnsureInitializerFunction() const
void set_dependent_code(const WeakArray &array) const
void DeoptimizeDependentCode(bool are_mutators_stopped=false) const
intptr_t guarded_list_length() const
InstancePtr AccessorClosure(bool make_setter) const
static StringPtr GetterName(const String &field_name)
AbstractTypePtr type() const
static StringPtr SetterName(const String &field_name)
void SetStaticValue(const Object &value) const
void SetFieldTypeSafe(const AbstractType &value) const
WeakArrayPtr dependent_code() const
DART_WARN_UNUSED_RESULT ErrorPtr VerifyEntryPoint(EntryPointPragma kind) const
static StringPtr NameFromGetter(const String &getter_name)
intptr_t KernelLibraryIndex() const
void set_guarded_list_length_unsafe(intptr_t list_length) const
void RecordStore(const Object &value) const
void set_guarded_list_length(intptr_t list_length) const
static StringPtr SetterSymbol(const String &field_name)
TokenPosition token_pos() const
KernelProgramInfoPtr KernelProgramInfo() const
int32_t SourceFingerprint() const
static FinalizablePersistentHandle * New(IsolateGroup *isolate_group, const Object &object, void *peer, Dart_HandleFinalizer callback, intptr_t external_size, bool auto_delete)
void VisitObject(ObjectPtr obj)
FinalizeVMIsolateVisitor()
void set_token(const Object &value) const
void set_finalizer(const FinalizerBase &value) const
void set_external_size(intptr_t value) const
intptr_t external_size() const
static FinalizerEntryPtr New(const FinalizerBase &finalizer, Heap::Space space=Heap::kNew)
static intptr_t type_arguments_offset()
static FinalizerPtr New(Heap::Space space=Heap::kNew)
static Float32x4Ptr New(float value0, float value1, float value2, float value3, Heap::Space space=Heap::kNew)
void set_w(float w) const
void set_y(float y) const
virtual uint32_t CanonicalizeHash() const
virtual bool CanonicalizeEquals(const Instance &other) const
void set_z(float z) const
simd128_value_t value() const
void set_x(float x) const
void set_value(simd128_value_t value) const
void set_y(double y) const
void set_value(simd128_value_t value) const
virtual uint32_t CanonicalizeHash() const
simd128_value_t value() const
static Float64x2Ptr New(double value0, double value1, Heap::Space space=Heap::kNew)
void set_x(double x) const
virtual bool CanonicalizeEquals(const Instance &other) const
static FreeListElement * AsElementNew(uword addr, intptr_t size)
static FreeListElement * AsElement(uword addr, intptr_t size)
bool Matches(const Function &function) const
FunctionName(const String &name, String *tmp_string)
FunctionTypeMapping(Zone *zone, FunctionTypeMapping **mapping, const FunctionType &from, const FunctionType &to)
TypeParameterPtr MapTypeParameter(const TypeParameter &type_param) const
const FunctionType * Find(const Object &from) const
bool ContainsOwnersOfTypeParameters(const TypeParameter &p1, const TypeParameter &p2) const
void set_packed_parameter_counts(uint32_t packed_parameter_counts) const
static intptr_t NumOptionalParametersOf(FunctionTypePtr ptr)
TypeParametersPtr type_parameters() const
void SetIsRequiredAt(intptr_t index) const
void set_result_type(const AbstractType &value) const
intptr_t NumOptionalNamedParameters() const
intptr_t num_implicit_parameters() const
void SetParameterTypeAt(intptr_t index, const AbstractType &value) const
AbstractTypePtr ParameterTypeAt(intptr_t index) const
bool ContainsHandles() const
TypeParameterPtr TypeParameterAt(intptr_t index, Nullability nullability=Nullability::kNonNullable) const
const char * ToUserVisibleCString() const
bool HasRequiredNamedParameters() const
StringPtr ParameterNameAt(intptr_t index) const
void set_num_fixed_parameters(intptr_t value) const
void set_num_implicit_parameters(intptr_t value) const
AbstractTypePtr result_type() const
intptr_t NumOptionalPositionalParameters() const
virtual void PrintName(NameVisibility visibility, BaseTextBuffer *printer) const
virtual AbstractTypePtr UpdateFunctionTypes(intptr_t num_parent_type_args_adjustment, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping) const
bool IsRequiredAt(intptr_t index) const
bool IsSubtypeOf(const FunctionType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr) const
void PrintParameters(Thread *thread, Zone *zone, NameVisibility name_visibility, BaseTextBuffer *printer) const
void set_named_parameter_names(const Array &value) const
ArrayPtr named_parameter_names() const
static FunctionTypePtr Clone(const FunctionType &orig, Heap::Space space)
void SetParameterNameAt(intptr_t index, const String &value) const
void CreateNameArrayIncludingFlags(Heap::Space space=Heap::kOld) const
static intptr_t NumFixedParametersOf(FunctionTypePtr ptr)
virtual AbstractTypePtr InstantiateFrom(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping=nullptr, intptr_t num_parent_type_args_adjustment=0) const
intptr_t NumParentTypeArguments() const
void set_packed_type_parameter_counts(uint16_t packed_parameter_counts) const
void set_parameter_types(const Array &value) const
virtual void EnumerateURIs(URIs *uris) const
static intptr_t NumParentTypeArgumentsOf(FunctionTypePtr ptr)
virtual uword ComputeHash() const
bool HasSameTypeParametersAndBounds(const FunctionType &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
static intptr_t NumTypeArgumentsOf(FunctionTypePtr ptr)
bool HasOptionalNamedParameters() const
bool HasOptionalParameters() const
intptr_t GetRequiredFlagIndex(intptr_t index, intptr_t *flag_mask) const
void FinalizeNameArray() const
bool HasOptionalPositionalParameters() const
void SetNumOptionalParameters(intptr_t num_optional_parameters, bool are_optional_positional) const
void SetNumParentTypeArguments(intptr_t value) const
static intptr_t NumParametersOf(FunctionTypePtr ptr)
bool IsContravariantParameter(intptr_t parameter_position, const FunctionType &other, intptr_t other_parameter_position, Heap::Space space, FunctionTypeMapping *function_type_equivalence) const
virtual bool IsEquivalent(const Instance &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
intptr_t NumParameters() const
static intptr_t NumOptionalNamedParametersOf(FunctionTypePtr ptr)
StringPtr ToUserVisibleString() const
void Print(NameVisibility name_visibility, BaseTextBuffer *printer) const
static bool HasOptionalNamedParameters(FunctionTypePtr ptr)
static bool IsGeneric(FunctionTypePtr ptr)
intptr_t num_fixed_parameters() const
static FunctionTypePtr New(intptr_t num_parent_type_arguments=0, Nullability nullability=Nullability::kNonNullable, Heap::Space space=Heap::kOld)
static intptr_t NumTypeParametersOf(FunctionTypePtr ptr)
intptr_t NumTypeParameters() const
virtual AbstractTypePtr Canonicalize(Thread *thread) const
FunctionTypePtr ToNullability(Nullability value, Heap::Space space) const
virtual bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
uint16_t packed_type_parameter_counts() const
void SetTypeParameters(const TypeParameters &value) const
ArrayPtr parameter_types() const
uint32_t packed_parameter_counts() const
static intptr_t NumOptionalPositionalParametersOf(FunctionTypePtr ptr)
void SetIsOptimizable(bool value) const
intptr_t KernelLibraryIndex() const
void set_owner(const Object &value) const
FunctionPtr GetDynamicInvocationForwarder(const String &mangled_name) const
void set_context_scope(const ContextScope &value) const
StringPtr ParameterNameAt(intptr_t index) const
void set_accessor_field(const Field &value) const
intptr_t MaxNumberOfParametersInRegisters(Zone *zone) const
FunctionPtr CreateMethodExtractor(const String &getter_name) const
bool HasOptionalNamedParameters() const
FunctionPtr ForwardingTarget() const
InstantiationMode default_type_arguments_instantiation_mode() const
void SetFfiCallbackTarget(const Function &target) const
bool IsImplicitConstructor() const
void SetFfiCallbackKind(FfiCallbackKind value) const
StringPtr GetSource() const
bool PrologueNeedsArgumentsDescriptor() const
const char * QualifiedUserVisibleNameCString() const
bool IsRequiredAt(intptr_t index) const
intptr_t NumParentTypeArguments() const
StringPtr UserVisibleName() const
ObjectPtr DoArgumentTypesMatch(const Array &args, const ArgumentsDescriptor &arg_names) const
void AssignFfiCallbackId(int32_t callback_id) const
ICDataPtr FindICData(intptr_t deopt_id) const
void set_default_type_arguments_instantiation_mode(InstantiationMode value) const
bool IsImplicitInstanceClosureFunction() const
FfiCallbackKind GetFfiCallbackKind() const
intptr_t SourceSize() const
void SetFfiCSignature(const FunctionType &sig) const
bool IsImplicitClosureFunction() const
bool IsPreferInline() const
bool is_old_native() const
FunctionPtr CreateDynamicInvocationForwarder(const String &mangled_name) const
bool is_sticky_specialization() const
void set_modifier(UntaggedFunction::AsyncModifier value) const
static bool IsDynamicInvocationForwarderName(const String &name)
bool IsNoSuchMethodDispatcher() const
bool SafeToClosurize() const
int32_t FfiCallbackId() const
bool IsFfiCallClosure() const
StringPtr native_name() const
static bool is_visible(FunctionPtr f)
void set_end_token_pos(TokenPosition value) const
void EnsureHasCompiledUnoptimizedCode() const
bool IsDynamicClosureCallDispatcher() const
void InheritKernelOffsetFrom(const Function &src) const
bool IsIdempotent() const
intptr_t NumOptionalParameters() const
bool IsCachableIdempotent() const
bool IsTypedDataViewFactory() const
bool HasOptionalParameters() const
void SetKernelLibraryAndEvalScript(const Script &script, const class KernelProgramInfo &kernel_program_info, intptr_t index) const
void CreateNameArray(Heap::Space space=Heap::kOld) const
InstancePtr GetFfiCallClosurePragmaValue() const
bool FfiCSignatureContainsHandles() const
void set_awaiter_link(AwaiterLink link) const
void SetForwardingTarget(const Function &target) const
ObjectPtr RawOwner() const
const char * ToFullyQualifiedCString() const
InstancePtr FfiCallbackExceptionalReturn() const
bool CanBeInlined() const
static const char * KindToCString(UntaggedFunction::Kind kind)
StringPtr UserVisibleSignature() const
FunctionPtr parent_function() const
ClosurePtr ImplicitInstanceClosure(const Instance &receiver) const
static FunctionPtr New(const FunctionType &signature, const String &name, UntaggedFunction::Kind kind, bool is_static, bool is_const, bool is_abstract, bool is_external, bool is_native, const Object &owner, TokenPosition token_pos, Heap::Space space=Heap::kOld)
StringPtr InternalSignature() const
intptr_t NumTypeArguments() const
virtual uword Hash() const
intptr_t string_specialization_cid() const
void set_token_pos(TokenPosition value) const
bool AreValidArguments(intptr_t num_type_arguments, intptr_t num_arguments, const Array &argument_names, String *error_message) const
TokenPosition token_pos() const
static StringPtr DemangleDynamicInvocationForwarderName(const String &name)
void SetParameterNameAt(intptr_t index, const String &value) const
intptr_t KernelLibraryOffset() const
bool AreValidArgumentCounts(intptr_t num_type_arguments, intptr_t num_arguments, intptr_t num_named_arguments, String *error_message) const
DART_WARN_UNUSED_RESULT ErrorPtr VerifyCallEntryPoint() const
bool ForceOptimize() const
void ClearCodeSafe() const
bool HasRequiredNamedParameters() const
DART_WARN_UNUSED_RESULT ErrorPtr VerifyClosurizedEntryPoint() const
void PrintName(const NameFormattingParams ¶ms, BaseTextBuffer *printer) const
void DropUncompiledImplicitClosureFunction() const
FunctionPtr ImplicitClosureFunction() const
const char * QualifiedScrubbedNameCString() const
bool HasOptimizedCode() const
int32_t SourceFingerprint() const
void set_unoptimized_code(const Code &value) const
intptr_t NumOptionalNamedParameters() const
bool CheckSourceFingerprint(int32_t fp, const char *kind=nullptr) const
void set_extracted_method_closure(const Function &function) const
void set_native_name(const String &name) const
static FunctionPtr NewClosureFunctionWithKind(UntaggedFunction::Kind kind, const String &name, const Function &parent, bool is_static, TokenPosition token_pos, const Object &owner)
intptr_t NumOptionalPositionalParameters() const
bool IsOptimizable() const
FunctionPtr FfiCallbackTarget() const
void SetInstructions(const Code &value) const
intptr_t NumTypeParameters() const
void RestoreICDataMap(ZoneGrowableArray< const ICData * > *deopt_id_to_ic_data, bool clone_ic_data) const
void SetDeoptReasonForAll(intptr_t deopt_id, ICData::DeoptReasonId reason)
void SwitchToUnoptimizedCode() const
bool HasOptionalPositionalParameters() const
FunctionPtr GetOutermostFunction() const
void SaveICDataMap(const ZoneGrowableArray< const ICData * > &deopt_id_to_ic_data, const Array &edge_counters_array, const Array &coverage_array) const
StringPtr QualifiedScrubbedName() const
void SetFfiCallbackExceptionalReturn(const Instance &value) const
bool HasInstantiatedSignature(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
bool IsInvokeFieldDispatcher() const
ArrayPtr ic_data_array() const
void reset_unboxed_parameters_and_return() const
void InstallOptimizedCode(const Code &code) const
void set_saved_args_desc(const Array &array) const
static StringPtr CreateDynamicInvocationForwarderName(const String &name)
FieldPtr accessor_field() const
bool IsNonImplicitClosureFunction() const
bool HasSavedArgumentsDescriptor() const
TypeArgumentsPtr DefaultTypeArguments(Zone *zone) const
const char * NameCString(NameVisibility name_visibility) const
bool IsImplicitStaticClosureFunction() const
bool IsMethodExtractor() const
intptr_t NumImplicitParameters() const
bool is_ffi_native() const
ArrayPtr GetCoverageArray() const
static FunctionPtr NewClosureFunction(const String &name, const Function &parent, TokenPosition token_pos)
bool HasBreakpoint() const
bool MayHaveUncheckedEntryPoint() const
FunctionPtr extracted_method_closure() const
TypedDataViewPtr KernelLibrary() const
void set_packed_fields(uint32_t packed_fields) const
CodePtr EnsureHasCode() const
static FunctionPtr NewImplicitClosureFunction(const String &name, const Function &parent, TokenPosition token_pos)
bool IsUnmodifiableTypedDataViewFactory() const
KernelProgramInfoPtr KernelProgramInfo() const
void SetSignature(const FunctionType &value) const
bool FfiCSignatureReturnsStruct() const
AbstractTypePtr ParameterTypeAt(intptr_t index) const
AwaiterLink awaiter_link() const
intptr_t num_fixed_parameters() const
bool NeedsMonomorphicCheckedEntry(Zone *zone) const
const char * UserVisibleNameCString() const
const char * ToQualifiedCString() const
StringPtr QualifiedUserVisibleName() const
void SwitchToLazyCompiledUnoptimizedCode() const
bool HasDynamicCallers(Zone *zone) const
void SetInstructionsSafe(const Code &value) const
UntaggedFunction::Kind kind() const
intptr_t NumParameters() const
FunctionPtr GetMethodExtractor(const String &getter_name) const
bool RecognizedKindForceOptimize() const
ClosurePtr ImplicitStaticClosure() const
bool IsConstructor() const
ArrayPtr saved_args_desc() const
ContextScopePtr context_scope() const
bool HasImplicitClosureFunction() const
InstancePtr GetNativeAnnotation() const
void AttachCode(const Code &value) const
FunctionPtr ImplicitClosureTarget(Zone *zone) const
void SetRegExpData(const RegExp ®exp, intptr_t string_specialization_cid, bool sticky) const
const char * ToLibNamePrefixedQualifiedCString() const
void ClearICDataArray() const
FunctionTypePtr FfiCSignature() const
TypeParameterPtr TypeParameterAt(intptr_t index, Nullability nullability=Nullability::kNonNullable) const
void set_recognized_kind(MethodRecognizer::Kind value) const
static intptr_t type_arguments_offset()
bool HasBreakpointInCode(const Code &code)
bool HasBreakpoint(Thread *thread, const Function &function)
void SetData(const Array &value) const
void Add(const Object &value, Heap::Space space=Heap::kNew) const
void SetLength(intptr_t value) const
ObjectPtr RemoveLast() const
static GrowableObjectArrayPtr New(Heap::Space space=Heap::kNew)
static intptr_t type_arguments_offset()
virtual TypeArgumentsPtr GetTypeArguments() const
ObjectPtr At(intptr_t index) const
void Grow(intptr_t new_capacity, Heap::Space space=Heap::kNew) const
bool UpdateOrInsert(const Object &key, const Object &value) const
bool Insert(const Object &key)
ObjectPtr GetOrNull(const Key &key, bool *present=nullptr) const
ObjectPtr GetPayload(intptr_t entry, intptr_t component) const
StorageTraits::ArrayHandle & Release()
ObjectPtr GetKey(intptr_t entry) const
void IterateVMIsolateObjects(ObjectVisitor *visitor) const
void IterateOldObjectsNoImagePages(ObjectVisitor *visitor) const
bool HasOutstandingSample() const
void * InvokeCallbackForLastSample(intptr_t cid)
uword Allocate(Thread *thread, intptr_t size, Space space)
void SetHeapSamplingData(ObjectPtr obj, void *data)
intptr_t SetHashIfNotSet(ObjectPtr raw_obj, intptr_t hash)
void * GetPeer(ObjectPtr raw_obj) const
intptr_t GetHash(ObjectPtr raw_obj) const
void SetPeer(ObjectPtr raw_obj, void *peer)
void SetCanonicalHash(ObjectPtr raw_obj, intptr_t hash)
intptr_t UsedInWords(Space space) const
intptr_t GetCanonicalHash(ObjectPtr raw_obj) const
Space SpaceForExternal(intptr_t size) const
intptr_t deopt_id() const
intptr_t NumArgsTested() const
RebindRule rebind_rule() const
uint32_t DeoptReasons() const
void SetOriginal(const ICData &value) const
void AddDeoptReason(ICData::DeoptReasonId reason) const
AbstractTypePtr receivers_static_type() const
static ICDataPtr Clone(const ICData &from)
FunctionPtr Owner() const
static ImmutableArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
InstancePtr CopyShallowToOldSpace(Thread *thread) const
void SetNativeFields(uint16_t num_fields, const intptr_t *field_values) const
ObjectPtr Invoke(const String &selector, const Array &arguments, const Array &argument_names, bool respect_reflectable=true, bool check_is_entrypoint=false) const
static intptr_t DataOffsetFor(intptr_t cid)
static intptr_t NextFieldOffset()
uint16_t NumNativeFields() const
static intptr_t InstanceSize()
bool IsCallable(Function *function) const
ObjectPtr InvokeSetter(const String &selector, const Instance &argument, bool respect_reflectable=true, bool check_is_entrypoint=false) const
virtual InstancePtr CanonicalizeLocked(Thread *thread) const
ObjectPtr GetField(const Field &field) const
virtual bool CanonicalizeEquals(const Instance &other) const
bool IsInstanceOf(const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments) const
AbstractTypePtr GetType(Heap::Space space) const
bool IsIdenticalTo(const Instance &other) const
static intptr_t ElementSizeFor(intptr_t cid)
virtual void SetTypeArguments(const TypeArguments &value) const
bool IsAssignableTo(const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments) const
intptr_t SizeFromClass() const
virtual bool OperatorEquals(const Instance &other) const
void SetNativeField(int index, intptr_t value) const
ObjectPtr InvokeGetter(const String &selector, bool respect_reflectable=true, bool check_is_entrypoint=false) const
InstancePtr Canonicalize(Thread *thread) const
virtual TypeArgumentsPtr GetTypeArguments() const
virtual ObjectPtr HashCode() const
bool IsValidNativeIndex(int index) const
IntegerPtr IdentityHashCode(Thread *thread) const
static bool NullIsAssignableTo(const AbstractType &other)
intptr_t * NativeFieldsDataAddr() const
ObjectPtr EvaluateCompiledExpression(const Class &klass, const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array &arguments, const TypeArguments &type_arguments) const
void SetField(const Field &field, const Object &value) const
virtual bool IsPointer() const
static InstancePtr NewAlreadyFinalized(const Class &cls, Heap::Space space=Heap::kNew)
virtual uint32_t CanonicalizeHash() const
static InstancePtr New(const Class &cls, Heap::Space space=Heap::kNew)
virtual void CanonicalizeFieldsLocked(Thread *thread) const
void set_stats(CodeStatistics *stats) const
uword MonomorphicEntryPoint() const
uword PayloadStart() const
void set_z(int32_t z) const
virtual bool CanonicalizeEquals(const Instance &other) const
static Int32x4Ptr New(int32_t value0, int32_t value1, int32_t value2, int32_t value3, Heap::Space space=Heap::kNew)
void set_value(simd128_value_t value) const
void set_y(int32_t y) const
virtual uint32_t CanonicalizeHash() const
void set_x(int32_t x) const
simd128_value_t value() const
void set_w(int32_t w) const
IntegerPtr ShiftOp(Token::Kind operation, const Integer &other, Heap::Space space=Heap::kNew) const
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
virtual bool FitsIntoSmi() const
virtual int CompareWith(const Integer &other) const
IntegerPtr AsValidInteger() const
virtual double AsDoubleValue() const
static IntegerPtr NewCanonical(const String &str)
IntegerPtr ArithmeticOp(Token::Kind operation, const Integer &other, Heap::Space space=Heap::kNew) const
const char * ToHexCString(Zone *zone) const
IntegerPtr BitOp(Token::Kind operation, const Integer &other, Heap::Space space=Heap::kNew) const
virtual bool IsNegative() const
static IntegerPtr NewFromUint64(uint64_t value, Heap::Space space=Heap::kNew)
virtual int64_t AsInt64Value() const
static bool IsValueInRange(uint64_t value)
virtual bool IsZero() const
virtual bool Equals(const Instance &other) const
virtual uint32_t CanonicalizeHash() const
virtual uint32_t AsTruncatedUint32Value() const
static int EncodeType(Level level, Kind kind)
const uint8_t * snapshot_instructions
GroupDebugger * debugger() const
Mutex * kernel_data_class_cache_mutex()
void RegisterClass(const Class &cls)
bool all_classes_finalized() const
ObjectStore * object_store() const
SafepointRwLock * program_lock()
static IsolateGroup * Current()
ClassTable * class_table() const
Mutex * type_arguments_canonicalization_mutex()
Mutex * initializer_functions_mutex()
FieldTable * initial_field_table() const
IsolateGroupSource * source() const
Mutex * constant_canonicalization_mutex()
Mutex * kernel_data_lib_cache_mutex()
Mutex * subtype_test_cache_mutex()
UserTagPtr current_tag() const
FieldTable * field_table() const
static Isolate * Current()
UserTagPtr default_tag() const
ObjectPtr CallDeferredLoadHandler(intptr_t id)
GrowableObjectArrayPtr tag_table() const
IsolateGroup * group() const
void set_current_tag(const UserTag &tag)
void set_default_tag(const UserTag &tag)
void set_constants(const Array &constants) const
intptr_t KernelLibraryStartOffset(intptr_t library_index) const
intptr_t KernelLibraryEndOffset(intptr_t library_index) const
LibraryPtr LookupLibrary(Thread *thread, const Smi &name_index) const
void set_scripts(const Array &scripts) const
ArrayPtr libraries_cache() const
TypedDataViewPtr KernelLibrary(intptr_t library_index) const
ClassPtr LookupClass(Thread *thread, const Smi &name_index) const
ArrayPtr constants() const
void set_classes_cache(const Array &cache) const
TypedDataViewPtr constants_table() const
TypedDataPtr string_offsets() const
TypedDataViewPtr string_data() const
ArrayPtr classes_cache() const
LibraryPtr InsertLibrary(Thread *thread, const Smi &name_index, const Library &lib) const
TypedDataViewPtr metadata_mappings() const
void set_constants_table(const TypedDataView &value) const
TypedDataPtr canonical_names() const
ScriptPtr ScriptAt(intptr_t index) const
void set_libraries_cache(const Array &cache) const
TypedDataBasePtr kernel_component() const
ClassPtr InsertClass(Thread *thread, const Smi &name_index, const Class &klass) const
TypedDataViewPtr metadata_payloads() const
StringPtr FormatMessage() const
Report::Kind kind() const
virtual const char * ToErrorCString() const
static LanguageErrorPtr static LanguageErrorPtr NewFormattedV(const Error &prev_error, const Script &script, TokenPosition token_pos, bool report_after_token, Report::Kind kind, Heap::Space space, const char *format, va_list args)
static LanguageErrorPtr NewFormatted(const Error &prev_error, const Script &script, TokenPosition token_pos, bool report_after_token, Report::Kind kind, Heap::Space space, const char *format,...) PRINTF_ATTRIBUTE(7
TokenPosition token_pos() const
static bool ReportStats()
static uword Hash(const Object &key)
static ObjectPtr NewKey(const String &str)
static bool IsMatch(const Object &a, const Object &b)
static const char * Name()
bool is_deferred_load() const
void AddImport(const Namespace &import) const
intptr_t num_imports() const
LibraryPtr importer() const
LibraryPtr GetLibrary(int index) const
static LibraryPtr CoreLibrary()
static LibraryPtr VMServiceLibrary()
void SetLoadInProgress() const
StringPtr PrivateName(const String &name) const
ScriptPtr LookupScript(const String &url, bool useResolvedUri=false) const
void Register(Thread *thread) const
ObjectPtr LookupReExport(const String &name, ZoneGrowableArray< intptr_t > *visited=nullptr) const
intptr_t num_imports() const
static LibraryPtr MirrorsLibrary()
static bool IsPrivate(const String &name)
bool LoadRequested() const
ObjectPtr InvokeGetter(const String &selector, bool throw_nsm_if_absent, bool respect_reflectable=true, bool check_is_entrypoint=false) const
static LibraryPtr IsolateLibrary()
GrowableObjectArrayPtr used_scripts() const
void SetName(const String &name) const
void DropDependenciesAndCaches() const
ArrayPtr LoadedScripts() const
static ClassPtr LookupCoreClass(const String &class_name)
void AddObject(const Object &obj, const String &name) const
ObjectPtr InvokeSetter(const String &selector, const Instance &argument, bool respect_reflectable=true, bool check_is_entrypoint=false) const
ObjectPtr LookupLocalOrReExportObject(const String &name) const
void EnsureTopLevelClassIsFinalized() const
TypedDataViewPtr KernelLibrary() const
static LibraryPtr ConvertLibrary()
void AddMetadata(const Object &declaration, intptr_t kernel_offset) const
ClassPtr LookupClassAllowPrivate(const String &name) const
LibraryPtr ImportLibraryAt(intptr_t index) const
ObjectPtr GetMetadata(const Object &declaration) const
void AddClass(const Class &cls) const
ObjectPtr Invoke(const String &selector, const Array &arguments, const Array &argument_names, bool respect_reflectable=true, bool check_is_entrypoint=false) const
ObjectPtr EvaluateCompiledExpression(const ExternalTypedData &kernel_buffer, const Array &type_definitions, const Array ¶m_values, const TypeArguments &type_param_values) const
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
ClassPtr toplevel_class() const
static LibraryPtr NativeWrappersLibrary()
NamespacePtr ImportAt(intptr_t index) const
static LibraryPtr CollectionLibrary()
void SetLoadRequested() const
static LibraryPtr GetLibrary(intptr_t index)
static bool FindPragma(Thread *T, bool only_core, const Object &object, const String &pragma_name, bool multiple=false, Object *options=nullptr)
void set_loading_unit(const LoadingUnit &value) const
static LibraryPtr AsyncLibrary()
ClassPtr LookupClass(const String &name) const
static LibraryPtr LookupLibrary(Thread *thread, const String &url)
static const String & PrivateCoreLibName(const String &member)
void AddImport(const Namespace &ns) const
LoadingUnitPtr loading_unit() const
static ErrorPtr CompileAll(bool ignore_error=false)
void set_dependencies(const Array &deps) const
static const char kPrivateIdentifierStart
void set_index(intptr_t value) const
static LibraryPtr InternalLibrary()
static void InitNativeWrappersLibrary(IsolateGroup *isolate_group, bool is_kernel_file)
FieldPtr LookupFieldAllowPrivate(const String &name) const
static LibraryPtr FfiLibrary()
static void RegisterLibraries(Thread *thread, const GrowableObjectArray &libs)
LibraryPrefixPtr LookupLocalLibraryPrefix(const String &name) const
static bool IsPrivateCoreLibName(const String &name, const String &member)
StringPtr private_key() const
static LibraryPtr MathLibrary()
bool LoadInProgress() const
void CopyPragmas(const Library &old_lib)
intptr_t kernel_library_index() const
intptr_t KernelLibraryOffset() const
KernelProgramInfoPtr kernel_program_info() const
static const char kPrivateKeySeparator
void set_toplevel_class(const Class &value) const
bool IsAnyCoreLibrary() const
static void InitCoreLibrary(IsolateGroup *isolate_group)
void AddExport(const Namespace &ns) const
static LibraryPtr DeveloperLibrary()
static LibraryPtr TypedDataLibrary()
void set_kernel_program_info(const KernelProgramInfo &info) const
void ComputeAndSetHashMask() const
virtual void CanonicalizeFieldsLocked(Thread *thread) const
virtual uint32_t CanonicalizeHash() const
virtual bool CanonicalizeEquals(const Instance &other) const
static constexpr intptr_t kInitialIndexSize
static const LinkedHashBase & Cast(const Object &obj)
static intptr_t type_arguments_offset()
static LoadingUnitPtr New(intptr_t id, const LoadingUnit &parent)
LoadingUnitPtr parent() const
static intptr_t LoadingUnitOf(const Function &function)
void set_loaded(bool value) const
ObjectPtr CompleteLoad(const String &error_message, bool transient_error) const
static constexpr intptr_t kIllegalId
static constexpr intptr_t kRootId
void set_base_objects(const Array &value) const
ObjectPtr IssueLoad() const
void set_load_outstanding() const
static ContextScopePtr CreateImplicitClosureScope(const Function &func)
static intptr_t InstanceSize()
static MapPtr NewDefault(intptr_t class_id=kMapCid, Heap::Space space=Heap::kNew)
static MapPtr New(intptr_t class_id, const Array &data, const TypedData &index, intptr_t hash_mask, intptr_t used_data, intptr_t deleted_keys, Heap::Space space=Heap::kNew)
void EnsureContains(const Smi &class_id, const Object &target) const
static constexpr intptr_t kSpreadFactor
void set_mask(intptr_t mask) const
intptr_t filled_entry_count() const
void set_filled_entry_count(intptr_t num) const
ObjectPtr Lookup(const Smi &class_id) const
void set_buckets(const Array &buckets) const
static constexpr double kLoadFactor
static constexpr intptr_t kInitialCapacity
static bool IsMarkedAsRecognized(const Function &function, const char *kind=nullptr)
static void InitializeState()
static MintPtr NewCanonical(int64_t value)
virtual int CompareWith(const Integer &other) const
virtual int64_t AsInt64Value() const
virtual uint32_t AsTruncatedUint32Value() const
static constexpr intptr_t kBits
virtual bool FitsIntoSmi() const
static constexpr int64_t kMinValue
virtual bool Equals(const Instance &other) const
static constexpr int64_t kMaxValue
static MintPtr New(int64_t value, Heap::Space space=Heap::kNew)
virtual double AsDoubleValue() const
FieldPtr GetFieldReferent() const
TypeParameterPtr GetTypeParameterReferent() const
LibraryPtr GetLibraryReferent() const
static MirrorReferencePtr New(const Object &referent, Heap::Space space=Heap::kNew)
AbstractTypePtr GetAbstractTypeReferent() const
FunctionTypePtr GetFunctionTypeReferent() const
ClassPtr GetClassReferent() const
FunctionPtr GetFunctionReferent() const
bool IsOwnedByCurrentThread() const
ArrayPtr hide_names() const
bool HidesName(const String &name) const
ObjectPtr Lookup(const String &name, ZoneGrowableArray< intptr_t > *trail=nullptr) const
ArrayPtr show_names() const
LibraryPtr target() const
void RunCallback(const FinalizerEntry &entry, const char *trace_context) const
static NativeFinalizerPtr New(Heap::Space space=Heap::kNew)
StringPtr ToString(Heap::Space space) const
static OSThread * Current()
static intptr_t ThreadIdToIntPtr(ThreadId id)
static int64_t GetCurrentTimeMillis()
static int64_t GetCurrentMonotonicMicros()
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static bool StringToInt64(const char *str, int64_t *value)
static BuildId GetAppBuildId(const uint8_t *snapshot_instructions)
static const uint8_t * GetAppDSOBase(const uint8_t *snapshot_instructions)
static intptr_t ProcessId()
static char * SCreate(Zone *zone, const char *format,...) PRINTF_ATTRIBUTE(2
IsolateGroup * isolate_group() const
void VisitCompressedPointers(uword heap_base, CompressedObjectPtr *first, CompressedObjectPtr *last)
static intptr_t InstanceSize()
static ObjectPoolPtr NewFromBuilder(const compiler::ObjectPoolBuilder &builder)
bool IsFreeListElement() const
ObjectPtr Decompress(uword heap_base) const
UntaggedObject * untag() const
bool IsStringInstance() const
bool IsForwardingCorpse() const
intptr_t GetClassId() const
intptr_t GetClassIdMayBeSmi() const
void set_bootstrap_library(BootstrapLibraryId index, const Library &value)
static ObjectPtr Clone(const Object &orig, Heap::Space space, bool load_with_relaxed_atomics=false)
static ObjectPtr Allocate(intptr_t cls_id, intptr_t size, Heap::Space space, bool compressed, uword ptr_field_start_offset, uword ptr_field_end_offset)
void StoreNonPointer(const FieldType *addr, ValueType value) const
static ClassPtr loadingunit_class()
static ClassPtr type_parameters_class()
static ClassPtr ffi_trampoline_data_class()
static ClassPtr class_class()
static void InitNullAndBool(IsolateGroup *isolate_group)
static ClassPtr namespace_class()
static const ClassId kClassId
void StoreCompressedPointer(compressed_type const *addr, type value) const
intptr_t GetClassId() const
static ClassPtr language_error_class()
bool InVMIsolateHeap() const
virtual StringPtr DictionaryName() const
static ClassPtr unhandled_exception_class()
static bool ShouldHaveImmutabilityBitSet(classid_t class_id)
static void FinishInit(IsolateGroup *isolate_group)
static void FinalizeVMIsolate(IsolateGroup *isolate_group)
static ClassPtr context_class()
static ClassPtr patch_class_class()
static ClassPtr code_class()
static void InitVtables()
static void MakeUnusedSpaceTraversable(const Object &obj, intptr_t original_size, intptr_t used_size)
static void set_vm_isolate_snapshot_object_table(const Array &table)
void SetCanonical() const
static void FinalizeReadOnlyObject(ObjectPtr object)
virtual const char * ToCString() const
static constexpr bool ContainsCompressedPointers()
static ClassPtr library_class()
static ClassPtr unwind_error_class()
cpp_vtable vtable() const
CLASS_LIST(STORE_NON_POINTER_ILLEGAL_TYPE)
static ClassPtr field_class()
static constexpr intptr_t RoundedAllocationSize(intptr_t size)
static ClassPtr script_class()
static ClassPtr context_scope_class()
static ObjectPtr RawCast(ObjectPtr obj)
static Object & ZoneHandle()
static ClassPtr function_class()
static void Init(IsolateGroup *isolate_group)
static constexpr intptr_t kHashBits
static ClassPtr closure_data_class()
static ClassPtr api_error_class()
void StoreSimd128(const FieldType *addr, simd128_value_t value) const
static ClassPtr subtypetestcache_class()
static void VerifyBuiltinVtables()
static intptr_t UnroundedSize(OneByteStringPtr str)
static OneByteStringPtr New(intptr_t len, Heap::Space space)
static OneByteStringPtr ConcatAll(const Array &strings, intptr_t start, intptr_t end, intptr_t len, Heap::Space space)
static intptr_t data_offset()
static intptr_t InstanceSize()
static OneByteStringPtr Transform(int32_t(*mapping)(int32_t ch), const String &str, Heap::Space space)
static OneByteStringPtr EscapeSpecialCharacters(const String &str)
static OneByteStringPtr SubStringUnchecked(const String &str, intptr_t begin_index, intptr_t length, Heap::Space space)
static OneByteStringPtr Concat(const String &str1, const String &str2, Heap::Space space)
static constexpr intptr_t kBytesPerElement
void AllocateBlack(intptr_t size)
void VisitObjectsUnsafe(ObjectVisitor *visitor) const
static PassiveObject & Handle()
void set_kernel_program_info(const KernelProgramInfo &info) const
intptr_t YieldIndex() const
TokenPosition TokenPos() const
intptr_t TryIndex() const
UntaggedPcDescriptors::Kind Kind() const
static intptr_t UnroundedSize(PcDescriptorsPtr desc)
static intptr_t InstanceSize()
static intptr_t type_arguments_offset()
static PointerPtr New(uword native_address, Heap::Space space=Heap::kNew)
static intptr_t InstanceSize()
static void DumpStackTrace(void *context)
static void SampleAllocation(Thread *thread, intptr_t cid, uint32_t identity_hash)
static ReceivePortPtr New(Dart_Port id, const String &debug_name, Heap::Space space=Heap::kNew)
static bool IsMatch(const Object &a, const Object &b)
static uword Hash(const Object &key)
static const char * Name()
static ObjectPtr NewKey(const Array &arr)
static bool ReportStats()
static RecordShape ForUnnamed(intptr_t num_fields)
ArrayPtr GetFieldNames(Thread *thread) const
static constexpr intptr_t kMaxFieldNamesIndex
intptr_t num_fields() const
static constexpr intptr_t kMaxNumFields
static RecordShape Register(Thread *thread, intptr_t num_fields, const Array &field_names)
AbstractTypePtr FieldTypeAt(intptr_t index) const
virtual void EnumerateURIs(URIs *uris) const
RecordTypePtr ToNullability(Nullability value, Heap::Space space) const
RecordShape shape() const
virtual uword ComputeHash() const
ArrayPtr GetFieldNames(Thread *thread) const
virtual bool IsEquivalent(const Instance &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
static RecordTypePtr New(RecordShape shape, const Array &field_types, Nullability nullability=Nullability::kNonNullable, Heap::Space space=Heap::kOld)
virtual AbstractTypePtr Canonicalize(Thread *thread) const
virtual AbstractTypePtr UpdateFunctionTypes(intptr_t num_parent_type_args_adjustment, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping) const
virtual AbstractTypePtr InstantiateFrom(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping=nullptr, intptr_t num_parent_type_args_adjustment=0) const
bool IsSubtypeOf(const RecordType &other, Heap::Space space, FunctionTypeMapping *function_type_equivalence=nullptr) const
void SetFieldTypeAt(intptr_t index, const AbstractType &value) const
virtual void PrintName(NameVisibility visibility, BaseTextBuffer *printer) const
virtual bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
virtual uint32_t CanonicalizeHash() const
RecordShape shape() const
static intptr_t GetPositionalFieldIndexFromFieldName(const String &field_name)
virtual void CanonicalizeFieldsLocked(Thread *thread) const
RecordTypePtr GetRecordType() const
virtual bool CanonicalizeEquals(const Instance &other) const
static RecordPtr New(RecordShape shape, Heap::Space space=Heap::kNew)
static intptr_t field_offset(intptr_t index)
intptr_t GetFieldIndexByName(Thread *thread, const String &field_name) const
ObjectPtr FieldAt(intptr_t field_index) const
const char * ToCString() const
void set_pattern(const String &pattern) const
StringPtr pattern() const
virtual uint32_t CanonicalizeHash() const
virtual bool CanonicalizeEquals(const Instance &other) const
void set_function(intptr_t cid, bool sticky, const Function &value) const
static RegExpPtr New(Zone *zone, Heap::Space space=Heap::kNew)
void set_num_bracket_expressions(SmiPtr value) const
void set_capture_name_map(const Array &array) const
void set_bytecode(bool is_one_byte, bool sticky, const TypedData &bytecode) const
RegExpFlags flags() const
static DART_NORETURN void LongJump(const Error &error)
static void MessageF(Kind kind, const Script &script, TokenPosition token_pos, bool report_after_token, const char *format,...) PRINTF_ATTRIBUTE(5
static constexpr bool AtLocation
static StringPtr PrependSnippet(Kind kind, const Script &script, TokenPosition token_pos, bool report_after_token, const String &message)
static FunctionPtr ResolveDynamicAnyArgs(Zone *zone, const Class &receiver_class, const String &function_name, bool allow_add)
static FunctionPtr ResolveDynamicFunction(Zone *zone, const Class &receiver_class, const String &function_name)
static FunctionPtr ResolveFunction(Zone *zone, const Class &receiver_class, const String &function_name)
static CodePtr Lookup(IsolateGroup *group, uword pc, bool is_return_address)
bool IsCurrentThreadWriter()
intptr_t GetTokenLength(const TokenPosition &token_pos) const
TypedDataPtr line_starts() const
bool IsPartOfDartColonLibrary() const
GrowableObjectArrayPtr GenerateLineNumberArray() const
void CollectTokenPositionsFor() const
TokenPosition MaxPosition() const
intptr_t col_offset() const
void LoadSourceFromKernel(const uint8_t *kernel_buffer, intptr_t kernel_buffer_len) const
LibraryPtr FindLibrary() const
StringPtr resolved_url() const
void InitializeFromKernel(const KernelProgramInfo &info, intptr_t script_index, const TypedData &line_starts, const TypedDataView &constant_coverage) const
void set_url(const String &value) const
StringPtr GetSnippet(intptr_t from_line, intptr_t from_column, intptr_t to_line, intptr_t to_column) const
TypedDataViewPtr constant_coverage() const
bool TokenRangeAtLine(intptr_t line_number, TokenPosition *first_token_index, TokenPosition *last_token_index) const
bool IsValidTokenPosition(TokenPosition token_pos) const
static ScriptPtr New(const String &url, const String &source)
StringPtr GetLine(intptr_t line_number, Heap::Space space=Heap::kNew) const
intptr_t line_offset() const
bool GetTokenLocation(const TokenPosition &token_pos, intptr_t *line, intptr_t *column=nullptr) const
static SendPortPtr New(Dart_Port id, Heap::Space space=Heap::kNew)
static void HandleEvent(ServiceEvent *event, bool enter_safepoint=true)
static StreamInfo profiler_stream
static SetPtr New(intptr_t class_id, const Array &data, const TypedData &index, intptr_t hash_mask, intptr_t used_data, intptr_t deleted_keys, Heap::Space space=Heap::kNew)
static SetPtr NewDefault(intptr_t class_id=kSetCid, Heap::Space space=Heap::kNew)
static SmiPtr New(intptr_t value)
virtual bool Equals(const Instance &other) const
virtual int64_t AsInt64Value() const
virtual int CompareWith(const Integer &other) const
virtual uint32_t AsTruncatedUint32Value() const
static bool IsValid(int64_t value)
virtual double AsDoubleValue() const
virtual bool IsNegative() const
static bool IsPossibleAwaiterLink(const Class &cls)
static constexpr uword kFutureListenerPcOffset
void SetPcOffsetAtFrame(intptr_t frame_index, uword pc_offset) const
bool skip_sync_start_in_parent_stack() const
void set_skip_sync_start_in_parent_stack(bool value) const
void SetCodeAtFrame(intptr_t frame_index, const Object &code) const
static constexpr intptr_t kSyncAsyncCroppedFrames
void set_async_link(const StackTrace &async_link) const
uword PcOffsetAtFrame(intptr_t frame_index) const
static StackTracePtr New(const Array &code_array, const TypedData &pc_offset_array, Heap::Space space=Heap::kNew)
ObjectPtr CodeAtFrame(intptr_t frame_index) const
void set_expand_inlined(bool value) const
static StaticTypeExactnessState TriviallyExact(intptr_t type_arguments_offset_in_bytes)
static bool CanRepresentAsTriviallyExact(intptr_t type_arguments_offset_in_bytes)
static StaticTypeExactnessState HasExactSuperType()
static StaticTypeExactnessState NotExact()
static StaticTypeExactnessState NotTracking()
const char * ToCString() const
static StaticTypeExactnessState Compute(const Type &static_type, const Instance &value, bool print_trace=false)
static StaticTypeExactnessState HasExactSuperClass()
void Add(uint16_t code_unit)
static StringPtr FromLatin1(const uint8_t *latin1_array, intptr_t array_len, Heap::Space space=Heap::kNew)
static StringPtr ScrubNameRetainPrivate(const String &name, bool is_extension=false)
static constexpr intptr_t kMaxElements
static void Copy(const String &dst, intptr_t dst_offset, const uint8_t *characters, intptr_t len)
static StringPtr NewFormatted(const char *format,...) PRINTF_ATTRIBUTE(1
bool EndsWith(const String &other) const
static StringPtr RemovePrivateKey(const String &name)
bool IsOneByteString() const
static uint32_t SetCachedHashIfNotSet(StringPtr obj, uint32_t hash)
static uword HashRawSymbol(const StringPtr symbol)
static bool ParseDouble(const String &str, intptr_t start, intptr_t end, double *result)
char * ToMallocCString() const
static StringPtr ToLowerCase(const String &str, Heap::Space space=Heap::kNew)
static StringPtr static StringPtr static StringPtr NewFormattedV(const char *format, va_list args, Heap::Space space=Heap::kNew)
static uword HashConcat(const String &str1, const String &str2)
static StringPtr ConcatAllRange(const Array &strings, intptr_t start, intptr_t end, Heap::Space space=Heap::kNew)
static StringPtr ConcatAll(const Array &strings, Heap::Space space=Heap::kNew)
void SetHash(intptr_t value) const
static const char * ScrubName(const String &name, bool is_extension=false)
void SetLength(intptr_t value) const
bool Equals(const String &str) const
static constexpr intptr_t kOneByteChar
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
static constexpr intptr_t kTwoByteChar
intptr_t CompareTo(const String &other) const
intptr_t CharSize() const
void ToUTF8(uint8_t *utf8_array, intptr_t array_len) const
bool IsTwoByteString() const
uint16_t CharAt(intptr_t index) const
static StringPtr SubString(const String &str, intptr_t begin_index, Heap::Space space=Heap::kNew)
bool StartsWith(const String &other) const
static StringPtr EscapeSpecialCharacters(const String &str)
static StringPtr Concat(const String &str1, const String &str2, Heap::Space space=Heap::kNew)
virtual InstancePtr CanonicalizeLocked(Thread *thread) const
static StringPtr DecodeIRI(const String &str)
static const char * ToCString(Thread *thread, StringPtr ptr)
static StringPtr Transform(int32_t(*mapping)(int32_t ch), const String &str, Heap::Space space=Heap::kNew)
static StringPtr ToUpperCase(const String &str, Heap::Space space=Heap::kNew)
static StringPtr FromUTF16(const uint16_t *utf16_array, intptr_t array_len, Heap::Space space=Heap::kNew)
virtual bool CanonicalizeEquals(const Instance &other) const
bool EqualsConcat(const String &str1, const String &str2) const
static bool EqualsIgnoringPrivateKey(const String &str1, const String &str2)
static const char * EncodeIRI(const String &str)
static uint32_t GetCachedHash(const StringPtr obj)
static StringPtr FromUTF32(const int32_t *utf32_array, intptr_t array_len, Heap::Space space=Heap::kNew)
static StringPtr FromUTF8(const uint8_t *utf8_array, intptr_t array_len, Heap::Space space=Heap::kNew)
static intptr_t LengthOf(StringPtr obj)
static const char * NameOfStub(uword entry_point)
static bool HasBeenInitialized()
void GetCurrentCheck(intptr_t ix, Object *instance_class_id_or_signature, AbstractType *destination_type, TypeArguments *instance_type_arguments, TypeArguments *instantiator_type_arguments, TypeArguments *function_type_arguments, TypeArguments *instance_parent_function_type_arguments, TypeArguments *instance_delayed_type_arguments, Bool *test_result) const
void WriteEntryToBuffer(Zone *zone, BaseTextBuffer *buffer, intptr_t index, const char *line_prefix=nullptr) const
intptr_t num_occupied() const
static constexpr intptr_t kMaxLinearCacheSize
intptr_t NumEntries() const
bool Equals(const SubtypeTestCache &other) const
static SubtypeTestCachePtr New(intptr_t num_inputs)
static constexpr intptr_t kMaxInputs
void GetCheck(intptr_t ix, Object *instance_class_id_or_signature, AbstractType *destination_type, TypeArguments *instance_type_arguments, TypeArguments *instantiator_type_arguments, TypeArguments *function_type_arguments, TypeArguments *instance_parent_function_type_arguments, TypeArguments *instance_delayed_type_arguments, Bool *test_result) const
SubtypeTestCachePtr Copy(Thread *thread) const
static intptr_t UsedInputsForType(const AbstractType &type)
intptr_t num_inputs() const
intptr_t NumberOfChecks() const
bool GetNextCheck(intptr_t *ix, Object *instance_class_id_or_signature, AbstractType *destination_type, TypeArguments *instance_type_arguments, TypeArguments *instantiator_type_arguments, TypeArguments *function_type_arguments, TypeArguments *instance_parent_function_type_arguments, TypeArguments *instance_delayed_type_arguments, Bool *test_result) const
intptr_t AddCheck(const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &instance_parent_function_type_arguments, const TypeArguments &instance_delayed_type_arguments, const Bool &test_result) const
bool HasCheck(const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &instance_parent_function_type_arguments, const TypeArguments &instance_delayed_type_arguments, intptr_t *index, Bool *result) const
@ kInstanceDelayedFunctionTypeArguments
@ kInstanceCidOrSignature
@ kInstanceParentFunctionTypeArguments
@ kInstantiatorTypeArguments
static constexpr intptr_t kMaxLinearCacheEntries
void WriteToBuffer(Zone *zone, BaseTextBuffer *buffer, const char *line_prefix=nullptr) const
bool IsOccupied(intptr_t index) const
static SuspendStatePtr Clone(Thread *thread, const SuspendState &src, Heap::Space space=Heap::kNew)
static intptr_t FrameSizeGrowthGap()
static intptr_t payload_offset()
CodePtr GetCodeObject() const
static intptr_t InstanceSize()
static SuspendStatePtr New(intptr_t frame_size, const Instance &function_data, Heap::Space space=Heap::kNew)
static bool IsSymbolCid(Thread *thread, classid_t class_id)
static uint32_t CanonicalizeHash(Thread *thread, const Instance &instance)
static const String & HashMark()
static const String & NewLine()
static StringPtr LookupFromGet(Thread *thread, const String &str)
static StringPtr FromConcat(Thread *thread, const String &str1, const String &str2)
static StringPtr LookupFromSet(Thread *thread, const String &str)
static const String & Library()
static StringPtr FromGet(Thread *thread, const String &str)
static StringPtr FromSet(Thread *thread, const String &str)
static void SetupSymbolTable(IsolateGroup *isolate_group)
static StringPtr FromConcatAll(Thread *thread, const GrowableHandlePtrArray< const String > &strs)
static const String & Void()
static const String & This()
static const String & Empty()
static StringPtr New(Thread *thread, const char *cstr)
static const String & Dot()
static const String & Equals()
LongJumpScope * long_jump_base() const
void DeferredMarkingStackAddObject(ObjectPtr obj)
int32_t no_callback_scope_depth() const
static Thread * Current()
int32_t no_safepoint_scope_depth() const
void IncrementNoCallbackScopeDepth()
uword top_exit_frame_info() const
bool OwnsDeoptSafepoint() const
bool IsDartMutatorThread() const
ExecutionState execution_state() const
Isolate * isolate() const
IsolateGroup * isolate_group() const
void DecrementNoCallbackScopeDepth()
HeapProfileSampler & heap_sampler()
const char * ToCString() const
int32_t Serialize() const
static TokenPosition Deserialize(int32_t value)
static constexpr int32_t kMaxSourcePos
static const TokenPosition kMinSource
bool IsClassifying() const
static TransferableTypedDataPtr New(uint8_t *data, intptr_t len)
static intptr_t UnroundedSize(TwoByteStringPtr str)
static TwoByteStringPtr New(intptr_t len, Heap::Space space)
static TwoByteStringPtr Transform(int32_t(*mapping)(int32_t ch), const String &str, Heap::Space space)
static constexpr intptr_t kBytesPerElement
static TwoByteStringPtr ConcatAll(const Array &strings, intptr_t start, intptr_t end, intptr_t len, Heap::Space space)
static intptr_t InstanceSize()
static intptr_t data_offset()
static TwoByteStringPtr Concat(const String &str1, const String &str2, Heap::Space space)
static TwoByteStringPtr EscapeSpecialCharacters(const String &str)
bool IsOccupied(intptr_t entry) const
KeyLocation FindKeyOrUnused(const TypeArguments &instantiator_tav, const TypeArguments &function_tav) const
Cache(Zone *zone, const TypeArguments &source)
TypeArgumentsPtr Retrieve(intptr_t entry) const
static const Array & EmptyStorage()
intptr_t NumOccupied() const
KeyLocation AddEntry(intptr_t entry, const TypeArguments &instantiator_tav, const TypeArguments &function_tav, const TypeArguments &instantiated_tav) const
intptr_t NumEntries() const
bool IsEquivalent(const TypeArguments &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
void EnumerateURIs(URIs *uris) const
void PrintSubvectorName(intptr_t from_index, intptr_t len, NameVisibility name_visibility, BaseTextBuffer *printer) const
static constexpr intptr_t kNullabilityBitsPerType
bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
TypeArgumentsPtr ToInstantiatorTypeArguments(Thread *thread, const Class &cls) const
intptr_t nullability() const
uword HashForRange(intptr_t from_index, intptr_t len) const
static intptr_t types_offset()
static constexpr intptr_t kNullableBit
TypeArgumentsPtr TruncatedTo(intptr_t length) const
bool Equals(const TypeArguments &other) const
static intptr_t InstanceSize()
bool IsSubvectorInstantiated(intptr_t from_index, intptr_t len, Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
bool CanShareFunctionTypeArguments(const Function &function, bool *with_runtime_check=nullptr) const
static constexpr intptr_t kMaxElements
void PrintTo(BaseTextBuffer *printer) const
bool CanShareInstantiatorTypeArguments(const Class &instantiator_class, bool *with_runtime_check=nullptr) const
InstantiationMode GetInstantiationMode(Zone *zone, const Function *function=nullptr, const Class *cls=nullptr) const
TypeArgumentsPtr InstantiateAndCanonicalizeFrom(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments) const
bool IsUninstantiatedIdentity() const
TypeArgumentsPtr FromInstanceTypeArguments(Thread *thread, const Class &cls) const
AbstractTypePtr TypeAtNullSafe(intptr_t index) const
bool IsSubvectorEquivalent(const TypeArguments &other, intptr_t from_index, intptr_t len, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
bool HasInstantiations() const
TypeArgumentsPtr ConcatenateTypeParameters(Zone *zone, const TypeArguments &other) const
StringPtr UserVisibleName() const
static constexpr intptr_t kNonNullableBit
bool HasCount(intptr_t count) const
static constexpr intptr_t kNullabilityMaxTypes
static constexpr intptr_t kAllDynamicHash
void SetTypeAt(intptr_t index, const AbstractType &value) const
TypeArgumentsPtr InstantiateFrom(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping=nullptr, intptr_t num_parent_type_args_adjustment=0) const
TypeArgumentsPtr Canonicalize(Thread *thread) const
bool IsRaw(intptr_t from_index, intptr_t len) const
TypeArgumentsPtr UpdateFunctionTypes(intptr_t num_parent_type_args_adjustment, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping) const
static TypeArgumentsPtr New(intptr_t len, Heap::Space space=Heap::kOld)
AbstractTypePtr TypeAt(intptr_t index) const
TypeArgumentsPtr Prepend(Zone *zone, const TypeArguments &other, intptr_t other_length, intptr_t total_length) const
virtual uword ComputeHash() const
bool IsClassTypeParameter() const
void set_parameterized_class_id(classid_t value) const
virtual AbstractTypePtr UpdateFunctionTypes(intptr_t num_parent_type_args_adjustment, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping) const
TypeParameterPtr ToNullability(Nullability value, Heap::Space space) const
virtual void PrintName(NameVisibility visibility, BaseTextBuffer *printer) const
virtual bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
void set_index(intptr_t value) const
classid_t parameterized_class_id() const
ClassPtr parameterized_class() const
AbstractTypePtr bound() const
AbstractTypePtr GetFromTypeArguments(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments) const
virtual bool IsEquivalent(const Instance &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
virtual AbstractTypePtr InstantiateFrom(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping=nullptr, intptr_t num_parent_type_args_adjustment=0) const
void set_base(intptr_t value) const
const char * CanonicalNameCString() const
bool IsFunctionTypeParameter() const
FunctionTypePtr parameterized_function_type() const
virtual AbstractTypePtr Canonicalize(Thread *thread) const
void SetNameAt(intptr_t index, const String &value) const
void SetBoundAt(intptr_t index, const AbstractType &value) const
void Print(Thread *thread, Zone *zone, bool are_class_type_parameters, intptr_t base, NameVisibility name_visibility, BaseTextBuffer *printer) const
static constexpr intptr_t kFlagsPerSmiShift
static constexpr intptr_t kFlagsPerSmiMask
StringPtr NameAt(intptr_t index) const
AbstractTypePtr DefaultAt(intptr_t index) const
bool IsGenericCovariantImplAt(intptr_t index) const
static TypeParametersPtr New(Heap::Space space=Heap::kOld)
bool AllDynamicDefaults() const
bool AllDynamicBounds() const
AbstractTypePtr BoundAt(intptr_t index) const
void SetDefaultAt(intptr_t index, const AbstractType &value) const
void SetIsGenericCovariantImplAt(intptr_t index, bool value) const
static CodePtr DefaultCodeForType(const AbstractType &type, bool lazy_specialize=true)
virtual void EnumerateURIs(URIs *uris) const
TypeArgumentsPtr GetInstanceTypeArguments(Thread *thread, bool canonicalize=true) const
static TypePtr VoidType()
static TypePtr NullableIntType()
friend class TypeArguments
virtual classid_t type_class_id() const
virtual void PrintName(NameVisibility visibility, BaseTextBuffer *printer) const
TypePtr ToNullability(Nullability value, Heap::Space space) const
static TypePtr ArrayType()
static TypePtr NullableDouble()
virtual ClassPtr type_class() const
bool IsDeclarationTypeOf(const Class &cls) const
static TypePtr MintType()
static TypePtr NullType()
virtual bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
virtual TypeArgumentsPtr arguments() const
static TypePtr StringType()
static TypePtr BoolType()
static TypePtr DartFunctionType()
static TypePtr ObjectType()
virtual AbstractTypePtr UpdateFunctionTypes(intptr_t num_parent_type_args_adjustment, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping) const
void set_type_class(const Class &value) const
static TypePtr NeverType()
virtual uword ComputeHash() const
void set_arguments(const TypeArguments &value) const
virtual AbstractTypePtr InstantiateFrom(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping=nullptr, intptr_t num_parent_type_args_adjustment=0) const
static TypePtr Float64x2()
static TypePtr DynamicType()
virtual AbstractTypePtr Canonicalize(Thread *thread) const
static TypePtr Float32x4()
static TypePtr New(const Class &clazz, const TypeArguments &arguments, Nullability nullability=Nullability::kNonNullable, Heap::Space space=Heap::kOld)
static TypePtr NullableNumber()
static TypePtr NewNonParameterizedType(const Class &type_class)
static TypePtr DartTypeType()
virtual bool IsEquivalent(const Instance &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
TypedDataElementType ElementType() const
TypedDataViewPtr ViewFromTo(intptr_t start, intptr_t end, Heap::Space space=Heap::kNew) const
intptr_t ElementSizeInBytes() const
static intptr_t length_offset()
intptr_t LengthInBytes() const
bool IsExternalOrExternalView() const
void * DataAddr(intptr_t byte_offset) const
static TypedDataViewPtr New(intptr_t class_id, Heap::Space space=Heap::kNew)
static intptr_t InstanceSize()
static intptr_t payload_offset()
static TypedDataPtr Grow(const TypedData ¤t, intptr_t len, Heap::Space space=Heap::kNew)
virtual bool CanonicalizeEquals(const Instance &other) const
virtual uint32_t CanonicalizeHash() const
static intptr_t MaxElements(intptr_t class_id)
static TypedDataPtr New(intptr_t class_id, intptr_t len, Heap::Space space=Heap::kNew)
static intptr_t InstanceSize()
static DART_FORCE_INLINE constexpr intptr_t Length()
virtual const char * ToErrorCString() const
InstancePtr exception() const
static UnhandledExceptionPtr New(const Instance &exception, const Instance &stacktrace, Heap::Space space=Heap::kNew)
InstancePtr stacktrace() const
bool can_patch_to_monomorphic() const
@ kFinalizedUninstantiated
static const char * KindToCString(Kind k)
static constexpr uword update(intptr_t size, uword tag)
static bool IsMarked(uword tags)
static uword ToAddr(const UntaggedObject *raw_obj)
intptr_t HeapSize() const
bool InVMIsolateHeap() const
void VisitPointersPrecise(ObjectPointerVisitor *visitor)
intptr_t VisitPointers(ObjectPointerVisitor *visitor)
void SetMarkBitUnsynchronized()
void set_is_user_initiated(bool value) const
static UnwindErrorPtr New(const String &message, Heap::Space space=Heap::kNew)
StringPtr message() const
virtual const char * ToErrorCString() const
static UserTagPtr FindTagById(const Isolate *isolate, uword tag_id)
static UserTagPtr New(const String &label, Heap::Space space=Heap::kOld)
static UserTagPtr FindTagInIsolate(Isolate *isolate, Thread *thread, const String &label)
UserTagPtr MakeActive() const
static UserTagPtr DefaultTag()
static bool TagTableIsFull(Thread *thread)
static int32_t Decode(uint16_t lead, uint16_t trail)
static void Encode(int32_t codepoint, uint16_t *dst)
static bool IsLeadSurrogate(uint32_t ch)
static intptr_t Length(int32_t ch)
static bool IsTrailSurrogate(uint32_t ch)
static intptr_t Length(int32_t ch)
static intptr_t CodeUnitCount(const uint8_t *utf8_array, intptr_t array_len, Type *type)
static intptr_t ReportInvalidByte(const uint8_t *utf8_array, intptr_t array_len, intptr_t len)
static bool DecodeToUTF16(const uint8_t *utf8_array, intptr_t array_len, uint16_t *dst, intptr_t len)
static intptr_t Decode(const uint8_t *utf8_array, intptr_t array_len, int32_t *ch)
static bool DecodeToLatin1(const uint8_t *utf8_array, intptr_t array_len, uint8_t *dst, intptr_t len)
static intptr_t Encode(int32_t ch, char *dst)
static bool IsSupplementary(int32_t code_point)
static bool IsBmp(int32_t code_point)
static bool IsLatin1(int32_t code_point)
static bool IsInt(intptr_t N, T value)
static constexpr uintptr_t RoundUpToPowerOfTwo(uintptr_t x)
static T MulWithWrapAround(T a, T b)
static constexpr T Maximum(T x, T y)
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
static constexpr int ShiftForPowerOfTwo(T x)
static char * StrDup(const char *s)
static int static int VSNPrint(char *str, size_t size, const char *format, va_list args)
static T Minimum(T x, T y)
static T AddWithWrapAround(T a, T b)
static T SubWithWrapAround(T a, T b)
static uint32_t BigEndianToHost32(uint32_t be_value)
static bool IsUint(intptr_t N, T value)
static constexpr bool IsAligned(T x, uintptr_t alignment, uintptr_t offset=0)
static int64_t ShiftLeftWithTruncation(int64_t a, int64_t b)
static constexpr bool IsPowerOfTwo(T x)
static void Protect(void *address, intptr_t size, Protection mode)
static WeakPropertyPtr New(Heap::Space space=Heap::kNew)
static intptr_t type_arguments_offset()
static WeakReferencePtr New(Heap::Space space=Heap::kNew)
static ObjectPtr Unwrap(ObjectPtr obj)
static ObjectPtr UnwrapIfTarget(ObjectPtr obj)
void VisitPointers(ObjectPtr *from, ObjectPtr *to) override
WriteBarrierUpdateVisitor(Thread *thread, ObjectPtr obj)
char * PrintToString(const char *format,...) PRINTF_ATTRIBUTE(2
ElementType * Alloc(intptr_t length)
bool has_monomorphic_entry() const
intptr_t CountPointerOffsets() const
intptr_t CodeSize() const
ObjectPoolBuilder & object_pool_builder()
intptr_t UncheckedEntryOffset() const
const ZoneGrowableArray< intptr_t > & GetPointerOffsets() const
void FinalizeInstructions(const MemoryRegion ®ion)
bool should_be_aligned() const
bool HasObjectPoolBuilder() const
intptr_t prologue_offset() const
Object & GetSelfHandle() const
static void InitializeState()
static word type_arguments_offset()
static word InstanceSize()
static const word kNoTypeArguments
static word InstanceSize()
static word InstanceSize()
static word type_arguments_offset()
static word type_arguments_offset()
static word type_arguments_offset()
static word NextFieldOffset()
static word InstanceSize()
static word type_arguments_offset()
static word InstanceSize()
static word InstanceSize()
static word type_arguments_offset()
static const word kMaxNumFields
static const word kMaxFieldNamesIndex
static word InstanceSize()
static word InstanceSize()
static word InstanceSize()
static word type_arguments_offset()
DART_WARN_UNUSED_RESULT bool LocationForPosition(intptr_t position, intptr_t *line, intptr_t *col=nullptr) const
uint32_t MaxPosition() const
DART_WARN_UNUSED_RESULT bool TokenRangeAtLine(intptr_t line_number, dart::TokenPosition *first_token_index, dart::TokenPosition *last_token_index) const
uint32_t At(intptr_t index) const
ObjectPtr LoadExpressionEvaluationFunction(const String &library_url, const String &klass)
static StringPtr FindSourceForScript(const uint8_t *kernel_buffer, intptr_t kernel_buffer_length, const String &url)
static uint32_t CalculateFunctionFingerprint(const Function &func)
static uint32_t CalculateFieldFingerprint(const Field &field)
static uint32_t CalculateClassFingerprint(const Class &klass)
static std::unique_ptr< Program > ReadFromTypedData(const ExternalTypedData &typed_data, const char **error=nullptr)
#define THR_Print(format,...)
#define kIsolateSnapshotInstructionsAsmSymbol
#define DART_WARN_UNUSED_RESULT
#define kVmSnapshotInstructionsAsmSymbol
void(* Dart_HandleFinalizer)(void *isolate_callback_data, void *peer)
const EmbeddedViewParams * params
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
FlutterSemanticsFlag flag
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const uint8_t uint32_t uint32_t GError ** error
uint32_t uint32_t * format
Dart_NativeFunction function
#define HANDLESCOPE(thread)
static float max(float r, float g, float b)
#define TIR_Print(format,...)
#define MSAN_CHECK_INITIALIZED(ptr, len)
SK_API std::unique_ptr< SkCodec > Decode(std::unique_ptr< SkStream >, SkCodec::Result *, SkCodecs::DecodeContext=nullptr)
Optional< SkRect > bounds
sk_sp< const SkImage > image
ClipOpAndAA opAA SkRegion region
SK_API sk_sp< SkSurface > Null(int width, int height)
void Decompress(const uint8_t *input, intptr_t input_len, uint8_t **output, intptr_t *output_length)
void UnboxFieldIfSupported(const dart::Field &field, const dart::AbstractType &type)
@ kRequiredNamedParameterFlag
static constexpr intptr_t kWordSize
bool IsDouble(const dart::Object &a)
static constexpr intptr_t kCompressedWordSize
static constexpr intptr_t kNumParameterFlagsPerElement
intptr_t RoundedAllocationSize(intptr_t size)
bool NeedsDynamicInvocationForwarder(const Function &function)
void ReadParameterCovariance(const Function &function, BitVector *is_covariant, BitVector *is_generic_covariant_impl)
static ProcedureAttributesMetadata ProcedureAttributesOf(Zone *zone, const KernelProgramInfo &kernel_program_info, const TypedDataView &kernel_data, intptr_t kernel_data_program_offset, intptr_t kernel_offset)
FunctionPtr CreateFieldInitializerFunction(Thread *thread, Zone *zone, const Field &field)
ObjectPtr EvaluateMetadata(const Library &library, intptr_t kernel_offset, bool is_annotations_offset)
static UnboxingInfoMetadata * UnboxingInfoMetadataOf(Zone *zone, const KernelProgramInfo &kernel_program_info, const TypedDataView &kernel_data, intptr_t kernel_data_program_offset, intptr_t kernel_offset)
ObjectPtr EvaluateStaticConstFieldInitializer(const Field &field)
def link(from_root, to_root)
static constexpr intptr_t kNullIdentityHash
bool IsTypedDataViewClassId(intptr_t index)
ArrayOfTuplesView< TypeArguments::Cache::Entry, std::tuple< Object, TypeArguments, TypeArguments >, TypeArguments::Cache::kHeaderSize > InstantiationsCacheTable
static ArrayPtr CreateCallableArgumentsFromStatic(Zone *zone, const Instance &receiver, const Array &static_args, const Array &arg_names, const ArgumentsDescriptor &static_args_descriptor)
bool IsTypedDataClassId(intptr_t index)
static void AppendSubString(BaseTextBuffer *buffer, const char *name, intptr_t start_pos, intptr_t len)
static constexpr intptr_t kFalseIdentityHash
static bool IsIdentChar(int32_t c)
static void TransferableTypedDataFinalizer(void *isolate_callback_data, void *peer)
static void ReportTooManyTypeArguments(const Class &cls)
void DoubleToCString(double d, char *buffer, int buffer_size)
bool CStringToDouble(const char *str, intptr_t length, double *result)
static constexpr intptr_t kOldObjectAlignmentOffset
static bool EvaluationFunctionNeedsReceiver(Thread *thread, Zone *zone, const Function &eval_function)
static const char *const names[]
@ kSharesInstantiatorTypeArguments
@ kSharesFunctionTypeArguments
static constexpr intptr_t kNewObjectAlignmentOffset
static type SpecialCharacter(type value)
ZoneGrowableHandlePtrArray< const String > URIs
static constexpr intptr_t kCompressedWordSizeLog2
static bool EqualsIgnoringPrivateKey(const String &str1, const String &str2)
CAllocUniquePtr< char > CStringUniquePtr
bool IsTypedDataBaseClassId(intptr_t index)
constexpr intptr_t kBitsPerWord
static constexpr intptr_t kBoolValueMask
static const intptr_t kGetterPrefixLength
static constexpr intptr_t kFalseOffsetFromNull
static int32_t GetHexCharacter(int32_t c)
static StaticTypeExactnessState TrivialTypeExactnessFor(const Class &cls)
static intptr_t GetListLength(const Object &value)
static int32_t EscapeOverhead(int32_t c)
DART_WARN_UNUSED_RESULT ErrorPtr EntryPointFieldInvocationError(const String &getter_name)
@ kQualifiedFunctionLibKindLibUrl
@ kQualifiedFunctionLibKindLibName
DART_EXPORT bool IsNull(Dart_Handle object)
static constexpr intptr_t kBoolVsNullMask
bool IsTypeClassId(intptr_t index)
intptr_t RawSmiValue(const SmiPtr raw_value)
static bool SubtypeTestCacheEntryMatches(const SubtypeTestCacheTable::TupleView &t, intptr_t num_inputs, const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &instance_parent_function_type_arguments, const TypeArguments &instance_delayed_type_arguments)
static ObjectPtr EvaluateCompiledExpressionHelper(Zone *zone, const Function &eval_function, const Array &type_definitions, const Array &arguments, const TypeArguments &type_arguments)
void * malloc(size_t size)
uint32_t CombineHashes(uint32_t hash, uint32_t other_hash)
const char *const class_name
bool IsArrayClassId(intptr_t index)
static bool IsPercent(int32_t c)
static constexpr intptr_t kTrueOffsetFromNull
DART_WARN_UNUSED_RESULT ErrorPtr EntryPointMemberInvocationError(const Object &member)
bool IsUnmodifiableTypedDataViewClassId(intptr_t index)
@ kUnmodifiableByteDataViewCid
static bool IsHexCharacter(int32_t c)
static bool IsSpecialCharacter(type value)
static TypeArgumentsPtr RetrieveInstantiatorTypeArguments(Zone *zone, const Function &function, const Instance &receiver)
bool IsFfiTypeClassId(intptr_t index)
constexpr uint32_t kMaxUint32
static const char *const kInitPrefix
EntryPointPragma FindEntryPointPragma(IsolateGroup *IG, const Array &metadata, Field *reusable_field_handle, Object *pragma)
static bool IsAsciiNonprintable(int32_t c)
static int PrintVarInfo(char *buffer, int len, intptr_t i, const String &var_name, const UntaggedLocalVarDescriptors::VarInfo &info)
FunctionPtr GetFunction(const Library &lib, const char *name)
static void PrintSymbolicStackFrameBody(BaseTextBuffer *buffer, const char *function_name, const char *url, intptr_t line=-1, intptr_t column=-1)
ArrayOfTuplesView< SubtypeTestCache::Entries, std::tuple< Object, TypeArguments, TypeArguments, TypeArguments, TypeArguments, TypeArguments, AbstractType, Bool > > SubtypeTestCacheTable
DART_WARN_UNUSED_RESULT ErrorPtr VerifyEntryPoint(const Library &lib, const Object &member, const Object &annotated, std::initializer_list< EntryPointPragma > allowed_kinds)
static bool IsURISafeCharacter(int32_t c)
static void FunctionPrintNameHelper(const Function &fun, const NameFormattingParams ¶ms, BaseTextBuffer *printer)
static int32_t MergeHexCharacters(int32_t c1, int32_t c2)
constexpr uword kBreakInstructionFiller
static void IndentN(int count)
static void ReportTooManyImports(const Library &lib)
uint32_t Multiply64Hash(int64_t ivalue)
void CreateSpecializedFunction(Thread *thread, Zone *zone, const RegExp ®exp, intptr_t specialization_cid, bool sticky, const Object &owner)
bool IsAllocatableInNewSpace(intptr_t size)
UnorderedHashSet< CanonicalTypeTraits > CanonicalTypeSet
static const char * Concat(const char *a, const char *b)
static constexpr intptr_t kSlotsPerInterruptCheck
uintptr_t compressed_uword
static bool MatchesAccessorName(const String &name, const char *prefix, intptr_t prefix_length, const String &accessor_name)
static void DwarfStackTracesHandler(bool value)
UnorderedHashSet< ClassFunctionsTraits > ClassFunctionsSet
static ObjectPtr ThrowTypeError(const TokenPosition token_pos, const Instance &src_value, const AbstractType &dst_type, const String &dst_name)
static bool IsDecimalDigit(int32_t c)
UnorderedHashMap< LibraryLookupTraits > LibraryLookupMap
bool ShouldHaveImmutabilityBitSetCid(intptr_t predefined_cid)
static intptr_t ConstructFunctionFullyQualifiedCString(const Function &function, char **chars, intptr_t reserve_len, bool with_lib, QualifiedFunctionLibKind lib_kind)
uint32_t HashBytes(const uint8_t *bytes, intptr_t size)
static const char *const kGetterPrefix
static classid_t NormalizeClassIdForSyntacticalTypeEquality(classid_t cid)
bool FindPragmaInMetadata(Thread *T, const Object &metadata_obj, const String &pragma_name, bool multiple, Object *options)
static void PrintSymbolicStackFrame(Zone *zone, BaseTextBuffer *buffer, const Function &function, TokenPosition token_pos_or_line, intptr_t frame_index, bool is_line=false)
DEFINE_FLAG(bool, print_cluster_information, false, "Print information about clusters written to snapshot")
static T LoadUnaligned(const T *ptr)
static constexpr intptr_t kTrueIdentityHash
static bool IsVisibleAsFutureListener(const Function &function)
static constexpr intptr_t kCompressedWordSize
raw_obj untag() -> num_entries()) VARIABLE_COMPRESSED_VISITOR(Array, Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(TypedData, TypedData::ElementSizeInBytes(raw_obj->GetClassId()) *Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(Record, RecordShape(raw_obj->untag() ->shape()).num_fields()) VARIABLE_NULL_VISITOR(CompressedStackMaps, CompressedStackMaps::PayloadSizeOf(raw_obj)) VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag() ->length())) VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag() ->length())) intptr_t UntaggedField::VisitFieldPointers(FieldPtr raw_obj, ObjectPointerVisitor *visitor)
uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits=kBitsPerInt32)
static const intptr_t kSetterPrefixLength
static uword Hash64To32(uint64_t v)
DEFINE_FLAG_HANDLER(PrecompilationModeHandler, precompilation, "Precompilation mode")
void DumpFunctionTypeTable(Isolate *isolate)
FrameLayout runtime_frame_layout
static void StoreUnaligned(T *ptr, T value)
static void ReportTooManyTypeParameters(const FunctionType &sig)
static uint32_t Hash(uint32_t key)
void DumpTypeTable(Isolate *isolate)
static DART_FORCE_INLINE uword LocalVarAddress(uword fp, intptr_t index)
bool TESTING_runtime_fail_on_existing_cache_entry
bool IsFfiPointerClassId(intptr_t index)
constexpr int32_t kMaxInt32
static const intptr_t kInitPrefixLength
constexpr intptr_t kWordSize
const StackTrace & GetCurrentStackTrace(int skip_frames)
static ObjectPtr InvokeInstanceFunction(Thread *thread, const Instance &receiver, const Function &function, const String &target_name, const Array &args, const Array &args_descriptor_array, bool respect_reflectable, const TypeArguments &instantiator_type_args)
static constexpr intptr_t kObjectAlignment
static bool HasPragma(const Object &declaration)
static ArrayPtr NewDictionary(intptr_t initial_size)
static void ThrowNoSuchMethod(const Instance &receiver, const String &function_name, const Array &arguments, const Array &argument_names, const InvocationMirror::Level level, const InvocationMirror::Kind kind)
static void AddScriptIfUnique(const GrowableObjectArray &scripts, const Script &candidate)
constexpr int64_t kMinInt64RepresentableAsDouble
bool IsIntegerClassId(intptr_t index)
UnorderedHashMap< RecordFieldNamesMapTraits > RecordFieldNamesMap
bool IsInternalOnlyClassId(intptr_t index)
void DumpTypeParameterTable(Isolate *isolate)
const char *const function_name
static int8_t data[kExtLength]
static int32_t GetHexValue(int32_t c)
static void PrintSymbolicStackFrameIndex(BaseTextBuffer *buffer, intptr_t frame_index)
constexpr int64_t kMaxInt64RepresentableAsDouble
static bool ShouldBePrivate(const String &name)
bool IsDeeplyImmutableCid(intptr_t predefined_cid)
bool IsAllocatableViaFreeLists(intptr_t size)
NOT_IN_PRODUCT(LibraryPtr ReloadTestScript(const char *script))
static ObjectPtr LoadExpressionEvaluationFunction(Zone *zone, const ExternalTypedData &kernel_buffer, const String &library_url, const String &klass)
void DumpTypeArgumentsTable(Isolate *isolate)
static const char * SafeTypeArgumentsToCString(const TypeArguments &args)
static bool IsIdentStartChar(int32_t c)
static bool IsLetter(int32_t c)
static FinalizablePersistentHandle * AddFinalizer(const Object &referent, void *peer, Dart_HandleFinalizer callback, intptr_t external_size)
static const char *const kSetterPrefix
static TypeArgumentsPtr RetrieveFunctionTypeArguments(Thread *thread, Zone *zone, const Function &function, const Instance &receiver, const TypeArguments &instantiator_type_args, const Array &args, const ArgumentsDescriptor &args_desc)
bool IsBuiltinListClassId(intptr_t index)
static int NumEntries(const FinalizerEntry &entry, intptr_t acc=0)
constexpr intptr_t kBitsPerInt64
bool IsExternalTypedDataClassId(intptr_t index)
COMPILE_ASSERT(kUnreachableReference==WeakTable::kNoValue)
constexpr intptr_t kIntptrMax
bool IsStringClassId(intptr_t index)
@ kCurrentAndEnclosingFree
static bool InVmTests(const Function &function)
static intptr_t GetRelativeSourceIndex(const String &src, intptr_t line, intptr_t line_offset=0, intptr_t column=1, intptr_t column_offset=0, intptr_t starting_index=0)
ObjectPtr CompressedObjectPtr
void DumpRecordTypeTable(Isolate *isolate)
static intptr_t GetListLengthOffset(intptr_t cid)
DECLARE_FLAG(bool, show_invisible_frames)
bool Equals(const T *a, const T *b)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library name
struct PathData * Data(SkPath *path)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
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 mode
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 JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static Dart_Handle InvokeFunction(Dart_Handle builtin_library, const char *name)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
std::function< void()> closure
const myers::Point & get(const myers::Segment &)
def print(*args, **kwargs)
static bool is_linear(SkPoint p0, SkPoint p1, SkPoint p2)
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
#define SHARED_READONLY_HANDLES_LIST(V)
#define FOR_EACH_REBIND_RULE(V)
static DecodeResult decode(std::string path)
#define CONTEXT_SCOPE_VARIABLE_DESC_FLAG_LIST(V)
#define CORE_LIB_INTRINSIC_LIST(V)
#define GRAPH_TYPED_DATA_INTRINSICS_LIST(V)
#define INTERNAL_LIB_INTRINSIC_LIST(V)
#define CORE_INTEGER_LIB_INTRINSIC_LIST(V)
#define POLYMORPHIC_TARGET_LIST(V)
#define GRAPH_CORE_INTRINSICS_LIST(V)
#define DEVELOPER_LIB_INTRINSIC_LIST(V)
#define RECOGNIZED_LIST_FACTORY_LIST(V)
#define OTHER_RECOGNIZED_LIST(V)
#define REUSABLE_CLASS_HANDLESCOPE(thread)
#define REUSABLE_LOADING_UNIT_HANDLESCOPE(thread)
#define REUSABLE_INSTANCE_HANDLESCOPE(thread)
#define REUSABLE_ARRAY_HANDLESCOPE(thread)
#define REUSABLE_SMI_HANDLESCOPE(thread)
#define REUSABLE_STRING_HANDLESCOPE(thread)
#define REUSABLE_TYPE_PARAMETERS_HANDLESCOPE(thread)
#define REUSABLE_FUNCTION_HANDLESCOPE(thread)
#define REUSABLE_FIELD_HANDLESCOPE(thread)
#define REUSABLE_LIBRARY_HANDLESCOPE(thread)
#define REUSABLE_ABSTRACT_TYPE_HANDLESCOPE(thread)
#define REUSABLE_OBJECT_HANDLESCOPE(thread)
#define REUSABLE_TYPE_ARGUMENTS_HANDLESCOPE(thread)
CidCount(intptr_t cid_, intptr_t count_, Function *f_)
intptr_t FrameSlotForVariableIndex(intptr_t index) const
static constexpr intptr_t kElementSize
simd128_value_t & readFrom(const float *v)
std::shared_ptr< const fml::Mapping > data
#define TIMELINE_DURATION(thread, stream, name)
#define NOT_IN_PRECOMPILED_RUNTIME(code)
#define ARRAY_SIZE(array)
#define NOT_IN_PRECOMPILED(code)
#define EQUALS_IGNORING_PRIVATE_KEY(class_id, type, str1, str2)
#define CLASS_LIST_WITH_NULL(V)
#define ADD_SET_FIELD(clazz)
#define REGISTER_TYPED_DATA_CLASS(clazz)
#define REGISTER_FFI_CLASS(clazz)
#define CHECK_ERROR(error)
#define INITIALIZE_SHARED_READONLY_HANDLE(Type, name)
#define REGISTER_EXT_TYPED_DATA_CLASS(clazz)
#define DEFINE_FLAG_ACCESSORS(Name)
#define PRECOMPILER_WSR_FIELD_DEFINITION(Class, Type, Name)
#define REGISTER_TYPED_DATA_VIEW_CLASS(clazz)
#define TRACE_TYPE_CHECKS_VERBOSE(format,...)
#define REGISTER_FFI_TYPE_MARKER(clazz)
#define HANDLE_CASE(clazz)
#define SET_CLASS_NAME(class_name, name)
#define TYPED_DATA_GET_INDEXED_CASES(clazz)
#define INIT_VTABLE(clazz)
#define DEFINE_SHARED_READONLY_HANDLE(Type, name)