Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Side by Side Diff: src/scopes.cc

Issue 1250423002: Find right scope associated with prologue (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/scopes.h ('k') | test/mjsunit/harmony/regress/regress-513474.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « src/scopes.h ('k') | test/mjsunit/harmony/regress/regress-513474.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698