OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 __ str(TMP, copy_addr); | 743 __ str(TMP, copy_addr); |
744 __ Bind(&loop_condition); | 744 __ Bind(&loop_condition); |
745 __ subs(R8, R8, Operand(1)); | 745 __ subs(R8, R8, Operand(1)); |
746 __ b(&loop, PL); | 746 __ b(&loop, PL); |
747 | 747 |
748 // Copy or initialize optional named arguments. | 748 // Copy or initialize optional named arguments. |
749 Label all_arguments_processed; | 749 Label all_arguments_processed; |
750 #ifdef DEBUG | 750 #ifdef DEBUG |
751 const bool check_correct_named_args = true; | 751 const bool check_correct_named_args = true; |
752 #else | 752 #else |
753 const bool check_correct_named_args = function.IsClosureFunction(); | 753 const bool check_correct_named_args = |
| 754 function.IsClosureFunction() || function.IsConvertedClosureFunction(); |
754 #endif | 755 #endif |
755 if (num_opt_named_params > 0) { | 756 if (num_opt_named_params > 0) { |
756 // Start by alphabetically sorting the names of the optional parameters. | 757 // Start by alphabetically sorting the names of the optional parameters. |
757 LocalVariable** opt_param = new LocalVariable*[num_opt_named_params]; | 758 LocalVariable** opt_param = new LocalVariable*[num_opt_named_params]; |
758 int* opt_param_position = new int[num_opt_named_params]; | 759 int* opt_param_position = new int[num_opt_named_params]; |
759 for (int pos = num_fixed_params; pos < num_params; pos++) { | 760 for (int pos = num_fixed_params; pos < num_params; pos++) { |
760 LocalVariable* parameter = scope->VariableAt(pos); | 761 LocalVariable* parameter = scope->VariableAt(pos); |
761 const String& opt_param_name = parameter->name(); | 762 const String& opt_param_name = parameter->name(); |
762 int i = pos - num_fixed_params; | 763 int i = pos - num_fixed_params; |
763 while (--i >= 0) { | 764 while (--i >= 0) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 if (check_correct_named_args) { | 851 if (check_correct_named_args) { |
851 __ LoadFieldFromOffset(R7, R4, ArgumentsDescriptor::count_offset()); | 852 __ LoadFieldFromOffset(R7, R4, ArgumentsDescriptor::count_offset()); |
852 __ SmiUntag(R7); | 853 __ SmiUntag(R7); |
853 // Check that R8 equals R7, i.e. no named arguments passed. | 854 // Check that R8 equals R7, i.e. no named arguments passed. |
854 __ CompareRegisters(R8, R7); | 855 __ CompareRegisters(R8, R7); |
855 __ b(&all_arguments_processed, EQ); | 856 __ b(&all_arguments_processed, EQ); |
856 } | 857 } |
857 } | 858 } |
858 | 859 |
859 __ Bind(&wrong_num_arguments); | 860 __ Bind(&wrong_num_arguments); |
860 if (function.IsClosureFunction()) { | 861 if (function.IsClosureFunction() || function.IsConvertedClosureFunction()) { |
861 __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack. | 862 __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack. |
862 __ BranchPatchable(*StubCode::CallClosureNoSuchMethod_entry()); | 863 __ BranchPatchable(*StubCode::CallClosureNoSuchMethod_entry()); |
863 // The noSuchMethod call may return to the caller, but not here. | 864 // The noSuchMethod call may return to the caller, but not here. |
864 } else if (check_correct_named_args) { | 865 } else if (check_correct_named_args) { |
865 __ Stop("Wrong arguments"); | 866 __ Stop("Wrong arguments"); |
866 } | 867 } |
867 | 868 |
868 __ Bind(&all_arguments_processed); | 869 __ Bind(&all_arguments_processed); |
869 // Nullify originally passed arguments only after they have been copied and | 870 // Nullify originally passed arguments only after they have been copied and |
870 // checked, otherwise noSuchMethod would not see their original values. | 871 // checked, otherwise noSuchMethod would not see their original values. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 | 981 |
981 const int num_fixed_params = function.num_fixed_parameters(); | 982 const int num_fixed_params = function.num_fixed_parameters(); |
982 const int num_copied_params = parsed_function().num_copied_params(); | 983 const int num_copied_params = parsed_function().num_copied_params(); |
983 const int num_locals = parsed_function().num_stack_locals(); | 984 const int num_locals = parsed_function().num_stack_locals(); |
984 | 985 |
985 // We check the number of passed arguments when we have to copy them due to | 986 // We check the number of passed arguments when we have to copy them due to |
986 // the presence of optional parameters. | 987 // the presence of optional parameters. |
987 // No such checking code is generated if only fixed parameters are declared, | 988 // No such checking code is generated if only fixed parameters are declared, |
988 // unless we are in debug mode or unless we are compiling a closure. | 989 // unless we are in debug mode or unless we are compiling a closure. |
989 if (num_copied_params == 0) { | 990 if (num_copied_params == 0) { |
990 const bool check_arguments = | 991 const bool check_arguments = (function.IsClosureFunction() || |
991 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); | 992 function.IsConvertedClosureFunction()) && |
| 993 !flow_graph().IsCompiledForOsr(); |
992 if (check_arguments) { | 994 if (check_arguments) { |
993 __ Comment("Check argument count"); | 995 __ Comment("Check argument count"); |
994 // Check that exactly num_fixed arguments are passed in. | 996 // Check that exactly num_fixed arguments are passed in. |
995 Label correct_num_arguments, wrong_num_arguments; | 997 Label correct_num_arguments, wrong_num_arguments; |
996 __ LoadFieldFromOffset(R0, R4, ArgumentsDescriptor::count_offset()); | 998 __ LoadFieldFromOffset(R0, R4, ArgumentsDescriptor::count_offset()); |
997 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); | 999 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); |
998 __ b(&wrong_num_arguments, NE); | 1000 __ b(&wrong_num_arguments, NE); |
999 __ LoadFieldFromOffset(R1, R4, | 1001 __ LoadFieldFromOffset(R1, R4, |
1000 ArgumentsDescriptor::positional_count_offset()); | 1002 ArgumentsDescriptor::positional_count_offset()); |
1001 __ CompareRegisters(R0, R1); | 1003 __ CompareRegisters(R0, R1); |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 | 1743 |
1742 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1744 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
1743 __ PopDouble(reg); | 1745 __ PopDouble(reg); |
1744 } | 1746 } |
1745 | 1747 |
1746 #undef __ | 1748 #undef __ |
1747 | 1749 |
1748 } // namespace dart | 1750 } // namespace dart |
1749 | 1751 |
1750 #endif // defined TARGET_ARCH_ARM64 | 1752 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |