| 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 void ParsedFunction::AllocateVariables() { | 140 void ParsedFunction::AllocateVariables() { |
| 141 LocalScope* scope = node_sequence()->scope(); | 141 LocalScope* scope = node_sequence()->scope(); |
| 142 const int fixed_parameter_count = function().num_fixed_parameters(); | 142 const int fixed_parameter_count = function().num_fixed_parameters(); |
| 143 const int optional_parameter_count = function().num_optional_parameters(); | 143 const int optional_parameter_count = function().num_optional_parameters(); |
| 144 const int parameter_count = fixed_parameter_count + optional_parameter_count; | 144 const int parameter_count = fixed_parameter_count + optional_parameter_count; |
| 145 // Compute start indices to parameters and locals, and the number of | 145 // Compute start indices to parameters and locals, and the number of |
| 146 // parameters to copy. | 146 // parameters to copy. |
| 147 if (optional_parameter_count == 0) { | 147 if (optional_parameter_count == 0) { |
| 148 // Parameter i will be at fp[1 + parameter_count - i] and local variable | 148 // Parameter i will be at fp[1 + parameter_count - i] and local variable |
| 149 // j will be at fp[-1 - j]. | 149 // j will be at fp[kFirstStackSlotIndex - j]. |
| 150 first_parameter_index_ = 1 + parameter_count; | 150 first_parameter_index_ = 1 + parameter_count; |
| 151 first_stack_local_index_ = -1; | 151 first_stack_local_index_ = kFirstStackSlotIndex; |
| 152 copied_parameter_count_ = 0; | 152 copied_parameter_count_ = 0; |
| 153 } else { | 153 } else { |
| 154 // Parameter i will be at fp[-1 - i] and local variable j will be at | 154 // Parameter i will be at fp[-1 - i] and local variable j will be at |
| 155 // fp[-1 - parameter_count - j]. | 155 // fp[-1 - parameter_count - j]. |
| 156 first_parameter_index_ = -1; | 156 first_parameter_index_ = kFirstStackSlotIndex; |
| 157 first_stack_local_index_ = -1 - parameter_count; | 157 first_stack_local_index_ = first_parameter_index_ - parameter_count; |
| 158 copied_parameter_count_ = parameter_count; | 158 copied_parameter_count_ = parameter_count; |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Allocate parameters and local variables, either in the local frame or | 161 // Allocate parameters and local variables, either in the local frame or |
| 162 // in the context(s). | 162 // in the context(s). |
| 163 LocalScope* context_owner = NULL; // No context needed yet. | 163 LocalScope* context_owner = NULL; // No context needed yet. |
| 164 int next_free_frame_index = | 164 int next_free_frame_index = |
| 165 scope->AllocateVariables(first_parameter_index_, | 165 scope->AllocateVariables(first_parameter_index_, |
| 166 parameter_count, | 166 parameter_count, |
| 167 first_stack_local_index_, | 167 first_stack_local_index_, |
| (...skipping 8277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8445 void Parser::SkipQualIdent() { | 8445 void Parser::SkipQualIdent() { |
| 8446 ASSERT(IsIdentifier()); | 8446 ASSERT(IsIdentifier()); |
| 8447 ConsumeToken(); | 8447 ConsumeToken(); |
| 8448 if (CurrentToken() == Token::kPERIOD) { | 8448 if (CurrentToken() == Token::kPERIOD) { |
| 8449 ConsumeToken(); // Consume the kPERIOD token. | 8449 ConsumeToken(); // Consume the kPERIOD token. |
| 8450 ExpectIdentifier("identifier expected after '.'"); | 8450 ExpectIdentifier("identifier expected after '.'"); |
| 8451 } | 8451 } |
| 8452 } | 8452 } |
| 8453 | 8453 |
| 8454 } // namespace dart | 8454 } // namespace dart |
| OLD | NEW |