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

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

Issue 1818063002: Disable ES6 tail call elimination for native functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 cached_parse_data_(NULL), 776 cached_parse_data_(NULL),
777 total_preparse_skipped_(0), 777 total_preparse_skipped_(0),
778 pre_parse_timer_(NULL), 778 pre_parse_timer_(NULL),
779 parsing_on_main_thread_(true) { 779 parsing_on_main_thread_(true) {
780 // Even though we were passed ParseInfo, we should not store it in 780 // Even though we were passed ParseInfo, we should not store it in
781 // Parser - this makes sure that Isolate is not accidentally accessed via 781 // Parser - this makes sure that Isolate is not accidentally accessed via
782 // ParseInfo during background parsing. 782 // ParseInfo during background parsing.
783 DCHECK(!info->script().is_null() || info->source_stream() != NULL); 783 DCHECK(!info->script().is_null() || info->source_stream() != NULL);
784 set_allow_lazy(info->allow_lazy_parsing()); 784 set_allow_lazy(info->allow_lazy_parsing());
785 set_allow_natives(FLAG_allow_natives_syntax || info->is_native()); 785 set_allow_natives(FLAG_allow_natives_syntax || info->is_native());
786 set_allow_tailcalls(FLAG_harmony_tailcalls && !info->is_native());
786 set_allow_harmony_sloppy(FLAG_harmony_sloppy); 787 set_allow_harmony_sloppy(FLAG_harmony_sloppy);
787 set_allow_harmony_sloppy_function(FLAG_harmony_sloppy_function); 788 set_allow_harmony_sloppy_function(FLAG_harmony_sloppy_function);
788 set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let); 789 set_allow_harmony_sloppy_let(FLAG_harmony_sloppy_let);
789 set_allow_legacy_const(FLAG_legacy_const); 790 set_allow_legacy_const(FLAG_legacy_const);
790 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions); 791 set_allow_harmony_do_expressions(FLAG_harmony_do_expressions);
791 set_allow_harmony_function_name(FLAG_harmony_function_name); 792 set_allow_harmony_function_name(FLAG_harmony_function_name);
792 set_allow_harmony_function_sent(FLAG_harmony_function_sent); 793 set_allow_harmony_function_sent(FLAG_harmony_function_sent);
793 set_allow_harmony_restrictive_declarations( 794 set_allow_harmony_restrictive_declarations(
794 FLAG_harmony_restrictive_declarations); 795 FLAG_harmony_restrictive_declarations);
795 set_allow_harmony_exponentiation_operator( 796 set_allow_harmony_exponentiation_operator(
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 Token::EQ_STRICT, assign, 2674 Token::EQ_STRICT, assign,
2674 factory()->NewUndefinedLiteral(RelocInfo::kNoPosition), pos); 2675 factory()->NewUndefinedLiteral(RelocInfo::kNoPosition), pos);
2675 2676
2676 // is_undefined ? this : is_object_conditional 2677 // is_undefined ? this : is_object_conditional
2677 return_value = factory()->NewConditional( 2678 return_value = factory()->NewConditional(
2678 is_undefined, ThisExpression(scope_, factory(), pos), 2679 is_undefined, ThisExpression(scope_, factory(), pos),
2679 is_object_conditional, pos); 2680 is_object_conditional, pos);
2680 } 2681 }
2681 2682
2682 // ES6 14.6.1 Static Semantics: IsInTailPosition 2683 // ES6 14.6.1 Static Semantics: IsInTailPosition
2683 if (FLAG_harmony_tailcalls && !is_sloppy(language_mode())) { 2684 if (allow_tailcalls() && !is_sloppy(language_mode())) {
2684 function_state_->AddExpressionInTailPosition(return_value); 2685 function_state_->AddExpressionInTailPosition(return_value);
2685 } 2686 }
2686 } 2687 }
2687 ExpectSemicolon(CHECK_OK); 2688 ExpectSemicolon(CHECK_OK);
2688 2689
2689 if (is_generator()) { 2690 if (is_generator()) {
2690 return_value = BuildIteratorResult(return_value, true); 2691 return_value = BuildIteratorResult(return_value, true);
2691 } 2692 }
2692 2693
2693 result = factory()->NewReturnStatement(return_value, loc.beg_pos); 2694 result = factory()->NewReturnStatement(return_value, loc.beg_pos);
(...skipping 4182 matching lines...) Expand 10 before | Expand all | Expand 10 after
6876 try_block, target); 6877 try_block, target);
6877 final_loop = target; 6878 final_loop = target;
6878 } 6879 }
6879 6880
6880 return final_loop; 6881 return final_loop;
6881 } 6882 }
6882 6883
6883 6884
6884 } // namespace internal 6885 } // namespace internal
6885 } // namespace v8 6886 } // 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