OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |