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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 // Point to next named entry. | 873 // Point to next named entry. |
874 __ AddImmediate(T0, ArgumentsDescriptor::named_entry_size()); | 874 __ AddImmediate(T0, ArgumentsDescriptor::named_entry_size()); |
875 __ subu(T3, ZR, T3); | 875 __ subu(T3, ZR, T3); |
876 __ sll(T3, T3, 1); | 876 __ sll(T3, T3, 1); |
877 __ addu(T3, T1, T3); | 877 __ addu(T3, T1, T3); |
878 __ b(&assign_optional_parameter); | 878 __ b(&assign_optional_parameter); |
879 __ delay_slot()->lw(T3, Address(T3)); | 879 __ delay_slot()->lw(T3, Address(T3)); |
880 | 880 |
881 __ Bind(&load_default_value); | 881 __ Bind(&load_default_value); |
882 // Load T3 with default argument. | 882 // Load T3 with default argument. |
883 const Object& value = Object::ZoneHandle(zone(), | 883 const Instance& value = |
884 parsed_function().default_parameter_values().At( | 884 parsed_function().DefaultParameterAt(param_pos - num_fixed_params); |
885 param_pos - num_fixed_params)); | |
886 __ LoadObject(T3, value); | 885 __ LoadObject(T3, value); |
887 __ Bind(&assign_optional_parameter); | 886 __ Bind(&assign_optional_parameter); |
888 // Assign T3 to fp[kFirstLocalSlotFromFp - param_pos]. | 887 // Assign T3 to fp[kFirstLocalSlotFromFp - param_pos]. |
889 // We do not use the final allocation index of the variable here, i.e. | 888 // We do not use the final allocation index of the variable here, i.e. |
890 // scope->VariableAt(i)->index(), because captured variables still need | 889 // scope->VariableAt(i)->index(), because captured variables still need |
891 // to be copied to the context that is not yet allocated. | 890 // to be copied to the context that is not yet allocated. |
892 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; | 891 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; |
893 __ sw(T3, Address(FP, computed_param_pos * kWordSize)); | 892 __ sw(T3, Address(FP, computed_param_pos * kWordSize)); |
894 } | 893 } |
895 delete[] opt_param; | 894 delete[] opt_param; |
(...skipping 11 matching lines...) Expand all Loading... |
907 FieldAddress(S4, ArgumentsDescriptor::positional_count_offset())); | 906 FieldAddress(S4, ArgumentsDescriptor::positional_count_offset())); |
908 __ SmiUntag(T2); | 907 __ SmiUntag(T2); |
909 for (int i = 0; i < num_opt_pos_params; i++) { | 908 for (int i = 0; i < num_opt_pos_params; i++) { |
910 Label next_parameter; | 909 Label next_parameter; |
911 // Handle this optional positional parameter only if k or fewer positional | 910 // Handle this optional positional parameter only if k or fewer positional |
912 // arguments have been passed, where k is param_pos, the position of this | 911 // arguments have been passed, where k is param_pos, the position of this |
913 // optional parameter in the formal parameter list. | 912 // optional parameter in the formal parameter list. |
914 const int param_pos = num_fixed_params + i; | 913 const int param_pos = num_fixed_params + i; |
915 __ BranchSignedGreater(T2, Immediate(param_pos), &next_parameter); | 914 __ BranchSignedGreater(T2, Immediate(param_pos), &next_parameter); |
916 // Load T3 with default argument. | 915 // Load T3 with default argument. |
917 const Object& value = Object::ZoneHandle(zone(), | 916 const Object& value = parsed_function().DefaultParameterAt(i); |
918 parsed_function().default_parameter_values().At(i)); | |
919 __ LoadObject(T3, value); | 917 __ LoadObject(T3, value); |
920 // Assign T3 to fp[kFirstLocalSlotFromFp - param_pos]. | 918 // Assign T3 to fp[kFirstLocalSlotFromFp - param_pos]. |
921 // We do not use the final allocation index of the variable here, i.e. | 919 // We do not use the final allocation index of the variable here, i.e. |
922 // scope->VariableAt(i)->index(), because captured variables still need | 920 // scope->VariableAt(i)->index(), because captured variables still need |
923 // to be copied to the context that is not yet allocated. | 921 // to be copied to the context that is not yet allocated. |
924 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; | 922 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; |
925 __ sw(T3, Address(FP, computed_param_pos * kWordSize)); | 923 __ sw(T3, Address(FP, computed_param_pos * kWordSize)); |
926 __ Bind(&next_parameter); | 924 __ Bind(&next_parameter); |
927 } | 925 } |
928 if (check_correct_named_args) { | 926 if (check_correct_named_args) { |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 __ AddImmediate(SP, kDoubleSize); | 1864 __ AddImmediate(SP, kDoubleSize); |
1867 } | 1865 } |
1868 | 1866 |
1869 | 1867 |
1870 #undef __ | 1868 #undef __ |
1871 | 1869 |
1872 | 1870 |
1873 } // namespace dart | 1871 } // namespace dart |
1874 | 1872 |
1875 #endif // defined TARGET_ARCH_MIPS | 1873 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |