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

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

Issue 11442010: Introduce a class encapsulating arguments descriptor arrays. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 8 years 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
« no previous file with comments | « no previous file | runtime/vm/code_patcher_ia32.cc » ('j') | runtime/vm/dart_entry.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler_macros.h" 7 #include "vm/assembler_macros.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 // Arg0: formal parameter index as Smi. 668 // Arg0: formal parameter index as Smi.
669 // Arg1: formal parameter name as Symbol. 669 // Arg1: formal parameter name as Symbol.
670 // Arg2: arguments descriptor array. 670 // Arg2: arguments descriptor array.
671 // Return value: true or false. 671 // Return value: true or false.
672 DEFINE_RUNTIME_ENTRY(ArgumentDefinitionTest, 3) { 672 DEFINE_RUNTIME_ENTRY(ArgumentDefinitionTest, 3) {
673 ASSERT(arguments.ArgCount() == 673 ASSERT(arguments.ArgCount() ==
674 kArgumentDefinitionTestRuntimeEntry.argument_count()); 674 kArgumentDefinitionTestRuntimeEntry.argument_count());
675 const Smi& param_index = Smi::CheckedHandle(arguments.ArgAt(0)); 675 const Smi& param_index = Smi::CheckedHandle(arguments.ArgAt(0));
676 const String& param_name = String::CheckedHandle(arguments.ArgAt(1)); 676 const String& param_name = String::CheckedHandle(arguments.ArgAt(1));
677 ASSERT(param_name.IsSymbol()); 677 ASSERT(param_name.IsSymbol());
678 const Array& arg_desc = Array::CheckedHandle(arguments.ArgAt(2)); 678 ArgumentsDescriptor arg_desc(arguments.ArgAt(2));
regis 2012/12/05 18:39:24 Why did you remove the CheckedHandle here and belo
regis 2012/12/05 18:39:24 You cannot pass a raw object as parameter.
Kevin Millikin (Google) 2012/12/05 19:11:23 Here: it's not removed, the ArgumentsDescriptor co
srdjan 2012/12/05 19:34:17 We need to document when to use CheckedHandle (onl
679 const intptr_t num_pos_args = Smi::CheckedHandle(arg_desc.At(1)).Value(); 679 const intptr_t num_pos_args = arg_desc.PositionalCount();
680 // Check if the formal parameter is defined by a positional argument. 680 // Check if the formal parameter is defined by a positional argument.
681 bool is_defined = num_pos_args > param_index.Value(); 681 bool is_defined = num_pos_args > param_index.Value();
682 if (!is_defined) { 682 if (!is_defined) {
683 // Check if the formal parameter is defined by a named argument. 683 // Check if the formal parameter is defined by a named argument.
684 const intptr_t num_named_args = 684 const intptr_t num_named_args = arg_desc.NamedCount();
685 Smi::CheckedHandle(arg_desc.At(0)).Value() - num_pos_args;
686 String& arg_name = String::Handle(); 685 String& arg_name = String::Handle();
687 for (intptr_t i = 0; i < num_named_args; i++) { 686 for (intptr_t i = 0; i < num_named_args; i++) {
688 arg_name ^= arg_desc.At(2*i + 2); 687 arg_name ^= arg_desc.NameAt(i);
689 if (arg_name.raw() == param_name.raw()) { 688 if (arg_name.raw() == param_name.raw()) {
690 is_defined = true; 689 is_defined = true;
691 break; 690 break;
692 } 691 }
693 } 692 }
694 } 693 }
695 arguments.SetReturn(Bool::Handle(Bool::Get(is_defined))); 694 arguments.SetReturn(Bool::Handle(Bool::Get(is_defined)));
696 } 695 }
697 696
698 697
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 Isolate* isolate = Isolate::Current(); 1878 Isolate* isolate = Isolate::Current();
1880 StackZone zone(isolate); 1879 StackZone zone(isolate);
1881 HANDLESCOPE(isolate); 1880 HANDLESCOPE(isolate);
1882 const Bigint& big_left = Bigint::Handle(left); 1881 const Bigint& big_left = Bigint::Handle(left);
1883 const Bigint& big_right = Bigint::Handle(right); 1882 const Bigint& big_right = Bigint::Handle(right);
1884 return BigintOperations::Compare(big_left, big_right); 1883 return BigintOperations::Compare(big_left, big_right);
1885 } 1884 }
1886 END_LEAF_RUNTIME_ENTRY 1885 END_LEAF_RUNTIME_ENTRY
1887 1886
1888 } // namespace dart 1887 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_patcher_ia32.cc » ('j') | runtime/vm/dart_entry.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698