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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 // R5 is arg_pos as Smi. | 854 // R5 is arg_pos as Smi. |
855 // Point to next named entry. | 855 // Point to next named entry. |
856 __ add(R6, R6, Operand(ArgumentsDescriptor::named_entry_size())); | 856 __ add(R6, R6, Operand(ArgumentsDescriptor::named_entry_size())); |
857 // Negate and untag R5 so we can use in scaled address mode. | 857 // Negate and untag R5 so we can use in scaled address mode. |
858 __ subs(R5, ZR, Operand(R5, ASR, 1)); | 858 __ subs(R5, ZR, Operand(R5, ASR, 1)); |
859 Address argument_addr(R7, R5, UXTX, Address::Scaled); // R5 is untagged. | 859 Address argument_addr(R7, R5, UXTX, Address::Scaled); // R5 is untagged. |
860 __ ldr(R5, argument_addr); | 860 __ ldr(R5, argument_addr); |
861 __ b(&assign_optional_parameter); | 861 __ b(&assign_optional_parameter); |
862 __ Bind(&load_default_value); | 862 __ Bind(&load_default_value); |
863 // Load R5 with default argument. | 863 // Load R5 with default argument. |
864 const Object& value = Object::ZoneHandle( | 864 const Instance& value = parsed_function().DefaultParameterValueAt( |
865 zone(), parsed_function().default_parameter_values().At( | 865 param_pos - num_fixed_params); |
866 param_pos - num_fixed_params)); | |
867 __ LoadObject(R5, value); | 866 __ LoadObject(R5, value); |
868 __ Bind(&assign_optional_parameter); | 867 __ Bind(&assign_optional_parameter); |
869 // Assign R5 to fp[kFirstLocalSlotFromFp - param_pos]. | 868 // Assign R5 to fp[kFirstLocalSlotFromFp - param_pos]. |
870 // We do not use the final allocation index of the variable here, i.e. | 869 // We do not use the final allocation index of the variable here, i.e. |
871 // scope->VariableAt(i)->index(), because captured variables still need | 870 // scope->VariableAt(i)->index(), because captured variables still need |
872 // to be copied to the context that is not yet allocated. | 871 // to be copied to the context that is not yet allocated. |
873 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; | 872 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; |
874 __ StoreToOffset(R5, FP, computed_param_pos * kWordSize); | 873 __ StoreToOffset(R5, FP, computed_param_pos * kWordSize); |
875 } | 874 } |
876 delete[] opt_param; | 875 delete[] opt_param; |
(...skipping 12 matching lines...) Expand all Loading... |
889 __ SmiUntag(R8); | 888 __ SmiUntag(R8); |
890 for (int i = 0; i < num_opt_pos_params; i++) { | 889 for (int i = 0; i < num_opt_pos_params; i++) { |
891 Label next_parameter; | 890 Label next_parameter; |
892 // Handle this optional positional parameter only if k or fewer positional | 891 // Handle this optional positional parameter only if k or fewer positional |
893 // arguments have been passed, where k is param_pos, the position of this | 892 // arguments have been passed, where k is param_pos, the position of this |
894 // optional parameter in the formal parameter list. | 893 // optional parameter in the formal parameter list. |
895 const int param_pos = num_fixed_params + i; | 894 const int param_pos = num_fixed_params + i; |
896 __ CompareImmediate(R8, param_pos); | 895 __ CompareImmediate(R8, param_pos); |
897 __ b(&next_parameter, GT); | 896 __ b(&next_parameter, GT); |
898 // Load R5 with default argument. | 897 // Load R5 with default argument. |
899 const Object& value = Object::ZoneHandle( | 898 const Object& value = parsed_function().DefaultParameterValueAt(i); |
900 zone(), parsed_function().default_parameter_values().At(i)); | |
901 __ LoadObject(R5, value); | 899 __ LoadObject(R5, value); |
902 // Assign R5 to fp[kFirstLocalSlotFromFp - param_pos]. | 900 // Assign R5 to fp[kFirstLocalSlotFromFp - param_pos]. |
903 // We do not use the final allocation index of the variable here, i.e. | 901 // We do not use the final allocation index of the variable here, i.e. |
904 // scope->VariableAt(i)->index(), because captured variables still need | 902 // scope->VariableAt(i)->index(), because captured variables still need |
905 // to be copied to the context that is not yet allocated. | 903 // to be copied to the context that is not yet allocated. |
906 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; | 904 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; |
907 __ StoreToOffset(R5, FP, computed_param_pos * kWordSize); | 905 __ StoreToOffset(R5, FP, computed_param_pos * kWordSize); |
908 __ Bind(&next_parameter); | 906 __ Bind(&next_parameter); |
909 } | 907 } |
910 if (check_correct_named_args) { | 908 if (check_correct_named_args) { |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1838 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
1841 __ PopDouble(reg); | 1839 __ PopDouble(reg); |
1842 } | 1840 } |
1843 | 1841 |
1844 | 1842 |
1845 #undef __ | 1843 #undef __ |
1846 | 1844 |
1847 } // namespace dart | 1845 } // namespace dart |
1848 | 1846 |
1849 #endif // defined TARGET_ARCH_ARM64 | 1847 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |