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

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

Issue 1418813008: This adds a mechanism to invalidate code that was generated in the background. The invalidation can… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Restructure Created 5 years, 1 month 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 2872 matching lines...) Expand 10 before | Expand all | Expand 10 after
2883 virtual void ReportSwitchingCode(const Code& code) { 2883 virtual void ReportSwitchingCode(const Code& code) {
2884 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { 2884 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
2885 Function& function = Function::Handle(code.function()); 2885 Function& function = Function::Handle(code.function());
2886 THR_Print("Switching %s to unoptimized code because CHA invalid" 2886 THR_Print("Switching %s to unoptimized code because CHA invalid"
2887 " (%s)\n", 2887 " (%s)\n",
2888 function.ToFullyQualifiedCString(), 2888 function.ToFullyQualifiedCString(),
2889 cls_.ToCString()); 2889 cls_.ToCString());
2890 } 2890 }
2891 } 2891 }
2892 2892
2893 virtual void IncrementInvalidationGen() {
2894 Isolate::Current()->IncrCHAInvalidationGen();
2895 }
2896
2893 private: 2897 private:
2894 const Class& cls_; 2898 const Class& cls_;
2895 DISALLOW_COPY_AND_ASSIGN(CHACodeArray); 2899 DISALLOW_COPY_AND_ASSIGN(CHACodeArray);
2896 }; 2900 };
2897 2901
2898 2902
2899 void Class::RegisterCHACode(const Code& code) { 2903 void Class::RegisterCHACode(const Code& code) {
2900 if (FLAG_trace_cha) { 2904 if (FLAG_trace_cha) {
2901 THR_Print("RegisterCHACode %s class %s\n", 2905 THR_Print("RegisterCHACode %s class %s\n",
2902 Function::Handle(code.function()).ToQualifiedCString(), ToCString()); 2906 Function::Handle(code.function()).ToQualifiedCString(), ToCString());
(...skipping 4864 matching lines...) Expand 10 before | Expand all | Expand 10 after
7767 virtual void ReportSwitchingCode(const Code& code) { 7771 virtual void ReportSwitchingCode(const Code& code) {
7768 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { 7772 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
7769 Function& function = Function::Handle(code.function()); 7773 Function& function = Function::Handle(code.function());
7770 THR_Print("Switching %s to unoptimized code because guard" 7774 THR_Print("Switching %s to unoptimized code because guard"
7771 " on field %s was violated.\n", 7775 " on field %s was violated.\n",
7772 function.ToFullyQualifiedCString(), 7776 function.ToFullyQualifiedCString(),
7773 field_.ToCString()); 7777 field_.ToCString());
7774 } 7778 }
7775 } 7779 }
7776 7780
7781 virtual void IncrementInvalidationGen() {
7782 Isolate::Current()->IncrFieldInvalidationGen();
7783 }
7784
7777 private: 7785 private:
7778 const Field& field_; 7786 const Field& field_;
7779 DISALLOW_COPY_AND_ASSIGN(FieldDependentArray); 7787 DISALLOW_COPY_AND_ASSIGN(FieldDependentArray);
7780 }; 7788 };
7781 7789
7782 7790
7783 void Field::RegisterDependentCode(const Code& code) const { 7791 void Field::RegisterDependentCode(const Code& code) const {
7784 ASSERT(code.is_optimized()); 7792 ASSERT(code.is_optimized());
7785 FieldDependentArray a(*this); 7793 FieldDependentArray a(*this);
7786 a.Register(code); 7794 a.Register(code);
(...skipping 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after
10807 virtual void ReportSwitchingCode(const Code& code) { 10815 virtual void ReportSwitchingCode(const Code& code) {
10808 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { 10816 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
10809 THR_Print("Prefix '%s': disabling %s code for %s function '%s'\n", 10817 THR_Print("Prefix '%s': disabling %s code for %s function '%s'\n",
10810 String::Handle(prefix_.name()).ToCString(), 10818 String::Handle(prefix_.name()).ToCString(),
10811 code.is_optimized() ? "optimized" : "unoptimized", 10819 code.is_optimized() ? "optimized" : "unoptimized",
10812 code.IsDisabled() ? "'patched'" : "'unpatched'", 10820 code.IsDisabled() ? "'patched'" : "'unpatched'",
10813 Function::Handle(code.function()).ToCString()); 10821 Function::Handle(code.function()).ToCString());
10814 } 10822 }
10815 } 10823 }
10816 10824
10825 virtual void IncrementInvalidationGen() {
10826 Isolate::Current()->IncrPrefixInvalidationGen();
10827 }
10828
10817 private: 10829 private:
10818 const LibraryPrefix& prefix_; 10830 const LibraryPrefix& prefix_;
10819 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); 10831 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray);
10820 }; 10832 };
10821 10833
10822 10834
10823 void LibraryPrefix::RegisterDependentCode(const Code& code) const { 10835 void LibraryPrefix::RegisterDependentCode(const Code& code) const {
10824 ASSERT(is_deferred_load()); 10836 ASSERT(is_deferred_load());
10825 ASSERT(!is_loaded()); 10837 ASSERT(!is_loaded());
10826 PrefixDependentArray a(*this); 10838 PrefixDependentArray a(*this);
(...skipping 6205 matching lines...) Expand 10 before | Expand all | Expand 10 after
17032 return "Number"; 17044 return "Number";
17033 } 17045 }
17034 17046
17035 17047
17036 void Number::PrintJSONImpl(JSONStream* stream, bool ref) const { 17048 void Number::PrintJSONImpl(JSONStream* stream, bool ref) const {
17037 UNREACHABLE(); 17049 UNREACHABLE();
17038 } 17050 }
17039 17051
17040 17052
17041 const char* Integer::ToCString() const { 17053 const char* Integer::ToCString() const {
17042 // Integer is an interface. No instances of Integer should exist. 17054 // Integer is an interface. No instances of Integer should exist except null.
17043 UNREACHABLE(); 17055 ASSERT(IsNull());
17044 return "Integer"; 17056 return "NULL Integer";
17045 } 17057 }
17046 17058
17047 17059
17048 void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const { 17060 void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const {
17049 JSONObject jsobj(stream); 17061 JSONObject jsobj(stream);
17050 PrintSharedInstanceJSON(&jsobj, ref); 17062 PrintSharedInstanceJSON(&jsobj, ref);
17051 jsobj.AddProperty("kind", "Int"); 17063 jsobj.AddProperty("kind", "Int");
17052 jsobj.AddServiceId(*this); 17064 jsobj.AddServiceId(*this);
17053 jsobj.AddProperty("valueAsString", ToCString()); 17065 jsobj.AddProperty("valueAsString", ToCString());
17054 } 17066 }
(...skipping 4862 matching lines...) Expand 10 before | Expand all | Expand 10 after
21917 return tag_label.ToCString(); 21929 return tag_label.ToCString();
21918 } 21930 }
21919 21931
21920 21932
21921 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21933 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21922 Instance::PrintJSONImpl(stream, ref); 21934 Instance::PrintJSONImpl(stream, ref);
21923 } 21935 }
21924 21936
21925 21937
21926 } // namespace dart 21938 } // namespace dart
OLDNEW
« runtime/vm/isolate.h ('K') | « runtime/vm/isolate.cc ('k') | runtime/vm/weak_code.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698