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

Side by Side Diff: src/ast/scopes.cc

Issue 1695583003: [WIP] for-of iterator finalization (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
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/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/ast/scopeinfo.h" 8 #include "src/ast/scopeinfo.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 return var; 528 return var;
529 } 529 }
530 530
531 531
532 Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode, 532 Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode,
533 InitializationFlag init_flag, Variable::Kind kind, 533 InitializationFlag init_flag, Variable::Kind kind,
534 MaybeAssignedFlag maybe_assigned_flag, 534 MaybeAssignedFlag maybe_assigned_flag,
535 int declaration_group_start) { 535 int declaration_group_start) {
536 DCHECK(!already_resolved()); 536 DCHECK(!already_resolved());
537 // This function handles VAR, LET, and CONST modes. DYNAMIC variables are 537 // This function handles VAR, LET, and CONST modes. DYNAMIC variables are
538 // introduces during variable allocation, and TEMPORARY variables are 538 // introduced during variable allocation, and TEMPORARY variables are
539 // allocated via NewTemporary(). 539 // allocated via NewTemporary().
540 DCHECK(IsDeclaredVariableMode(mode)); 540 DCHECK(IsDeclaredVariableMode(mode));
541 ++num_var_or_const_; 541 ++num_var_or_const_;
542 return variables_.Declare(this, name, mode, kind, init_flag, 542 return variables_.Declare(this, name, mode, kind, init_flag,
543 maybe_assigned_flag, declaration_group_start); 543 maybe_assigned_flag, declaration_group_start);
544 } 544 }
545 545
546 546
547 Variable* Scope::DeclareDynamicGlobal(const AstRawString* name) { 547 Variable* Scope::DeclareDynamicGlobal(const AstRawString* name) {
548 DCHECK(is_script_scope()); 548 DCHECK(is_script_scope());
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 void Scope::AllocateVariablesRecursively(Isolate* isolate) { 1639 void Scope::AllocateVariablesRecursively(Isolate* isolate) {
1640 if (!already_resolved()) { 1640 if (!already_resolved()) {
1641 num_stack_slots_ = 0; 1641 num_stack_slots_ = 0;
1642 } 1642 }
1643 // Allocate variables for inner scopes. 1643 // Allocate variables for inner scopes.
1644 for (int i = 0; i < inner_scopes_.length(); i++) { 1644 for (int i = 0; i < inner_scopes_.length(); i++) {
1645 inner_scopes_[i]->AllocateVariablesRecursively(isolate); 1645 inner_scopes_[i]->AllocateVariablesRecursively(isolate);
1646 } 1646 }
1647 1647
1648 // If scope is already resolved, we still need to allocate 1648 // If scope is already resolved, we still need to allocate
1649 // variables in inner scopes which might not had been resolved yet. 1649 // variables in inner scopes which might not have been resolved yet.
1650 if (already_resolved()) return; 1650 if (already_resolved()) return;
1651 // The number of slots required for variables. 1651 // The number of slots required for variables.
1652 num_heap_slots_ = Context::MIN_CONTEXT_SLOTS; 1652 num_heap_slots_ = Context::MIN_CONTEXT_SLOTS;
1653 1653
1654 // Allocate variables for this scope. 1654 // Allocate variables for this scope.
1655 // Parameters must be allocated first, if any. 1655 // Parameters must be allocated first, if any.
1656 if (is_function_scope()) AllocateParameterLocals(isolate); 1656 if (is_function_scope()) AllocateParameterLocals(isolate);
1657 if (has_this_declaration()) AllocateReceiver(); 1657 if (has_this_declaration()) AllocateReceiver();
1658 AllocateNonParameterLocalsAndDeclaredGlobals(isolate); 1658 AllocateNonParameterLocalsAndDeclaredGlobals(isolate);
1659 1659
(...skipping 29 matching lines...) Expand all
1689 function_ != NULL && function_->proxy()->var()->IsContextSlot(); 1689 function_ != NULL && function_->proxy()->var()->IsContextSlot();
1690 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - 1690 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
1691 (is_function_var_in_context ? 1 : 0); 1691 (is_function_var_in_context ? 1 : 0);
1692 } 1692 }
1693 1693
1694 1694
1695 int Scope::ContextGlobalCount() const { return num_global_slots(); } 1695 int Scope::ContextGlobalCount() const { return num_global_slots(); }
1696 1696
1697 } // namespace internal 1697 } // namespace internal
1698 } // namespace v8 1698 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698