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

Unified Diff: src/scopes.cc

Issue 8431001: Tune context allocation for variables accessed from inner scopes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | src/variables.h » ('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 3167c4d0926f916dbe443dc5c3019e79ca74399b..78233d5a3f4430a33753a9abb6d7b0f76dc9fee5 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -707,9 +707,9 @@ static void PrintVar(int indent, Variable* var) {
PrintName(var->name());
PrintF("; // ");
PrintLocation(var);
- if (var->is_accessed_from_inner_scope()) {
+ if (var->has_forced_context_allocation()) {
if (!var->IsUnallocated()) PrintF(", ");
- PrintF("inner scope access");
+ PrintF("forced context allocation");
}
PrintF("\n");
}
@@ -848,7 +848,9 @@ Variable* Scope::LookupRecursive(Handle<String> name,
*binding_kind = BOUND;
} else if (outer_scope_ != NULL) {
var = outer_scope_->LookupRecursive(name, context, binding_kind);
- if (*binding_kind == BOUND) var->MarkAsAccessedFromInnerScope();
+ if (*binding_kind == BOUND && (is_function_scope() || is_with_scope())) {
+ var->ForceContextAllocation();
+ }
}
if (is_with_scope()) {
@@ -980,7 +982,7 @@ bool Scope::MustAllocate(Variable* var) {
// via an eval() call. This is only possible if the variable has a
// visible name.
if ((var->is_this() || var->name()->length() > 0) &&
- (var->is_accessed_from_inner_scope() ||
+ (var->has_forced_context_allocation() ||
scope_calls_eval_ ||
inner_scope_calls_eval_ ||
scope_contains_with_ ||
@@ -1003,7 +1005,7 @@ bool Scope::MustAllocateInContext(Variable* var) {
// catch-bound variables are always allocated in a context.
if (var->mode() == TEMPORARY) return false;
if (is_catch_scope() || is_block_scope()) return true;
- return var->is_accessed_from_inner_scope() ||
+ return var->has_forced_context_allocation() ||
scope_calls_eval_ ||
inner_scope_calls_eval_ ||
scope_contains_with_ ||
@@ -1067,9 +1069,8 @@ void Scope::AllocateParameterLocals() {
Variable* var = params_[i];
ASSERT(var->scope() == this);
if (uses_nonstrict_arguments) {
- // Give the parameter a use from an inner scope, to force allocation
- // to the context.
- var->MarkAsAccessedFromInnerScope();
+ // Force context allocation of the parameter.
+ var->ForceContextAllocation();
}
if (MustAllocate(var)) {
« no previous file with comments | « no previous file | src/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698