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

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

Issue 2316623004: 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 <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 2606 matching lines...) Expand 10 before | Expand all | Expand 10 after
2617 factory()->NewUndefinedLiteral(kNoSourcePosition), pos); 2617 factory()->NewUndefinedLiteral(kNoSourcePosition), pos);
2618 2618
2619 // is_undefined ? this : is_object_conditional 2619 // is_undefined ? this : is_object_conditional
2620 return_value = factory()->NewConditional( 2620 return_value = factory()->NewConditional(
2621 is_undefined, ThisExpression(pos), is_object_conditional, pos); 2621 is_undefined, ThisExpression(pos), is_object_conditional, pos);
2622 } else { 2622 } else {
2623 ReturnExprScope maybe_allow_tail_calls( 2623 ReturnExprScope maybe_allow_tail_calls(
2624 function_state_, ReturnExprContext::kInsideValidReturnStatement); 2624 function_state_, ReturnExprContext::kInsideValidReturnStatement);
2625 return_value = ParseExpression(true, CHECK_OK); 2625 return_value = ParseExpression(true, CHECK_OK);
2626 2626
2627 if (allow_tailcalls() && !is_sloppy(language_mode())) { 2627 if (allow_tailcalls() && !is_sloppy(language_mode()) && !is_resumable()) {
2628 // ES6 14.6.1 Static Semantics: IsInTailPosition 2628 // ES6 14.6.1 Static Semantics: IsInTailPosition
2629 function_state_->AddImplicitTailCallExpression(return_value); 2629 function_state_->AddImplicitTailCallExpression(return_value);
2630 } 2630 }
2631 } 2631 }
2632 } 2632 }
2633 ExpectSemicolon(CHECK_OK); 2633 ExpectSemicolon(CHECK_OK);
2634 2634
2635 if (is_generator()) { 2635 if (is_generator()) {
2636 return_value = BuildIteratorResult(return_value, true); 2636 return_value = BuildIteratorResult(return_value, true);
2637 } else if (is_async_function()) { 2637 } else if (is_async_function()) {
(...skipping 4203 matching lines...) Expand 10 before | Expand all | Expand 10 after
6841 node->Print(Isolate::Current()); 6841 node->Print(Isolate::Current());
6842 } 6842 }
6843 #endif // DEBUG 6843 #endif // DEBUG
6844 6844
6845 #undef CHECK_OK 6845 #undef CHECK_OK
6846 #undef CHECK_OK_VOID 6846 #undef CHECK_OK_VOID
6847 #undef CHECK_FAILED 6847 #undef CHECK_FAILED
6848 6848
6849 } // namespace internal 6849 } // namespace internal
6850 } // namespace v8 6850 } // 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