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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 target_function.ToFullyQualifiedCString(), | 761 target_function.ToFullyQualifiedCString(), |
762 target_code.EntryPoint()); | 762 target_code.EntryPoint()); |
763 } | 763 } |
764 arguments.SetReturn(target_code); | 764 arguments.SetReturn(target_code); |
765 } | 765 } |
766 | 766 |
767 | 767 |
768 // Resolves and compiles the target function of an instance call, updates | 768 // Resolves and compiles the target function of an instance call, updates |
769 // function cache of the receiver's class and returns the compiled code or null. | 769 // function cache of the receiver's class and returns the compiled code or null. |
770 // Only the number of named arguments is checked, but not the actual names. | 770 // Only the number of named arguments is checked, but not the actual names. |
771 RawCode* ResolveCompileInstanceCallTarget( | 771 RawCode* ResolveCompileInstanceCallTarget(const Instance& receiver, |
772 const Instance& receiver, | 772 const ICData& ic_data) { |
773 const ICData& ic_data, | 773 ArgumentsDescriptor |
774 const Array& arguments_descriptor_array) { | 774 arguments_descriptor(Array::Handle(ic_data.arguments_descriptor())); |
775 ArgumentsDescriptor arguments_descriptor(arguments_descriptor_array); | |
776 intptr_t num_arguments = arguments_descriptor.Count(); | 775 intptr_t num_arguments = arguments_descriptor.Count(); |
777 int num_named_arguments = arguments_descriptor.NamedCount(); | 776 int num_named_arguments = arguments_descriptor.NamedCount(); |
778 String& function_name = String::Handle(ic_data.target_name()); | 777 String& function_name = String::Handle(ic_data.target_name()); |
779 ASSERT(function_name.IsSymbol()); | 778 ASSERT(function_name.IsSymbol()); |
780 | 779 |
781 Function& function = Function::Handle(); | 780 Function& function = Function::Handle(); |
782 function = Resolver::ResolveDynamic(receiver, | 781 function = Resolver::ResolveDynamic(receiver, |
783 function_name, | 782 function_name, |
784 num_arguments, | 783 num_arguments, |
785 num_named_arguments); | 784 num_named_arguments); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 isolate->debugger()->SignalBpReached(); | 866 isolate->debugger()->SignalBpReached(); |
868 } | 867 } |
869 | 868 |
870 | 869 |
871 static RawFunction* InlineCacheMissHandler( | 870 static RawFunction* InlineCacheMissHandler( |
872 const GrowableArray<const Instance*>& args, | 871 const GrowableArray<const Instance*>& args, |
873 const ICData& ic_data, | 872 const ICData& ic_data, |
874 const Array& args_descriptor_array) { | 873 const Array& args_descriptor_array) { |
875 const Instance& receiver = *args[0]; | 874 const Instance& receiver = *args[0]; |
876 const Code& target_code = | 875 const Code& target_code = |
877 Code::Handle(ResolveCompileInstanceCallTarget(receiver, | 876 Code::Handle(ResolveCompileInstanceCallTarget(receiver, ic_data)); |
878 ic_data, | |
879 args_descriptor_array)); | |
880 if (target_code.IsNull()) { | 877 if (target_code.IsNull()) { |
881 // Let the megamorphic stub handle special cases: NoSuchMethod, | 878 // Let the megamorphic stub handle special cases: NoSuchMethod, |
882 // closure calls. | 879 // closure calls. |
883 if (FLAG_trace_ic) { | 880 if (FLAG_trace_ic) { |
884 OS::PrintErr("InlineCacheMissHandler NULL code for receiver: %s\n", | 881 OS::PrintErr("InlineCacheMissHandler NULL code for receiver: %s\n", |
885 receiver.ToCString()); | 882 receiver.ToCString()); |
886 } | 883 } |
887 return Function::null(); | 884 return Function::null(); |
888 } | 885 } |
889 const Function& target_function = | 886 const Function& target_function = |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1806 // Arg1: Value that is being stored. | 1803 // Arg1: Value that is being stored. |
1807 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1804 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
1808 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); | 1805 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); |
1809 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1806 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
1810 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1807 const Object& value = Object::Handle(arguments.ArgAt(1)); |
1811 | 1808 |
1812 field.UpdateCid(value.GetClassId()); | 1809 field.UpdateCid(value.GetClassId()); |
1813 } | 1810 } |
1814 | 1811 |
1815 } // namespace dart | 1812 } // namespace dart |
OLD | NEW |