OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 2779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 | 2790 |
2791 private: | 2791 private: |
2792 const Class& cls_; | 2792 const Class& cls_; |
2793 DISALLOW_COPY_AND_ASSIGN(CHACodeArray); | 2793 DISALLOW_COPY_AND_ASSIGN(CHACodeArray); |
2794 }; | 2794 }; |
2795 | 2795 |
2796 | 2796 |
2797 #if defined(DEBUG) | 2797 #if defined(DEBUG) |
2798 static bool IsMutatorOrAtSafepoint() { | 2798 static bool IsMutatorOrAtSafepoint() { |
2799 Thread* thread = Thread::Current(); | 2799 Thread* thread = Thread::Current(); |
2800 return thread->IsMutatorThread() || | 2800 return thread->IsMutatorThread() || thread->IsAtSafepoint(); |
2801 thread->isolate()->thread_registry()->AtSafepoint(); | |
2802 } | 2801 } |
2803 #endif | 2802 #endif |
2804 | 2803 |
2805 | 2804 |
2806 void Class::RegisterCHACode(const Code& code) { | 2805 void Class::RegisterCHACode(const Code& code) { |
2807 if (FLAG_trace_cha) { | 2806 if (FLAG_trace_cha) { |
2808 THR_Print("RegisterCHACode '%s' depends on class '%s'\n", | 2807 THR_Print("RegisterCHACode '%s' depends on class '%s'\n", |
2809 Function::Handle(code.function()).ToQualifiedCString(), ToCString()); | 2808 Function::Handle(code.function()).ToQualifiedCString(), ToCString()); |
2810 } | 2809 } |
2811 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); | 2810 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); |
(...skipping 7955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10767 // - invalidate dependent code of this prefix; | 10766 // - invalidate dependent code of this prefix; |
10768 // - mark this prefixes as loaded; | 10767 // - mark this prefixes as loaded; |
10769 // - complete the future associated with this prefix. | 10768 // - complete the future associated with this prefix. |
10770 const Library& deferred_lib = Library::Handle(GetLibrary(0)); | 10769 const Library& deferred_lib = Library::Handle(GetLibrary(0)); |
10771 if (deferred_lib.Loaded()) { | 10770 if (deferred_lib.Loaded()) { |
10772 this->set_is_loaded(); | 10771 this->set_is_loaded(); |
10773 return true; | 10772 return true; |
10774 } else if (deferred_lib.LoadNotStarted()) { | 10773 } else if (deferred_lib.LoadNotStarted()) { |
10775 Thread* thread = Thread::Current(); | 10774 Thread* thread = Thread::Current(); |
10776 Isolate* isolate = thread->isolate(); | 10775 Isolate* isolate = thread->isolate(); |
10777 Api::Scope api_scope(thread); | |
10778 Zone* zone = thread->zone(); | 10776 Zone* zone = thread->zone(); |
10779 deferred_lib.SetLoadRequested(); | 10777 deferred_lib.SetLoadRequested(); |
10780 const GrowableObjectArray& pending_deferred_loads = | 10778 const GrowableObjectArray& pending_deferred_loads = |
10781 GrowableObjectArray::Handle( | 10779 GrowableObjectArray::Handle( |
10782 isolate->object_store()->pending_deferred_loads()); | 10780 isolate->object_store()->pending_deferred_loads()); |
10783 pending_deferred_loads.Add(deferred_lib); | 10781 pending_deferred_loads.Add(deferred_lib); |
10784 const String& lib_url = String::Handle(zone, deferred_lib.url()); | 10782 const String& lib_url = String::Handle(zone, deferred_lib.url()); |
10785 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); | 10783 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); |
10786 handler(Dart_kImportTag, | 10784 { |
10787 Api::NewHandle(thread, importer()), | 10785 TransitionVMToNative transition(thread); |
10788 Api::NewHandle(thread, lib_url.raw())); | 10786 Api::Scope api_scope(thread); |
| 10787 handler(Dart_kImportTag, |
| 10788 Api::NewHandle(thread, importer()), |
| 10789 Api::NewHandle(thread, lib_url.raw())); |
| 10790 } |
10789 } else { | 10791 } else { |
10790 // Another load request is in flight. | 10792 // Another load request is in flight. |
10791 ASSERT(deferred_lib.LoadRequested()); | 10793 ASSERT(deferred_lib.LoadRequested()); |
10792 } | 10794 } |
10793 return false; // Load request not yet completed. | 10795 return false; // Load request not yet completed. |
10794 } | 10796 } |
10795 | 10797 |
10796 | 10798 |
10797 RawArray* LibraryPrefix::dependent_code() const { | 10799 RawArray* LibraryPrefix::dependent_code() const { |
10798 return raw_ptr()->dependent_code_; | 10800 return raw_ptr()->dependent_code_; |
(...skipping 11242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22041 return tag_label.ToCString(); | 22043 return tag_label.ToCString(); |
22042 } | 22044 } |
22043 | 22045 |
22044 | 22046 |
22045 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 22047 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
22046 Instance::PrintJSONImpl(stream, ref); | 22048 Instance::PrintJSONImpl(stream, ref); |
22047 } | 22049 } |
22048 | 22050 |
22049 | 22051 |
22050 } // namespace dart | 22052 } // namespace dart |
OLD | NEW |