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

Unified Diff: src/scopes.cc

Issue 1335633002: Do not look for the slot in the ScopeInfo's global range when it's not necessary. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup Created 5 years, 3 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/scopeinfo.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index ba2efb2bcc9e1d7c742780f0f9d586b81a70c6f8..963d539afb96e664e8b2f063a14f7e85ee03048f 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -394,12 +394,16 @@ Variable* Scope::LookupLocal(const AstRawString* name) {
// Check context slot lookup.
VariableMode mode;
- VariableLocation location;
+ VariableLocation location = VariableLocation::CONTEXT;
InitializationFlag init_flag;
MaybeAssignedFlag maybe_assigned_flag;
- int index =
- ScopeInfo::ContextSlotIndex(scope_info_, name_handle, &mode, &location,
- &init_flag, &maybe_assigned_flag);
+ int index = ScopeInfo::ContextSlotIndex(scope_info_, name_handle, &mode,
+ &init_flag, &maybe_assigned_flag);
+ if (index < 0) {
+ location = VariableLocation::GLOBAL;
+ index = ScopeInfo::ContextGlobalSlotIndex(scope_info_, name_handle, &mode,
+ &init_flag, &maybe_assigned_flag);
+ }
if (index < 0) {
// Check parameters.
index = scope_info_->ParameterIndex(*name_handle);
« no previous file with comments | « src/scopeinfo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698