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

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

Issue 1962853002: [es8] Prepare explicit tail calls (STC) for staging with implicit tail calls (PTC). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@src-stage
Patch Set: Addressing comments Created 4 years, 7 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 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 return_value = factory()->NewConditional( 2650 return_value = factory()->NewConditional(
2651 is_undefined, ThisExpression(scope_, factory(), pos), 2651 is_undefined, ThisExpression(scope_, factory(), pos),
2652 is_object_conditional, pos); 2652 is_object_conditional, pos);
2653 } else { 2653 } else {
2654 ReturnExprScope maybe_allow_tail_calls( 2654 ReturnExprScope maybe_allow_tail_calls(
2655 function_state_, ReturnExprContext::kInsideValidReturnStatement); 2655 function_state_, ReturnExprContext::kInsideValidReturnStatement);
2656 return_value = ParseExpression(true, CHECK_OK); 2656 return_value = ParseExpression(true, CHECK_OK);
2657 2657
2658 if (allow_tailcalls() && !is_sloppy(language_mode())) { 2658 if (allow_tailcalls() && !is_sloppy(language_mode())) {
2659 // ES6 14.6.1 Static Semantics: IsInTailPosition 2659 // ES6 14.6.1 Static Semantics: IsInTailPosition
2660 Scanner::Location loc(pos, pos + 1); 2660 function_state_->AddImplicitTailCallExpression(return_value);
2661 function_state_->AddExpressionInTailPosition(return_value, loc);
2662 } 2661 }
2663 } 2662 }
2664 } 2663 }
2665 ExpectSemicolon(CHECK_OK); 2664 ExpectSemicolon(CHECK_OK);
2666 2665
2667 if (is_generator()) { 2666 if (is_generator()) {
2668 return_value = BuildIteratorResult(return_value, true); 2667 return_value = BuildIteratorResult(return_value, true);
2669 } 2668 }
2670 2669
2671 result = factory()->NewReturnStatement(return_value, loc.beg_pos); 2670 result = factory()->NewReturnStatement(return_value, loc.beg_pos);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2982 // to the list of return expressions. 2981 // to the list of return expressions.
2983 function_state_->tail_call_expressions().Append( 2982 function_state_->tail_call_expressions().Append(
2984 tail_call_expressions_in_catch_block); 2983 tail_call_expressions_in_catch_block);
2985 2984
2986 DCHECK(finally_block == NULL); 2985 DCHECK(finally_block == NULL);
2987 DCHECK(catch_scope != NULL && catch_variable != NULL); 2986 DCHECK(catch_scope != NULL && catch_variable != NULL);
2988 result = factory()->NewTryCatchStatement(try_block, catch_scope, 2987 result = factory()->NewTryCatchStatement(try_block, catch_scope,
2989 catch_variable, catch_block, pos); 2988 catch_variable, catch_block, pos);
2990 } else { 2989 } else {
2991 if (FLAG_harmony_explicit_tailcalls && 2990 if (FLAG_harmony_explicit_tailcalls &&
2992 !tail_call_expressions_in_catch_block.is_empty()) { 2991 tail_call_expressions_in_catch_block.has_explicit_tail_calls()) {
2993 // TODO(ishell): update chapter number. 2992 // TODO(ishell): update chapter number.
2994 // ES8 XX.YY.ZZ 2993 // ES8 XX.YY.ZZ
2995 ReportMessageAt(tail_call_expressions_in_catch_block.location(), 2994 ReportMessageAt(tail_call_expressions_in_catch_block.location(),
2996 MessageTemplate::kUnexpectedTailCallInCatchBlock); 2995 MessageTemplate::kUnexpectedTailCallInCatchBlock);
2997 *ok = false; 2996 *ok = false;
2998 return NULL; 2997 return NULL;
2999 } 2998 }
3000 DCHECK(finally_block != NULL); 2999 DCHECK(finally_block != NULL);
3001 result = factory()->NewTryFinallyStatement(try_block, finally_block, pos); 3000 result = factory()->NewTryFinallyStatement(try_block, finally_block, pos);
3002 } 3001 }
(...skipping 3814 matching lines...) Expand 10 before | Expand all | Expand 10 after
6817 try_block, target); 6816 try_block, target);
6818 final_loop = target; 6817 final_loop = target;
6819 } 6818 }
6820 6819
6821 return final_loop; 6820 return final_loop;
6822 } 6821 }
6823 6822
6824 6823
6825 } // namespace internal 6824 } // namespace internal
6826 } // namespace v8 6825 } // 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