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

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-tests 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
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 2755 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 2766
2767 private: 2767 private:
2768 const Class& cls_; 2768 const Class& cls_;
2769 DISALLOW_COPY_AND_ASSIGN(CHACodeArray); 2769 DISALLOW_COPY_AND_ASSIGN(CHACodeArray);
2770 }; 2770 };
2771 2771
2772 2772
2773 #if defined(DEBUG) 2773 #if defined(DEBUG)
2774 static bool IsMutatorOrAtSafepoint() { 2774 static bool IsMutatorOrAtSafepoint() {
2775 Thread* thread = Thread::Current(); 2775 Thread* thread = Thread::Current();
2776 return thread->IsMutatorThread() || 2776 return thread->IsMutatorThread() || thread->IsAtSafepoint();
2777 thread->isolate()->thread_registry()->AtSafepoint();
2778 } 2777 }
2779 #endif 2778 #endif
2780 2779
2781 2780
2782 void Class::RegisterCHACode(const Code& code) { 2781 void Class::RegisterCHACode(const Code& code) {
2783 if (FLAG_trace_cha) { 2782 if (FLAG_trace_cha) {
2784 THR_Print("RegisterCHACode '%s' depends on class '%s'\n", 2783 THR_Print("RegisterCHACode '%s' depends on class '%s'\n",
2785 Function::Handle(code.function()).ToQualifiedCString(), ToCString()); 2784 Function::Handle(code.function()).ToQualifiedCString(), ToCString());
2786 } 2785 }
2787 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); 2786 DEBUG_ASSERT(IsMutatorOrAtSafepoint());
(...skipping 7889 matching lines...) Expand 10 before | Expand all | Expand 10 after
10677 // - invalidate dependent code of this prefix; 10676 // - invalidate dependent code of this prefix;
10678 // - mark this prefixes as loaded; 10677 // - mark this prefixes as loaded;
10679 // - complete the future associated with this prefix. 10678 // - complete the future associated with this prefix.
10680 const Library& deferred_lib = Library::Handle(GetLibrary(0)); 10679 const Library& deferred_lib = Library::Handle(GetLibrary(0));
10681 if (deferred_lib.Loaded()) { 10680 if (deferred_lib.Loaded()) {
10682 this->set_is_loaded(); 10681 this->set_is_loaded();
10683 return true; 10682 return true;
10684 } else if (deferred_lib.LoadNotStarted()) { 10683 } else if (deferred_lib.LoadNotStarted()) {
10685 Thread* thread = Thread::Current(); 10684 Thread* thread = Thread::Current();
10686 Isolate* isolate = thread->isolate(); 10685 Isolate* isolate = thread->isolate();
10687 Api::Scope api_scope(thread);
10688 Zone* zone = thread->zone(); 10686 Zone* zone = thread->zone();
10689 deferred_lib.SetLoadRequested(); 10687 deferred_lib.SetLoadRequested();
10690 const GrowableObjectArray& pending_deferred_loads = 10688 const GrowableObjectArray& pending_deferred_loads =
10691 GrowableObjectArray::Handle( 10689 GrowableObjectArray::Handle(
10692 isolate->object_store()->pending_deferred_loads()); 10690 isolate->object_store()->pending_deferred_loads());
10693 pending_deferred_loads.Add(deferred_lib); 10691 pending_deferred_loads.Add(deferred_lib);
10694 const String& lib_url = String::Handle(zone, deferred_lib.url()); 10692 const String& lib_url = String::Handle(zone, deferred_lib.url());
10695 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); 10693 Dart_LibraryTagHandler handler = isolate->library_tag_handler();
10696 handler(Dart_kImportTag, 10694 {
10697 Api::NewHandle(thread, importer()), 10695 TransitionVMToNative transition(thread);
10698 Api::NewHandle(thread, lib_url.raw())); 10696 Api::Scope api_scope(thread);
10697 handler(Dart_kImportTag,
10698 Api::NewHandle(thread, importer()),
10699 Api::NewHandle(thread, lib_url.raw()));
10700 }
10699 } else { 10701 } else {
10700 // Another load request is in flight. 10702 // Another load request is in flight.
10701 ASSERT(deferred_lib.LoadRequested()); 10703 ASSERT(deferred_lib.LoadRequested());
10702 } 10704 }
10703 return false; // Load request not yet completed. 10705 return false; // Load request not yet completed.
10704 } 10706 }
10705 10707
10706 10708
10707 RawArray* LibraryPrefix::dependent_code() const { 10709 RawArray* LibraryPrefix::dependent_code() const {
10708 return raw_ptr()->dependent_code_; 10710 return raw_ptr()->dependent_code_;
(...skipping 11997 matching lines...) Expand 10 before | Expand all | Expand 10 after
22706 return tag_label.ToCString(); 22708 return tag_label.ToCString();
22707 } 22709 }
22708 22710
22709 22711
22710 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 22712 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
22711 Instance::PrintJSONImpl(stream, ref); 22713 Instance::PrintJSONImpl(stream, ref);
22712 } 22714 }
22713 22715
22714 22716
22715 } // namespace dart 22717 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698