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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 ? FunctionLiteral::kShouldLazyCompile | 543 ? FunctionLiteral::kShouldLazyCompile |
544 : FunctionLiteral::kShouldEagerCompile); | 544 : FunctionLiteral::kShouldEagerCompile); |
545 allow_lazy_ = FLAG_lazy && info->allow_lazy_parsing() && !info->is_native() && | 545 allow_lazy_ = FLAG_lazy && info->allow_lazy_parsing() && !info->is_native() && |
546 info->extension() == nullptr && can_compile_lazily; | 546 info->extension() == nullptr && can_compile_lazily; |
547 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); | 547 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); |
548 set_allow_tailcalls(FLAG_harmony_tailcalls && !info->is_native() && | 548 set_allow_tailcalls(FLAG_harmony_tailcalls && !info->is_native() && |
549 info->isolate()->is_tail_call_elimination_enabled()); | 549 info->isolate()->is_tail_call_elimination_enabled()); |
550 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); | 550 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); |
551 set_allow_harmony_function_sent(FLAG_harmony_function_sent); | 551 set_allow_harmony_function_sent(FLAG_harmony_function_sent); |
552 set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators); | 552 set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators); |
553 set_allow_harmony_trailing_commas(FLAG_harmony_trailing_commas); | |
554 set_allow_harmony_class_fields(FLAG_harmony_class_fields); | 553 set_allow_harmony_class_fields(FLAG_harmony_class_fields); |
555 set_allow_harmony_object_spread(FLAG_harmony_object_spread); | 554 set_allow_harmony_object_spread(FLAG_harmony_object_spread); |
556 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 555 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
557 ++feature) { | 556 ++feature) { |
558 use_counts_[feature] = 0; | 557 use_counts_[feature] = 0; |
559 } | 558 } |
560 if (info->ast_value_factory() == NULL) { | 559 if (info->ast_value_factory() == NULL) { |
561 // info takes ownership of AstValueFactory. | 560 // info takes ownership of AstValueFactory. |
562 info->set_ast_value_factory(new AstValueFactory(zone(), info->hash_seed())); | 561 info->set_ast_value_factory(new AstValueFactory(zone(), info->hash_seed())); |
563 info->set_ast_value_factory_owned(); | 562 info->set_ast_value_factory_owned(); |
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2740 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.PreParse"); | 2739 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.PreParse"); |
2741 | 2740 |
2742 if (reusable_preparser_ == NULL) { | 2741 if (reusable_preparser_ == NULL) { |
2743 reusable_preparser_ = new PreParser( | 2742 reusable_preparser_ = new PreParser( |
2744 zone(), &scanner_, stack_limit_, ast_value_factory(), | 2743 zone(), &scanner_, stack_limit_, ast_value_factory(), |
2745 &pending_error_handler_, runtime_call_stats_, parsing_on_main_thread_); | 2744 &pending_error_handler_, runtime_call_stats_, parsing_on_main_thread_); |
2746 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); | 2745 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); |
2747 SET_ALLOW(natives); | 2746 SET_ALLOW(natives); |
2748 SET_ALLOW(harmony_do_expressions); | 2747 SET_ALLOW(harmony_do_expressions); |
2749 SET_ALLOW(harmony_function_sent); | 2748 SET_ALLOW(harmony_function_sent); |
2750 SET_ALLOW(harmony_trailing_commas); | |
2751 SET_ALLOW(harmony_class_fields); | 2749 SET_ALLOW(harmony_class_fields); |
2752 SET_ALLOW(harmony_object_spread); | 2750 SET_ALLOW(harmony_object_spread); |
2753 #undef SET_ALLOW | 2751 #undef SET_ALLOW |
2754 } | 2752 } |
2755 // Aborting inner function preparsing would leave scopes in an inconsistent | 2753 // Aborting inner function preparsing would leave scopes in an inconsistent |
2756 // state; we don't parse inner functions in the abortable mode anyway. | 2754 // state; we don't parse inner functions in the abortable mode anyway. |
2757 DCHECK(!is_inner_function || !may_abort); | 2755 DCHECK(!is_inner_function || !may_abort); |
2758 | 2756 |
2759 PreParser::PreParseResult result = reusable_preparser_->PreParseFunction( | 2757 PreParser::PreParseResult result = reusable_preparser_->PreParseFunction( |
2760 kind, function_scope, parsing_module_, is_inner_function, may_abort, | 2758 kind, function_scope, parsing_module_, is_inner_function, may_abort, |
(...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5130 | 5128 |
5131 return final_loop; | 5129 return final_loop; |
5132 } | 5130 } |
5133 | 5131 |
5134 #undef CHECK_OK | 5132 #undef CHECK_OK |
5135 #undef CHECK_OK_VOID | 5133 #undef CHECK_OK_VOID |
5136 #undef CHECK_FAILED | 5134 #undef CHECK_FAILED |
5137 | 5135 |
5138 } // namespace internal | 5136 } // namespace internal |
5139 } // namespace v8 | 5137 } // namespace v8 |
OLD | NEW |