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/globals.h" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "lib/error.h" | 10 #include "lib/error.h" |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 // the presence of optional parameters. | 1061 // the presence of optional parameters. |
1062 // No such checking code is generated if only fixed parameters are declared, | 1062 // No such checking code is generated if only fixed parameters are declared, |
1063 // unless we are in debug mode or unless we are compiling a closure. | 1063 // unless we are in debug mode or unless we are compiling a closure. |
1064 LocalVariable* saved_args_desc_var = | 1064 LocalVariable* saved_args_desc_var = |
1065 parsed_function().GetSavedArgumentsDescriptorVar(); | 1065 parsed_function().GetSavedArgumentsDescriptorVar(); |
1066 if (num_copied_params == 0) { | 1066 if (num_copied_params == 0) { |
1067 #ifdef DEBUG | 1067 #ifdef DEBUG |
1068 ASSERT(!parsed_function().function().HasOptionalParameters()); | 1068 ASSERT(!parsed_function().function().HasOptionalParameters()); |
1069 const bool check_arguments = true; | 1069 const bool check_arguments = true; |
1070 #else | 1070 #else |
1071 const bool check_arguments = function.IsClosureFunction(); | 1071 const bool check_arguments = |
| 1072 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); |
1072 #endif | 1073 #endif |
1073 if (check_arguments) { | 1074 if (check_arguments) { |
1074 __ Comment("Check argument count"); | 1075 __ Comment("Check argument count"); |
1075 // Check that exactly num_fixed arguments are passed in. | 1076 // Check that exactly num_fixed arguments are passed in. |
1076 Label correct_num_arguments, wrong_num_arguments; | 1077 Label correct_num_arguments, wrong_num_arguments; |
1077 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset())); | 1078 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset())); |
1078 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); | 1079 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); |
1079 __ b(&wrong_num_arguments, NE); | 1080 __ b(&wrong_num_arguments, NE); |
1080 __ ldr(R1, FieldAddress(R4, | 1081 __ ldr(R1, FieldAddress(R4, |
1081 ArgumentsDescriptor::positional_count_offset())); | 1082 ArgumentsDescriptor::positional_count_offset())); |
1082 __ cmp(R0, ShifterOperand(R1)); | 1083 __ cmp(R0, ShifterOperand(R1)); |
1083 __ b(&correct_num_arguments, EQ); | 1084 __ b(&correct_num_arguments, EQ); |
1084 __ Bind(&wrong_num_arguments); | 1085 __ Bind(&wrong_num_arguments); |
1085 if (function.IsClosureFunction()) { | 1086 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) { |
1086 if (StackSize() != 0) { | 1087 if (StackSize() != 0) { |
1087 // We need to unwind the space we reserved for locals and copied | 1088 // We need to unwind the space we reserved for locals and copied |
1088 // parameters. The NoSuchMethodFunction stub does not expect to see | 1089 // parameters. The NoSuchMethodFunction stub does not expect to see |
1089 // that area on the stack. | 1090 // that area on the stack. |
1090 __ AddImmediate(SP, StackSize() * kWordSize); | 1091 __ AddImmediate(SP, StackSize() * kWordSize); |
1091 } | 1092 } |
1092 // The call below has an empty stackmap because we have just | 1093 // The call below has an empty stackmap because we have just |
1093 // dropped the spill slots. | 1094 // dropped the spill slots. |
1094 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); | 1095 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); |
1095 | 1096 |
1096 // Invoke noSuchMethod function passing "call" as the function name. | 1097 // Invoke noSuchMethod function passing the original function name. |
| 1098 // For closure functions, use "call" as the original name. |
| 1099 const String& name = |
| 1100 String::Handle(function.IsClosureFunction() |
| 1101 ? Symbols::Call().raw() |
| 1102 : function.name()); |
1097 const int kNumArgsChecked = 1; | 1103 const int kNumArgsChecked = 1; |
1098 const ICData& ic_data = ICData::ZoneHandle( | 1104 const ICData& ic_data = ICData::ZoneHandle( |
1099 ICData::New(function, Symbols::Call(), Object::null_array(), | 1105 ICData::New(function, name, Object::null_array(), |
1100 Isolate::kNoDeoptId, kNumArgsChecked)); | 1106 Isolate::kNoDeoptId, kNumArgsChecked)); |
1101 __ LoadObject(R5, ic_data); | 1107 __ LoadObject(R5, ic_data); |
1102 // FP - 4 : saved PP, object pool pointer of caller. | 1108 // FP - 4 : saved PP, object pool pointer of caller. |
1103 // FP + 0 : previous frame pointer. | 1109 // FP + 0 : previous frame pointer. |
1104 // FP + 4 : return address. | 1110 // FP + 4 : return address. |
1105 // FP + 8 : PC marker, for easy identification of RawInstruction obj. | 1111 // FP + 8 : PC marker, for easy identification of RawInstruction obj. |
1106 // FP + 12: last argument (arg n-1). | 1112 // FP + 12: last argument (arg n-1). |
1107 // SP + 0 : saved PP. | 1113 // SP + 0 : saved PP. |
1108 // SP + 16 + 4*(n-1) : first argument (arg 0). | 1114 // SP + 16 + 4*(n-1) : first argument (arg 0). |
1109 // R5 : ic-data. | 1115 // R5 : ic-data. |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1788 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
1783 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); | 1789 __ vldrd(reg, Address(SP, kDoubleSize, Address::PostIndex)); |
1784 } | 1790 } |
1785 | 1791 |
1786 | 1792 |
1787 #undef __ | 1793 #undef __ |
1788 | 1794 |
1789 } // namespace dart | 1795 } // namespace dart |
1790 | 1796 |
1791 #endif // defined TARGET_ARCH_ARM | 1797 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |