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

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

Issue 2135503002: Narrowly address async function stack overflow parsing case (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/mjsunit/harmony/regress/regress-624300.js » ('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 "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-rewriter.h" 9 #include "src/ast/ast-expression-rewriter.h"
10 #include "src/ast/ast-expression-visitor.h" 10 #include "src/ast/ast-expression-visitor.h"
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 is_strict(info->language_mode())); 1091 is_strict(info->language_mode()));
1092 DCHECK(info->language_mode() == shared_info->language_mode()); 1092 DCHECK(info->language_mode() == shared_info->language_mode());
1093 FunctionLiteral::FunctionType function_type = 1093 FunctionLiteral::FunctionType function_type =
1094 ComputeFunctionType(shared_info); 1094 ComputeFunctionType(shared_info);
1095 bool ok = true; 1095 bool ok = true;
1096 1096
1097 if (shared_info->is_arrow()) { 1097 if (shared_info->is_arrow()) {
1098 bool is_async = allow_harmony_async_await() && shared_info->is_async(); 1098 bool is_async = allow_harmony_async_await() && shared_info->is_async();
1099 if (is_async) { 1099 if (is_async) {
1100 DCHECK(!scanner()->HasAnyLineTerminatorAfterNext()); 1100 DCHECK(!scanner()->HasAnyLineTerminatorAfterNext());
1101 Consume(Token::ASYNC); 1101 if (!Check(Token::ASYNC)) {
1102 DCHECK(peek_any_identifier() || peek() == Token::LPAREN); 1102 CHECK(stack_overflow());
1103 return nullptr;
1104 }
1105 if (!(peek_any_identifier() || peek() == Token::LPAREN)) {
1106 CHECK(stack_overflow());
1107 return nullptr;
1108 }
1103 } 1109 }
1104 1110
1105 // TODO(adamk): We should construct this scope from the ScopeInfo. 1111 // TODO(adamk): We should construct this scope from the ScopeInfo.
1106 Scope* scope = 1112 Scope* scope =
1107 NewScope(scope_, FUNCTION_SCOPE, FunctionKind::kArrowFunction); 1113 NewScope(scope_, FUNCTION_SCOPE, FunctionKind::kArrowFunction);
1108 1114
1109 // These two bits only need to be explicitly set because we're 1115 // These two bits only need to be explicitly set because we're
1110 // not passing the ScopeInfo to the Scope constructor. 1116 // not passing the ScopeInfo to the Scope constructor.
1111 // TODO(adamk): Remove these calls once the above NewScope call 1117 // TODO(adamk): Remove these calls once the above NewScope call
1112 // passes the ScopeInfo. 1118 // passes the ScopeInfo.
(...skipping 5879 matching lines...) Expand 10 before | Expand all | Expand 10 after
6992 6998
6993 #ifdef DEBUG 6999 #ifdef DEBUG
6994 void Parser::Print(AstNode* node) { 7000 void Parser::Print(AstNode* node) {
6995 ast_value_factory()->Internalize(Isolate::Current()); 7001 ast_value_factory()->Internalize(Isolate::Current());
6996 node->Print(Isolate::Current()); 7002 node->Print(Isolate::Current());
6997 } 7003 }
6998 #endif // DEBUG 7004 #endif // DEBUG
6999 7005
7000 } // namespace internal 7006 } // namespace internal
7001 } // namespace v8 7007 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/regress/regress-624300.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698