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

Unified Diff: src/ast/scopes.cc

Issue 2221003002: Don't preallocate temps, params, decls space if we're ScopeInfo backed (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/scopes.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index 2acf68f5e3cf884e4f3060b75f5fd2a4f68c5080..239a714cfd2cb7a8151876b9b0679978c1c9c5b6 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -127,7 +127,7 @@ Scope::Scope(Zone* zone, Scope* inner_scope, ScopeType scope_type,
: zone_(zone),
outer_scope_(nullptr),
variables_(zone),
- decls_(4, zone),
+ decls_(0, zone),
scope_info_(scope_info),
scope_type_(scope_type),
already_resolved_(true) {
@@ -149,8 +149,8 @@ DeclarationScope::DeclarationScope(Zone* zone, Scope* inner_scope,
: Scope(zone, inner_scope, scope_type, scope_info),
function_kind_(scope_info.is_null() ? kNormalFunction
: scope_info->function_kind()),
- temps_(4, zone),
- params_(4, zone),
+ temps_(0, zone),
+ params_(0, zone),
sloppy_block_function_map_(zone),
module_descriptor_(nullptr) {
SetDefaults();
@@ -705,7 +705,6 @@ bool Scope::RemoveUnresolved(VariableProxy* var) {
Variable* Scope::NewTemporary(const AstRawString* name) {
- DCHECK(!already_resolved());
DeclarationScope* scope = GetClosureScope();
Variable* var = new(zone()) Variable(scope,
name,
@@ -717,6 +716,7 @@ Variable* Scope::NewTemporary(const AstRawString* name) {
}
int DeclarationScope::RemoveTemporary(Variable* var) {
+ DCHECK(!already_resolved());
DCHECK_NOT_NULL(var);
// Temporaries are only placed in ClosureScopes.
DCHECK_EQ(GetClosureScope(), this);
@@ -738,6 +738,7 @@ int DeclarationScope::RemoveTemporary(Variable* var) {
void Scope::AddDeclaration(Declaration* declaration) {
+ DCHECK(!already_resolved());
decls_.Add(declaration, zone());
}
« no previous file with comments | « src/ast/scopes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698