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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 ? FunctionLiteral::kShouldLazyCompile | 618 ? FunctionLiteral::kShouldLazyCompile |
619 : FunctionLiteral::kShouldEagerCompile); | 619 : FunctionLiteral::kShouldEagerCompile); |
620 set_allow_lazy(FLAG_lazy && info->allow_lazy_parsing() && | 620 set_allow_lazy(FLAG_lazy && info->allow_lazy_parsing() && |
621 !info->is_native() && info->extension() == nullptr && | 621 !info->is_native() && info->extension() == nullptr && |
622 can_compile_lazily); | 622 can_compile_lazily); |
623 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); | 623 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); |
624 set_allow_tailcalls(FLAG_harmony_tailcalls && !info->is_native() && | 624 set_allow_tailcalls(FLAG_harmony_tailcalls && !info->is_native() && |
625 info->isolate()->is_tail_call_elimination_enabled()); | 625 info->isolate()->is_tail_call_elimination_enabled()); |
626 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); | 626 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); |
627 set_allow_harmony_function_sent(FLAG_harmony_function_sent); | 627 set_allow_harmony_function_sent(FLAG_harmony_function_sent); |
628 set_allow_harmony_restrictive_declarations( | |
629 FLAG_harmony_restrictive_declarations); | |
630 set_allow_harmony_async_await(FLAG_harmony_async_await); | 628 set_allow_harmony_async_await(FLAG_harmony_async_await); |
631 set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators); | 629 set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators); |
632 set_allow_harmony_trailing_commas(FLAG_harmony_trailing_commas); | 630 set_allow_harmony_trailing_commas(FLAG_harmony_trailing_commas); |
633 set_allow_harmony_class_fields(FLAG_harmony_class_fields); | 631 set_allow_harmony_class_fields(FLAG_harmony_class_fields); |
634 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 632 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
635 ++feature) { | 633 ++feature) { |
636 use_counts_[feature] = 0; | 634 use_counts_[feature] = 0; |
637 } | 635 } |
638 if (info->ast_value_factory() == NULL) { | 636 if (info->ast_value_factory() == NULL) { |
639 // info takes ownership of AstValueFactory. | 637 // info takes ownership of AstValueFactory. |
(...skipping 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3270 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); | 3268 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); |
3271 | 3269 |
3272 if (reusable_preparser_ == NULL) { | 3270 if (reusable_preparser_ == NULL) { |
3273 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), | 3271 reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), |
3274 NULL, stack_limit_); | 3272 NULL, stack_limit_); |
3275 reusable_preparser_->set_allow_lazy(true); | 3273 reusable_preparser_->set_allow_lazy(true); |
3276 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); | 3274 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); |
3277 SET_ALLOW(natives); | 3275 SET_ALLOW(natives); |
3278 SET_ALLOW(harmony_do_expressions); | 3276 SET_ALLOW(harmony_do_expressions); |
3279 SET_ALLOW(harmony_function_sent); | 3277 SET_ALLOW(harmony_function_sent); |
3280 SET_ALLOW(harmony_restrictive_declarations); | |
3281 SET_ALLOW(harmony_async_await); | 3278 SET_ALLOW(harmony_async_await); |
3282 SET_ALLOW(harmony_trailing_commas); | 3279 SET_ALLOW(harmony_trailing_commas); |
3283 SET_ALLOW(harmony_class_fields); | 3280 SET_ALLOW(harmony_class_fields); |
3284 #undef SET_ALLOW | 3281 #undef SET_ALLOW |
3285 } | 3282 } |
3286 // Aborting inner function preparsing would leave scopes in an inconsistent | 3283 // Aborting inner function preparsing would leave scopes in an inconsistent |
3287 // state; we don't parse inner functions in the abortable mode anyway. | 3284 // state; we don't parse inner functions in the abortable mode anyway. |
3288 DCHECK(!is_inner_function || !may_abort); | 3285 DCHECK(!is_inner_function || !may_abort); |
3289 | 3286 |
3290 DeclarationScope* function_scope = function_state_->scope(); | 3287 DeclarationScope* function_scope = function_state_->scope(); |
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5400 | 5397 |
5401 return final_loop; | 5398 return final_loop; |
5402 } | 5399 } |
5403 | 5400 |
5404 #undef CHECK_OK | 5401 #undef CHECK_OK |
5405 #undef CHECK_OK_VOID | 5402 #undef CHECK_OK_VOID |
5406 #undef CHECK_FAILED | 5403 #undef CHECK_FAILED |
5407 | 5404 |
5408 } // namespace internal | 5405 } // namespace internal |
5409 } // namespace v8 | 5406 } // namespace v8 |
OLD | NEW |