Chromium Code Reviews

Unified Diff: src/scopes.cc

Issue 1005063002: Strawman: check strong mode free variables against the global object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: arrow func param fix Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/scopes.h ('k') | 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 c744dd418bbaaca2b74567048f30ecf208274da3..f6995eedb636bcbb00f1671d7a295ff81d3ceef8 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -593,8 +593,9 @@ class VarAndOrder {
};
-void Scope::CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals,
- ZoneList<Variable*>* context_locals) {
+void Scope::CollectStackAndContextLocals(
+ ZoneList<Variable*>* stack_locals, ZoneList<Variable*>* context_locals,
+ ZoneList<Variable*>* strong_mode_free_variables) {
DCHECK(stack_locals != NULL);
DCHECK(context_locals != NULL);
@@ -628,6 +629,11 @@ void Scope::CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals,
p != NULL;
p = variables_.Next(p)) {
Variable* var = reinterpret_cast<Variable*>(p->value);
+ if (strong_mode_free_variables && var->has_strong_mode_reference() &&
+ var->mode() == DYNAMIC_GLOBAL) {
+ strong_mode_free_variables->Add(var, zone());
+ }
+
if (var->is_used()) {
vars.Add(VarAndOrder(var, p->order), zone());
}
@@ -1115,6 +1121,12 @@ bool Scope::ResolveVariable(ParseInfo* info, VariableProxy* proxy,
DCHECK(var != NULL);
if (proxy->is_assigned()) var->set_maybe_assigned();
+ if (is_strong(language_mode())) {
+ // Record that the variable is referred to from strong mode. Also, record
+ // the position.
+ var->RecordStrongModeReference(proxy->position(), proxy->end_position());
+ }
+
proxy->BindTo(var);
return true;
« no previous file with comments | « src/scopes.h ('k') | src/variables.h » ('j') | no next file with comments »

Powered by Google App Engine