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

Unified Diff: src/parser.cc

Issue 6349020: Make arguments read only in strict mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 11 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/objects-inl.h ('k') | src/scopes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index c0976988ea3c077800842816c03981ee5cf7b248..8d88032eadbe4e5824f5af9b8e17b7111cb65805 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -747,6 +747,10 @@ FunctionLiteral* Parser::ParseLazy(Handle<SharedFunctionInfo> info,
scope);
TemporaryScope temp_scope(&this->temp_scope_);
+ if (info->strict_mode()) {
+ temp_scope.EnableStrictMode();
+ }
+
FunctionLiteralType type =
info->is_expression() ? EXPRESSION : DECLARATION;
bool ok = true;
@@ -3540,7 +3544,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name,
end_pos = scanner().location().end_pos;
}
- // Validate strict mode.
+ // Strict mode.
if (temp_scope_->StrictMode()) {
if (IsEvalOrArguments(name)) {
int position = function_token_position != RelocInfo::kNoPosition
@@ -3564,6 +3568,9 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name,
return NULL;
}
CheckOctalLiteral(start_pos, end_pos, CHECK_OK);
+
+ // In strict mode, arguments are const.
+ top_scope_->SetArgumentsConst();
}
FunctionLiteral* function_literal =
« no previous file with comments | « src/objects-inl.h ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698