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

#include <dart_entry.h>

Inheritance diagram for dart::DartLibraryCalls:
dart::AllStatic

Static Public Member Functions

static ObjectPtr InstanceCreate (const Library &library, const String &exception_name, const String &constructor_name, const Array &arguments)
 
static ObjectPtr ToString (const Instance &receiver)
 
static ObjectPtr HashCode (const Instance &receiver)
 
static ObjectPtr Equals (const Instance &left, const Instance &right)
 
static ObjectPtr LookupHandler (Dart_Port port_id)
 
static ObjectPtr HandleMessage (Dart_Port port_id, const Instance &message)
 
static ObjectPtr HandleFinalizerMessage (const FinalizerBase &finalizer)
 
static ObjectPtr LookupOpenPorts ()
 
static ObjectPtr DrainMicrotaskQueue ()
 
static ObjectPtr EnsureScheduleImmediate ()
 
static ObjectPtr RehashObjectsInDartCollection (Thread *thread, const Object &array_or_growable_array)
 
static ObjectPtr RehashObjectsInDartCore (Thread *thread, const Object &array_or_growable_array)
 

Detailed Description

Definition at line 267 of file dart_entry.h.

Member Function Documentation

◆ DrainMicrotaskQueue()

ObjectPtr dart::DartLibraryCalls::DrainMicrotaskQueue ( )
static

Definition at line 750 of file dart_entry.cc.

750 {
751 Zone* zone = Thread::Current()->zone();
752 Library& isolate_lib = Library::Handle(zone, Library::IsolateLibrary());
753 ASSERT(!isolate_lib.IsNull());
754 Function& function =
755 Function::Handle(zone, isolate_lib.LookupFunctionAllowPrivate(
756 Symbols::_runPendingImmediateCallback()));
757 const Object& result = Object::Handle(
758 zone, DartEntry::InvokeFunction(function, Object::empty_array()));
759 ASSERT(result.IsNull() || result.IsError());
760 return result.ptr();
761}
static ObjectPtr InvokeFunction(const Function &function, const Array &arguments)
Definition: dart_entry.cc:31
static LibraryPtr IsolateLibrary()
Definition: object.cc:14807
static Object & Handle()
Definition: object.h:407
Zone * zone() const
Definition: thread_state.h:37
static Thread * Current()
Definition: thread.h:362
#define ASSERT(E)
GAsyncResult * result
Dart_NativeFunction function
Definition: fuchsia.cc:51

◆ EnsureScheduleImmediate()

ObjectPtr dart::DartLibraryCalls::EnsureScheduleImmediate ( )
static

Definition at line 763 of file dart_entry.cc.

763 {
764 Zone* zone = Thread::Current()->zone();
765 const Library& async_lib = Library::Handle(zone, Library::AsyncLibrary());
766 ASSERT(!async_lib.IsNull());
767 const Function& function =
768 Function::Handle(zone, async_lib.LookupFunctionAllowPrivate(
769 Symbols::_ensureScheduleImmediate()));
770 ASSERT(!function.IsNull());
771 const Object& result = Object::Handle(
772 zone, DartEntry::InvokeFunction(function, Object::empty_array()));
773 ASSERT(result.IsNull() || result.IsError());
774 return result.ptr();
775}
static LibraryPtr AsyncLibrary()
Definition: object.cc:14779

◆ Equals()

ObjectPtr dart::DartLibraryCalls::Equals ( const Instance left,
const Instance right 
)
static

Definition at line 647 of file dart_entry.cc.

648 {
649 Thread* thread = Thread::Current();
650 Zone* zone = thread->zone();
651 const auto& function = Function::Handle(
652 zone, thread->isolate_group()->object_store()->_object_equals_function());
653 ASSERT(!function.IsNull());
654 const int kNumArguments = 2;
655 const Array& args = Array::Handle(zone, Array::New(kNumArguments));
656 args.SetAt(0, left);
657 args.SetAt(1, right);
658 const Object& result =
660 ASSERT(result.IsInstance() || result.IsError());
661 return result.ptr();
662}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition: object.h:10959
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ HandleFinalizerMessage()

