| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 | 1671 |
| 1672 void DeclarationScope::AllocateLocals() { | 1672 void DeclarationScope::AllocateLocals() { |
| 1673 // For now, function_ must be allocated at the very end. If it gets | 1673 // For now, function_ must be allocated at the very end. If it gets |
| 1674 // allocated in the context, it must be the last slot in the context, | 1674 // allocated in the context, it must be the last slot in the context, |
| 1675 // because of the current ScopeInfo implementation (see | 1675 // because of the current ScopeInfo implementation (see |
| 1676 // ScopeInfo::ScopeInfo(FunctionScope* scope) constructor). | 1676 // ScopeInfo::ScopeInfo(FunctionScope* scope) constructor). |
| 1677 if (function_ != nullptr) { | 1677 if (function_ != nullptr) { |
| 1678 AllocateNonParameterLocal(function_); | 1678 AllocateNonParameterLocal(function_); |
| 1679 } | 1679 } |
| 1680 | 1680 |
| 1681 if (rest_parameter_ != nullptr) { | 1681 DCHECK(rest_parameter_ == nullptr || !rest_parameter_->IsUnallocated()); |
| 1682 AllocateNonParameterLocal(rest_parameter_); | |
| 1683 } | |
| 1684 | 1682 |
| 1685 if (new_target_ != nullptr && !MustAllocate(new_target_)) { | 1683 if (new_target_ != nullptr && !MustAllocate(new_target_)) { |
| 1686 new_target_ = nullptr; | 1684 new_target_ = nullptr; |
| 1687 } | 1685 } |
| 1688 | 1686 |
| 1689 if (this_function_ != nullptr && !MustAllocate(this_function_)) { | 1687 if (this_function_ != nullptr && !MustAllocate(this_function_)) { |
| 1690 this_function_ = nullptr; | 1688 this_function_ = nullptr; |
| 1691 } | 1689 } |
| 1692 } | 1690 } |
| 1693 | 1691 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 function != nullptr && function->IsContextSlot(); | 1767 function != nullptr && function->IsContextSlot(); |
| 1770 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1768 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
| 1771 (is_function_var_in_context ? 1 : 0); | 1769 (is_function_var_in_context ? 1 : 0); |
| 1772 } | 1770 } |
| 1773 | 1771 |
| 1774 | 1772 |
| 1775 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1773 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
| 1776 | 1774 |
| 1777 } // namespace internal | 1775 } // namespace internal |
| 1778 } // namespace v8 | 1776 } // namespace v8 |
| OLD | NEW |