| 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler_macros.h" | 7 #include "vm/assembler_macros.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 // closure calls. | 886 // closure calls. |
| 887 if (FLAG_trace_ic) { | 887 if (FLAG_trace_ic) { |
| 888 OS::Print("InlineCacheMissHandler NULL code for receiver: %s\n", | 888 OS::Print("InlineCacheMissHandler NULL code for receiver: %s\n", |
| 889 receiver.ToCString()); | 889 receiver.ToCString()); |
| 890 } | 890 } |
| 891 return Function::null(); | 891 return Function::null(); |
| 892 } | 892 } |
| 893 const Function& target_function = | 893 const Function& target_function = |
| 894 Function::Handle(target_code.function()); | 894 Function::Handle(target_code.function()); |
| 895 ASSERT(!target_function.IsNull()); | 895 ASSERT(!target_function.IsNull()); |
| 896 DartFrameIterator iterator; | |
| 897 StackFrame* caller_frame = iterator.NextFrame(); | |
| 898 ASSERT(caller_frame != NULL); | |
| 899 if (args.length() == 1) { | 896 if (args.length() == 1) { |
| 900 ic_data.AddReceiverCheck(Class::Handle(args[0]->clazz()).id(), | 897 ic_data.AddReceiverCheck(Class::Handle(args[0]->clazz()).id(), |
| 901 target_function); | 898 target_function); |
| 902 } else { | 899 } else { |
| 903 GrowableArray<intptr_t> class_ids(args.length()); | 900 GrowableArray<intptr_t> class_ids(args.length()); |
| 904 ASSERT(ic_data.num_args_tested() == args.length()); | 901 ASSERT(ic_data.num_args_tested() == args.length()); |
| 905 for (intptr_t i = 0; i < args.length(); i++) { | 902 for (intptr_t i = 0; i < args.length(); i++) { |
| 906 class_ids.Add(Class::Handle(args[i]->clazz()).id()); | 903 class_ids.Add(Class::Handle(args[i]->clazz()).id()); |
| 907 } | 904 } |
| 908 ic_data.AddCheck(class_ids, target_function); | 905 ic_data.AddCheck(class_ids, target_function); |
| 909 } | 906 } |
| 910 if (FLAG_trace_ic_miss_in_optimized) { | 907 if (FLAG_trace_ic_miss_in_optimized || FLAG_trace_ic) { |
| 911 const Code& caller = Code::Handle(Code::LookupCode(caller_frame->pc())); | 908 DartFrameIterator iterator; |
| 912 if (caller.is_optimized()) { | 909 StackFrame* caller_frame = iterator.NextFrame(); |
| 913 OS::Print("IC miss in optimized code; call %s -> %s\n", | 910 ASSERT(caller_frame != NULL); |
| 914 Function::Handle(caller.function()).ToCString(), | 911 if (FLAG_trace_ic_miss_in_optimized) { |
| 912 const Code& caller = Code::Handle(Code::LookupCode(caller_frame->pc())); |
| 913 if (caller.is_optimized()) { |
| 914 OS::Print("IC miss in optimized code; call %s -> %s\n", |
| 915 Function::Handle(caller.function()).ToCString(), |
| 916 target_function.ToCString()); |
| 917 } |
| 918 } |
| 919 if (FLAG_trace_ic) { |
| 920 OS::Print("InlineCacheMissHandler %d call at %#"Px"' " |
| 921 "adding <%s> id:%"Pd" -> <%s>\n", |
| 922 args.length(), |
| 923 caller_frame->pc(), |
| 924 Class::Handle(receiver.clazz()).ToCString(), |
| 925 Class::Handle(receiver.clazz()).id(), |
| 915 target_function.ToCString()); | 926 target_function.ToCString()); |
| 916 } | 927 } |
| 917 } | 928 } |
| 918 if (FLAG_trace_ic) { | |
| 919 OS::Print("InlineCacheMissHandler %d call at %#"Px"' " | |
| 920 "adding <%s> id:%"Pd" -> <%s>\n", | |
| 921 args.length(), | |
| 922 caller_frame->pc(), | |
| 923 Class::Handle(receiver.clazz()).ToCString(), | |
| 924 Class::Handle(receiver.clazz()).id(), | |
| 925 target_function.ToCString()); | |
| 926 } | |
| 927 return target_function.raw(); | 929 return target_function.raw(); |
| 928 } | 930 } |
| 929 | 931 |
| 930 | 932 |
| 931 // Handles inline cache misses by updating the IC data array of the call | 933 // Handles inline cache misses by updating the IC data array of the call |
| 932 // site. | 934 // site. |
| 933 // Arg0: Receiver object. | 935 // Arg0: Receiver object. |
| 934 // Arg1: IC data object. | 936 // Arg1: IC data object. |
| 935 // Arg2: Arguments descriptor array. | 937 // Arg2: Arguments descriptor array. |
| 936 // Returns: target function with compiled code or null. | 938 // Returns: target function with compiled code or null. |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 return; | 1799 return; |
| 1798 } | 1800 } |
| 1799 HeapTrace* heap_trace = Isolate::Current()->heap()->trace(); | 1801 HeapTrace* heap_trace = Isolate::Current()->heap()->trace(); |
| 1800 heap_trace->TraceStoreIntoObject(RawObject::ToAddr(object), | 1802 heap_trace->TraceStoreIntoObject(RawObject::ToAddr(object), |
| 1801 field_addr, | 1803 field_addr, |
| 1802 RawObject::ToAddr(value)); | 1804 RawObject::ToAddr(value)); |
| 1803 } | 1805 } |
| 1804 END_LEAF_RUNTIME_ENTRY | 1806 END_LEAF_RUNTIME_ENTRY |
| 1805 | 1807 |
| 1806 } // namespace dart | 1808 } // namespace dart |
| OLD | NEW |