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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 // the presence of optional parameters. | 1109 // the presence of optional parameters. |
1110 // No such checking code is generated if only fixed parameters are declared, | 1110 // No such checking code is generated if only fixed parameters are declared, |
1111 // unless we are in debug mode or unless we are compiling a closure. | 1111 // unless we are in debug mode or unless we are compiling a closure. |
1112 LocalVariable* saved_args_desc_var = | 1112 LocalVariable* saved_args_desc_var = |
1113 parsed_function().GetSavedArgumentsDescriptorVar(); | 1113 parsed_function().GetSavedArgumentsDescriptorVar(); |
1114 if (num_copied_params == 0) { | 1114 if (num_copied_params == 0) { |
1115 #ifdef DEBUG | 1115 #ifdef DEBUG |
1116 ASSERT(!parsed_function().function().HasOptionalParameters()); | 1116 ASSERT(!parsed_function().function().HasOptionalParameters()); |
1117 const bool check_arguments = true; | 1117 const bool check_arguments = true; |
1118 #else | 1118 #else |
1119 const bool check_arguments = function.IsClosureFunction(); | 1119 const bool check_arguments = |
| 1120 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); |
1120 #endif | 1121 #endif |
1121 if (check_arguments) { | 1122 if (check_arguments) { |
1122 __ TraceSimMsg("Check argument count"); | 1123 __ TraceSimMsg("Check argument count"); |
1123 __ Comment("Check argument count"); | 1124 __ Comment("Check argument count"); |
1124 // Check that exactly num_fixed arguments are passed in. | 1125 // Check that exactly num_fixed arguments are passed in. |
1125 Label correct_num_arguments, wrong_num_arguments; | 1126 Label correct_num_arguments, wrong_num_arguments; |
1126 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset())); | 1127 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset())); |
1127 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params), | 1128 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params), |
1128 &wrong_num_arguments); | 1129 &wrong_num_arguments); |
1129 | 1130 |
1130 __ lw(T1, FieldAddress(S4, | 1131 __ lw(T1, FieldAddress(S4, |
1131 ArgumentsDescriptor::positional_count_offset())); | 1132 ArgumentsDescriptor::positional_count_offset())); |
1132 __ beq(T0, T1, &correct_num_arguments); | 1133 __ beq(T0, T1, &correct_num_arguments); |
1133 __ Bind(&wrong_num_arguments); | 1134 __ Bind(&wrong_num_arguments); |
1134 if (function.IsClosureFunction()) { | 1135 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) { |
1135 if (StackSize() != 0) { | 1136 if (StackSize() != 0) { |
1136 // We need to unwind the space we reserved for locals and copied | 1137 // We need to unwind the space we reserved for locals and copied |
1137 // parameters. The NoSuchMethodFunction stub does not expect to see | 1138 // parameters. The NoSuchMethodFunction stub does not expect to see |
1138 // that area on the stack. | 1139 // that area on the stack. |
1139 __ AddImmediate(SP, StackSize() * kWordSize); | 1140 __ AddImmediate(SP, StackSize() * kWordSize); |
1140 } | 1141 } |
1141 // The call below has an empty stackmap because we have just | 1142 // The call below has an empty stackmap because we have just |
1142 // dropped the spill slots. | 1143 // dropped the spill slots. |
1143 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); | 1144 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); |
1144 | 1145 |
1145 // Invoke noSuchMethod function passing "call" as the function name. | 1146 // Invoke noSuchMethod function passing the original function name. |
| 1147 // For closure functions, use "call" as the original name. |
| 1148 const String& name = |
| 1149 String::Handle(function.IsClosureFunction() |
| 1150 ? Symbols::Call().raw() |
| 1151 : function.name()); |
1146 const int kNumArgsChecked = 1; | 1152 const int kNumArgsChecked = 1; |
1147 const ICData& ic_data = ICData::ZoneHandle( | 1153 const ICData& ic_data = ICData::ZoneHandle( |
1148 ICData::New(function, Symbols::Call(), | 1154 ICData::New(function, name, Isolate::kNoDeoptId, kNumArgsChecked)); |
1149 Isolate::kNoDeoptId, kNumArgsChecked)); | |
1150 __ LoadObject(S5, ic_data); | 1155 __ LoadObject(S5, ic_data); |
1151 // FP - 4 : saved PP, object pool pointer of caller. | 1156 // FP - 4 : saved PP, object pool pointer of caller. |
1152 // FP + 0 : previous frame pointer. | 1157 // FP + 0 : previous frame pointer. |
1153 // FP + 4 : return address. | 1158 // FP + 4 : return address. |
1154 // FP + 8 : PC marker, for easy identification of RawInstruction obj. | 1159 // FP + 8 : PC marker, for easy identification of RawInstruction obj. |
1155 // FP + 12: last argument (arg n-1). | 1160 // FP + 12: last argument (arg n-1). |
1156 // SP + 0 : saved PP. | 1161 // SP + 0 : saved PP. |
1157 // SP + 16 + 4*(n-1) : first argument (arg 0). | 1162 // SP + 16 + 4*(n-1) : first argument (arg 0). |
1158 // S5 : ic-data. | 1163 // S5 : ic-data. |
1159 // S4 : arguments descriptor array. | 1164 // S4 : arguments descriptor array. |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 __ AddImmediate(SP, kDoubleSize); | 1933 __ AddImmediate(SP, kDoubleSize); |
1929 } | 1934 } |
1930 | 1935 |
1931 | 1936 |
1932 #undef __ | 1937 #undef __ |
1933 | 1938 |
1934 | 1939 |
1935 } // namespace dart | 1940 } // namespace dart |
1936 | 1941 |
1937 #endif // defined TARGET_ARCH_MIPS | 1942 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |