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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 } | 582 } |
583 | 583 |
584 | 584 |
585 void Scope::PropagateUsageFlagsToScope(Scope* other) { | 585 void Scope::PropagateUsageFlagsToScope(Scope* other) { |
586 DCHECK_NOT_NULL(other); | 586 DCHECK_NOT_NULL(other); |
587 DCHECK(!already_resolved_); | 587 DCHECK(!already_resolved_); |
588 DCHECK(!other->already_resolved_); | 588 DCHECK(!other->already_resolved_); |
589 if (calls_eval()) other->RecordEvalCall(); | 589 if (calls_eval()) other->RecordEvalCall(); |
590 } | 590 } |
591 | 591 |
592 | 592 Variable* Scope::LookupInScopeInfo(const AstRawString* name) { |
593 Variable* Scope::LookupLocal(const AstRawString* name) { | |
594 Variable* result = variables_.Lookup(name); | |
595 if (result != NULL || scope_info_.is_null()) { | |
596 return result; | |
597 } | |
598 Handle<String> name_handle = name->string(); | 593 Handle<String> name_handle = name->string(); |
599 // The Scope is backed up by ScopeInfo. This means it cannot operate in a | 594 // The Scope is backed up by ScopeInfo. This means it cannot operate in a |
600 // heap-independent mode, and all strings must be internalized immediately. So | 595 // heap-independent mode, and all strings must be internalized immediately. So |
601 // it's ok to get the Handle<String> here. | 596 // it's ok to get the Handle<String> here. |
602 // If we have a serialized scope info, we might find the variable there. | 597 // If we have a serialized scope info, we might find the variable there. |
603 // There should be no local slot with the given name. | 598 // There should be no local slot with the given name. |
604 DCHECK(scope_info_->StackSlotIndex(*name_handle) < 0); | 599 DCHECK(scope_info_->StackSlotIndex(*name_handle) < 0); |
605 | 600 |
606 // Check context slot lookup. | 601 // Check context slot lookup. |
607 VariableMode mode; | 602 VariableMode mode; |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 function != nullptr && function->IsContextSlot(); | 1663 function != nullptr && function->IsContextSlot(); |
1669 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1664 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
1670 (is_function_var_in_context ? 1 : 0); | 1665 (is_function_var_in_context ? 1 : 0); |
1671 } | 1666 } |
1672 | 1667 |
1673 | 1668 |
1674 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1669 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
1675 | 1670 |
1676 } // namespace internal | 1671 } // namespace internal |
1677 } // namespace v8 | 1672 } // namespace v8 |
OLD | NEW |