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 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2726 virtual void ReportSwitchingCode(const Code& code) { | 2726 virtual void ReportSwitchingCode(const Code& code) { |
2727 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 2727 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
2728 Function& function = Function::Handle(code.function()); | 2728 Function& function = Function::Handle(code.function()); |
2729 THR_Print("Switching %s to unoptimized code because CHA invalid" | 2729 THR_Print("Switching %s to unoptimized code because CHA invalid" |
2730 " (%s)\n", | 2730 " (%s)\n", |
2731 function.ToFullyQualifiedCString(), | 2731 function.ToFullyQualifiedCString(), |
2732 cls_.ToCString()); | 2732 cls_.ToCString()); |
2733 } | 2733 } |
2734 } | 2734 } |
2735 | 2735 |
2736 virtual void IncrementInvalidationGen() { | 2736 virtual void IncrementInvalidationGen() {} |
2737 Isolate::Current()->IncrCHAInvalidationGen(); | |
2738 } | |
2739 | 2737 |
2740 private: | 2738 private: |
2741 const Class& cls_; | 2739 const Class& cls_; |
2742 DISALLOW_COPY_AND_ASSIGN(CHACodeArray); | 2740 DISALLOW_COPY_AND_ASSIGN(CHACodeArray); |
2743 }; | 2741 }; |
2744 | 2742 |
2745 | 2743 |
2746 #if defined(DEBUG) | 2744 #if defined(DEBUG) |
2747 static bool IsMutatorOrAtSafepoint() { | 2745 static bool IsMutatorOrAtSafepoint() { |
2748 Thread* thread = Thread::Current(); | 2746 Thread* thread = Thread::Current(); |
(...skipping 7759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10508 RawClass* LibraryPrefix::LookupClass(const String& class_name) const { | 10506 RawClass* LibraryPrefix::LookupClass(const String& class_name) const { |
10509 const Object& obj = Object::Handle(LookupObject(class_name)); | 10507 const Object& obj = Object::Handle(LookupObject(class_name)); |
10510 if (obj.IsClass()) { | 10508 if (obj.IsClass()) { |
10511 return Class::Cast(obj).raw(); | 10509 return Class::Cast(obj).raw(); |
10512 } | 10510 } |
10513 return Class::null(); | 10511 return Class::null(); |
10514 } | 10512 } |
10515 | 10513 |
10516 | 10514 |
10517 void LibraryPrefix::set_is_loaded() const { | 10515 void LibraryPrefix::set_is_loaded() const { |
10518 Isolate::Current()->IncrPrefixInvalidationGen(); | |
10519 StoreNonPointer(&raw_ptr()->is_loaded_, true); | 10516 StoreNonPointer(&raw_ptr()->is_loaded_, true); |
10520 } | 10517 } |
10521 | 10518 |
10522 | 10519 |
10523 bool LibraryPrefix::LoadLibrary() const { | 10520 bool LibraryPrefix::LoadLibrary() const { |
10524 // Non-deferred prefixes are loaded. | 10521 // Non-deferred prefixes are loaded. |
10525 ASSERT(is_deferred_load() || is_loaded()); | 10522 ASSERT(is_deferred_load() || is_loaded()); |
10526 if (is_loaded()) { | 10523 if (is_loaded()) { |
10527 return true; // Load request has already completed. | 10524 return true; // Load request has already completed. |
10528 } | 10525 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10601 virtual void ReportSwitchingCode(const Code& code) { | 10598 virtual void ReportSwitchingCode(const Code& code) { |
10602 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 10599 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
10603 THR_Print("Prefix '%s': disabling %s code for %s function '%s'\n", | 10600 THR_Print("Prefix '%s': disabling %s code for %s function '%s'\n", |
10604 String::Handle(prefix_.name()).ToCString(), | 10601 String::Handle(prefix_.name()).ToCString(), |
10605 code.is_optimized() ? "optimized" : "unoptimized", | 10602 code.is_optimized() ? "optimized" : "unoptimized", |
10606 code.IsDisabled() ? "'patched'" : "'unpatched'", | 10603 code.IsDisabled() ? "'patched'" : "'unpatched'", |
10607 Function::Handle(code.function()).ToCString()); | 10604 Function::Handle(code.function()).ToCString()); |
10608 } | 10605 } |
10609 } | 10606 } |
10610 | 10607 |
10611 virtual void IncrementInvalidationGen() { | 10608 virtual void IncrementInvalidationGen() {} |
10612 Isolate::Current()->IncrPrefixInvalidationGen(); | |
10613 } | |
10614 | 10609 |
10615 private: | 10610 private: |
10616 const LibraryPrefix& prefix_; | 10611 const LibraryPrefix& prefix_; |
10617 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); | 10612 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); |
10618 }; | 10613 }; |
10619 | 10614 |
10620 | 10615 |
10621 void LibraryPrefix::RegisterDependentCode(const Code& code) const { | 10616 void LibraryPrefix::RegisterDependentCode(const Code& code) const { |
10622 ASSERT(is_deferred_load()); | 10617 ASSERT(is_deferred_load()); |
10623 // In background compilation, a library can be loaded while we are compiling. | 10618 // In background compilation, a library can be loaded while we are compiling. |
(...skipping 11117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21741 return UserTag::null(); | 21736 return UserTag::null(); |
21742 } | 21737 } |
21743 | 21738 |
21744 | 21739 |
21745 const char* UserTag::ToCString() const { | 21740 const char* UserTag::ToCString() const { |
21746 const String& tag_label = String::Handle(label()); | 21741 const String& tag_label = String::Handle(label()); |
21747 return tag_label.ToCString(); | 21742 return tag_label.ToCString(); |
21748 } | 21743 } |
21749 | 21744 |
21750 } // namespace dart | 21745 } // namespace dart |
OLD | NEW |