| 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/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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 | 153 |
| 154 void ParsedFunction::AllocateVariables() { | 154 void ParsedFunction::AllocateVariables() { |
| 155 LocalScope* scope = node_sequence()->scope(); | 155 LocalScope* scope = node_sequence()->scope(); |
| 156 const intptr_t num_fixed_params = function().num_fixed_parameters(); | 156 const intptr_t num_fixed_params = function().num_fixed_parameters(); |
| 157 const intptr_t num_opt_params = function().NumOptionalParameters(); | 157 const intptr_t num_opt_params = function().NumOptionalParameters(); |
| 158 intptr_t num_params = num_fixed_params + num_opt_params; | 158 intptr_t num_params = num_fixed_params + num_opt_params; |
| 159 // Compute start indices to parameters and locals, and the number of | 159 // Compute start indices to parameters and locals, and the number of |
| 160 // parameters to copy. | 160 // parameters to copy. |
| 161 if (num_opt_params == 0) { | 161 if (num_opt_params == 0) { |
| 162 // Parameter i will be at fp[kLastParamSlotIndex + num_params - 1 - i] and | 162 // Parameter i will be at fp[kParamEndSlotFromFp + num_params - i] and |
| 163 // local variable j will be at fp[kFirstLocalSlotIndex - j]. | 163 // local variable j will be at fp[kFirstLocalSlotFromFp - j]. |
| 164 ASSERT(GetSavedArgumentsDescriptorVar() == NULL); | 164 ASSERT(GetSavedArgumentsDescriptorVar() == NULL); |
| 165 first_parameter_index_ = kLastParamSlotIndex + num_params - 1; | 165 first_parameter_index_ = kParamEndSlotFromFp + num_params; |
| 166 first_stack_local_index_ = kFirstLocalSlotIndex; | 166 first_stack_local_index_ = kFirstLocalSlotFromFp; |
| 167 num_copied_params_ = 0; | 167 num_copied_params_ = 0; |
| 168 } else { | 168 } else { |
| 169 // Parameter i will be at fp[kFirstLocalSlotIndex - i] and local variable | 169 // Parameter i will be at fp[kFirstLocalSlotFromFp - i] and local variable |
| 170 // j will be at fp[kFirstLocalSlotIndex - num_params - j]. | 170 // j will be at fp[kFirstLocalSlotFromFp - num_params - j]. |
| 171 // The saved arguments descriptor variable must be allocated similarly to | 171 // The saved arguments descriptor variable must be allocated similarly to |
| 172 // a parameter, so that it gets both a frame slot and a context slot when | 172 // a parameter, so that it gets both a frame slot and a context slot when |
| 173 // captured. | 173 // captured. |
| 174 if (GetSavedArgumentsDescriptorVar() != NULL) { | 174 if (GetSavedArgumentsDescriptorVar() != NULL) { |
| 175 num_params += 1; | 175 num_params += 1; |
| 176 } | 176 } |
| 177 first_parameter_index_ = kFirstLocalSlotIndex; | 177 first_parameter_index_ = kFirstLocalSlotFromFp; |
| 178 first_stack_local_index_ = first_parameter_index_ - num_params; | 178 first_stack_local_index_ = first_parameter_index_ - num_params; |
| 179 num_copied_params_ = num_params; | 179 num_copied_params_ = num_params; |
| 180 } | 180 } |
| 181 | 181 |
| 182 // Allocate parameters and local variables, either in the local frame or | 182 // Allocate parameters and local variables, either in the local frame or |
| 183 // in the context(s). | 183 // in the context(s). |
| 184 LocalScope* context_owner = NULL; // No context needed yet. | 184 LocalScope* context_owner = NULL; // No context needed yet. |
| 185 int next_free_frame_index = | 185 int next_free_frame_index = |
| 186 scope->AllocateVariables(first_parameter_index_, | 186 scope->AllocateVariables(first_parameter_index_, |
| 187 num_params, | 187 num_params, |
| (...skipping 9766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9954 void Parser::SkipQualIdent() { | 9954 void Parser::SkipQualIdent() { |
| 9955 ASSERT(IsIdentifier()); | 9955 ASSERT(IsIdentifier()); |
| 9956 ConsumeToken(); | 9956 ConsumeToken(); |
| 9957 if (CurrentToken() == Token::kPERIOD) { | 9957 if (CurrentToken() == Token::kPERIOD) { |
| 9958 ConsumeToken(); // Consume the kPERIOD token. | 9958 ConsumeToken(); // Consume the kPERIOD token. |
| 9959 ExpectIdentifier("identifier expected after '.'"); | 9959 ExpectIdentifier("identifier expected after '.'"); |
| 9960 } | 9960 } |
| 9961 } | 9961 } |
| 9962 | 9962 |
| 9963 } // namespace dart | 9963 } // namespace dart |
| OLD | NEW |