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 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 | 1168 |
1169 // We check the number of passed arguments when we have to copy them due to | 1169 // We check the number of passed arguments when we have to copy them due to |
1170 // the presence of optional parameters. | 1170 // the presence of optional parameters. |
1171 // No such checking code is generated if only fixed parameters are declared, | 1171 // No such checking code is generated if only fixed parameters are declared, |
1172 // unless we are in debug mode or unless we are compiling a closure. | 1172 // unless we are in debug mode or unless we are compiling a closure. |
1173 if (num_copied_params == 0) { | 1173 if (num_copied_params == 0) { |
1174 #ifdef DEBUG | 1174 #ifdef DEBUG |
1175 ASSERT(!parsed_function().function().HasOptionalParameters()); | 1175 ASSERT(!parsed_function().function().HasOptionalParameters()); |
1176 const bool check_arguments = true; | 1176 const bool check_arguments = true; |
1177 #else | 1177 #else |
1178 const bool check_arguments = | 1178 const bool check_arguments = function.IsClosureFunction(); |
1179 function.IsClosureFunction() || function.IsNoSuchMethodDispatcher(); | |
1180 #endif | 1179 #endif |
1181 if (check_arguments) { | 1180 if (check_arguments) { |
1182 __ TraceSimMsg("Check argument count"); | 1181 __ TraceSimMsg("Check argument count"); |
1183 __ Comment("Check argument count"); | 1182 __ Comment("Check argument count"); |
1184 // Check that exactly num_fixed arguments are passed in. | 1183 // Check that exactly num_fixed arguments are passed in. |
1185 Label correct_num_arguments, wrong_num_arguments; | 1184 Label correct_num_arguments, wrong_num_arguments; |
1186 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset())); | 1185 __ lw(T0, FieldAddress(S4, ArgumentsDescriptor::count_offset())); |
1187 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params), | 1186 __ BranchNotEqual(T0, Smi::RawValue(num_fixed_params), |
1188 &wrong_num_arguments); | 1187 &wrong_num_arguments); |
1189 | 1188 |
1190 __ lw(T1, FieldAddress(S4, | 1189 __ lw(T1, FieldAddress(S4, |
1191 ArgumentsDescriptor::positional_count_offset())); | 1190 ArgumentsDescriptor::positional_count_offset())); |
1192 __ beq(T0, T1, &correct_num_arguments); | 1191 __ beq(T0, T1, &correct_num_arguments); |
1193 __ Bind(&wrong_num_arguments); | 1192 __ Bind(&wrong_num_arguments); |
1194 if (function.IsClosureFunction() || function.IsNoSuchMethodDispatcher()) { | 1193 if (function.IsClosureFunction()) { |
1195 // Invoke noSuchMethod function passing the original function name. | 1194 // Invoke noSuchMethod function passing the original function name. |
1196 // For closure functions, use "call" as the original name. | 1195 // For closure functions, use "call" as the original name. |
1197 const String& name = | 1196 const String& name = |
1198 String::Handle(function.IsClosureFunction() | 1197 String::Handle(function.IsClosureFunction() |
1199 ? Symbols::Call().raw() | 1198 ? Symbols::Call().raw() |
1200 : function.name()); | 1199 : function.name()); |
1201 const int kNumArgsChecked = 1; | 1200 const int kNumArgsChecked = 1; |
1202 const ICData& ic_data = ICData::ZoneHandle( | 1201 const ICData& ic_data = ICData::ZoneHandle( |
1203 ICData::New(function, name, Object::null_array(), | 1202 ICData::New(function, name, Object::null_array(), |
1204 Isolate::kNoDeoptId, kNumArgsChecked)); | 1203 Isolate::kNoDeoptId, kNumArgsChecked)); |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 __ AddImmediate(SP, kDoubleSize); | 1996 __ AddImmediate(SP, kDoubleSize); |
1998 } | 1997 } |
1999 | 1998 |
2000 | 1999 |
2001 #undef __ | 2000 #undef __ |
2002 | 2001 |
2003 | 2002 |
2004 } // namespace dart | 2003 } // namespace dart |
2005 | 2004 |
2006 #endif // defined TARGET_ARCH_MIPS | 2005 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |