24 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
25 const char* msg =
instance.ToCString();
38#if defined(HASH_IN_OBJECT_HEADER)
39 return Object::GetCachedHash(obj);
51 intptr_t
hash =
GetHash(isolate, arguments->NativeArgAt(0));
57 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
58 return instance.IdentityHashCode(arguments->thread());
63 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
68 return AbstractType::Cast(
instance).UserVisibleName();
70 const char* c_str =
instance.ToCString();
76 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
83 }
else if (
instance.IsAbstractType()) {
87 zone, thread->isolate_group()->object_store()->list_class());
88 auto& type_arguments =
90 type_arguments = type_arguments.FromInstanceTypeArguments(thread, cls);
94 type.SetIsFinalized();
95 return type.Canonicalize(thread);
104 const intptr_t left_cid = left.GetClassId();
105 const intptr_t right_cid = right.GetClassId();
107 if (left_cid != right_cid) {
124 if (left_cid == kClosureCid) {
125 const auto& left_closure = Closure::Cast(left);
126 const auto& right_closure = Closure::Cast(right);
129 if (left_closure.function_type_arguments() ==
130 right_closure.function_type_arguments() &&
131 left_closure.delayed_type_arguments() ==
132 right_closure.delayed_type_arguments() &&
133 left_closure.instantiator_type_arguments() ==
134 right_closure.instantiator_type_arguments()) {
137 if (left_fun.signature() == right_fun.signature()) {
148 if (left_cid == kRecordCid) {
149 const auto& left_record = Record::Cast(left);
150 const auto& right_record = Record::Cast(right);
151 if (left_record.shape() != right_record.shape()) {
156 const intptr_t num_fields = left_record.num_fields();
157 for (intptr_t
i = 0;
i < num_fields; ++
i) {
158 left_field ^= left_record.FieldAt(
i);
159 right_field ^= right_record.FieldAt(
i);
172 if (left.GetTypeArguments() == right.GetTypeArguments()) {
182 right_type_arguments, num_type_args - num_type_params, num_type_params,
188 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
190 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
196 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
198 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
200 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(2));
202 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(3));
204 const bool is_instance_of =
instance.IsInstanceOf(
205 type, instantiator_type_arguments, function_type_arguments);
206 if (FLAG_trace_type_checks) {
208 const char* result_str = is_instance_of ?
"true" :
"false";
209 THR_Print(
"Native Object.instanceOf: result %s\n", result_str);
222 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
224 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(1));
227 const bool is_instance_of =
instance.IsInstanceOf(
228 type, Object::null_type_arguments(), Object::null_type_arguments());
234 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(0));
235 return type.UserVisibleName();
240 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(0));
241 intptr_t hash_val =
type.Hash();
249 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(0));
251 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
252 if (
type.ptr() == other.
ptr()) {
259 const Type&
type = Type::CheckedHandle(zone, arguments->NativeArgAt(0));
261 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
262 if (
type.ptr() == other.
ptr()) {
270 LibraryPrefix::CheckedHandle(zone, arguments->NativeArgAt(0));
276 LibraryPrefix::CheckedHandle(zone, arguments->NativeArgAt(0));
277 isolate->SetPrefixIsLoaded(
prefix);
283 LibraryPrefix::CheckedHandle(zone, arguments->NativeArgAt(0));
290 const Smi&
id = Smi::CheckedHandle(zone, arguments->NativeArgAt(0));
292 Array::Handle(zone, isolate->group()->object_store()->loading_units());
314 return arguments->NativeArgAt(0);
334 zone, isolate->group()->object_store()->allocate_object_stub());
335 ASSERT(!stub.IsUnknownDartCode());
339 const uword instructions_start =
340 reinterpret_cast<uword>(isolate->source()->snapshot_instructions);
341 return Smi::New(stub.PayloadStart() - instructions_start);
346 zone, isolate->group()->object_store()->allocate_object_stub());
347 ASSERT(!stub.IsUnknownDartCode());
351 const uword instructions_start =
352 reinterpret_cast<uword>(isolate->source()->snapshot_instructions);
353 return Smi::New((stub.PayloadStart() - instructions_start) + stub.Size());
357 const Class& instance_cls,
359 const Class& interface_cls,
370 if (cur_cls.
ptr() == interface_cls.
ptr()) {
371 *interface_type_args = instance_type_args.
ptr();
375 for (intptr_t
i = 0;
i < interfaces.
Length();
i++) {
376 interface ^= interfaces.
At(
i);
377 ASSERT(interface.IsFinalized());
378 cur_interface_cls = interface.type_class();
379 cur_interface_type_args =
380 interface.GetInstanceTypeArguments(thread,
false);
381 if (!cur_interface_type_args.
IsNull() &&
384 instance_type_args, Object::null_type_arguments(),
kNoneFree,
388 cur_interface_type_args, interface_cls,
389 interface_type_args)) {
403 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
405 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
408 intptr_t num_type_args = 0;
409 if (arguments->NativeTypeArgCount() >= 1) {
412 if (function_type_arg.IsType() &&
414 interface_cls = function_type_arg.
type_class();
418 if (num_type_args == 0) {
422 "single function type argument must specify a generic class")));
430 ((num_type_args > 0) &&
432 .NumTypeParameters() != num_type_args))) {
435 String::New(
"argument 'extract' is not a generic function or not one "
436 "accepting the correct number of type arguments")));
439 if (num_type_args > 0) {
446 instance_type_args =
instance.GetTypeArguments();
449 interface_cls, &interface_type_args)) {
451 zone,
String::New(
"type of argument 'instance' is not a subtype of "
452 "the function type argument")));
454 if (!interface_type_args.
IsNull()) {
458 for (intptr_t
i = 0;
i < num_type_args;
i++) {
462 extracted_type_args =
469 if (extracted_type_args.
IsNull()) {
476 args.SetAt(0, extracted_type_args);
490 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0));
492 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
495 return function_type_arguments.
Prepend(
496 zone, parent_type_arguments, smi_parent_len.Value(), smi_len.Value());
505 Closure::CheckedHandle(zone, arguments->NativeArgAt(0));
516 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
529 target.NumParentTypeArguments(),
target.NumTypeArguments()));
533 for (intptr_t
i = 0;
i < type_params.
Length(); ++
i) {
535 subtype = type_args_to_check.
IsNull() ? Object::dynamic_type().ptr()
536 : type_args_to_check.
TypeAt(
i);
543 &subtype, &supertype, instantiator_type_args, function_type_args)) {
550 ASSERT(caller_frame !=
nullptr);
565 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0));
566 const Smi& num_type_arguments =
567 Smi::CheckedHandle(zone, arguments->NativeArgAt(1));
568 bool all_dynamic = type_arguments.
IsNull();
570 all_dynamic ? num_type_arguments.
Value() : type_arguments.
Length();
574 for (intptr_t
i = 0;
i <
len;
i++) {
576 type_list.
SetAt(
i, Object::dynamic_type());
583 return type_list.
ptr();
588 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
596 if (
level == InvocationMirror::Level::kTopLevel) {
597 if (receiver.IsString())
return receiver.
ptr();
601 if (receiver.IsType()) {
602 const auto& cls =
Class::Handle(zone, Type::Cast(receiver).type_class());
604 if (!
error.IsNull()) {
609 function = cls.LookupConstructor(method_name);
611 function = cls.LookupFactory(method_name);
614 function = cls.LookupStaticFunction(method_name);
616 }
else if (receiver.IsClosure()) {
617 function = Closure::Cast(receiver).function();
621 cls = cls.SuperClass();
627 return function.UserVisibleSignature();
T extract(SkSpan< const uint8_t > &data)
static uint32_t hash(const SkShaderBase::GradientInfo &v)
virtual bool IsEquivalent(const Instance &other, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
static bool InstantiateAndTestSubtype(AbstractType *subtype, AbstractType *supertype, const TypeArguments &instantiator_type_args, const TypeArguments &function_type_args)
virtual ClassPtr type_class() const
const char * NameCString() const
static ArrayPtr NewBoxed(intptr_t type_args_len, intptr_t num_arguments, const Array &optional_arguments_names, Heap::Space space=Heap::kOld)
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
void MakeImmutable() const
ObjectPtr At(intptr_t index) const
void SetAt(intptr_t index, const Object &value) const
static const Bool & Get(bool value)
static const Bool & True()
intptr_t NumTypeArguments() const
ArrayPtr interfaces() const
ClassPtr SuperClass(ClassTable *class_table=nullptr) const
intptr_t NumTypeParameters(Thread *thread) const
static ObjectPtr InvokeClosure(Thread *thread, const Array &arguments)
static ObjectPtr InvokeFunction(const Function &function, const Array &arguments)
static DART_NORETURN void ThrowArgumentError(const Instance &arg)
static void CreateAndThrowTypeError(TokenPosition location, const AbstractType &src_type, const AbstractType &dst_type, const String &dst_name)
static DART_NORETURN void PropagateError(const Error &error)
intptr_t GetHash(ObjectPtr raw_obj) const
static void DecodeType(int type, Level *level, Kind *kind)
IsolateGroup * group() const
static LibraryPtr CoreLibrary()
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
static constexpr intptr_t kIllegalId
ObjectPtr IssueLoad() const
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
bool IsDartInstance() const
static FunctionPtr ResolveDynamicAnyArgs(Zone *zone, const Class &receiver_class, const String &function_name, bool allow_add)
static SmiPtr New(intptr_t value)
static bool IsValid(int64_t value)
@ kNoCrossThreadIteration
TokenPosition GetTokenPos() const
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
static Thread * Current()
bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
bool IsSubvectorEquivalent(const TypeArguments &other, intptr_t from_index, intptr_t len, TypeEquality kind, FunctionTypeMapping *function_type_equivalence=nullptr) const
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
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
StringPtr NameAt(intptr_t index) const
bool AllDynamicBounds() const
AbstractTypePtr BoundAt(intptr_t index) const
static TypePtr StringType()
static TypePtr New(const Class &clazz, const TypeArguments &arguments, Nullability nullability=Nullability::kNonNullable, Heap::Space space=Heap::kOld)
static TypePtr DartTypeType()
#define THR_Print(format,...)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const uint8_t uint32_t uint32_t GError ** error
Dart_NativeFunction function
static bool HaveSameRuntimeTypeHelper(Zone *zone, const Instance &left, const Instance &right)
void DeoptimizeFunctionsOnStack()
bool IsTypeClassId(intptr_t index)
bool IsArrayClassId(intptr_t index)
static intptr_t GetHash(Isolate *isolate, const ObjectPtr obj)
static bool ExtractInterfaceTypeArgs(Zone *zone, const Class &instance_cls, const TypeArguments &instance_type_args, const Class &interface_cls, TypeArguments *interface_type_args)
DEFINE_NATIVE_ENTRY(List_allocate, 0, 2)
bool IsIntegerClassId(intptr_t index)
bool IsStringClassId(intptr_t index)
std::function< void()> closure
#define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value)