Chromium Code Reviews| 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 2779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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); |
| 2815 a.DisableCode(); | 2816 if (a.HasCodes()) { |
|
Florian Schneider
2016/01/04 11:31:38
What about the other call-sites of DisableCode()?
|
Florian Schneider
2016/01/04 11:31:38
If you always check HasCodes before calling Disabl
srdjan
2016/01/04 18:29:53
What I really meant to do (and changed it to):
|
| 2817 if (FLAG_trace_deoptimization) { | |
| 2818 THR_Print("Adding subclass %s\n", subclass.ToCString()); | |
| 2819 } | |
| 2820 a.DisableCode(); | |
| 2821 } | |
| 2816 } | 2822 } |
| 2817 | 2823 |
| 2818 | 2824 |
| 2819 bool Class::TraceAllocation(Isolate* isolate) const { | 2825 bool Class::TraceAllocation(Isolate* isolate) const { |
| 2820 ClassTable* class_table = isolate->class_table(); | 2826 ClassTable* class_table = isolate->class_table(); |
| 2821 return class_table->TraceAllocationFor(id()); | 2827 return class_table->TraceAllocationFor(id()); |
| 2822 } | 2828 } |
| 2823 | 2829 |
| 2824 | 2830 |
| 2825 void Class::SetTraceAllocation(bool trace_allocation) const { | 2831 void Class::SetTraceAllocation(bool trace_allocation) const { |
| (...skipping 2987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5813 return false; | 5819 return false; |
| 5814 } | 5820 } |
| 5815 if (is_native()) { | 5821 if (is_native()) { |
| 5816 // Native methods don't need to be optimized. | 5822 // Native methods don't need to be optimized. |
| 5817 return false; | 5823 return false; |
| 5818 } | 5824 } |
| 5819 if (is_optimizable() && (script() != Script::null()) && | 5825 if (is_optimizable() && (script() != Script::null()) && |
| 5820 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) { | 5826 ((end_token_pos() - token_pos()) < FLAG_huge_method_cutoff_in_tokens)) { |
| 5821 // Additional check needed for implicit getters. | 5827 // Additional check needed for implicit getters. |
| 5822 return (unoptimized_code() == Object::null()) || | 5828 return (unoptimized_code() == Object::null()) || |
| 5823 (Code::Handle(unoptimized_code()).Size() < | 5829 (Code::Handle(unoptimized_code()).Size() < |
| 5824 FLAG_huge_method_cutoff_in_code_size); | 5830 FLAG_huge_method_cutoff_in_code_size); |
| 5825 } | 5831 } |
| 5826 return false; | 5832 return false; |
| 5827 } | 5833 } |
| 5828 | 5834 |
| 5829 | 5835 |
| 5830 bool Function::IsNativeAutoSetupScope() const { | 5836 bool Function::IsNativeAutoSetupScope() const { |
| 5831 return is_native() ? is_optimizable() : false; | 5837 return is_native() ? is_optimizable() : false; |
| 5832 } | 5838 } |
| 5833 | 5839 |
| 5834 | 5840 |
| 5835 void Function::SetIsOptimizable(bool value) const { | 5841 void Function::SetIsOptimizable(bool value) const { |
| 5836 ASSERT(!is_native()); | 5842 ASSERT(!is_native()); |
| 5837 set_is_optimizable(value); | 5843 set_is_optimizable(value); |
| 5838 if (!value) { | 5844 if (!value) { |
| 5839 set_is_inlinable(false); | 5845 set_is_inlinable(false); |
| 5846 set_usage_counter(INT_MIN); | |
| 5840 } | 5847 } |
| 5841 } | 5848 } |
| 5842 | 5849 |
| 5843 | 5850 |
| 5844 void Function::SetIsNativeAutoSetupScope(bool value) const { | 5851 void Function::SetIsNativeAutoSetupScope(bool value) const { |
| 5845 ASSERT(is_native()); | 5852 ASSERT(is_native()); |
| 5846 set_is_optimizable(value); | 5853 set_is_optimizable(value); |
| 5847 } | 5854 } |
| 5848 | 5855 |
| 5849 | 5856 |
| (...skipping 16146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 21996 return tag_label.ToCString(); | 22003 return tag_label.ToCString(); |
| 21997 } | 22004 } |
| 21998 | 22005 |
| 21999 | 22006 |
| 22000 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 22007 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 22001 Instance::PrintJSONImpl(stream, ref); | 22008 Instance::PrintJSONImpl(stream, ref); |
| 22002 } | 22009 } |
| 22003 | 22010 |
| 22004 | 22011 |
| 22005 } // namespace dart | 22012 } // namespace dart |
| OLD | NEW |