Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 14e54ef0f8531a7356c80c7b8b86034117d7fdf6..14cdfcef3ce3bc7bf11a3eaab83bc7cc3a7ebe27 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -2773,8 +2773,7 @@ class CHACodeArray : public WeakCodeReferences { |
#if defined(DEBUG) |
static bool IsMutatorOrAtSafepoint() { |
Thread* thread = Thread::Current(); |
- return thread->IsMutatorThread() || |
- thread->isolate()->thread_registry()->AtSafepoint(); |
+ return thread->IsMutatorThread() || thread->IsAtSafepoint(); |
} |
#endif |
@@ -10684,7 +10683,6 @@ bool LibraryPrefix::LoadLibrary() const { |
} else if (deferred_lib.LoadNotStarted()) { |
Thread* thread = Thread::Current(); |
Isolate* isolate = thread->isolate(); |
- Api::Scope api_scope(thread); |
Zone* zone = thread->zone(); |
deferred_lib.SetLoadRequested(); |
const GrowableObjectArray& pending_deferred_loads = |
@@ -10693,9 +10691,13 @@ bool LibraryPrefix::LoadLibrary() const { |
pending_deferred_loads.Add(deferred_lib); |
const String& lib_url = String::Handle(zone, deferred_lib.url()); |
Dart_LibraryTagHandler handler = isolate->library_tag_handler(); |
- handler(Dart_kImportTag, |
- Api::NewHandle(thread, importer()), |
- Api::NewHandle(thread, lib_url.raw())); |
+ { |
+ TransitionVMToNative transition(thread); |
+ Api::Scope api_scope(thread); |
+ handler(Dart_kImportTag, |
+ Api::NewHandle(thread, importer()), |
+ Api::NewHandle(thread, lib_url.raw())); |
+ } |
} else { |
// Another load request is in flight. |
ASSERT(deferred_lib.LoadRequested()); |