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

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

Issue 2315043002: Merged: Disallow tail calls from async functions and generators (Closed)
Patch Set: Created 4 years, 3 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 | 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 "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 2754 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 2765
2766 // is_undefined ? this : is_object_conditional 2766 // is_undefined ? this : is_object_conditional
2767 return_value = factory()->NewConditional( 2767 return_value = factory()->NewConditional(
2768 is_undefined, ThisExpression(scope_, factory(), pos), 2768 is_undefined, ThisExpression(scope_, factory(), pos),
2769 is_object_conditional, pos); 2769 is_object_conditional, pos);
2770 } else { 2770 } else {
2771 ReturnExprScope maybe_allow_tail_calls( 2771 ReturnExprScope maybe_allow_tail_calls(
2772 function_state_, ReturnExprContext::kInsideValidReturnStatement); 2772 function_state_, ReturnExprContext::kInsideValidReturnStatement);
2773 return_value = ParseExpression(true, CHECK_OK); 2773 return_value = ParseExpression(true, CHECK_OK);
2774 2774
2775 if (allow_tailcalls() && !is_sloppy(language_mode())) { 2775 if (allow_tailcalls() && !is_sloppy(language_mode()) && !is_resumable()) {
2776 // ES6 14.6.1 Static Semantics: IsInTailPosition 2776 // ES6 14.6.1 Static Semantics: IsInTailPosition
2777 function_state_->AddImplicitTailCallExpression(return_value); 2777 function_state_->AddImplicitTailCallExpression(return_value);
2778 } 2778 }
2779 } 2779 }
2780 } 2780 }
2781 ExpectSemicolon(CHECK_OK); 2781 ExpectSemicolon(CHECK_OK);
2782 2782
2783 if (is_generator()) { 2783 if (is_generator()) {
2784 return_value = BuildIteratorResult(return_value, true); 2784 return_value = BuildIteratorResult(return_value, true);
2785 } else if (is_async_function()) { 2785 } else if (is_async_function()) {
(...skipping 4208 matching lines...) Expand 10 before | Expand all | Expand 10 after
6994 try_block, target); 6994 try_block, target);
6995 final_loop = target; 6995 final_loop = target;
6996 } 6996 }
6997 6997
6998 return final_loop; 6998 return final_loop;
6999 } 6999 }
7000 7000
7001 7001
7002 } // namespace internal 7002 } // namespace internal
7003 } // namespace v8 7003 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698