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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/test262-es6/test262-es6.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/ast-literal-reindexer.h" 9 #include "src/ast-literal-reindexer.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 1133
1134 1134
1135 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info, 1135 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info,
1136 Utf16CharacterStream* source) { 1136 Utf16CharacterStream* source) {
1137 Handle<SharedFunctionInfo> shared_info = info->shared_info(); 1137 Handle<SharedFunctionInfo> shared_info = info->shared_info();
1138 scanner_.Initialize(source); 1138 scanner_.Initialize(source);
1139 DCHECK(scope_ == NULL); 1139 DCHECK(scope_ == NULL);
1140 DCHECK(target_stack_ == NULL); 1140 DCHECK(target_stack_ == NULL);
1141 1141
1142 Handle<String> name(String::cast(shared_info->name())); 1142 Handle<String> name(String::cast(shared_info->name()));
1143
1144 // If we're lazy-compiling 'eval' itself, blank out its name to avoid
1145 // spurious "Unexpected eval in strict mode" errors.
1146 if (info->is_native() && *name == isolate->heap()->eval_string()) {
1147 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
1148 }
1149
1143 DCHECK(ast_value_factory()); 1150 DCHECK(ast_value_factory());
1144 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); 1151 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone());
1145 const AstRawString* raw_name = ast_value_factory()->GetString(name); 1152 const AstRawString* raw_name = ast_value_factory()->GetString(name);
1146 fni_->PushEnclosingName(raw_name); 1153 fni_->PushEnclosingName(raw_name);
1147 1154
1148 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); 1155 ParsingModeScope parsing_mode(this, PARSE_EAGERLY);
1149 1156
1150 // Place holder for the result. 1157 // Place holder for the result.
1151 FunctionLiteral* result = NULL; 1158 FunctionLiteral* result = NULL;
1152 1159
(...skipping 4791 matching lines...) Expand 10 before | Expand all | Expand 10 after
5944 Expression* Parser::SpreadCallNew(Expression* function, 5951 Expression* Parser::SpreadCallNew(Expression* function,
5945 ZoneList<v8::internal::Expression*>* args, 5952 ZoneList<v8::internal::Expression*>* args,
5946 int pos) { 5953 int pos) {
5947 args->InsertAt(0, function, zone()); 5954 args->InsertAt(0, function, zone());
5948 5955
5949 return factory()->NewCallRuntime( 5956 return factory()->NewCallRuntime(
5950 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5957 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5951 } 5958 }
5952 } // namespace internal 5959 } // namespace internal
5953 } // namespace v8 5960 } // namespace v8
OLDNEW
« 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