ObjectPtr dart::DartLibraryCalls::HandleFinalizerMessage ( const FinalizerBase finalizer)
static

Definition at line 721 of file dart_entry.cc.

722 {
723 if (FLAG_trace_finalizers) {
724 THR_Print("Running finalizer %p callback on isolate %p\n",
725 finalizer.ptr()->untag(), finalizer.isolate());
726 }
727
728 auto* const thread = Thread::Current();
729 auto* const zone = thread->zone();
730 auto* const isolate = thread->isolate();
731 auto* const object_store = thread->isolate_group()->object_store();
732 auto& function = Function::Handle(zone);
733 if (finalizer.IsFinalizer()) {
734 function ^= object_store->handle_finalizer_message_function();
735 } else {
736 ASSERT(finalizer.IsNativeFinalizer());
737 function ^= object_store->handle_native_finalizer_message_function();
738 }
739 ASSERT(!function.IsNull());
740 Array& args =
741 Array::Handle(zone, isolate->isolate_object_store()->dart_args_1());
742 ASSERT(!args.IsNull());
743 args.SetAt(0, finalizer);
745 const Object& handler =
747 return handler.ptr();
748}
#define THR_Print(format,...)
Definition: log.h:20
static void DebuggerSetResumeIfStepping(Isolate *isolate)
Definition: dart_entry.cc:690

◆ HandleMessage()

ObjectPtr dart::DartLibraryCalls::HandleMessage ( Dart_Port  port_id,
const Instance message 
)
static

Definition at line 701 of file dart_entry.cc.

702 {
703 auto* const thread = Thread::Current();
704 auto* const zone = thread->zone();
705 auto* const isolate = thread->isolate();
706 auto* const object_store = thread->isolate_group()->object_store();
707 const auto& function =
708 Function::Handle(zone, object_store->handle_message_function());
709 ASSERT(!function.IsNull());
710 Array& args =
711 Array::Handle(zone, isolate->isolate_object_store()->dart_args_2());
712 ASSERT(!args.IsNull());
713 args.SetAt(0, Integer::Handle(zone, Integer::New(port_id)));
714 args.SetAt(1, message);
716 const Object& handler =
718 return handler.ptr();
719}
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
Definition: object.cc:22984
Win32Message message

◆ HashCode()

ObjectPtr dart::DartLibraryCalls::HashCode ( const Instance receiver)
static

Definition at line 631 of file dart_entry.cc.

631 {
632 Thread* thread = Thread::Current();
633 Zone* zone = thread->zone();
634 const auto& function = Function::Handle(
635 zone,
636 thread->isolate_group()->object_store()->_object_hash_code_function());
637 ASSERT(!function.IsNull());
638 const int kNumArguments = 1;
639 const Array& args = Array::Handle(zone, Array::New(kNumArguments));
640 args.SetAt(0, receiver);
641 const Object& result =
643 ASSERT(result.IsInstance() || result.IsError());
644 return result.ptr();
645}

◆ InstanceCreate()

ObjectPtr dart::DartLibraryCalls::InstanceCreate ( const Library library,
const String exception_name,
const String constructor_name,
const Array arguments 
)
static

Definition at line 583 of file dart_entry.cc.

