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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/messages.h" | 9 #include "src/messages.h" |
10 #include "src/parser.h" | 10 #include "src/parser.h" |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 | 765 |
766 Scope* Scope::DeclarationScope() { | 766 Scope* Scope::DeclarationScope() { |
767 Scope* scope = this; | 767 Scope* scope = this; |
768 while (!scope->is_declaration_scope()) { | 768 while (!scope->is_declaration_scope()) { |
769 scope = scope->outer_scope(); | 769 scope = scope->outer_scope(); |
770 } | 770 } |
771 return scope; | 771 return scope; |
772 } | 772 } |
773 | 773 |
774 | 774 |
| 775 Scope* Scope::TempScope() { |
| 776 Scope* scope = this; |
| 777 while (!scope->is_declaration_scope() || scope->is_block_scope()) { |
| 778 scope = scope->outer_scope(); |
| 779 } |
| 780 return scope; |
| 781 } |
| 782 |
| 783 |
775 Handle<ScopeInfo> Scope::GetScopeInfo(Isolate* isolate) { | 784 Handle<ScopeInfo> Scope::GetScopeInfo(Isolate* isolate) { |
776 if (scope_info_.is_null()) { | 785 if (scope_info_.is_null()) { |
777 scope_info_ = ScopeInfo::Create(isolate, zone(), this); | 786 scope_info_ = ScopeInfo::Create(isolate, zone(), this); |
778 } | 787 } |
779 return scope_info_; | 788 return scope_info_; |
780 } | 789 } |
781 | 790 |
782 | 791 |
783 void Scope::GetNestedScopeChain(Isolate* isolate, | 792 void Scope::GetNestedScopeChain(Isolate* isolate, |
784 List<Handle<ScopeInfo> >* chain, int position) { | 793 List<Handle<ScopeInfo> >* chain, int position) { |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 bool is_function_var_in_context = | 1625 bool is_function_var_in_context = |
1617 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1626 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
1618 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1627 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1619 2 * num_global_slots() - (is_function_var_in_context ? 1 : 0); | 1628 2 * num_global_slots() - (is_function_var_in_context ? 1 : 0); |
1620 } | 1629 } |
1621 | 1630 |
1622 | 1631 |
1623 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1632 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
1624 } // namespace internal | 1633 } // namespace internal |
1625 } // namespace v8 | 1634 } // namespace v8 |
OLD | NEW |