| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/ast/scopeinfo.h" | 8 #include "src/ast/scopeinfo.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 ? outer_scope->has_forced_context_allocation() : false; | 200 ? outer_scope->has_forced_context_allocation() : false; |
| 201 num_var_or_const_ = 0; | 201 num_var_or_const_ = 0; |
| 202 num_stack_slots_ = 0; | 202 num_stack_slots_ = 0; |
| 203 num_heap_slots_ = 0; | 203 num_heap_slots_ = 0; |
| 204 num_global_slots_ = 0; | 204 num_global_slots_ = 0; |
| 205 num_modules_ = 0; | 205 num_modules_ = 0; |
| 206 module_var_ = NULL; | 206 module_var_ = NULL; |
| 207 arity_ = 0; | 207 arity_ = 0; |
| 208 has_simple_parameters_ = true; | 208 has_simple_parameters_ = true; |
| 209 rest_parameter_ = NULL; | 209 rest_parameter_ = NULL; |
| 210 rest_index_ = -1; | |
| 211 scope_info_ = scope_info; | 210 scope_info_ = scope_info; |
| 212 start_position_ = RelocInfo::kNoPosition; | 211 start_position_ = RelocInfo::kNoPosition; |
| 213 end_position_ = RelocInfo::kNoPosition; | 212 end_position_ = RelocInfo::kNoPosition; |
| 214 if (!scope_info.is_null()) { | 213 if (!scope_info.is_null()) { |
| 215 scope_calls_eval_ = scope_info->CallsEval(); | 214 scope_calls_eval_ = scope_info->CallsEval(); |
| 216 language_mode_ = scope_info->language_mode(); | 215 language_mode_ = scope_info->language_mode(); |
| 217 is_declaration_scope_ = scope_info->is_declaration_scope(); | 216 is_declaration_scope_ = scope_info->is_declaration_scope(); |
| 218 function_kind_ = scope_info->function_kind(); | 217 function_kind_ = scope_info->function_kind(); |
| 219 } | 218 } |
| 220 } | 219 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 kCreatedInitialized); | 520 kCreatedInitialized); |
| 522 // TODO(wingo): Avoid O(n^2) check. | 521 // TODO(wingo): Avoid O(n^2) check. |
| 523 *is_duplicate = IsDeclaredParameter(name); | 522 *is_duplicate = IsDeclaredParameter(name); |
| 524 } | 523 } |
| 525 if (!is_optional && !is_rest && arity_ == params_.length()) { | 524 if (!is_optional && !is_rest && arity_ == params_.length()) { |
| 526 ++arity_; | 525 ++arity_; |
| 527 } | 526 } |
| 528 if (is_rest) { | 527 if (is_rest) { |
| 529 DCHECK_NULL(rest_parameter_); | 528 DCHECK_NULL(rest_parameter_); |
| 530 rest_parameter_ = var; | 529 rest_parameter_ = var; |
| 531 rest_index_ = num_parameters(); | |
| 532 } | 530 } |
| 533 params_.Add(var, zone()); | 531 params_.Add(var, zone()); |
| 534 return var; | 532 return var; |
| 535 } | 533 } |
| 536 | 534 |
| 537 | 535 |
| 538 Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode, | 536 Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode, |
| 539 InitializationFlag init_flag, Variable::Kind kind, | 537 InitializationFlag init_flag, Variable::Kind kind, |
| 540 MaybeAssignedFlag maybe_assigned_flag, | 538 MaybeAssignedFlag maybe_assigned_flag, |
| 541 int declaration_group_start) { | 539 int declaration_group_start) { |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1663 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
| 1666 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1664 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
| 1667 (is_function_var_in_context ? 1 : 0); | 1665 (is_function_var_in_context ? 1 : 0); |
| 1668 } | 1666 } |
| 1669 | 1667 |
| 1670 | 1668 |
| 1671 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1669 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
| 1672 | 1670 |
| 1673 } // namespace internal | 1671 } // namespace internal |
| 1674 } // namespace v8 | 1672 } // namespace v8 |
| OLD | NEW |