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

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

Issue 12776006: Make allocation of Dart parameters and local variables architecture independent. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 152
153 void ParsedFunction::AllocateVariables() { 153 void ParsedFunction::AllocateVariables() {
154 LocalScope* scope = node_sequence()->scope(); 154 LocalScope* scope = node_sequence()->scope();
155 const intptr_t num_fixed_params = function().num_fixed_parameters(); 155 const intptr_t num_fixed_params = function().num_fixed_parameters();
156 const intptr_t num_opt_params = function().NumOptionalParameters(); 156 const intptr_t num_opt_params = function().NumOptionalParameters();
157 intptr_t num_params = num_fixed_params + num_opt_params; 157 intptr_t num_params = num_fixed_params + num_opt_params;
158 // Compute start indices to parameters and locals, and the number of 158 // Compute start indices to parameters and locals, and the number of
159 // parameters to copy. 159 // parameters to copy.
160 if (num_opt_params == 0) { 160 if (num_opt_params == 0) {
161 // Parameter i will be at fp[1 + num_params - i] and local variable 161 // Parameter i will be at fp[kLastParamSlotIndex + num_params - 1 - i] and
162 // j will be at fp[kFirstLocalSlotIndex - j]. 162 // local variable j will be at fp[kFirstLocalSlotIndex - j].
163 ASSERT(GetSavedArgumentsDescriptorVar() == NULL); 163 ASSERT(GetSavedArgumentsDescriptorVar() == NULL);
164 first_parameter_index_ = 1 + num_params; 164 first_parameter_index_ = kLastParamSlotIndex + num_params - 1;
zra 2013/03/14 21:14:20 It's a little surprising that the parser has to kn
regis 2013/03/14 21:32:22 Yes, indeed. Allocating variables was moved out of
165 first_stack_local_index_ = kFirstLocalSlotIndex; 165 first_stack_local_index_ = kFirstLocalSlotIndex;
166 num_copied_params_ = 0; 166 num_copied_params_ = 0;
167 } else { 167 } else {
168 // Parameter i will be at fp[kFirstLocalSlotIndex - i] and local variable 168 // Parameter i will be at fp[kFirstLocalSlotIndex - i] and local variable
169 // j will be at fp[kFirstLocalSlotIndex - num_params - j]. 169 // j will be at fp[kFirstLocalSlotIndex - num_params - j].
170 // The saved arguments descriptor variable must be allocated similarly to 170 // The saved arguments descriptor variable must be allocated similarly to
171 // a parameter, so that it gets both a frame slot and a context slot when 171 // a parameter, so that it gets both a frame slot and a context slot when
172 // captured. 172 // captured.
173 if (GetSavedArgumentsDescriptorVar() != NULL) { 173 if (GetSavedArgumentsDescriptorVar() != NULL) {
174 num_params += 1; 174 num_params += 1;
(...skipping 9894 matching lines...) Expand 10 before | Expand all | Expand 10 after
10069 void Parser::SkipQualIdent() { 10069 void Parser::SkipQualIdent() {
10070 ASSERT(IsIdentifier()); 10070 ASSERT(IsIdentifier());
10071 ConsumeToken(); 10071 ConsumeToken();
10072 if (CurrentToken() == Token::kPERIOD) { 10072 if (CurrentToken() == Token::kPERIOD) {
10073 ConsumeToken(); // Consume the kPERIOD token. 10073 ConsumeToken(); // Consume the kPERIOD token.
10074 ExpectIdentifier("identifier expected after '.'"); 10074 ExpectIdentifier("identifier expected after '.'");
10075 } 10075 }
10076 } 10076 }
10077 10077
10078 } // namespace dart 10078 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698