| 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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 __ str(IP, copy_addr); | 758 __ str(IP, copy_addr); |
| 759 __ Bind(&loop_condition); | 759 __ Bind(&loop_condition); |
| 760 __ subs(R6, R6, Operand(1)); | 760 __ subs(R6, R6, Operand(1)); |
| 761 __ b(&loop, PL); | 761 __ b(&loop, PL); |
| 762 | 762 |
| 763 // Copy or initialize optional named arguments. | 763 // Copy or initialize optional named arguments. |
| 764 Label all_arguments_processed; | 764 Label all_arguments_processed; |
| 765 #ifdef DEBUG | 765 #ifdef DEBUG |
| 766 const bool check_correct_named_args = true; | 766 const bool check_correct_named_args = true; |
| 767 #else | 767 #else |
| 768 const bool check_correct_named_args = function.IsClosureFunction(); | 768 const bool check_correct_named_args = |
| 769 function.IsClosureFunction() || function.IsConvertedClosureFunction(); |
| 769 #endif | 770 #endif |
| 770 if (num_opt_named_params > 0) { | 771 if (num_opt_named_params > 0) { |
| 771 // Start by alphabetically sorting the names of the optional parameters. | 772 // Start by alphabetically sorting the names of the optional parameters. |
| 772 LocalVariable** opt_param = new LocalVariable*[num_opt_named_params]; | 773 LocalVariable** opt_param = new LocalVariable*[num_opt_named_params]; |
| 773 int* opt_param_position = new int[num_opt_named_params]; | 774 int* opt_param_position = new int[num_opt_named_params]; |
| 774 for (int pos = num_fixed_params; pos < num_params; pos++) { | 775 for (int pos = num_fixed_params; pos < num_params; pos++) { |
| 775 LocalVariable* parameter = scope->VariableAt(pos); | 776 LocalVariable* parameter = scope->VariableAt(pos); |
| 776 const String& opt_param_name = parameter->name(); | 777 const String& opt_param_name = parameter->name(); |
| 777 int i = pos - num_fixed_params; | 778 int i = pos - num_fixed_params; |
| 778 while (--i >= 0) { | 779 while (--i >= 0) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 if (check_correct_named_args) { | 867 if (check_correct_named_args) { |
| 867 __ ldr(NOTFP, FieldAddress(R4, ArgumentsDescriptor::count_offset())); | 868 __ ldr(NOTFP, FieldAddress(R4, ArgumentsDescriptor::count_offset())); |
| 868 __ SmiUntag(NOTFP); | 869 __ SmiUntag(NOTFP); |
| 869 // Check that R6 equals NOTFP, i.e. no named arguments passed. | 870 // Check that R6 equals NOTFP, i.e. no named arguments passed. |
| 870 __ cmp(R6, Operand(NOTFP)); | 871 __ cmp(R6, Operand(NOTFP)); |
| 871 __ b(&all_arguments_processed, EQ); | 872 __ b(&all_arguments_processed, EQ); |
| 872 } | 873 } |
| 873 } | 874 } |
| 874 | 875 |
| 875 __ Bind(&wrong_num_arguments); | 876 __ Bind(&wrong_num_arguments); |
| 876 if (function.IsClosureFunction()) { | 877 if (function.IsClosureFunction() || function.IsConvertedClosureFunction()) { |
| 877 __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack. | 878 __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack. |
| 878 __ Branch(*StubCode::CallClosureNoSuchMethod_entry()); | 879 __ Branch(*StubCode::CallClosureNoSuchMethod_entry()); |
| 879 // The noSuchMethod call may return to the caller, but not here. | 880 // The noSuchMethod call may return to the caller, but not here. |
| 880 } else if (check_correct_named_args) { | 881 } else if (check_correct_named_args) { |
| 881 __ Stop("Wrong arguments"); | 882 __ Stop("Wrong arguments"); |
| 882 } | 883 } |
| 883 | 884 |
| 884 __ Bind(&all_arguments_processed); | 885 __ Bind(&all_arguments_processed); |
| 885 // Nullify originally passed arguments only after they have been copied and | 886 // Nullify originally passed arguments only after they have been copied and |
| 886 // checked, otherwise noSuchMethod would not see their original values. | 887 // checked, otherwise noSuchMethod would not see their original values. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 | 991 |
| 991 const int num_fixed_params = function.num_fixed_parameters(); | 992 const int num_fixed_params = function.num_fixed_parameters(); |
| 992 const int num_copied_params = parsed_function().num_copied_params(); | 993 const int num_copied_params = parsed_function().num_copied_params(); |
| 993 const int num_locals = parsed_function().num_stack_locals(); | 994 const int num_locals = parsed_function().num_stack_locals(); |
| 994 | 995 |
| 995 // We check the number of passed arguments when we have to copy them due to | 996 // We check the number of passed arguments when we have to copy them due to |
| 996 // the presence of optional parameters. | 997 // the presence of optional parameters. |
| 997 // No such checking code is generated if only fixed parameters are declared, | 998 // No such checking code is generated if only fixed parameters are declared, |
| 998 // unless we are in debug mode or unless we are compiling a closure. | 999 // unless we are in debug mode or unless we are compiling a closure. |
| 999 if (num_copied_params == 0) { | 1000 if (num_copied_params == 0) { |
| 1000 const bool check_arguments = | 1001 const bool check_arguments = (function.IsClosureFunction() || |
| 1001 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); | 1002 function.IsConvertedClosureFunction()) && |
| 1003 !flow_graph().IsCompiledForOsr(); |
| 1002 if (check_arguments) { | 1004 if (check_arguments) { |
| 1003 __ Comment("Check argument count"); | 1005 __ Comment("Check argument count"); |
| 1004 // Check that exactly num_fixed arguments are passed in. | 1006 // Check that exactly num_fixed arguments are passed in. |
| 1005 Label correct_num_arguments, wrong_num_arguments; | 1007 Label correct_num_arguments, wrong_num_arguments; |
| 1006 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset())); | 1008 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset())); |
| 1007 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); | 1009 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); |
| 1008 __ b(&wrong_num_arguments, NE); | 1010 __ b(&wrong_num_arguments, NE); |
| 1009 __ ldr(R1, | 1011 __ ldr(R1, |
| 1010 FieldAddress(R4, ArgumentsDescriptor::positional_count_offset())); | 1012 FieldAddress(R4, ArgumentsDescriptor::positional_count_offset())); |
| 1011 __ cmp(R0, Operand(R1)); | 1013 __ cmp(R0, Operand(R1)); |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1802 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1801 DRegister dreg = EvenDRegisterOf(reg); | 1803 DRegister dreg = EvenDRegisterOf(reg); |
| 1802 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1804 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1803 } | 1805 } |
| 1804 | 1806 |
| 1805 #undef __ | 1807 #undef __ |
| 1806 | 1808 |
| 1807 } // namespace dart | 1809 } // namespace dart |
| 1808 | 1810 |
| 1809 #endif // defined TARGET_ARCH_ARM | 1811 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |