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}
This commit is contained in:
parent
fcffcba725
commit
11d13027e8
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user