OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "lib/error.h" | 10 #include "lib/error.h" |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 for (int i = 0; i < num_opt_params; i++) { | 735 for (int i = 0; i < num_opt_params; i++) { |
736 // Handle this optional parameter only if k or fewer positional arguments | 736 // Handle this optional parameter only if k or fewer positional arguments |
737 // have been passed, where k is the position of this optional parameter in | 737 // have been passed, where k is the position of this optional parameter in |
738 // the formal parameter list. | 738 // the formal parameter list. |
739 Label load_default_value, assign_optional_parameter, next_parameter; | 739 Label load_default_value, assign_optional_parameter, next_parameter; |
740 const int param_pos = opt_param_position[i]; | 740 const int param_pos = opt_param_position[i]; |
741 __ cmpl(ECX, Immediate(param_pos)); | 741 __ cmpl(ECX, Immediate(param_pos)); |
742 __ j(GREATER, &next_parameter, Assembler::kNearJump); | 742 __ j(GREATER, &next_parameter, Assembler::kNearJump); |
743 // Check if this named parameter was passed in. | 743 // Check if this named parameter was passed in. |
744 __ movl(EAX, Address(EDI, 0)); // Load EAX with the name of the argument. | 744 __ movl(EAX, Address(EDI, 0)); // Load EAX with the name of the argument. |
| 745 ASSERT(opt_param[i]->name().IsSymbol()); |
745 __ CompareObject(EAX, opt_param[i]->name()); | 746 __ CompareObject(EAX, opt_param[i]->name()); |
746 __ j(NOT_EQUAL, &load_default_value, Assembler::kNearJump); | 747 __ j(NOT_EQUAL, &load_default_value, Assembler::kNearJump); |
747 // Load EAX with passed-in argument at provided arg_pos, i.e. at | 748 // Load EAX with passed-in argument at provided arg_pos, i.e. at |
748 // fp[1 + argc - arg_pos]. | 749 // fp[1 + argc - arg_pos]. |
749 __ movl(EAX, Address(EDI, kWordSize)); // EAX is arg_pos as Smi. | 750 __ movl(EAX, Address(EDI, kWordSize)); // EAX is arg_pos as Smi. |
750 __ addl(EDI, Immediate(2 * kWordSize)); // Point to next name/pos pair. | 751 __ addl(EDI, Immediate(2 * kWordSize)); // Point to next name/pos pair. |
751 __ negl(EAX); | 752 __ negl(EAX); |
752 Address argument_addr(EBX, EAX, TIMES_2, 0); // EAX is a negative Smi. | 753 Address argument_addr(EBX, EAX, TIMES_2, 0); // EAX is a negative Smi. |
753 __ movl(EAX, argument_addr); | 754 __ movl(EAX, argument_addr); |
754 __ jmp(&assign_optional_parameter, Assembler::kNearJump); | 755 __ jmp(&assign_optional_parameter, Assembler::kNearJump); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 } | 1138 } |
1138 } | 1139 } |
1139 } | 1140 } |
1140 | 1141 |
1141 | 1142 |
1142 #undef __ | 1143 #undef __ |
1143 | 1144 |
1144 } // namespace dart | 1145 } // namespace dart |
1145 | 1146 |
1146 #endif // defined TARGET_ARCH_IA32 | 1147 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |