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

Unified Diff: src/scopes.cc

Issue 352583008: Rollback to Version 3.28.4 (based on bleeding_edge revision r22031) (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 years, 6 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/scopes.h ('k') | src/spaces.cc » ('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 6806ee95cf4aeb8fc87c1306f1c0e7fcf51a9d1e..2b3c07a64f95d0ebabff2c4a1572ab9d24ecdaf4 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -170,7 +170,6 @@ void Scope::SetDefaults(ScopeType scope_type,
strict_mode_ = outer_scope != NULL ? outer_scope->strict_mode_ : SLOPPY;
outer_scope_calls_sloppy_eval_ = false;
inner_scope_calls_eval_ = false;
- inner_scope_contains_with_ = false;
force_eager_compilation_ = false;
force_context_allocation_ = (outer_scope != NULL && !is_function_scope())
? outer_scope->has_forced_context_allocation() : false;
@@ -195,7 +194,6 @@ Scope* Scope::DeserializeScopeChain(Context* context, Scope* global_scope,
Scope* current_scope = NULL;
Scope* innermost_scope = NULL;
bool contains_with = false;
- bool inner_contains_with = false;
while (!context->IsNativeContext()) {
if (context->IsWithContext()) {
Scope* with_scope = new(zone) Scope(current_scope,
@@ -245,11 +243,7 @@ Scope* Scope::DeserializeScopeChain(Context* context, Scope* global_scope,
global_scope->ast_value_factory_->GetString(Handle<String>(name)),
global_scope->ast_value_factory_, zone);
}
- if (inner_contains_with) current_scope->inner_scope_contains_with_ = true;
- if (contains_with) {
- current_scope->RecordWithStatement();
- inner_contains_with = true;
- }
+ if (contains_with) current_scope->RecordWithStatement();
if (innermost_scope == NULL) innermost_scope = current_scope;
// Forget about a with when we move to a context for a different function.
@@ -825,15 +819,9 @@ static void PrintVar(int indent, Variable* var) {
PrintName(var->raw_name());
PrintF("; // ");
PrintLocation(var);
- bool comma = !var->IsUnallocated();
if (var->has_forced_context_allocation()) {
- if (comma) PrintF(", ");
+ if (!var->IsUnallocated()) PrintF(", ");
PrintF("forced context allocation");
- comma = true;
- }
- if (var->maybe_assigned()) {
- if (comma) PrintF(", ");
- PrintF("maybe assigned");
}
PrintF("\n");
}
@@ -887,9 +875,6 @@ void Scope::Print(int n) {
}
if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n");
if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n");
- if (inner_scope_contains_with_) {
- Indent(n1, "// inner scope contains 'with'\n");
- }
if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n");
if (outer_scope_calls_sloppy_eval_) {
Indent(n1, "// outer scope calls 'eval' in sloppy context\n");
@@ -966,7 +951,7 @@ Variable* Scope::NonLocal(const AstRawString* name, VariableMode mode) {
}
-Variable* Scope::LookupRecursive(VariableProxy* proxy,
+Variable* Scope::LookupRecursive(const AstRawString* name,
BindingKind* binding_kind,
AstNodeFactory<AstNullVisitor>* factory) {
ASSERT(binding_kind != NULL);
@@ -978,7 +963,7 @@ Variable* Scope::LookupRecursive(VariableProxy* proxy,
}
// Try to find the variable in this scope.
- Variable* var = LookupLocal(proxy->raw_name());
+ Variable* var = LookupLocal(name);
// We found a variable and we are done. (Even if there is an 'eval' in
// this scope which introduces the same variable again, the resulting
@@ -992,11 +977,11 @@ Variable* Scope::LookupRecursive(VariableProxy* proxy,
// if any. We can do this for all scopes, since the function variable is
// only present - if at all - for function scopes.
*binding_kind = UNBOUND;
- var = LookupFunctionVar(proxy->raw_name(), factory);
+ var = LookupFunctionVar(name, factory);
if (var != NULL) {
*binding_kind = BOUND;
} else if (outer_scope_ != NULL) {
- var = outer_scope_->LookupRecursive(proxy, binding_kind, factory);
+ var = outer_scope_->LookupRecursive(name, binding_kind, factory);
if (*binding_kind == BOUND && (is_function_scope() || is_with_scope())) {
var->ForceContextAllocation();
}
@@ -1012,7 +997,6 @@ Variable* Scope::LookupRecursive(VariableProxy* proxy,
// the associated variable has to be marked as potentially being accessed
// from inside of an inner with scope (the property may not be in the 'with'
// object).
- if (var != NULL && proxy->is_assigned()) var->set_maybe_assigned();
*binding_kind = DYNAMIC_LOOKUP;
return NULL;
} else if (calls_sloppy_eval()) {
@@ -1041,7 +1025,7 @@ bool Scope::ResolveVariable(CompilationInfo* info,
// Otherwise, try to resolve the variable.
BindingKind binding_kind;
- Variable* var = LookupRecursive(proxy, &binding_kind, factory);
+ Variable* var = LookupRecursive(proxy->raw_name(), &binding_kind, factory);
switch (binding_kind) {
case BOUND:
// We found a variable binding.
@@ -1080,10 +1064,9 @@ bool Scope::ResolveVariable(CompilationInfo* info,
}
ASSERT(var != NULL);
- if (proxy->is_assigned()) var->set_maybe_assigned();
if (FLAG_harmony_scoping && strict_mode() == STRICT &&
- var->is_const_mode() && proxy->is_assigned()) {
+ var->is_const_mode() && proxy->IsLValue()) {
// Assignment to const. Throw a syntax error.
MessageLocation location(
info->script(), proxy->position(), proxy->position());
@@ -1157,7 +1140,7 @@ bool Scope::ResolveVariablesRecursively(
}
-void Scope::PropagateScopeInfo(bool outer_scope_calls_sloppy_eval ) {
+bool Scope::PropagateScopeInfo(bool outer_scope_calls_sloppy_eval ) {
if (outer_scope_calls_sloppy_eval) {
outer_scope_calls_sloppy_eval_ = true;
}
@@ -1165,18 +1148,16 @@ void Scope::PropagateScopeInfo(bool outer_scope_calls_sloppy_eval ) {
bool calls_sloppy_eval =
this->calls_sloppy_eval() || outer_scope_calls_sloppy_eval_;
for (int i = 0; i < inner_scopes_.length(); i++) {
- Scope* inner = inner_scopes_[i];
- inner->PropagateScopeInfo(calls_sloppy_eval);
- if (inner->scope_calls_eval_ || inner->inner_scope_calls_eval_) {
+ Scope* inner_scope = inner_scopes_[i];
+ if (inner_scope->PropagateScopeInfo(calls_sloppy_eval)) {
inner_scope_calls_eval_ = true;
}
- if (inner->scope_contains_with_ || inner->inner_scope_contains_with_) {
- inner_scope_contains_with_ = true;
- }
- if (inner->force_eager_compilation_) {
+ if (inner_scope->force_eager_compilation_) {
force_eager_compilation_ = true;
}
}
+
+ return scope_calls_eval_ || inner_scope_calls_eval_;
}
@@ -1193,8 +1174,7 @@ bool Scope::MustAllocate(Variable* var) {
is_block_scope() ||
is_module_scope() ||
is_global_scope())) {
- var->set_is_used();
- if (scope_calls_eval_ || inner_scope_calls_eval_) var->set_maybe_assigned();
+ var->set_is_used(true);
}
// Global variables do not need to be allocated.
return !var->IsGlobalObjectProperty() && var->is_used();
« no previous file with comments | « src/scopes.h ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698