| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.h" | 7 #include "vm/assembler.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 if (FLAG_trace_ic) { | 886 if (FLAG_trace_ic) { |
| 887 OS::PrintErr("InlineCacheMissHandler NULL code for receiver: %s\n", | 887 OS::PrintErr("InlineCacheMissHandler NULL code for receiver: %s\n", |
| 888 receiver.ToCString()); | 888 receiver.ToCString()); |
| 889 } | 889 } |
| 890 return Function::null(); | 890 return Function::null(); |
| 891 } | 891 } |
| 892 const Function& target_function = | 892 const Function& target_function = |
| 893 Function::Handle(target_code.function()); | 893 Function::Handle(target_code.function()); |
| 894 ASSERT(!target_function.IsNull()); | 894 ASSERT(!target_function.IsNull()); |
| 895 if (args.length() == 1) { | 895 if (args.length() == 1) { |
| 896 ic_data.AddReceiverCheck(Class::Handle(args[0]->clazz()).id(), | 896 ic_data.AddReceiverCheck(args[0]->GetClassId(), |
| 897 target_function); | 897 target_function); |
| 898 } else { | 898 } else { |
| 899 GrowableArray<intptr_t> class_ids(args.length()); | 899 GrowableArray<intptr_t> class_ids(args.length()); |
| 900 ASSERT(ic_data.num_args_tested() == args.length()); | 900 ASSERT(ic_data.num_args_tested() == args.length()); |
| 901 for (intptr_t i = 0; i < args.length(); i++) { | 901 for (intptr_t i = 0; i < args.length(); i++) { |
| 902 class_ids.Add(Class::Handle(args[i]->clazz()).id()); | 902 class_ids.Add(args[i]->GetClassId()); |
| 903 } | 903 } |
| 904 ic_data.AddCheck(class_ids, target_function); | 904 ic_data.AddCheck(class_ids, target_function); |
| 905 } | 905 } |
| 906 if (FLAG_trace_ic_miss_in_optimized || FLAG_trace_ic) { | 906 if (FLAG_trace_ic_miss_in_optimized || FLAG_trace_ic) { |
| 907 DartFrameIterator iterator; | 907 DartFrameIterator iterator; |
| 908 StackFrame* caller_frame = iterator.NextFrame(); | 908 StackFrame* caller_frame = iterator.NextFrame(); |
| 909 ASSERT(caller_frame != NULL); | 909 ASSERT(caller_frame != NULL); |
| 910 if (FLAG_trace_ic_miss_in_optimized) { | 910 if (FLAG_trace_ic_miss_in_optimized) { |
| 911 const Code& caller = Code::Handle(Code::LookupCode(caller_frame->pc())); | 911 const Code& caller = Code::Handle(Code::LookupCode(caller_frame->pc())); |
| 912 if (caller.is_optimized()) { | 912 if (caller.is_optimized()) { |
| 913 OS::PrintErr("IC miss in optimized code; call %s -> %s\n", | 913 OS::PrintErr("IC miss in optimized code; call %s -> %s\n", |
| 914 Function::Handle(caller.function()).ToCString(), | 914 Function::Handle(caller.function()).ToCString(), |
| 915 target_function.ToCString()); | 915 target_function.ToCString()); |
| 916 } | 916 } |
| 917 } | 917 } |
| 918 if (FLAG_trace_ic) { | 918 if (FLAG_trace_ic) { |
| 919 OS::PrintErr("InlineCacheMissHandler %d call at %#"Px"' " | 919 OS::PrintErr("InlineCacheMissHandler %d call at %#"Px"' " |
| 920 "adding <%s> id:%"Pd" -> <%s>\n", | 920 "adding <%s> id:%"Pd" -> <%s>\n", |
| 921 args.length(), | 921 args.length(), |
| 922 caller_frame->pc(), | 922 caller_frame->pc(), |
| 923 Class::Handle(receiver.clazz()).ToCString(), | 923 Class::Handle(receiver.clazz()).ToCString(), |
| 924 Class::Handle(receiver.clazz()).id(), | 924 receiver.GetClassId(), |
| 925 target_function.ToCString()); | 925 target_function.ToCString()); |
| 926 } | 926 } |
| 927 } | 927 } |
| 928 return target_function.raw(); | 928 return target_function.raw(); |
| 929 } | 929 } |
| 930 | 930 |
| 931 | 931 |
| 932 // Handles inline cache misses by updating the IC data array of the call | 932 // Handles inline cache misses by updating the IC data array of the call |
| 933 // site. | 933 // site. |
| 934 // Arg0: Receiver object. | 934 // Arg0: Receiver object. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 const intptr_t kNumArguments = 2; | 1081 const intptr_t kNumArguments = 2; |
| 1082 const intptr_t kNumNamedArguments = 0; | 1082 const intptr_t kNumNamedArguments = 0; |
| 1083 Function& target_function = Function::Handle(); | 1083 Function& target_function = Function::Handle(); |
| 1084 target_function = Resolver::ResolveDynamic(receiver, | 1084 target_function = Resolver::ResolveDynamic(receiver, |
| 1085 target_name, | 1085 target_name, |
| 1086 kNumArguments, | 1086 kNumArguments, |
| 1087 kNumNamedArguments); | 1087 kNumNamedArguments); |
| 1088 ASSERT(!target_function.IsNull()); | 1088 ASSERT(!target_function.IsNull()); |
| 1089 GrowableArray<intptr_t> class_ids(kNumArguments); | 1089 GrowableArray<intptr_t> class_ids(kNumArguments); |
| 1090 ASSERT(ic_data.num_args_tested() == kNumArguments); | 1090 ASSERT(ic_data.num_args_tested() == kNumArguments); |
| 1091 class_ids.Add(Class::Handle(receiver.clazz()).id()); | 1091 class_ids.Add(receiver.GetClassId()); |
| 1092 class_ids.Add(Class::Handle(arg1.clazz()).id()); | 1092 class_ids.Add(arg1.GetClassId()); |
| 1093 ic_data.AddCheck(class_ids, target_function); | 1093 ic_data.AddCheck(class_ids, target_function); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 | 1096 |
| 1097 // Invoke appropriate noSuchMethod function. | 1097 // Invoke appropriate noSuchMethod function. |
| 1098 // Arg0: receiver. | 1098 // Arg0: receiver. |
| 1099 // Arg1: ic-data. | 1099 // Arg1: ic-data. |
| 1100 // Arg2: arguments descriptor array. | 1100 // Arg2: arguments descriptor array. |
| 1101 // Arg3: arguments array. | 1101 // Arg3: arguments array. |
| 1102 DEFINE_RUNTIME_ENTRY(InvokeNoSuchMethodFunction, 4) { | 1102 DEFINE_RUNTIME_ENTRY(InvokeNoSuchMethodFunction, 4) { |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1764 | 1764 |
| 1765 // Update global type feedback recorded for a field recording the assignment | 1765 // Update global type feedback recorded for a field recording the assignment |
| 1766 // of the given value. | 1766 // of the given value. |
| 1767 // Arg0: Field object; | 1767 // Arg0: Field object; |
| 1768 // Arg1: Value that is being stored. | 1768 // Arg1: Value that is being stored. |
| 1769 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1769 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1770 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); | 1770 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); |
| 1771 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1771 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1772 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1772 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1773 | 1773 |
| 1774 field.UpdateCid(Class::Handle(value.clazz()).id()); | 1774 field.UpdateCid(value.GetClassId()); |
| 1775 } | 1775 } |
| 1776 | 1776 |
| 1777 } // namespace dart | 1777 } // namespace dart |
| OLD | NEW |