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

Unified Diff: src/scopes.cc

Issue 8417035: Introduce extended mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed more comments. Created 9 years, 1 month 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/x64/code-stubs-x64.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 f9cebcddaafff5532c4aac23ab7af06dd9a7c220..e8c1f272736a90971134bf50bb006722f71a8605 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -148,6 +148,9 @@ Scope::Scope(Scope* inner_scope,
SetDefaults(type, NULL, scope_info);
if (!scope_info.is_null()) {
num_heap_slots_ = scope_info_->ContextLength();
+ if (*scope_info != ScopeInfo::Empty()) {
+ language_mode_ = scope_info->language_mode();
+ }
}
AddInnerScope(inner_scope);
}
@@ -190,8 +193,8 @@ void Scope::SetDefaults(ScopeType type,
scope_contains_with_ = false;
scope_calls_eval_ = false;
// Inherit the strict mode from the parent scope.
- strict_mode_flag_ = (outer_scope != NULL)
- ? outer_scope->strict_mode_flag_ : kNonStrictMode;
+ language_mode_ = (outer_scope != NULL)
+ ? outer_scope->language_mode_ : CLASSIC_MODE;
outer_scope_calls_non_strict_eval_ = false;
inner_scope_calls_eval_ = false;
force_eager_compilation_ = false;
@@ -763,7 +766,16 @@ void Scope::Print(int n) {
if (HasTrivialOuterContext()) {
Indent(n1, "// scope has trivial outer context\n");
}
- if (is_strict_mode()) Indent(n1, "// strict mode scope\n");
+ switch (language_mode()) {
+ case CLASSIC_MODE:
+ break;
+ case STRICT_MODE:
+ Indent(n1, "// strict mode scope\n");
+ break;
+ case EXTENDED_MODE:
+ Indent(n1, "// extended mode scope\n");
+ break;
+ }
if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n");
if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n");
if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n");
@@ -973,7 +985,7 @@ bool Scope::PropagateScopeInfo(bool outer_scope_calls_non_strict_eval ) {
}
bool calls_non_strict_eval =
- (scope_calls_eval_ && !is_strict_mode()) ||
+ this->calls_non_strict_eval() ||
outer_scope_calls_non_strict_eval_;
for (int i = 0; i < inner_scopes_.length(); i++) {
Scope* inner_scope = inner_scopes_[i];
@@ -1070,7 +1082,7 @@ void Scope::AllocateParameterLocals() {
// In strict mode 'arguments' does not alias formal parameters.
// Therefore in strict mode we allocate parameters as if 'arguments'
// were not used.
- uses_nonstrict_arguments = !is_strict_mode();
+ uses_nonstrict_arguments = is_classic_mode();
}
// The same parameter may occur multiple times in the parameters_ list.
« no previous file with comments | « src/scopes.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698