OLD | NEW |
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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 } | 755 } |
756 | 756 |
757 | 757 |
758 ClassLiteral* ParserTraits::ParseClassLiteral( | 758 ClassLiteral* ParserTraits::ParseClassLiteral( |
759 const AstRawString* name, Scanner::Location class_name_location, | 759 const AstRawString* name, Scanner::Location class_name_location, |
760 bool name_is_strict_reserved, int pos, bool* ok) { | 760 bool name_is_strict_reserved, int pos, bool* ok) { |
761 return parser_->ParseClassLiteral(name, class_name_location, | 761 return parser_->ParseClassLiteral(name, class_name_location, |
762 name_is_strict_reserved, pos, ok); | 762 name_is_strict_reserved, pos, ok); |
763 } | 763 } |
764 | 764 |
| 765 void ParserTraits::MarkExpressionInTailPosition(Expression* expression) { |
| 766 expression->MarkTail(); |
| 767 } |
765 | 768 |
766 Parser::Parser(ParseInfo* info) | 769 Parser::Parser(ParseInfo* info) |
767 : ParserBase<ParserTraits>(info->zone(), &scanner_, info->stack_limit(), | 770 : ParserBase<ParserTraits>(info->zone(), &scanner_, info->stack_limit(), |
768 info->extension(), info->ast_value_factory(), | 771 info->extension(), info->ast_value_factory(), |
769 NULL, this), | 772 NULL, this), |
770 scanner_(info->unicode_cache()), | 773 scanner_(info->unicode_cache()), |
771 reusable_preparser_(NULL), | 774 reusable_preparser_(NULL), |
772 original_scope_(NULL), | 775 original_scope_(NULL), |
773 target_stack_(NULL), | 776 target_stack_(NULL), |
774 compile_options_(info->compile_options()), | 777 compile_options_(info->compile_options()), |
(...skipping 3796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4571 factory()->NewThisFunction(pos), | 4574 factory()->NewThisFunction(pos), |
4572 RelocInfo::kNoPosition), | 4575 RelocInfo::kNoPosition), |
4573 RelocInfo::kNoPosition)); | 4576 RelocInfo::kNoPosition)); |
4574 } | 4577 } |
4575 | 4578 |
4576 // ES6 14.6.1 Static Semantics: IsInTailPosition | 4579 // ES6 14.6.1 Static Semantics: IsInTailPosition |
4577 // Mark collected return expressions that are in tail call position. | 4580 // Mark collected return expressions that are in tail call position. |
4578 const List<Expression*>& expressions_in_tail_position = | 4581 const List<Expression*>& expressions_in_tail_position = |
4579 function_state_->expressions_in_tail_position(); | 4582 function_state_->expressions_in_tail_position(); |
4580 for (int i = 0; i < expressions_in_tail_position.length(); ++i) { | 4583 for (int i = 0; i < expressions_in_tail_position.length(); ++i) { |
4581 expressions_in_tail_position[i]->MarkTail(); | 4584 MarkExpressionInTailPosition(expressions_in_tail_position[i]); |
4582 } | 4585 } |
4583 return result; | 4586 return result; |
4584 } | 4587 } |
4585 | 4588 |
4586 | 4589 |
4587 PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser( | 4590 PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser( |
4588 SingletonLogger* logger, Scanner::BookmarkScope* bookmark) { | 4591 SingletonLogger* logger, Scanner::BookmarkScope* bookmark) { |
4589 // This function may be called on a background thread too; record only the | 4592 // This function may be called on a background thread too; record only the |
4590 // main thread preparse times. | 4593 // main thread preparse times. |
4591 if (pre_parse_timer_ != NULL) { | 4594 if (pre_parse_timer_ != NULL) { |
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6797 try_block, target); | 6800 try_block, target); |
6798 final_loop = target; | 6801 final_loop = target; |
6799 } | 6802 } |
6800 | 6803 |
6801 return final_loop; | 6804 return final_loop; |
6802 } | 6805 } |
6803 | 6806 |
6804 | 6807 |
6805 } // namespace internal | 6808 } // namespace internal |
6806 } // namespace v8 | 6809 } // namespace v8 |
OLD | NEW |