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

Unified Diff: src/scopes.cc

Issue 10010046: Return LOOKUP variable instead of CONTEXT for non-context allocated outer scope parameters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix, add regression test Created 8 years, 8 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 | « no previous file | test/mjsunit/regress/regress-119609.js » ('j') | 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 859cbd1ae61c8323c4f9edfb215ac1b8bfd53cc8..0913489eb4dd97cc1ff736effd60139cd2cc0bb4 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -388,14 +388,17 @@ Variable* Scope::LocalLookup(Handle<String> name) {
// Check context slot lookup.
VariableMode mode;
+ Variable::Location location = Variable::CONTEXT;
InitializationFlag init_flag;
int index = scope_info_->ContextSlotIndex(*name, &mode, &init_flag);
if (index < 0) {
// Check parameters.
- mode = VAR;
- init_flag = kCreatedInitialized;
index = scope_info_->ParameterIndex(*name);
if (index < 0) return NULL;
+
+ mode = DYNAMIC;
+ location = Variable::LOOKUP;
+ init_flag = kCreatedInitialized;
}
Variable* var =
@@ -405,7 +408,7 @@ Variable* Scope::LocalLookup(Handle<String> name) {
true,
Variable::NORMAL,
init_flag);
- var->AllocateTo(Variable::CONTEXT, index);
+ var->AllocateTo(location, index);
return var;
}
@@ -953,6 +956,8 @@ bool Scope::ResolveVariable(CompilationInfo* info,
// by 'eval' introduced variable bindings.
if (var->is_global()) {
var = NonLocal(proxy->name(), DYNAMIC_GLOBAL);
+ } else if (var->is_dynamic()) {
Kevin Millikin (Google) 2012/04/12 15:43:15 This is kind of subtle and doesn't jive with the c
+ var = NonLocal(proxy->name(), DYNAMIC);
} else {
Variable* invalidated = var;
var = NonLocal(proxy->name(), DYNAMIC_LOCAL);
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-119609.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698