| Index: runtime/vm/isolate.cc
|
| diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
|
| index 91b96648706524641bf07f74a37968400b8a7837..2d8bb4bfb638e2538f48d17e92a99fb18f81e5b6 100644
|
| --- a/runtime/vm/isolate.cc
|
| +++ b/runtime/vm/isolate.cc
|
| @@ -24,9 +24,9 @@
|
| #include "vm/lockers.h"
|
| #include "vm/log.h"
|
| #include "vm/message_handler.h"
|
| +#include "vm/object.h"
|
| #include "vm/object_id_ring.h"
|
| #include "vm/object_store.h"
|
| -#include "vm/object.h"
|
| #include "vm/os_thread.h"
|
| #include "vm/port.h"
|
| #include "vm/profiler.h"
|
| @@ -49,7 +49,6 @@
|
| #include "vm/verifier.h"
|
| #include "vm/visitor.h"
|
|
|
| -
|
| namespace dart {
|
|
|
| DECLARE_FLAG(bool, print_metrics);
|
| @@ -63,7 +62,6 @@ DECLARE_FLAG(int, reload_every);
|
| DECLARE_FLAG(bool, reload_every_back_off);
|
| DECLARE_FLAG(bool, trace_reload);
|
|
|
| -
|
| #if !defined(PRODUCT)
|
| static void CheckedModeHandler(bool value) {
|
| FLAG_enable_asserts = value;
|
| @@ -79,7 +77,6 @@ DEFINE_FLAG_HANDLER(CheckedModeHandler,
|
| DEFINE_FLAG_HANDLER(CheckedModeHandler, checked, "Enable checked mode.");
|
| #endif // !defined(PRODUCT)
|
|
|
| -
|
| // Quick access to the locally defined thread() and isolate() methods.
|
| #define T (thread())
|
| #define I (isolate())
|
| @@ -99,7 +96,6 @@ class VerifyOriginId : public IsolateVisitor {
|
| };
|
| #endif
|
|
|
| -
|
| static uint8_t* malloc_allocator(uint8_t* ptr,
|
| intptr_t old_size,
|
| intptr_t new_size) {
|
| @@ -111,7 +107,6 @@ static void malloc_deallocator(uint8_t* ptr) {
|
| free(reinterpret_cast<void*>(ptr));
|
| }
|
|
|
| -
|
| static void SerializeObject(const Instance& obj,
|
| uint8_t** obj_data,
|
| intptr_t* obj_len,
|
| @@ -134,23 +129,19 @@ static Message* SerializeMessage(Dart_Port dest_port, const Instance& obj) {
|
| }
|
| }
|
|
|
| -
|
| bool IsolateVisitor::IsVMInternalIsolate(Isolate* isolate) const {
|
| return ((isolate == Dart::vm_isolate()) ||
|
| ServiceIsolate::IsServiceIsolateDescendant(isolate));
|
| }
|
|
|
| -
|
| NoOOBMessageScope::NoOOBMessageScope(Thread* thread) : StackResource(thread) {
|
| thread->DeferOOBMessageInterrupts();
|
| }
|
|
|
| -
|
| NoOOBMessageScope::~NoOOBMessageScope() {
|
| thread()->RestoreOOBMessageInterrupts();
|
| }
|
|
|
| -
|
| NoReloadScope::NoReloadScope(Isolate* isolate, Thread* thread)
|
| : StackResource(thread), isolate_(isolate) {
|
| ASSERT(isolate_ != NULL);
|
| @@ -159,14 +150,12 @@ NoReloadScope::NoReloadScope(Isolate* isolate, Thread* thread)
|
| 0);
|
| }
|
|
|
| -
|
| NoReloadScope::~NoReloadScope() {
|
| AtomicOperations::FetchAndDecrement(&(isolate_->no_reload_scope_depth_));
|
| ASSERT(AtomicOperations::LoadRelaxed(&(isolate_->no_reload_scope_depth_)) >=
|
| 0);
|
| }
|
|
|
| -
|
| void Isolate::RegisterClass(const Class& cls) {
|
| #if !defined(PRODUCT)
|
| if (IsReloading()) {
|
| @@ -177,17 +166,14 @@ void Isolate::RegisterClass(const Class& cls) {
|
| class_table()->Register(cls);
|
| }
|
|
|
| -
|
| void Isolate::RegisterClassAt(intptr_t index, const Class& cls) {
|
| class_table()->RegisterAt(index, cls);
|
| }
|
|
|
| -
|
| void Isolate::ValidateClassTable() {
|
| class_table()->Validate();
|
| }
|
|
|
| -
|
| void Isolate::SendInternalLibMessage(LibMsgId msg_id, uint64_t capability) {
|
| const Array& msg = Array::Handle(Array::New(3));
|
| Object& element = Object::Handle();
|
| @@ -207,7 +193,6 @@ void Isolate::SendInternalLibMessage(LibMsgId msg_id, uint64_t capability) {
|
| Message::kOOBPriority));
|
| }
|
|
|
| -
|
| class IsolateMessageHandler : public MessageHandler {
|
| public:
|
| explicit IsolateMessageHandler(Isolate* isolate);
|
| @@ -237,18 +222,15 @@ class IsolateMessageHandler : public MessageHandler {
|
| Isolate* isolate_;
|
| };
|
|
|
| -
|
| IsolateMessageHandler::IsolateMessageHandler(Isolate* isolate)
|
| : isolate_(isolate) {}
|
|
|
| -
|
| IsolateMessageHandler::~IsolateMessageHandler() {}
|
|
|
| const char* IsolateMessageHandler::name() const {
|
| return isolate_->name();
|
| }
|
|
|
| -
|
| // Isolate library OOB messages are fixed sized arrays which have the
|
| // following format:
|
| // [ OOB dispatch, Isolate library dispatch, <message specific data> ]
|
| @@ -430,7 +412,6 @@ RawError* IsolateMessageHandler::HandleLibMessage(const Array& message) {
|
| return Error::null();
|
| }
|
|
|
| -
|
| void IsolateMessageHandler::MessageNotify(Message::Priority priority) {
|
| if (priority >= Message::kOOBPriority) {
|
| // Handle out of band messages even if the mutator thread is busy.
|
| @@ -443,7 +424,6 @@ void IsolateMessageHandler::MessageNotify(Message::Priority priority) {
|
| }
|
| }
|
|
|
| -
|
| MessageHandler::MessageStatus IsolateMessageHandler::HandleMessage(
|
| Message* message) {
|
| ASSERT(IsCurrentIsolate());
|
| @@ -589,7 +569,6 @@ MessageHandler::MessageStatus IsolateMessageHandler::HandleMessage(
|
| return status;
|
| }
|
|
|
| -
|
| #ifndef PRODUCT
|
| void IsolateMessageHandler::NotifyPauseOnStart() {
|
| if (!FLAG_support_service) {
|
| @@ -607,7 +586,6 @@ void IsolateMessageHandler::NotifyPauseOnStart() {
|
| }
|
| }
|
|
|
| -
|
| void IsolateMessageHandler::NotifyPauseOnExit() {
|
| if (!FLAG_support_service) {
|
| return;
|
| @@ -624,19 +602,16 @@ void IsolateMessageHandler::NotifyPauseOnExit() {
|
| }
|
| #endif // !PRODUCT
|
|
|
| -
|
| #if defined(DEBUG)
|
| void IsolateMessageHandler::CheckAccess() {
|
| ASSERT(IsCurrentIsolate());
|
| }
|
| #endif
|
|
|
| -
|
| bool IsolateMessageHandler::IsCurrentIsolate() const {
|
| return (I == Isolate::Current());
|
| }
|
|
|
| -
|
| static MessageHandler::MessageStatus StoreError(Thread* thread,
|
| const Error& error) {
|
| thread->set_sticky_error(error);
|
| @@ -649,7 +624,6 @@ static MessageHandler::MessageStatus StoreError(Thread* thread,
|
| return MessageHandler::kError;
|
| }
|
|
|
| -
|
| MessageHandler::MessageStatus IsolateMessageHandler::ProcessUnhandledException(
|
| const Error& result) {
|
| NoReloadScope no_reload_scope(T->isolate(), T);
|
| @@ -709,7 +683,6 @@ MessageHandler::MessageStatus IsolateMessageHandler::ProcessUnhandledException(
|
| return kOK;
|
| }
|
|
|
| -
|
| void Isolate::FlagsInitialize(Dart_IsolateFlags* api_flags) {
|
| api_flags->version = DART_FLAGS_CURRENT_VERSION;
|
| #define INIT_FROM_FLAG(name, isolate_flag, flag) api_flags->isolate_flag = flag;
|
| @@ -717,7 +690,6 @@ void Isolate::FlagsInitialize(Dart_IsolateFlags* api_flags) {
|
| #undef INIT_FROM_FLAG
|
| }
|
|
|
| -
|
| void Isolate::FlagsCopyTo(Dart_IsolateFlags* api_flags) const {
|
| api_flags->version = DART_FLAGS_CURRENT_VERSION;
|
| #define INIT_FROM_FIELD(name, isolate_flag, flag) \
|
| @@ -726,7 +698,6 @@ void Isolate::FlagsCopyTo(Dart_IsolateFlags* api_flags) const {
|
| #undef INIT_FROM_FIELD
|
| }
|
|
|
| -
|
| #if !defined(PRODUCT)
|
| void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) {
|
| #define SET_FROM_FLAG(name, isolate_flag, flag) \
|
| @@ -737,7 +708,6 @@ void Isolate::FlagsCopyFrom(const Dart_IsolateFlags& api_flags) {
|
| }
|
| #endif // !defined(PRODUCT)
|
|
|
| -
|
| #if defined(DEBUG)
|
| // static
|
| void BaseIsolate::AssertCurrent(BaseIsolate* isolate) {
|
| @@ -894,7 +864,6 @@ Isolate::~Isolate() {
|
| delete thread_registry_;
|
| }
|
|
|
| -
|
| void Isolate::InitOnce() {
|
| create_callback_ = NULL;
|
| isolates_list_monitor_ = new Monitor();
|
| @@ -902,7 +871,6 @@ void Isolate::InitOnce() {
|
| EnableIsolateCreation();
|
| }
|
|
|
| -
|
| Isolate* Isolate::Init(const char* name_prefix,
|
| const Dart_IsolateFlags& api_flags,
|
| bool is_vm_isolate) {
|
| @@ -982,20 +950,17 @@ Isolate* Isolate::Init(const char* name_prefix,
|
| return result;
|
| }
|
|
|
| -
|
| Thread* Isolate::mutator_thread() const {
|
| ASSERT(thread_registry() != NULL);
|
| return thread_registry()->mutator_thread();
|
| }
|
|
|
| -
|
| void Isolate::SetupImagePage(const uint8_t* image_buffer, bool is_executable) {
|
| Image image(image_buffer);
|
| heap_->SetupImagePage(image.object_start(), image.object_size(),
|
| is_executable);
|
| }
|
|
|
| -
|
| void Isolate::ScheduleMessageInterrupts() {
|
| // We take the threads lock here to ensure that the mutator thread does not
|
| // exit the isolate while we are trying to schedule interrupts on it.
|
| @@ -1006,23 +971,19 @@ void Isolate::ScheduleMessageInterrupts() {
|
| }
|
| }
|
|
|
| -
|
| void Isolate::set_debugger_name(const char* name) {
|
| free(debugger_name_);
|
| debugger_name_ = strdup(name);
|
| }
|
|
|
| -
|
| int64_t Isolate::UptimeMicros() const {
|
| return OS::GetCurrentMonotonicMicros() - start_time_micros_;
|
| }
|
|
|
| -
|
| bool Isolate::IsPaused() const {
|
| return (debugger_ != NULL) && (debugger_->PauseEvent() != NULL);
|
| }
|
|
|
| -
|
| RawError* Isolate::PausePostRequest() {
|
| if (!FLAG_support_debugger) {
|
| return Error::null();
|
| @@ -1043,7 +1004,6 @@ RawError* Isolate::PausePostRequest() {
|
| return Error::null();
|
| }
|
|
|
| -
|
| void Isolate::BuildName(const char* name_prefix) {
|
| ASSERT(name_ == NULL);
|
| if (name_prefix == NULL) {
|
| @@ -1057,7 +1017,6 @@ void Isolate::BuildName(const char* name_prefix) {
|
| name_ = OS::SCreate(NULL, "%s-%" Pd64 "", name_prefix, main_port());
|
| }
|
|
|
| -
|
| void Isolate::DoneLoading() {
|
| GrowableObjectArray& libs =
|
| GrowableObjectArray::Handle(current_zone(), object_store()->libraries());
|
| @@ -1074,7 +1033,6 @@ void Isolate::DoneLoading() {
|
| TokenStream::CloseSharedTokenList(this);
|
| }
|
|
|
| -
|
| bool Isolate::CanReload() const {
|
| #ifndef PRODUCT
|
| return !ServiceIsolate::IsServiceIsolateDescendant(this) && is_runnable() &&
|
| @@ -1086,7 +1044,6 @@ bool Isolate::CanReload() const {
|
| #endif
|
| }
|
|
|
| -
|
| #ifndef PRODUCT
|
| bool Isolate::ReloadSources(JSONStream* js,
|
| bool force_reload,
|
| @@ -1104,7 +1061,6 @@ bool Isolate::ReloadSources(JSONStream* js,
|
| return success;
|
| }
|
|
|
| -
|
| void Isolate::DeleteReloadContext() {
|
| // Another thread may be in the middle of GetClassForHeapWalkAt.
|
| Thread* thread = Thread::Current();
|
| @@ -1115,7 +1071,6 @@ void Isolate::DeleteReloadContext() {
|
| }
|
| #endif // !PRODUCT
|
|
|
| -
|
| void Isolate::DoneFinalizing() {
|
| #if !defined(PRODUCT)
|
| if (IsReloading()) {
|
| @@ -1124,7 +1079,6 @@ void Isolate::DoneFinalizing() {
|
| #endif // !defined(PRODUCT)
|
| }
|
|
|
| -
|
| bool Isolate::MakeRunnable() {
|
| ASSERT(Isolate::Current() == NULL);
|
|
|
| @@ -1180,19 +1134,16 @@ bool Isolate::MakeRunnable() {
|
| return true;
|
| }
|
|
|
| -
|
| bool Isolate::VerifyPauseCapability(const Object& capability) const {
|
| return !capability.IsNull() && capability.IsCapability() &&
|
| (pause_capability() == Capability::Cast(capability).Id());
|
| }
|
|
|
| -
|
| bool Isolate::VerifyTerminateCapability(const Object& capability) const {
|
| return !capability.IsNull() && capability.IsCapability() &&
|
| (terminate_capability() == Capability::Cast(capability).Id());
|
| }
|
|
|
| -
|
| bool Isolate::AddResumeCapability(const Capability& capability) {
|
| // Ensure a limit for the number of resume capabilities remembered.
|
| static const intptr_t kMaxResumeCapabilities = kSmiMax / (6 * kWordSize);
|
| @@ -1225,7 +1176,6 @@ bool Isolate::AddResumeCapability(const Capability& capability) {
|
| return true;
|
| }
|
|
|
| -
|
| bool Isolate::RemoveResumeCapability(const Capability& capability) {
|
| const GrowableObjectArray& caps = GrowableObjectArray::Handle(
|
| current_zone(), object_store()->resume_capabilities());
|
| @@ -1242,7 +1192,6 @@ bool Isolate::RemoveResumeCapability(const Capability& capability) {
|
| return false;
|
| }
|
|
|
| -
|
| // TODO(iposva): Remove duplicated code and start using some hash based
|
| // structure instead of these linear lookups.
|
| void Isolate::AddExitListener(const SendPort& listener,
|
| @@ -1280,7 +1229,6 @@ void Isolate::AddExitListener(const SendPort& listener,
|
| }
|
| }
|
|
|
| -
|
| void Isolate::RemoveExitListener(const SendPort& listener) {
|
| const GrowableObjectArray& listeners = GrowableObjectArray::Handle(
|
| current_zone(), object_store()->exit_listeners());
|
| @@ -1297,7 +1245,6 @@ void Isolate::RemoveExitListener(const SendPort& listener) {
|
| }
|
| }
|
|
|
| -
|
| void Isolate::NotifyExitListeners() {
|
| const GrowableObjectArray& listeners = GrowableObjectArray::Handle(
|
| current_zone(), this->object_store()->exit_listeners());
|
| @@ -1315,7 +1262,6 @@ void Isolate::NotifyExitListeners() {
|
| }
|
| }
|
|
|
| -
|
| void Isolate::AddErrorListener(const SendPort& listener) {
|
| // Ensure a limit for the number of listeners remembered.
|
| static const intptr_t kMaxListeners = kSmiMax / (6 * kWordSize);
|
| @@ -1347,7 +1293,6 @@ void Isolate::AddErrorListener(const SendPort& listener) {
|
| }
|
| }
|
|
|
| -
|
| void Isolate::RemoveErrorListener(const SendPort& listener) {
|
| const GrowableObjectArray& listeners = GrowableObjectArray::Handle(
|
| current_zone(), object_store()->error_listeners());
|
| @@ -1363,7 +1308,6 @@ void Isolate::RemoveErrorListener(const SendPort& listener) {
|
| }
|
| }
|
|
|
| -
|
| bool Isolate::NotifyErrorListeners(const String& msg,
|
| const String& stacktrace) {
|
| const GrowableObjectArray& listeners = GrowableObjectArray::Handle(
|
| @@ -1384,7 +1328,6 @@ bool Isolate::NotifyErrorListeners(const String& msg,
|
| return listeners.Length() > 0;
|
| }
|
|
|
| -
|
| static MessageHandler::MessageStatus RunIsolate(uword parameter) {
|
| Isolate* isolate = reinterpret_cast<Isolate*>(parameter);
|
| IsolateSpawnState* state = NULL;
|
| @@ -1416,7 +1359,6 @@ static MessageHandler::MessageStatus RunIsolate(uword parameter) {
|
|
|
| // Switch back to spawning isolate.
|
|
|
| -
|
| if (!ClassFinalizer::ProcessPendingClasses()) {
|
| // Error is in sticky error already.
|
| #if defined(DEBUG)
|
| @@ -1491,7 +1433,6 @@ static MessageHandler::MessageStatus RunIsolate(uword parameter) {
|
| return MessageHandler::kOK;
|
| }
|
|
|
| -
|
| static void ShutdownIsolate(uword parameter) {
|
| Isolate* isolate = reinterpret_cast<Isolate*>(parameter);
|
| // We must wait for any outstanding spawn calls to complete before
|
| @@ -1526,7 +1467,6 @@ static void ShutdownIsolate(uword parameter) {
|
| Dart::ShutdownIsolate(isolate);
|
| }
|
|
|
| -
|
| void Isolate::SetStickyError(RawError* sticky_error) {
|
| ASSERT(
|
| ((sticky_error_ == Error::null()) || (sticky_error == Error::null())) &&
|
| @@ -1534,13 +1474,11 @@ void Isolate::SetStickyError(RawError* sticky_error) {
|
| sticky_error_ = sticky_error;
|
| }
|
|
|
| -
|
| void Isolate::Run() {
|
| message_handler()->Run(Dart::thread_pool(), RunIsolate, ShutdownIsolate,
|
| reinterpret_cast<uword>(this));
|
| }
|
|
|
| -
|
| void Isolate::AddClosureFunction(const Function& function) const {
|
| ASSERT(!Compiler::IsBackgroundCompilation());
|
| GrowableObjectArray& closures =
|
| @@ -1550,7 +1488,6 @@ void Isolate::AddClosureFunction(const Function& function) const {
|
| closures.Add(function, Heap::kOld);
|
| }
|
|
|
| -
|
| // If the linear lookup turns out to be too expensive, the list
|
| // of closures could be maintained in a hash map, with the key
|
| // being the token position of the closure. There are almost no
|
| @@ -1574,7 +1511,6 @@ RawFunction* Isolate::LookupClosureFunction(const Function& parent,
|
| return Function::null();
|
| }
|
|
|
| -
|
| intptr_t Isolate::FindClosureIndex(const Function& needle) const {
|
| const GrowableObjectArray& closures_array =
|
| GrowableObjectArray::Handle(object_store()->closure_functions());
|
| @@ -1587,7 +1523,6 @@ intptr_t Isolate::FindClosureIndex(const Function& needle) const {
|
| return -1;
|
| }
|
|
|
| -
|
| RawFunction* Isolate::ClosureFunctionFromIndex(intptr_t idx) const {
|
| const GrowableObjectArray& closures_array =
|
| GrowableObjectArray::Handle(object_store()->closure_functions());
|
| @@ -1597,7 +1532,6 @@ RawFunction* Isolate::ClosureFunctionFromIndex(intptr_t idx) const {
|
| return Function::RawCast(closures_array.At(idx));
|
| }
|
|
|
| -
|
| class FinalizeWeakPersistentHandlesVisitor : public HandleVisitor {
|
| public:
|
| FinalizeWeakPersistentHandlesVisitor() : HandleVisitor(Thread::Current()) {}
|
| @@ -1612,7 +1546,6 @@ class FinalizeWeakPersistentHandlesVisitor : public HandleVisitor {
|
| DISALLOW_COPY_AND_ASSIGN(FinalizeWeakPersistentHandlesVisitor);
|
| };
|
|
|
| -
|
| void Isolate::LowLevelShutdown() {
|
| // Ensure we have a zone and handle scope so that we can call VM functions,
|
| // but we no longer allocate new heap objects.
|
| @@ -1635,7 +1568,6 @@ void Isolate::LowLevelShutdown() {
|
| debugger()->Shutdown();
|
| }
|
|
|
| -
|
| // Close all the ports owned by this isolate.
|
| PortMap::ClosePorts(message_handler());
|
|
|
| @@ -1684,7 +1616,6 @@ void Isolate::LowLevelShutdown() {
|
| }
|
| }
|
|
|
| -
|
| void Isolate::StopBackgroundCompiler() {
|
| // Wait until all background compilation has finished.
|
| if (background_compiler_ != NULL) {
|
| @@ -1692,7 +1623,6 @@ void Isolate::StopBackgroundCompiler() {
|
| }
|
| }
|
|
|
| -
|
| void Isolate::MaybeIncreaseReloadEveryNStackOverflowChecks() {
|
| if (FLAG_reload_every_back_off) {
|
| if (reload_every_n_stack_overflow_checks_ < 5000) {
|
| @@ -1707,7 +1637,6 @@ void Isolate::MaybeIncreaseReloadEveryNStackOverflowChecks() {
|
| }
|
| }
|
|
|
| -
|
| void Isolate::Shutdown() {
|
| ASSERT(this == Isolate::Current());
|
| StopBackgroundCompiler();
|
| @@ -1783,7 +1712,6 @@ void Isolate::Shutdown() {
|
| }
|
| }
|
|
|
| -
|
| Dart_IsolateCreateCallback Isolate::create_callback_ = NULL;
|
| Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL;
|
| Dart_IsolateCleanupCallback Isolate::cleanup_callback_ = NULL;
|
| @@ -1798,14 +1726,12 @@ void Isolate::IterateObjectPointers(ObjectPointerVisitor* visitor,
|
| VisitObjectPointers(visitor, validate_frames);
|
| }
|
|
|
| -
|
| void Isolate::IterateStackPointers(ObjectPointerVisitor* visitor,
|
| bool validate_frames) {
|
| HeapIterationScope heap_iteration_scope;
|
| VisitStackPointers(visitor, validate_frames);
|
| }
|
|
|
| -
|
| void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor,
|
| bool validate_frames) {
|
| ASSERT(visitor != NULL);
|
| @@ -1882,26 +1808,22 @@ void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor,
|
| VisitStackPointers(visitor, validate_frames);
|
| }
|
|
|
| -
|
| void Isolate::VisitStackPointers(ObjectPointerVisitor* visitor,
|
| bool validate_frames) {
|
| // Visit objects in all threads (e.g., Dart stack, handles in zones).
|
| thread_registry()->VisitObjectPointers(visitor, validate_frames);
|
| }
|
|
|
| -
|
| void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor) {
|
| if (api_state() != NULL) {
|
| api_state()->VisitWeakHandles(visitor);
|
| }
|
| }
|
|
|
| -
|
| void Isolate::PrepareForGC() {
|
| thread_registry()->PrepareForGC();
|
| }
|
|
|
| -
|
| RawClass* Isolate::GetClassForHeapWalkAt(intptr_t cid) {
|
| RawClass* raw_class = NULL;
|
| #ifndef PRODUCT
|
| @@ -1918,7 +1840,6 @@ RawClass* Isolate::GetClassForHeapWalkAt(intptr_t cid) {
|
| return raw_class;
|
| }
|
|
|
| -
|
| void Isolate::AddPendingDeopt(uword fp, uword pc) {
|
| // GrowableArray::Add is not atomic and may be interrupt by a profiler
|
| // stack walk.
|
| @@ -1937,7 +1858,6 @@ void Isolate::AddPendingDeopt(uword fp, uword pc) {
|
| delete old_pending_deopts;
|
| }
|
|
|
| -
|
| uword Isolate::FindPendingDeopt(uword fp) const {
|
| for (intptr_t i = 0; i < pending_deopts_->length(); i++) {
|
| if ((*pending_deopts_)[i].fp() == fp) {
|
| @@ -1948,7 +1868,6 @@ uword Isolate::FindPendingDeopt(uword fp) const {
|
| return 0;
|
| }
|
|
|
| -
|
| void Isolate::ClearPendingDeoptsAtOrBelow(uword fp) const {
|
| for (intptr_t i = pending_deopts_->length() - 1; i >= 0; i--) {
|
| if ((*pending_deopts_)[i].fp() <= fp) {
|
| @@ -1957,7 +1876,6 @@ void Isolate::ClearPendingDeoptsAtOrBelow(uword fp) const {
|
| }
|
| }
|
|
|
| -
|
| #ifndef PRODUCT
|
| static const char* ExceptionPauseInfoToServiceEnum(Dart_ExceptionPauseInfo pi) {
|
| switch (pi) {
|
| @@ -1973,7 +1891,6 @@ static const char* ExceptionPauseInfoToServiceEnum(Dart_ExceptionPauseInfo pi) {
|
| }
|
| }
|
|
|
| -
|
| void Isolate::PrintJSON(JSONStream* stream, bool ref) {
|
| if (!FLAG_support_service) {
|
| return;
|
| @@ -2108,12 +2025,10 @@ void Isolate::PrintJSON(JSONStream* stream, bool ref) {
|
| }
|
| #endif
|
|
|
| -
|
| void Isolate::set_tag_table(const GrowableObjectArray& value) {
|
| tag_table_ = value.raw();
|
| }
|
|
|
| -
|
| void Isolate::set_current_tag(const UserTag& tag) {
|
| uword user_tag = tag.tag();
|
| ASSERT(user_tag < kUwordMax);
|
| @@ -2121,7 +2036,6 @@ void Isolate::set_current_tag(const UserTag& tag) {
|
| current_tag_ = tag.raw();
|
| }
|
|
|
| -
|
| void Isolate::set_default_tag(const UserTag& tag) {
|
| default_tag_ = tag.raw();
|
| }
|
| @@ -2130,13 +2044,11 @@ void Isolate::set_ic_miss_code(const Code& code) {
|
| ic_miss_code_ = code.raw();
|
| }
|
|
|
| -
|
| void Isolate::set_deoptimized_code_array(const GrowableObjectArray& value) {
|
| ASSERT(Thread::Current()->IsMutatorThread());
|
| deoptimized_code_array_ = value.raw();
|
| }
|
|
|
| -
|
| void Isolate::TrackDeoptimizedCode(const Code& code) {
|
| ASSERT(!code.IsNull());
|
| const GrowableObjectArray& deoptimized_code =
|
| @@ -2150,24 +2062,20 @@ void Isolate::TrackDeoptimizedCode(const Code& code) {
|
| deoptimized_code.Add(code);
|
| }
|
|
|
| -
|
| void Isolate::clear_sticky_error() {
|
| sticky_error_ = Error::null();
|
| }
|
|
|
| -
|
| void Isolate::set_pending_service_extension_calls(
|
| const GrowableObjectArray& value) {
|
| pending_service_extension_calls_ = value.raw();
|
| }
|
|
|
| -
|
| void Isolate::set_registered_service_extension_handlers(
|
| const GrowableObjectArray& value) {
|
| registered_service_extension_handlers_ = value.raw();
|
| }
|
|
|
| -
|
| void Isolate::AddDeoptimizingBoxedField(const Field& field) {
|
| ASSERT(Compiler::IsBackgroundCompilation());
|
| ASSERT(!field.IsOriginal());
|
| @@ -2182,7 +2090,6 @@ void Isolate::AddDeoptimizingBoxedField(const Field& field) {
|
| array.Add(Field::Handle(field.Original()), Heap::kOld);
|
| }
|
|
|
| -
|
| RawField* Isolate::GetDeoptimizingBoxedField() {
|
| ASSERT(Thread::Current()->IsMutatorThread());
|
| SafepointMutexLocker ml(field_list_mutex_);
|
| @@ -2197,7 +2104,6 @@ RawField* Isolate::GetDeoptimizingBoxedField() {
|
| return Field::RawCast(array.RemoveLast());
|
| }
|
|
|
| -
|
| #ifndef PRODUCT
|
| RawObject* Isolate::InvokePendingServiceExtensionCalls() {
|
| if (!FLAG_support_service) {
|
| @@ -2275,14 +2181,12 @@ RawObject* Isolate::InvokePendingServiceExtensionCalls() {
|
| return Object::null();
|
| }
|
|
|
| -
|
| RawGrowableObjectArray* Isolate::GetAndClearPendingServiceExtensionCalls() {
|
| RawGrowableObjectArray* r = pending_service_extension_calls_;
|
| pending_service_extension_calls_ = GrowableObjectArray::null();
|
| return r;
|
| }
|
|
|
| -
|
| void Isolate::AppendServiceExtensionCall(const Instance& closure,
|
| const String& method_name,
|
| const Array& parameter_keys,
|
| @@ -2314,7 +2218,6 @@ void Isolate::AppendServiceExtensionCall(const Instance& closure,
|
| calls.Add(id);
|
| }
|
|
|
| -
|
| // This function is written in C++ and not Dart because we must do this
|
| // operation atomically in the face of random OOB messages. Do not port
|
| // to Dart code unless you can ensure that the operations will can be
|
| @@ -2350,7 +2253,6 @@ void Isolate::RegisterServiceExtensionHandler(const String& name,
|
| }
|
| }
|
|
|
| -
|
| // This function is written in C++ and not Dart because we must do this
|
| // operation atomically in the face of random OOB messages. Do not port
|
| // to Dart code unless you can ensure that the operations will can be
|
| @@ -2376,14 +2278,12 @@ RawInstance* Isolate::LookupServiceExtensionHandler(const String& name) {
|
| }
|
| #endif // !PRODUCT
|
|
|
| -
|
| void Isolate::WakePauseEventHandler(Dart_Isolate isolate) {
|
| Isolate* iso = reinterpret_cast<Isolate*>(isolate);
|
| MonitorLocker ml(iso->pause_loop_monitor_);
|
| ml.Notify();
|
| }
|
|
|
| -
|
| void Isolate::PauseEventHandler() {
|
| // We are stealing a pause event (like a breakpoint) from the
|
| // embedder. We don't know what kind of thread we are on -- it
|
| @@ -2433,7 +2333,6 @@ void Isolate::PauseEventHandler() {
|
| Dart_ExitScope();
|
| }
|
|
|
| -
|
| void Isolate::VisitIsolates(IsolateVisitor* visitor) {
|
| if (visitor == NULL) {
|
| return;
|
| @@ -2448,7 +2347,6 @@ void Isolate::VisitIsolates(IsolateVisitor* visitor) {
|
| }
|
| }
|
|
|
| -
|
| intptr_t Isolate::IsolateListLength() {
|
| MonitorLocker ml(isolates_list_monitor_);
|
| intptr_t count = 0;
|
| @@ -2460,7 +2358,6 @@ intptr_t Isolate::IsolateListLength() {
|
| return count;
|
| }
|
|
|
| -
|
| bool Isolate::AddIsolateToList(Isolate* isolate) {
|
| MonitorLocker ml(isolates_list_monitor_);
|
| if (!creation_enabled_) {
|
| @@ -2473,7 +2370,6 @@ bool Isolate::AddIsolateToList(Isolate* isolate) {
|
| return true;
|
| }
|
|
|
| -
|
| void Isolate::RemoveIsolateFromList(Isolate* isolate) {
|
| MonitorLocker ml(isolates_list_monitor_);
|
| ASSERT(isolate != NULL);
|
| @@ -2502,25 +2398,21 @@ void Isolate::RemoveIsolateFromList(Isolate* isolate) {
|
| ASSERT(!creation_enabled_);
|
| }
|
|
|
| -
|
| void Isolate::DisableIsolateCreation() {
|
| MonitorLocker ml(isolates_list_monitor_);
|
| creation_enabled_ = false;
|
| }
|
|
|
| -
|
| void Isolate::EnableIsolateCreation() {
|
| MonitorLocker ml(isolates_list_monitor_);
|
| creation_enabled_ = true;
|
| }
|
|
|
| -
|
| bool Isolate::IsolateCreationEnabled() {
|
| MonitorLocker ml(isolates_list_monitor_);
|
| return creation_enabled_;
|
| }
|
|
|
| -
|
| void Isolate::KillLocked(LibMsgId msg_id) {
|
| Dart_CObject kill_msg;
|
| Dart_CObject* list_values[4];
|
| @@ -2561,7 +2453,6 @@ void Isolate::KillLocked(LibMsgId msg_id) {
|
| }
|
| }
|
|
|
| -
|
| class IsolateKillerVisitor : public IsolateVisitor {
|
| public:
|
| explicit IsolateKillerVisitor(Isolate::LibMsgId msg_id)
|
| @@ -2593,25 +2484,21 @@ class IsolateKillerVisitor : public IsolateVisitor {
|
| Isolate::LibMsgId msg_id_;
|
| };
|
|
|
| -
|
| void Isolate::KillAllIsolates(LibMsgId msg_id) {
|
| IsolateKillerVisitor visitor(msg_id);
|
| VisitIsolates(&visitor);
|
| }
|
|
|
| -
|
| void Isolate::KillIfExists(Isolate* isolate, LibMsgId msg_id) {
|
| IsolateKillerVisitor visitor(isolate, msg_id);
|
| VisitIsolates(&visitor);
|
| }
|
|
|
| -
|
| void Isolate::IncrementSpawnCount() {
|
| MonitorLocker ml(spawn_count_monitor_);
|
| spawn_count_++;
|
| }
|
|
|
| -
|
| void Isolate::WaitForOutstandingSpawns() {
|
| MonitorLocker ml(spawn_count_monitor_);
|
| while (spawn_count_ > 0) {
|
| @@ -2619,12 +2506,10 @@ void Isolate::WaitForOutstandingSpawns() {
|
| }
|
| }
|
|
|
| -
|
| Monitor* Isolate::threads_lock() const {
|
| return thread_registry_->threads_lock();
|
| }
|
|
|
| -
|
| Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) {
|
| // Schedule the thread into the isolate by associating
|
| // a 'Thread' structure with it (this is done while we are holding
|
| @@ -2676,7 +2561,6 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) {
|
| return thread;
|
| }
|
|
|
| -
|
| void Isolate::UnscheduleThread(Thread* thread,
|
| bool is_mutator,
|
| bool bypass_safepoint) {
|
| @@ -2721,7 +2605,6 @@ void Isolate::UnscheduleThread(Thread* thread,
|
| thread_registry()->ReturnThreadLocked(is_mutator, thread);
|
| }
|
|
|
| -
|
| static RawInstance* DeserializeObject(Thread* thread,
|
| uint8_t* obj_data,
|
| intptr_t obj_len) {
|
| @@ -2737,7 +2620,6 @@ static RawInstance* DeserializeObject(Thread* thread,
|
| return instance.raw();
|
| }
|
|
|
| -
|
| static const char* NewConstChar(const char* chars) {
|
| size_t len = strlen(chars);
|
| char* mem = new char[len + 1];
|
| @@ -2745,7 +2627,6 @@ static const char* NewConstChar(const char* chars) {
|
| return mem;
|
| }
|
|
|
| -
|
| IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port,
|
| Dart_Port origin_id,
|
| void* init_data,
|
| @@ -2799,7 +2680,6 @@ IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port,
|
| Isolate::Current()->FlagsCopyTo(isolate_flags());
|
| }
|
|
|
| -
|
| IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port,
|
| void* init_data,
|
| const char* script_url,
|
| @@ -2843,7 +2723,6 @@ IsolateSpawnState::IsolateSpawnState(Dart_Port parent_port,
|
| Isolate::Current()->FlagsCopyTo(isolate_flags());
|
| }
|
|
|
| -
|
| IsolateSpawnState::~IsolateSpawnState() {
|
| delete[] script_url_;
|
| delete[] package_root_;
|
| @@ -2855,7 +2734,6 @@ IsolateSpawnState::~IsolateSpawnState() {
|
| free(serialized_message_);
|
| }
|
|
|
| -
|
| RawObject* IsolateSpawnState::ResolveFunction() {
|
| Thread* thread = Thread::Current();
|
| Zone* zone = thread->zone();
|
| @@ -2933,18 +2811,15 @@ RawObject* IsolateSpawnState::ResolveFunction() {
|
| return func.raw();
|
| }
|
|
|
| -
|
| RawInstance* IsolateSpawnState::BuildArgs(Thread* thread) {
|
| return DeserializeObject(thread, serialized_args_, serialized_args_len_);
|
| }
|
|
|
| -
|
| RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) {
|
| return DeserializeObject(thread, serialized_message_,
|
| serialized_message_len_);
|
| }
|
|
|
| -
|
| void IsolateSpawnState::DecrementSpawnCount() {
|
| ASSERT(spawn_count_monitor_ != NULL);
|
| ASSERT(spawn_count_ != NULL);
|
|
|