| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 __ movl(EAX, Address(EDI, ArgumentsDescriptor::position_offset())); | 877 __ movl(EAX, Address(EDI, ArgumentsDescriptor::position_offset())); |
| 878 // EAX is arg_pos as Smi. | 878 // EAX is arg_pos as Smi. |
| 879 // Point to next named entry. | 879 // Point to next named entry. |
| 880 __ addl(EDI, Immediate(ArgumentsDescriptor::named_entry_size())); | 880 __ addl(EDI, Immediate(ArgumentsDescriptor::named_entry_size())); |
| 881 __ negl(EAX); | 881 __ negl(EAX); |
| 882 Address argument_addr(EBX, EAX, TIMES_2, 0); // EAX is a negative Smi. | 882 Address argument_addr(EBX, EAX, TIMES_2, 0); // EAX is a negative Smi. |
| 883 __ movl(EAX, argument_addr); | 883 __ movl(EAX, argument_addr); |
| 884 __ jmp(&assign_optional_parameter, Assembler::kNearJump); | 884 __ jmp(&assign_optional_parameter, Assembler::kNearJump); |
| 885 __ Bind(&load_default_value); | 885 __ Bind(&load_default_value); |
| 886 // Load EAX with default argument. | 886 // Load EAX with default argument. |
| 887 const Object& value = Object::ZoneHandle(zone(), | 887 const Instance& value = parsed_function().DefaultParameterValueAt( |
| 888 parsed_function().default_parameter_values().At( | 888 param_pos - num_fixed_params); |
| 889 param_pos - num_fixed_params)); | |
| 890 __ LoadObject(EAX, value); | 889 __ LoadObject(EAX, value); |
| 891 __ Bind(&assign_optional_parameter); | 890 __ Bind(&assign_optional_parameter); |
| 892 // Assign EAX to fp[kFirstLocalSlotFromFp - param_pos]. | 891 // Assign EAX to fp[kFirstLocalSlotFromFp - param_pos]. |
| 893 // We do not use the final allocation index of the variable here, i.e. | 892 // We do not use the final allocation index of the variable here, i.e. |
| 894 // scope->VariableAt(i)->index(), because captured variables still need | 893 // scope->VariableAt(i)->index(), because captured variables still need |
| 895 // to be copied to the context that is not yet allocated. | 894 // to be copied to the context that is not yet allocated. |
| 896 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; | 895 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; |
| 897 const Address param_addr(EBP, computed_param_pos * kWordSize); | 896 const Address param_addr(EBP, computed_param_pos * kWordSize); |
| 898 __ movl(param_addr, EAX); | 897 __ movl(param_addr, EAX); |
| 899 } | 898 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 912 __ SmiUntag(ECX); | 911 __ SmiUntag(ECX); |
| 913 for (int i = 0; i < num_opt_pos_params; i++) { | 912 for (int i = 0; i < num_opt_pos_params; i++) { |
| 914 Label next_parameter; | 913 Label next_parameter; |
| 915 // Handle this optional positional parameter only if k or fewer positional | 914 // Handle this optional positional parameter only if k or fewer positional |
| 916 // arguments have been passed, where k is param_pos, the position of this | 915 // arguments have been passed, where k is param_pos, the position of this |
| 917 // optional parameter in the formal parameter list. | 916 // optional parameter in the formal parameter list. |
| 918 const int param_pos = num_fixed_params + i; | 917 const int param_pos = num_fixed_params + i; |
| 919 __ cmpl(ECX, Immediate(param_pos)); | 918 __ cmpl(ECX, Immediate(param_pos)); |
| 920 __ j(GREATER, &next_parameter, Assembler::kNearJump); | 919 __ j(GREATER, &next_parameter, Assembler::kNearJump); |
| 921 // Load EAX with default argument. | 920 // Load EAX with default argument. |
| 922 const Object& value = Object::ZoneHandle(zone(), | 921 const Object& value = parsed_function().DefaultParameterValueAt(i); |
| 923 parsed_function().default_parameter_values().At(i)); | |
| 924 __ LoadObject(EAX, value); | 922 __ LoadObject(EAX, value); |
| 925 // Assign EAX to fp[kFirstLocalSlotFromFp - param_pos]. | 923 // Assign EAX to fp[kFirstLocalSlotFromFp - param_pos]. |
| 926 // We do not use the final allocation index of the variable here, i.e. | 924 // We do not use the final allocation index of the variable here, i.e. |
| 927 // scope->VariableAt(i)->index(), because captured variables still need | 925 // scope->VariableAt(i)->index(), because captured variables still need |
| 928 // to be copied to the context that is not yet allocated. | 926 // to be copied to the context that is not yet allocated. |
| 929 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; | 927 const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos; |
| 930 const Address param_addr(EBP, computed_param_pos * kWordSize); | 928 const Address param_addr(EBP, computed_param_pos * kWordSize); |
| 931 __ movl(param_addr, EAX); | 929 __ movl(param_addr, EAX); |
| 932 __ Bind(&next_parameter); | 930 __ Bind(&next_parameter); |
| 933 } | 931 } |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1854 __ movups(reg, Address(ESP, 0)); | 1852 __ movups(reg, Address(ESP, 0)); |
| 1855 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1853 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1856 } | 1854 } |
| 1857 | 1855 |
| 1858 | 1856 |
| 1859 #undef __ | 1857 #undef __ |
| 1860 | 1858 |
| 1861 } // namespace dart | 1859 } // namespace dart |
| 1862 | 1860 |
| 1863 #endif // defined TARGET_ARCH_IA32 | 1861 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |