| 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/ast/ast.h" | 10 #include "src/ast/ast.h" |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 } | 1451 } |
| 1452 for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) { | 1452 for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) { |
| 1453 scope->CheckScopePositions(); | 1453 scope->CheckScopePositions(); |
| 1454 } | 1454 } |
| 1455 } | 1455 } |
| 1456 | 1456 |
| 1457 void Scope::CheckZones() { | 1457 void Scope::CheckZones() { |
| 1458 DCHECK(!needs_migration_); | 1458 DCHECK(!needs_migration_); |
| 1459 for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) { | 1459 for (Scope* scope = inner_scope_; scope != nullptr; scope = scope->sibling_) { |
| 1460 CHECK_EQ(scope->zone(), zone()); | 1460 CHECK_EQ(scope->zone(), zone()); |
| 1461 scope->CheckZones(); |
| 1461 } | 1462 } |
| 1462 } | 1463 } |
| 1463 #endif // DEBUG | 1464 #endif // DEBUG |
| 1464 | 1465 |
| 1465 Variable* Scope::NonLocal(const AstRawString* name, VariableMode mode) { | 1466 Variable* Scope::NonLocal(const AstRawString* name, VariableMode mode) { |
| 1466 // Declare a new non-local. | 1467 // Declare a new non-local. |
| 1467 DCHECK(IsDynamicVariableMode(mode)); | 1468 DCHECK(IsDynamicVariableMode(mode)); |
| 1468 Variable* var = variables_.Declare(zone(), NULL, name, mode, NORMAL_VARIABLE, | 1469 Variable* var = variables_.Declare(zone(), NULL, name, mode, NORMAL_VARIABLE, |
| 1469 kCreatedInitialized); | 1470 kCreatedInitialized); |
| 1470 // Allocate it by giving it a dynamic lookup. | 1471 // Allocate it by giving it a dynamic lookup. |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1902 Variable* function = | 1903 Variable* function = |
| 1903 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 1904 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
| 1904 bool is_function_var_in_context = | 1905 bool is_function_var_in_context = |
| 1905 function != nullptr && function->IsContextSlot(); | 1906 function != nullptr && function->IsContextSlot(); |
| 1906 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1907 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
| 1907 (is_function_var_in_context ? 1 : 0); | 1908 (is_function_var_in_context ? 1 : 0); |
| 1908 } | 1909 } |
| 1909 | 1910 |
| 1910 } // namespace internal | 1911 } // namespace internal |
| 1911 } // namespace v8 | 1912 } // namespace v8 |
| OLD | NEW |