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

Unified Diff: src/parser.cc

Issue 1227093005: Fix uses of eval() with non-string arguments under nosnap/--use-strict (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use ParseInfo::is_native and compare eval_string instead Created 5 years, 5 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 | test/test262-es6/test262-es6.status » ('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 753391193bf03667a685a24161b83e53ca3ecbda..ce1dd24ad767f516818ea98ae7acb790132a4fa2 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -1140,6 +1140,13 @@ FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info,
DCHECK(target_stack_ == NULL);
Handle<String> name(String::cast(shared_info->name()));
+
+ // If we're lazy-compiling 'eval' itself, blank out its name to avoid
+ // spurious "Unexpected eval in strict mode" errors.
+ if (info->is_native() && *name == isolate->heap()->eval_string()) {
+ name = isolate->factory()->empty_string();
arv (Not doing code reviews) 2015/07/09 19:00:59 Would it be possible to skip the name check instea
adamk 2015/07/09 19:09:00 Hmm, I see we already have a bool flag we pass to
+ }
+
DCHECK(ast_value_factory());
fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone());
const AstRawString* raw_name = ast_value_factory()->GetString(name);
« no previous file with comments | « no previous file | test/test262-es6/test262-es6.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698