Commit 11d13027 authored by marja's avatar marja Committed by Commit bot

PreParsing inner funcs: Do fewer variable name lookups.

It's unnecessarily to first lookup and then insert.

BUG=v8:5501

Review-Url: https://codereview.chromium.org/2608333003
Cr-Commit-Position: refs/heads/master@{#42065}
parent fcffcba7
......@@ -1037,11 +1037,10 @@ void Scope::DeclareVariableName(const AstRawString* name, VariableMode mode) {
DCHECK(!is_eval_scope());
DCHECK(is_declaration_scope() ||
(IsLexicalVariableMode(mode) && is_block_scope()));
DCHECK(scope_info_.is_null());
// Declare the variable in the declaration scope.
if (LookupLocal(name) == nullptr) {
variables_.DeclareName(zone(), name);
}
}
VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory,
......
......@@ -34,8 +34,8 @@ class VariableMap: public ZoneHashMap {
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned,
bool* added = nullptr);
// Records that "name" exists but doesn't create a Variable. Useful for
// preparsing.
// Records that "name" exists (if not recorded yet) but doesn't create a
// Variable. Useful for preparsing.
void DeclareName(Zone* zone, const AstRawString* name);
Variable* Lookup(const AstRawString* name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment