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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 if (unresolved_[i] == var) { | 522 if (unresolved_[i] == var) { |
523 unresolved_.Remove(i); | 523 unresolved_.Remove(i); |
524 return; | 524 return; |
525 } | 525 } |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 | 529 |
530 Variable* Scope::NewTemporary(const AstRawString* name) { | 530 Variable* Scope::NewTemporary(const AstRawString* name) { |
531 DCHECK(!already_resolved()); | 531 DCHECK(!already_resolved()); |
532 Scope* scope = this->TemporaryScope(); | 532 Scope* scope = this->ClosureScope(); |
533 Variable* var = new(zone()) Variable(scope, | 533 Variable* var = new(zone()) Variable(scope, |
534 name, | 534 name, |
535 TEMPORARY, | 535 TEMPORARY, |
536 Variable::NORMAL, | 536 Variable::NORMAL, |
537 kCreatedInitialized); | 537 kCreatedInitialized); |
538 scope->temps_.Add(var, zone()); | 538 scope->temps_.Add(var, zone()); |
539 return var; | 539 return var; |
540 } | 540 } |
541 | 541 |
542 | 542 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 754 |
755 Scope* Scope::DeclarationScope() { | 755 Scope* Scope::DeclarationScope() { |
756 Scope* scope = this; | 756 Scope* scope = this; |
757 while (!scope->is_declaration_scope()) { | 757 while (!scope->is_declaration_scope()) { |
758 scope = scope->outer_scope(); | 758 scope = scope->outer_scope(); |
759 } | 759 } |
760 return scope; | 760 return scope; |
761 } | 761 } |
762 | 762 |
763 | 763 |
764 Scope* Scope::TemporaryScope() { | 764 Scope* Scope::ClosureScope() { |
765 Scope* scope = this; | 765 Scope* scope = this; |
766 while (!scope->is_declaration_scope() || scope->is_block_scope()) { | 766 while (!scope->is_declaration_scope() || scope->is_block_scope()) { |
767 scope = scope->outer_scope(); | 767 scope = scope->outer_scope(); |
768 } | 768 } |
769 return scope; | 769 return scope; |
770 } | 770 } |
771 | 771 |
772 | 772 |
773 Scope* Scope::ReceiverScope() { | 773 Scope* Scope::ReceiverScope() { |
774 Scope* scope = this; | 774 Scope* scope = this; |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 bool is_function_var_in_context = | 1625 bool is_function_var_in_context = |
1626 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1626 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
1627 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1627 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1628 2 * num_global_slots() - (is_function_var_in_context ? 1 : 0); | 1628 2 * num_global_slots() - (is_function_var_in_context ? 1 : 0); |
1629 } | 1629 } |
1630 | 1630 |
1631 | 1631 |
1632 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1632 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
1633 } // namespace internal | 1633 } // namespace internal |
1634 } // namespace v8 | 1634 } // namespace v8 |
OLD | NEW |