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

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: sync 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/weak_code.h » ('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 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 3021 matching lines...) Expand 10 before | Expand all | Expand 10 after
10808 virtual void ReportSwitchingCode(const Code& code) { 10816 virtual void ReportSwitchingCode(const Code& code) {
10809 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { 10817 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
10810 THR_Print("Prefix '%s': disabling %s code for %s function '%s'\n", 10818 THR_Print("Prefix '%s': disabling %s code for %s function '%s'\n",
10811 String::Handle(prefix_.name()).ToCString(), 10819 String::Handle(prefix_.name()).ToCString(),
10812 code.is_optimized() ? "optimized" : "unoptimized", 10820 code.is_optimized() ? "optimized" : "unoptimized",
10813 code.IsDisabled() ? "'patched'" : "'unpatched'", 10821 code.IsDisabled() ? "'patched'" : "'unpatched'",
10814 Function::Handle(code.function()).ToCString()); 10822 Function::Handle(code.function()).ToCString());
10815 } 10823 }
10816 } 10824 }
10817 10825
10826 virtual void IncrementInvalidationGen() {
10827 Isolate::Current()->IncrPrefixInvalidationGen();
10828 }
10829
10818 private: 10830 private:
10819 const LibraryPrefix& prefix_; 10831 const LibraryPrefix& prefix_;
10820 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); 10832 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray);
10821 }; 10833 };
10822 10834
10823 10835
10824 void LibraryPrefix::RegisterDependentCode(const Code& code) const { 10836 void LibraryPrefix::RegisterDependentCode(const Code& code) const {
10825 ASSERT(is_deferred_load()); 10837 ASSERT(is_deferred_load());
10826 ASSERT(!is_loaded()); 10838 ASSERT(!is_loaded());
10827 PrefixDependentArray a(*this); 10839 PrefixDependentArray a(*this);
(...skipping 6216 matching lines...) Expand 10 before | Expand all | Expand 10 after
17044 return "Number"; 17056 return "Number";
17045 } 17057 }
17046 17058
17047 17059
17048 void Number::PrintJSONImpl(JSONStream* stream, bool ref) const { 17060 void Number::PrintJSONImpl(JSONStream* stream, bool ref) const {
17049 UNREACHABLE(); 17061 UNREACHABLE();
17050 } 17062 }
17051 17063
17052 17064
17053 const char* Integer::ToCString() const { 17065 const char* Integer::ToCString() const {
17054 // Integer is an interface. No instances of Integer should exist. 17066 // Integer is an interface. No instances of Integer should exist except null.
17055 UNREACHABLE(); 17067 ASSERT(IsNull());
17056 return "Integer"; 17068 return "NULL Integer";
17057 } 17069 }
17058 17070
17059 17071
17060 void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const { 17072 void Integer::PrintJSONImpl(JSONStream* stream, bool ref) const {
17061 JSONObject jsobj(stream); 17073 JSONObject jsobj(stream);
17062 PrintSharedInstanceJSON(&jsobj, ref); 17074 PrintSharedInstanceJSON(&jsobj, ref);
17063 jsobj.AddProperty("kind", "Int"); 17075 jsobj.AddProperty("kind", "Int");
17064 jsobj.AddServiceId(*this); 17076 jsobj.AddServiceId(*this);
17065 jsobj.AddProperty("valueAsString", ToCString()); 17077 jsobj.AddProperty("valueAsString", ToCString());
17066 } 17078 }
(...skipping 4862 matching lines...) Expand 10 before | Expand all | Expand 10 after
21929 return tag_label.ToCString(); 21941 return tag_label.ToCString();
21930 } 21942 }
21931 21943
21932 21944
21933 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21945 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21934 Instance::PrintJSONImpl(stream, ref); 21946 Instance::PrintJSONImpl(stream, ref);
21935 } 21947 }
21936 21948
21937 21949
21938 } // namespace dart 21950 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/weak_code.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698