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

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

Issue 2224793003: Only conditionally add inner scope when deserializing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « no previous file | src/ast/scopes.cc » ('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 #ifndef V8_AST_SCOPES_H_ 5 #ifndef V8_AST_SCOPES_H_
6 #define V8_AST_SCOPES_H_ 6 #define V8_AST_SCOPES_H_
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/base/hashmap.h" 9 #include "src/base/hashmap.h"
10 #include "src/globals.h" 10 #include "src/globals.h"
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 615
616 // Construct a scope based on the scope info. 616 // Construct a scope based on the scope info.
617 Scope(Zone* zone, Scope* inner_scope, ScopeType type, 617 Scope(Zone* zone, Scope* inner_scope, ScopeType type,
618 Handle<ScopeInfo> scope_info); 618 Handle<ScopeInfo> scope_info);
619 619
620 // Construct a catch scope with a binding for the name. 620 // Construct a catch scope with a binding for the name.
621 Scope(Zone* zone, Scope* inner_scope, 621 Scope(Zone* zone, Scope* inner_scope,
622 const AstRawString* catch_variable_name); 622 const AstRawString* catch_variable_name);
623 623
624 void AddInnerScope(Scope* inner_scope) { 624 void AddInnerScope(Scope* inner_scope) {
625 if (inner_scope != nullptr) { 625 inner_scope->sibling_ = inner_scope_;
626 inner_scope->sibling_ = inner_scope_; 626 inner_scope_ = inner_scope;
627 inner_scope_ = inner_scope; 627 inner_scope->outer_scope_ = this;
628 inner_scope->outer_scope_ = this;
629 }
630 } 628 }
631 629
632 void RemoveInnerScope(Scope* inner_scope) { 630 void RemoveInnerScope(Scope* inner_scope) {
633 DCHECK_NOT_NULL(inner_scope); 631 DCHECK_NOT_NULL(inner_scope);
634 if (inner_scope == inner_scope_) { 632 if (inner_scope == inner_scope_) {
635 inner_scope_ = inner_scope_->sibling_; 633 inner_scope_ = inner_scope_->sibling_;
636 return; 634 return;
637 } 635 }
638 for (Scope* scope = inner_scope_; scope != nullptr; 636 for (Scope* scope = inner_scope_; scope != nullptr;
639 scope = scope->sibling_) { 637 scope = scope->sibling_) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 // Convenience variable; Subclass constructor only 890 // Convenience variable; Subclass constructor only
893 Variable* this_function_; 891 Variable* this_function_;
894 // Module descriptor; module scopes only. 892 // Module descriptor; module scopes only.
895 ModuleDescriptor* module_descriptor_; 893 ModuleDescriptor* module_descriptor_;
896 }; 894 };
897 895
898 } // namespace internal 896 } // namespace internal
899 } // namespace v8 897 } // namespace v8
900 898
901 #endif // V8_AST_SCOPES_H_ 899 #endif // V8_AST_SCOPES_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698