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 2789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2800 // temp === undefined | 2800 // temp === undefined |
2801 Expression* is_undefined = factory()->NewCompareOperation( | 2801 Expression* is_undefined = factory()->NewCompareOperation( |
2802 Token::EQ_STRICT, assign, | 2802 Token::EQ_STRICT, assign, |
2803 factory()->NewUndefinedLiteral(RelocInfo::kNoPosition), pos); | 2803 factory()->NewUndefinedLiteral(RelocInfo::kNoPosition), pos); |
2804 | 2804 |
2805 // is_undefined ? this : is_object_conditional | 2805 // is_undefined ? this : is_object_conditional |
2806 return_value = factory()->NewConditional( | 2806 return_value = factory()->NewConditional( |
2807 is_undefined, ThisExpression(scope_, factory(), pos), | 2807 is_undefined, ThisExpression(scope_, factory(), pos), |
2808 is_object_conditional, pos); | 2808 is_object_conditional, pos); |
2809 } | 2809 } |
2810 | |
2811 // ES6 14.6.1 Static Semantics: IsInTailPosition | |
2812 if (FLAG_harmony_tailcalls && !is_sloppy(language_mode())) { | |
2813 return_value->MarkTail(); | |
2814 } | |
2815 } | 2810 } |
2816 ExpectSemicolon(CHECK_OK); | 2811 ExpectSemicolon(CHECK_OK); |
2817 | 2812 |
2818 if (is_generator()) { | 2813 if (is_generator()) { |
2819 Expression* generator = factory()->NewVariableProxy( | 2814 Expression* generator = factory()->NewVariableProxy( |
2820 function_state_->generator_object_variable()); | 2815 function_state_->generator_object_variable()); |
2821 Expression* yield = factory()->NewYield( | 2816 Expression* yield = factory()->NewYield( |
2822 generator, return_value, Yield::kFinal, loc.beg_pos); | 2817 generator, return_value, Yield::kFinal, loc.beg_pos); |
2823 result = factory()->NewExpressionStatement(yield, loc.beg_pos); | 2818 result = factory()->NewExpressionStatement(yield, loc.beg_pos); |
2824 } else { | 2819 } else { |
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4771 | 4766 |
4772 VariableProxy* fproxy = factory()->NewVariableProxy(fvar); | 4767 VariableProxy* fproxy = factory()->NewVariableProxy(fvar); |
4773 result->Set(kFunctionNameAssignmentIndex, | 4768 result->Set(kFunctionNameAssignmentIndex, |
4774 factory()->NewExpressionStatement( | 4769 factory()->NewExpressionStatement( |
4775 factory()->NewAssignment(Token::INIT, fproxy, | 4770 factory()->NewAssignment(Token::INIT, fproxy, |
4776 factory()->NewThisFunction(pos), | 4771 factory()->NewThisFunction(pos), |
4777 RelocInfo::kNoPosition), | 4772 RelocInfo::kNoPosition), |
4778 RelocInfo::kNoPosition)); | 4773 RelocInfo::kNoPosition)); |
4779 } | 4774 } |
4780 | 4775 |
| 4776 // ES6 14.6.1 Static Semantics: IsInTailPosition |
| 4777 if (FLAG_harmony_tailcalls && !is_sloppy(language_mode())) { |
| 4778 for (int i = 0; i < body->length(); i++) { |
| 4779 Statement* stmt = body->at(i); |
| 4780 stmt->MarkTail(); |
| 4781 } |
| 4782 } |
4781 return result; | 4783 return result; |
4782 } | 4784 } |
4783 | 4785 |
4784 | 4786 |
4785 PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser( | 4787 PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser( |
4786 SingletonLogger* logger, Scanner::BookmarkScope* bookmark) { | 4788 SingletonLogger* logger, Scanner::BookmarkScope* bookmark) { |
4787 // This function may be called on a background thread too; record only the | 4789 // This function may be called on a background thread too; record only the |
4788 // main thread preparse times. | 4790 // main thread preparse times. |
4789 if (pre_parse_timer_ != NULL) { | 4791 if (pre_parse_timer_ != NULL) { |
4790 pre_parse_timer_->Start(); | 4792 pre_parse_timer_->Start(); |
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6344 | 6346 |
6345 statements->Add(get_return, zone); | 6347 statements->Add(get_return, zone); |
6346 statements->Add(check_return, zone); | 6348 statements->Add(check_return, zone); |
6347 statements->Add(call_return, zone); | 6349 statements->Add(call_return, zone); |
6348 statements->Add(validate_result, zone); | 6350 statements->Add(validate_result, zone); |
6349 } | 6351 } |
6350 | 6352 |
6351 | 6353 |
6352 } // namespace internal | 6354 } // namespace internal |
6353 } // namespace v8 | 6355 } // namespace v8 |
OLD | NEW |