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

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

Issue 1559653002: Investigate & fix issues around usage_count and deoptimization_count (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: d Created 4 years, 11 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/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 2779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2790 2790
2791 2791
2792 #if defined(DEBUG) 2792 #if defined(DEBUG)
2793 static bool IsMutatorOrAtSafepoint() { 2793 static bool IsMutatorOrAtSafepoint() {
2794 Thread* thread = Thread::Current(); 2794 Thread* thread = Thread::Current();
2795 return thread->IsMutatorThread() || 2795 return thread->IsMutatorThread() ||
2796 thread->isolate()->thread_registry()->AtSafepoint(); 2796 thread->isolate()->thread_registry()->AtSafepoint();
2797 } 2797 }
2798 #endif 2798 #endif
2799 2799
2800
2800 void Class::RegisterCHACode(const Code& code) { 2801 void Class::RegisterCHACode(const Code& code) {
2801 if (FLAG_trace_cha) { 2802 if (FLAG_trace_cha) {
2802 THR_Print("RegisterCHACode %s class %s\n", 2803 THR_Print("RegisterCHACode '%s' depends on class '%s'\n",
2803 Function::Handle(code.function()).ToQualifiedCString(), ToCString()); 2804 Function::Handle(code.function()).ToQualifiedCString(), ToCString());
2804 } 2805 }
2805 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); 2806 DEBUG_ASSERT(IsMutatorOrAtSafepoint());
2806 ASSERT(code.is_optimized()); 2807 ASSERT(code.is_optimized());
2807 CHACodeArray a(*this); 2808 CHACodeArray a(*this);
2808 a.Register(code); 2809 a.Register(code);
2809 } 2810 }
2810 2811
2811 2812
2812 void Class::DisableCHAOptimizedCode() { 2813 void Class::DisableCHAOptimizedCode(const Class& subclass) {
2813 ASSERT(Thread::Current()->IsMutatorThread()); 2814 ASSERT(Thread::Current()->IsMutatorThread());
2814 CHACodeArray a(*this); 2815 CHACodeArray a(*this);
2816 if (FLAG_trace_deoptimization && a.HasCodes()) {
2817 THR_Print("Adding subclass %s\n", subclass.ToCString());
2818 }
2815 a.DisableCode(); 2819 a.DisableCode();
2816 } 2820 }
2817 2821
2818 2822
2819 bool Class::TraceAllocation(Isolate* isolate) const { 2823 bool Class::TraceAllocation(Isolate* isolate) const {
2820 ClassTable* class_table = isolate->class_table(); 2824 ClassTable* class_table = isolate->class_table();
2821 return class_table->TraceAllocationFor(id()); 2825 return class_table->TraceAllocationFor(id());
2822 } 2826 }
2823 2827
2824 2828
(...skipping 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after
5813 return false; 5817 return false;
5814 } 5818 }
5815 if (is_native()) { 5819 if (is_native()) {
5816 // Native methods don't need to be optimized. 5820 // Native methods don't need to be optimized.
5817 return false; 5821 return false;
5818 } 5822 }
5819 if (is_optimizable() && (script() != Script::null()) && 5823 if (is_optimizable() && (script() != Script::null()) &&
5820 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) { 5824 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) {
5821 // Additional check needed for implicit getters. 5825 // Additional check needed for implicit getters.
5822 return (unoptimized_code() == Object::null()) || 5826 return (unoptimized_code() == Object::null()) ||
5823 (Code::Handle(unoptimized_code()).Size() < 5827 (Code::Handle(unoptimized_code()).Size() <
5824 FLAG_huge_method_cutoff_in_code_size); 5828 FLAG_huge_method_cutoff_in_code_size);
5825 } 5829 }
5826 return false; 5830 return false;
5827 } 5831 }
5828 5832
5829 5833
5830 bool Function::IsNativeAutoSetupScope() const { 5834 bool Function::IsNativeAutoSetupScope() const {
5831 return is_native() ? is_optimizable() : false; 5835 return is_native() ? is_optimizable() : false;
5832 } 5836 }
5833 5837
5834 5838
5835 void Function::SetIsOptimizable(bool value) const { 5839 void Function::SetIsOptimizable(bool value) const {
5836 ASSERT(!is_native()); 5840 ASSERT(!is_native());
5837 set_is_optimizable(value); 5841 set_is_optimizable(value);
5838 if (!value) { 5842 if (!value) {
5839 set_is_inlinable(false); 5843 set_is_inlinable(false);
5844 set_usage_counter(INT_MIN);
5840 } 5845 }
5841 } 5846 }
5842 5847
5843 5848
5844 void Function::SetIsNativeAutoSetupScope(bool value) const { 5849 void Function::SetIsNativeAutoSetupScope(bool value) const {
5845 ASSERT(is_native()); 5850 ASSERT(is_native());
5846 set_is_optimizable(value); 5851 set_is_optimizable(value);
5847 } 5852 }
5848 5853
5849 5854
(...skipping 16174 matching lines...) Expand 10 before | Expand all | Expand 10 after
22024 return tag_label.ToCString(); 22029 return tag_label.ToCString();
22025 } 22030 }
22026 22031
22027 22032
22028 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 22033 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
22029 Instance::PrintJSONImpl(stream, ref); 22034 Instance::PrintJSONImpl(stream, ref);
22030 } 22035 }
22031 22036
22032 22037
22033 } // namespace dart 22038 } // 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