Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: runtime/vm/object.cc

Issue 1541073002: Implement safepointing of threads (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix-typo Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/native_entry.cc ('k') | runtime/vm/object_graph_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 2772
2773 private: 2773 private:
2774 const Class& cls_; 2774 const Class& cls_;
2775 DISALLOW_COPY_AND_ASSIGN(CHACodeArray); 2775 DISALLOW_COPY_AND_ASSIGN(CHACodeArray);
2776 }; 2776 };
2777 2777
2778 2778
2779 #if defined(DEBUG) 2779 #if defined(DEBUG)
2780 static bool IsMutatorOrAtSafepoint() { 2780 static bool IsMutatorOrAtSafepoint() {
2781 Thread* thread = Thread::Current(); 2781 Thread* thread = Thread::Current();
2782 return thread->IsMutatorThread() || 2782 return thread->IsMutatorThread() || thread->IsAtSafepoint();
2783 thread->isolate()->thread_registry()->AtSafepoint();
2784 } 2783 }
2785 #endif 2784 #endif
2786 2785
2787 2786
2788 void Class::RegisterCHACode(const Code& code) { 2787 void Class::RegisterCHACode(const Code& code) {
2789 if (FLAG_trace_cha) { 2788 if (FLAG_trace_cha) {
2790 THR_Print("RegisterCHACode '%s' depends on class '%s'\n", 2789 THR_Print("RegisterCHACode '%s' depends on class '%s'\n",
2791 Function::Handle(code.function()).ToQualifiedCString(), ToCString()); 2790 Function::Handle(code.function()).ToQualifiedCString(), ToCString());
2792 } 2791 }
2793 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); 2792 DEBUG_ASSERT(IsMutatorOrAtSafepoint());
(...skipping 7891 matching lines...) Expand 10 before | Expand all | Expand 10 after
10685 // - invalidate dependent code of this prefix; 10684 // - invalidate dependent code of this prefix;
10686 // - mark this prefixes as loaded; 10685 // - mark this prefixes as loaded;
10687 // - complete the future associated with this prefix. 10686 // - complete the future associated with this prefix.
10688 const Library& deferred_lib = Library::Handle(GetLibrary(0)); 10687 const Library& deferred_lib = Library::Handle(GetLibrary(0));
10689 if (deferred_lib.Loaded()) { 10688 if (deferred_lib.Loaded()) {
10690 this->set_is_loaded(); 10689 this->set_is_loaded();
10691 return true; 10690 return true;
10692 } else if (deferred_lib.LoadNotStarted()) { 10691 } else if (deferred_lib.LoadNotStarted()) {
10693 Thread* thread = Thread::Current(); 10692 Thread* thread = Thread::Current();
10694 Isolate* isolate = thread->isolate(); 10693 Isolate* isolate = thread->isolate();
10695 Api::Scope api_scope(thread);
10696 Zone* zone = thread->zone(); 10694 Zone* zone = thread->zone();
10697 deferred_lib.SetLoadRequested(); 10695 deferred_lib.SetLoadRequested();
10698 const GrowableObjectArray& pending_deferred_loads = 10696 const GrowableObjectArray& pending_deferred_loads =
10699 GrowableObjectArray::Handle( 10697 GrowableObjectArray::Handle(
10700 isolate->object_store()->pending_deferred_loads()); 10698 isolate->object_store()->pending_deferred_loads());
10701 pending_deferred_loads.Add(deferred_lib); 10699 pending_deferred_loads.Add(deferred_lib);
10702 const String& lib_url = String::Handle(zone, deferred_lib.url()); 10700 const String& lib_url = String::Handle(zone, deferred_lib.url());
10703 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); 10701 Dart_LibraryTagHandler handler = isolate->library_tag_handler();
10704 handler(Dart_kImportTag, 10702 {
10705 Api::NewHandle(thread, importer()), 10703 TransitionVMToNative transition(thread);
10706 Api::NewHandle(thread, lib_url.raw())); 10704 Api::Scope api_scope(thread);
10705 handler(Dart_kImportTag,
10706 Api::NewHandle(thread, importer()),
10707 Api::NewHandle(thread, lib_url.raw()));
10708 }
10707 } else { 10709 } else {
10708 // Another load request is in flight. 10710 // Another load request is in flight.
10709 ASSERT(deferred_lib.LoadRequested()); 10711 ASSERT(deferred_lib.LoadRequested());
10710 } 10712 }
10711 return false; // Load request not yet completed. 10713 return false; // Load request not yet completed.
10712 } 10714 }
10713 10715
10714 10716
10715 RawArray* LibraryPrefix::dependent_code() const { 10717 RawArray* LibraryPrefix::dependent_code() const {
10716 return raw_ptr()->dependent_code_; 10718 return raw_ptr()->dependent_code_;
(...skipping 12120 matching lines...) Expand 10 before | Expand all | Expand 10 after
22837 return tag_label.ToCString(); 22839 return tag_label.ToCString();
22838 } 22840 }
22839 22841
22840 22842
22841 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 22843 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
22842 Instance::PrintJSONImpl(stream, ref); 22844 Instance::PrintJSONImpl(stream, ref);
22843 } 22845 }
22844 22846
22845 22847
22846 } // namespace dart 22848 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/native_entry.cc ('k') | runtime/vm/object_graph_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698