Inline fast-path of Scope::LookupLocal

BUG=v8:5209

Review-Url: https://codereview.chromium.org/2275773002
Cr-Commit-Position: refs/heads/master@{#38865}
This commit is contained in:
verwaest 2016-08-24 07:03:36 -07:00 committed by Commit bot
parent 6646d73b6f
commit 8547b072c8
2 changed files with 8 additions and 7 deletions

View File

@ -589,12 +589,7 @@ void Scope::PropagateUsageFlagsToScope(Scope* other) {
if (calls_eval()) other->RecordEvalCall();
}
Variable* Scope::LookupLocal(const AstRawString* name) {
Variable* result = variables_.Lookup(name);
if (result != NULL || scope_info_.is_null()) {
return result;
}
Variable* Scope::LookupInScopeInfo(const AstRawString* name) {
Handle<String> name_handle = name->string();
// The Scope is backed up by ScopeInfo. This means it cannot operate in a
// heap-independent mode, and all strings must be internalized immediately. So

View File

@ -120,7 +120,13 @@ class Scope: public ZoneObject {
// Declarations
// Lookup a variable in this scope. Returns the variable or NULL if not found.
Variable* LookupLocal(const AstRawString* name);
Variable* LookupLocal(const AstRawString* name) {
Variable* result = variables_.Lookup(name);
if (result != nullptr || scope_info_.is_null()) return result;
return LookupInScopeInfo(name);
}
Variable* LookupInScopeInfo(const AstRawString* name);
// Lookup a variable in this scope or outer scopes.
// Returns the variable or NULL if not found.