Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.cc

Issue 10911217: Fix issue with optional named parameters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 int num_opt_named_params = function.num_optional_named_parameters(); 625 int num_opt_named_params = function.num_optional_named_parameters();
626 const int num_params = 626 const int num_params =
627 num_fixed_params + num_opt_pos_params + num_opt_named_params; 627 num_fixed_params + num_opt_pos_params + num_opt_named_params;
628 int implicit_this_param_pos = is_native_instance_closure ? -1 : 0; 628 int implicit_this_param_pos = is_native_instance_closure ? -1 : 0;
629 ASSERT(parsed_function().first_parameter_index() == 629 ASSERT(parsed_function().first_parameter_index() ==
630 ParsedFunction::kFirstLocalSlotIndex + implicit_this_param_pos); 630 ParsedFunction::kFirstLocalSlotIndex + implicit_this_param_pos);
631 631
632 // Check that min_num_pos_args <= num_pos_args <= max_num_pos_args, 632 // Check that min_num_pos_args <= num_pos_args <= max_num_pos_args,
633 // where num_pos_args is the number of positional arguments passed in. 633 // where num_pos_args is the number of positional arguments passed in.
634 const int min_num_pos_args = num_fixed_params; 634 const int min_num_pos_args = num_fixed_params;
635 const int max_num_pos_args = num_fixed_params + num_opt_pos_params + 635 const int max_num_pos_args = num_fixed_params + num_opt_pos_params;
636 (FLAG_reject_named_argument_as_positional ? 0 : num_opt_named_params);
637 636
638 // Number of positional args is the second Smi in descriptor array (EDX). 637 // Number of positional args is the second Smi in descriptor array (EDX).
639 __ movl(ECX, FieldAddress(EDX, Array::data_offset() + (1 * kWordSize))); 638 __ movl(ECX, FieldAddress(EDX, Array::data_offset() + (1 * kWordSize)));
640 // Check that min_num_pos_args <= num_pos_args. 639 // Check that min_num_pos_args <= num_pos_args.
641 Label wrong_num_arguments; 640 Label wrong_num_arguments;
642 __ cmpl(ECX, Immediate(Smi::RawValue(min_num_pos_args))); 641 __ cmpl(ECX, Immediate(Smi::RawValue(min_num_pos_args)));
643 __ j(LESS, &wrong_num_arguments); 642 __ j(LESS, &wrong_num_arguments);
644 // Check that num_pos_args <= max_num_pos_args. 643 // Check that num_pos_args <= max_num_pos_args.
645 __ cmpl(ECX, Immediate(Smi::RawValue(max_num_pos_args))); 644 __ cmpl(ECX, Immediate(Smi::RawValue(max_num_pos_args)));
646 __ j(GREATER, &wrong_num_arguments); 645 __ j(GREATER, &wrong_num_arguments);
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 __ popl(ECX); 1383 __ popl(ECX);
1385 __ popl(EAX); 1384 __ popl(EAX);
1386 } 1385 }
1387 1386
1388 1387
1389 #undef __ 1388 #undef __
1390 1389
1391 } // namespace dart 1390 } // namespace dart
1392 1391
1393 #endif // defined TARGET_ARCH_IA32 1392 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler_x64.cc » ('j') | tests/language/optional_named_parameters_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698