| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 // RAX is arg_pos as Smi. | 866 // RAX is arg_pos as Smi. |
| 867 // Point to next named entry. | 867 // Point to next named entry. |
| 868 __ AddImmediate( | 868 __ AddImmediate( |
| 869 RDI, Immediate(ArgumentsDescriptor::named_entry_size())); | 869 RDI, Immediate(ArgumentsDescriptor::named_entry_size())); |
| 870 __ negq(RAX); | 870 __ negq(RAX); |
| 871 Address argument_addr(RBX, RAX, TIMES_4, 0); // RAX is a negative Smi. | 871 Address argument_addr(RBX, RAX, TIMES_4, 0); // RAX is a negative Smi. |
| 872 __ movq(RAX, argument_addr); | 872 __ movq(RAX, argument_addr); |
| 873 __ jmp(&assign_optional_parameter, Assembler::kNearJump); | 873 __ jmp(&assign_optional_parameter, Assembler::kNearJump); |
| 874 __ Bind(&load_default_value); | 874 __ Bind(&load_default_value); |
| 875 // Load RAX with default argument. | 875 // Load RAX with default argument. |
| 876 const Object& value = Object::ZoneHandle(zone(), | 876 const Instance& value = |
| 877 parsed_function().default_parameter_values().At( | 877 parsed_function().DefaultParameterAt(param_pos - num_fixed_params); |
| 878 param_pos - num_fixed_params)); | |
| 879 __ LoadObject(RAX, value); | 878 __ LoadObject(RAX, value); |
| 880 __ Bind(&assign_optional_parameter); | 879 __ Bind(&assign_optional_parameter); |
| 881 // Assign RAX to fp[kFirstLocalSlotFromFp - param_pos]. | 880 // Assign RAX to fp[kFirstLocalSlotFromFp - param_pos]. |
| 882 // We do not use the final allocation index of the variable here, i.e. | 881 // We do not use the final allocation index of the variable here, i.e. |
| 883 // scope->VariableAt(i)->index(), because captured variables still need | 882 // scope->VariableAt(i)->index(), because captured variables still need |
| 884 // to be copied to the context that is not yet allocated. | 883 // to be copied to the context that is not yet allocated. |
| 885 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; | 884 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; |
| 886 const Address param_addr(RBP, computed_param_pos * kWordSize); | 885 const Address param_addr(RBP, computed_param_pos * kWordSize); |
| 887 __ movq(param_addr, RAX); | 886 __ movq(param_addr, RAX); |
| 888 } | 887 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 902 __ SmiUntag(RCX); | 901 __ SmiUntag(RCX); |
| 903 for (int i = 0; i < num_opt_pos_params; i++) { | 902 for (int i = 0; i < num_opt_pos_params; i++) { |
| 904 Label next_parameter; | 903 Label next_parameter; |
| 905 // Handle this optional positional parameter only if k or fewer positional | 904 // Handle this optional positional parameter only if k or fewer positional |
| 906 // arguments have been passed, where k is param_pos, the position of this | 905 // arguments have been passed, where k is param_pos, the position of this |
| 907 // optional parameter in the formal parameter list. | 906 // optional parameter in the formal parameter list. |
| 908 const int param_pos = num_fixed_params + i; | 907 const int param_pos = num_fixed_params + i; |
| 909 __ CompareImmediate(RCX, Immediate(param_pos)); | 908 __ CompareImmediate(RCX, Immediate(param_pos)); |
| 910 __ j(GREATER, &next_parameter, Assembler::kNearJump); | 909 __ j(GREATER, &next_parameter, Assembler::kNearJump); |
| 911 // Load RAX with default argument. | 910 // Load RAX with default argument. |
| 912 const Object& value = Object::ZoneHandle(zone(), | 911 const Object& value = parsed_function().DefaultParameterAt(i); |
| 913 parsed_function().default_parameter_values().At(i)); | |
| 914 __ LoadObject(RAX, value); | 912 __ LoadObject(RAX, value); |
| 915 // Assign RAX to fp[kFirstLocalSlotFromFp - param_pos]. | 913 // Assign RAX to fp[kFirstLocalSlotFromFp - param_pos]. |
| 916 // We do not use the final allocation index of the variable here, i.e. | 914 // We do not use the final allocation index of the variable here, i.e. |
| 917 // scope->VariableAt(i)->index(), because captured variables still need | 915 // scope->VariableAt(i)->index(), because captured variables still need |
| 918 // to be copied to the context that is not yet allocated. | 916 // to be copied to the context that is not yet allocated. |
| 919 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; | 917 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; |
| 920 const Address param_addr(RBP, computed_param_pos * kWordSize); | 918 const Address param_addr(RBP, computed_param_pos * kWordSize); |
| 921 __ movq(param_addr, RAX); | 919 __ movq(param_addr, RAX); |
| 922 __ Bind(&next_parameter); | 920 __ Bind(&next_parameter); |
| 923 } | 921 } |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 __ movups(reg, Address(RSP, 0)); | 1795 __ movups(reg, Address(RSP, 0)); |
| 1798 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1796 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
| 1799 } | 1797 } |
| 1800 | 1798 |
| 1801 | 1799 |
| 1802 #undef __ | 1800 #undef __ |
| 1803 | 1801 |
| 1804 } // namespace dart | 1802 } // namespace dart |
| 1805 | 1803 |
| 1806 #endif // defined TARGET_ARCH_X64 | 1804 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |