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

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

Issue 2445993002: Drop unused end-position from VariableProxy (Closed)
Patch Set: Addressed comment Created 4 years, 1 month 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/ast/scopes.h ('k') | src/parsing/parser.h » ('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/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 // same variable if it is declared several times. This is not a 949 // same variable if it is declared several times. This is not a
950 // semantic issue, but it may be a performance issue since it may 950 // semantic issue, but it may be a performance issue since it may
951 // lead to repeated DeclareEvalVar or DeclareEvalFunction calls. 951 // lead to repeated DeclareEvalVar or DeclareEvalFunction calls.
952 decls_.Add(declaration, zone()); 952 decls_.Add(declaration, zone());
953 proxy->BindTo(var); 953 proxy->BindTo(var);
954 return var; 954 return var;
955 } 955 }
956 956
957 VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory, 957 VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory,
958 const AstRawString* name, 958 const AstRawString* name,
959 int start_position, int end_position, 959 int start_position, VariableKind kind) {
960 VariableKind kind) {
961 // Note that we must not share the unresolved variables with 960 // Note that we must not share the unresolved variables with
962 // the same name because they may be removed selectively via 961 // the same name because they may be removed selectively via
963 // RemoveUnresolved(). 962 // RemoveUnresolved().
964 DCHECK(!already_resolved_); 963 DCHECK(!already_resolved_);
965 DCHECK_EQ(!needs_migration_, factory->zone() == zone()); 964 DCHECK_EQ(!needs_migration_, factory->zone() == zone());
966 VariableProxy* proxy = 965 VariableProxy* proxy = factory->NewVariableProxy(name, kind, start_position);
967 factory->NewVariableProxy(name, kind, start_position, end_position);
968 proxy->set_next_unresolved(unresolved_); 966 proxy->set_next_unresolved(unresolved_);
969 unresolved_ = proxy; 967 unresolved_ = proxy;
970 return proxy; 968 return proxy;
971 } 969 }
972 970
973 void Scope::AddUnresolved(VariableProxy* proxy) { 971 void Scope::AddUnresolved(VariableProxy* proxy) {
974 DCHECK(!already_resolved_); 972 DCHECK(!already_resolved_);
975 DCHECK(!proxy->is_resolved()); 973 DCHECK(!proxy->is_resolved());
976 proxy->set_next_unresolved(unresolved_); 974 proxy->set_next_unresolved(unresolved_);
977 unresolved_ = proxy; 975 unresolved_ = proxy;
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 Variable* function = 2018 Variable* function =
2021 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 2019 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
2022 bool is_function_var_in_context = 2020 bool is_function_var_in_context =
2023 function != nullptr && function->IsContextSlot(); 2021 function != nullptr && function->IsContextSlot();
2024 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 2022 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
2025 (is_function_var_in_context ? 1 : 0); 2023 (is_function_var_in_context ? 1 : 0);
2026 } 2024 }
2027 2025
2028 } // namespace internal 2026 } // namespace internal
2029 } // namespace v8 2027 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.h ('k') | src/parsing/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698