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

Side by Side Diff: src/parsing/parser.cc

Issue 2621173002: Remove --harmony-async-await runtime flag (Closed)
Patch Set: Update test ref Created 3 years, 11 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 | « src/flag-definitions.h ('k') | src/parsing/parser-base.h » ('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/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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 set_default_eager_compile_hint(can_compile_lazily 542 set_default_eager_compile_hint(can_compile_lazily
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_async_await(FLAG_harmony_async_await);
553 set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators); 552 set_allow_harmony_restrictive_generators(FLAG_harmony_restrictive_generators);
554 set_allow_harmony_trailing_commas(FLAG_harmony_trailing_commas); 553 set_allow_harmony_trailing_commas(FLAG_harmony_trailing_commas);
555 set_allow_harmony_class_fields(FLAG_harmony_class_fields); 554 set_allow_harmony_class_fields(FLAG_harmony_class_fields);
556 set_allow_harmony_object_spread(FLAG_harmony_object_spread); 555 set_allow_harmony_object_spread(FLAG_harmony_object_spread);
557 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; 556 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
558 ++feature) { 557 ++feature) {
559 use_counts_[feature] = 0; 558 use_counts_[feature] = 0;
560 } 559 }
561 if (info->ast_value_factory() == NULL) { 560 if (info->ast_value_factory() == NULL) {
562 // info takes ownership of AstValueFactory. 561 // info takes ownership of AstValueFactory.
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 FunctionState function_state(&function_state_, &scope_state_, 846 FunctionState function_state(&function_state_, &scope_state_,
848 outer_function); 847 outer_function);
849 BlockState block_state(&scope_state_, outer); 848 BlockState block_state(&scope_state_, outer);
850 DCHECK(is_sloppy(outer->language_mode()) || 849 DCHECK(is_sloppy(outer->language_mode()) ||
851 is_strict(info->language_mode())); 850 is_strict(info->language_mode()));
852 FunctionLiteral::FunctionType function_type = ComputeFunctionType(info); 851 FunctionLiteral::FunctionType function_type = ComputeFunctionType(info);
853 FunctionKind kind = info->function_kind(); 852 FunctionKind kind = info->function_kind();
854 bool ok = true; 853 bool ok = true;
855 854
856 if (IsArrowFunction(kind)) { 855 if (IsArrowFunction(kind)) {
857 if (allow_harmony_async_await() && IsAsyncFunction(kind)) { 856 if (IsAsyncFunction(kind)) {
858 DCHECK(!scanner()->HasAnyLineTerminatorAfterNext()); 857 DCHECK(!scanner()->HasAnyLineTerminatorAfterNext());
859 if (!Check(Token::ASYNC)) { 858 if (!Check(Token::ASYNC)) {
860 CHECK(stack_overflow()); 859 CHECK(stack_overflow());
861 return nullptr; 860 return nullptr;
862 } 861 }
863 if (!(peek_any_identifier() || peek() == Token::LPAREN)) { 862 if (!(peek_any_identifier() || peek() == Token::LPAREN)) {
864 CHECK(stack_overflow()); 863 CHECK(stack_overflow());
865 return nullptr; 864 return nullptr;
866 } 865 }
867 } 866 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 case Token::FUNCTION: 1225 case Token::FUNCTION:
1227 result = ParseHoistableDeclaration(&local_names, true, CHECK_OK); 1226 result = ParseHoistableDeclaration(&local_names, true, CHECK_OK);
1228 break; 1227 break;
1229 1228
1230 case Token::CLASS: 1229 case Token::CLASS:
1231 Consume(Token::CLASS); 1230 Consume(Token::CLASS);
1232 result = ParseClassDeclaration(&local_names, true, CHECK_OK); 1231 result = ParseClassDeclaration(&local_names, true, CHECK_OK);
1233 break; 1232 break;
1234 1233
1235 case Token::ASYNC: 1234 case Token::ASYNC:
1236 if (allow_harmony_async_await() && PeekAhead() == Token::FUNCTION && 1235 if (PeekAhead() == Token::FUNCTION &&
1237 !scanner()->HasAnyLineTerminatorAfterNext()) { 1236 !scanner()->HasAnyLineTerminatorAfterNext()) {
1238 Consume(Token::ASYNC); 1237 Consume(Token::ASYNC);
1239 result = ParseAsyncFunctionDeclaration(&local_names, true, CHECK_OK); 1238 result = ParseAsyncFunctionDeclaration(&local_names, true, CHECK_OK);
1240 break; 1239 break;
1241 } 1240 }
1242 /* falls through */ 1241 /* falls through */
1243 1242
1244 default: { 1243 default: {
1245 int pos = position(); 1244 int pos = position();
1246 ExpressionClassifier classifier(this); 1245 ExpressionClassifier classifier(this);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 result = ParseClassDeclaration(&names, false, CHECK_OK); 1358 result = ParseClassDeclaration(&names, false, CHECK_OK);
1360 break; 1359 break;
1361 1360
1362 case Token::VAR: 1361 case Token::VAR:
1363 case Token::LET: 1362 case Token::LET:
1364 case Token::CONST: 1363 case Token::CONST:
1365 result = ParseVariableStatement(kStatementListItem, &names, CHECK_OK); 1364 result = ParseVariableStatement(kStatementListItem, &names, CHECK_OK);
1366 break; 1365 break;
1367 1366
1368 case Token::ASYNC: 1367 case Token::ASYNC:
1369 if (allow_harmony_async_await()) { 1368 // TODO(neis): Why don't we have the same check here as in
1370 // TODO(neis): Why don't we have the same check here as in 1369 // ParseStatementListItem?
1371 // ParseStatementListItem? 1370 Consume(Token::ASYNC);
1372 Consume(Token::ASYNC); 1371 result = ParseAsyncFunctionDeclaration(&names, false, CHECK_OK);
1373 result = ParseAsyncFunctionDeclaration(&names, false, CHECK_OK); 1372 break;
1374 break;
1375 }
1376 /* falls through */
1377 1373
1378 default: 1374 default:
1379 *ok = false; 1375 *ok = false;
1380 ReportUnexpectedToken(scanner()->current_token()); 1376 ReportUnexpectedToken(scanner()->current_token());
1381 return nullptr; 1377 return nullptr;
1382 } 1378 }
1383 loc.end_pos = scanner()->location().end_pos; 1379 loc.end_pos = scanner()->location().end_pos;
1384 1380
1385 ModuleDescriptor* descriptor = module(); 1381 ModuleDescriptor* descriptor = module();
1386 for (int i = 0; i < names.length(); ++i) { 1382 for (int i = 0; i < names.length(); ++i) {
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.PreParse"); 2740 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.PreParse");
2745 2741
2746 if (reusable_preparser_ == NULL) { 2742 if (reusable_preparser_ == NULL) {
2747 reusable_preparser_ = new PreParser( 2743 reusable_preparser_ = new PreParser(
2748 zone(), &scanner_, stack_limit_, ast_value_factory(), 2744 zone(), &scanner_, stack_limit_, ast_value_factory(),
2749 &pending_error_handler_, runtime_call_stats_, parsing_on_main_thread_); 2745 &pending_error_handler_, runtime_call_stats_, parsing_on_main_thread_);
2750 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); 2746 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name());
2751 SET_ALLOW(natives); 2747 SET_ALLOW(natives);
2752 SET_ALLOW(harmony_do_expressions); 2748 SET_ALLOW(harmony_do_expressions);
2753 SET_ALLOW(harmony_function_sent); 2749 SET_ALLOW(harmony_function_sent);
2754 SET_ALLOW(harmony_async_await);
2755 SET_ALLOW(harmony_trailing_commas); 2750 SET_ALLOW(harmony_trailing_commas);
2756 SET_ALLOW(harmony_class_fields); 2751 SET_ALLOW(harmony_class_fields);
2757 SET_ALLOW(harmony_object_spread); 2752 SET_ALLOW(harmony_object_spread);
2758 #undef SET_ALLOW 2753 #undef SET_ALLOW
2759 } 2754 }
2760 // Aborting inner function preparsing would leave scopes in an inconsistent 2755 // Aborting inner function preparsing would leave scopes in an inconsistent
2761 // state; we don't parse inner functions in the abortable mode anyway. 2756 // state; we don't parse inner functions in the abortable mode anyway.
2762 DCHECK(!is_inner_function || !may_abort); 2757 DCHECK(!is_inner_function || !may_abort);
2763 2758
2764 PreParser::PreParseResult result = reusable_preparser_->PreParseFunction( 2759 PreParser::PreParseResult result = reusable_preparser_->PreParseFunction(
(...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after
5134 5129
5135 return final_loop; 5130 return final_loop;
5136 } 5131 }
5137 5132
5138 #undef CHECK_OK 5133 #undef CHECK_OK
5139 #undef CHECK_OK_VOID 5134 #undef CHECK_OK_VOID
5140 #undef CHECK_FAILED 5135 #undef CHECK_FAILED
5141 5136
5142 } // namespace internal 5137 } // namespace internal
5143 } // namespace v8 5138 } // namespace v8
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698