586 {
587 const Class& cls = Class::Handle(lib.LookupClassAllowPrivate(class_name));
588 ASSERT(!cls.IsNull());
589 // For now, we only support a non-parameterized or raw type.
590 const int kNumExtraArgs = 1; // implicit rcvr arg.
591 const Instance& exception_object = Instance::Handle(Instance::New(cls));
592 const Array& constructor_arguments =
593 Array::Handle(Array::New(arguments.Length() + kNumExtraArgs));
594 constructor_arguments.SetAt(0, exception_object);
595 Object& obj = Object::Handle();
596 for (intptr_t i = 0; i < arguments.Length(); i++) {
597 obj = arguments.At(i);
598 constructor_arguments.SetAt((i + kNumExtraArgs), obj);
599 }
600
601 const String& function_name =
602 String::Handle(String::Concat(class_name, constructor_name));
603 const Function& constructor =
604 Function::Handle(cls.LookupConstructorAllowPrivate(function_name));
605 ASSERT(!constructor.IsNull());
606 const Object& retval = Object::Handle(
607 DartEntry::InvokeFunction(constructor, constructor_arguments));
608 ASSERT(retval.IsNull() || retval.IsError());
609 if (retval.IsError()) {
610 return retval.ptr();
611 }
612 return exception_object.ptr();
613}
static InstancePtr New(const Class &cls, Heap::Space space=Heap::kNew)
Definition: object.cc:20935
static StringPtr Concat(const String &str1, const String &str2, Heap::Space space=Heap::kNew)
Definition: object.cc:24037
const char *const class_name
const char *const function_name

◆ LookupHandler()

ObjectPtr dart::DartLibraryCalls::LookupHandler ( Dart_Port  port_id)
static

Definition at line 664 of file dart_entry.cc.

664 {
665 Thread* const thread = Thread::Current();
666 Zone* const zone = thread->zone();
667 const auto& function = Function::Handle(
668 zone, thread->isolate_group()->object_store()->lookup_port_handler());
669 ASSERT(!function.IsNull());
670 Array& args = Array::Handle(
671 zone, thread->isolate()->isolate_object_store()->dart_args_1());
672 ASSERT(!args.IsNull());
673 args.SetAt(0, Integer::Handle(zone, Integer::New(port_id)));
674 const Object& result =
676 return result.ptr();
677}

◆ LookupOpenPorts()

ObjectPtr dart::DartLibraryCalls::LookupOpenPorts ( )
static

Definition at line 679 of file dart_entry.cc.

679 {
680 Thread* thread = Thread::Current();
681 Zone* zone = thread->zone();
682 Function& function = Function::Handle(
683 zone, thread->isolate_group()->object_store()->lookup_open_ports());
684 ASSERT(!function.IsNull());
685 const Object& result = Object::Handle(
686 zone, DartEntry::InvokeFunction(function, Object::empty_array()));
687 return result.ptr();
688}

◆ RehashObjectsInDartCollection()

ObjectPtr dart::DartLibraryCalls::RehashObjectsInDartCollection ( Thread thread,
const Object array_or_growable_array 
)
static

Definition at line 792 of file dart_entry.cc.

794 {
795 auto zone = thread->zone();
796 const auto& collections_lib =
798 return RehashObjects(zone, collections_lib, array_or_growable_array);
799}
static LibraryPtr CollectionLibrary()
Definition: object.cc:14791
static ObjectPtr RehashObjects(Zone *zone, const Library &library, const Object &array_or_growable_array)
Definition: dart_entry.cc:777

◆ RehashObjectsInDartCore()

ObjectPtr dart::DartLibraryCalls::RehashObjectsInDartCore ( Thread thread,
const Object array_or_growable_array 
)
static

Definition at line 801 of file dart_entry.cc.

803 {
804 auto zone = thread->zone();
805 const auto& core_lib = Library::Handle(zone, Library::CoreLibrary());
806 return RehashObjects(zone, core_lib, array_or_growable_array);
807}
static LibraryPtr CoreLibrary()
Definition: object.cc:14787

◆ ToString()

ObjectPtr dart::DartLibraryCalls::ToString ( const Instance receiver)
static

Definition at line 615 of file dart_entry.cc.

615 {
616 Thread* thread = Thread::Current();
617 Zone* zone = thread->zone();
618 const auto& function = Function::Handle(
619 zone,
620 thread->isolate_group()->object_store()->_object_to_string_function());
621 ASSERT(!function.IsNull());
622 const int kNumArguments = 1;
623 const Array& args = Array::Handle(zone, Array::New(kNumArguments));
624 args.SetAt(0, receiver);
625 const Object& result =
627 ASSERT(result.IsInstance() || result.IsError());
628 return result.ptr();
629}

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