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

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

Issue 2224843003: Reduce number of scope() accesses (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Undo unrelated change Created 4 years, 4 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 | « src/parsing/parser.h ('k') | 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.h" 10 #include "src/ast/ast.h"
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 char array[100]; 683 char array[100];
684 const char* string = DoubleToCString(double_value, ArrayVector(array)); 684 const char* string = DoubleToCString(double_value, ArrayVector(array));
685 return parser_->ast_value_factory()->GetOneByteString(string); 685 return parser_->ast_value_factory()->GetOneByteString(string);
686 } 686 }
687 687
688 688
689 const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) { 689 const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) {
690 return parser_->scanner()->NextSymbol(parser_->ast_value_factory()); 690 return parser_->scanner()->NextSymbol(parser_->ast_value_factory());
691 } 691 }
692 692
693 693 Expression* ParserTraits::ThisExpression(AstNodeFactory* factory, int pos) {
694 Expression* ParserTraits::ThisExpression(Scope* scope, AstNodeFactory* factory, 694 return parser_->scope()->NewUnresolved(
695 int pos) { 695 factory, parser_->ast_value_factory()->this_string(), Variable::THIS, pos,
696 return scope->NewUnresolved(factory, 696 pos + 4);
697 parser_->ast_value_factory()->this_string(),
698 Variable::THIS, pos, pos + 4);
699 } 697 }
700 698
701 Expression* ParserTraits::NewSuperPropertyReference(Scope* scope, 699 Expression* ParserTraits::NewSuperPropertyReference(AstNodeFactory* factory,
702 AstNodeFactory* factory,
703 int pos) { 700 int pos) {
704 // this_function[home_object_symbol] 701 // this_function[home_object_symbol]
705 VariableProxy* this_function_proxy = scope->NewUnresolved( 702 VariableProxy* this_function_proxy = parser_->scope()->NewUnresolved(
706 factory, parser_->ast_value_factory()->this_function_string(), 703 factory, parser_->ast_value_factory()->this_function_string(),
707 Variable::NORMAL, pos); 704 Variable::NORMAL, pos);
708 Expression* home_object_symbol_literal = 705 Expression* home_object_symbol_literal =
709 factory->NewSymbolLiteral("home_object_symbol", kNoSourcePosition); 706 factory->NewSymbolLiteral("home_object_symbol", kNoSourcePosition);
710 Expression* home_object = factory->NewProperty( 707 Expression* home_object = factory->NewProperty(
711 this_function_proxy, home_object_symbol_literal, pos); 708 this_function_proxy, home_object_symbol_literal, pos);
712 return factory->NewSuperPropertyReference( 709 return factory->NewSuperPropertyReference(
713 ThisExpression(scope, factory, pos)->AsVariableProxy(), home_object, pos); 710 ThisExpression(factory, pos)->AsVariableProxy(), home_object, pos);
714 } 711 }
715 712
716 Expression* ParserTraits::NewSuperCallReference(Scope* scope, 713 Expression* ParserTraits::NewSuperCallReference(AstNodeFactory* factory,
717 AstNodeFactory* factory,
718 int pos) { 714 int pos) {
719 VariableProxy* new_target_proxy = scope->NewUnresolved( 715 VariableProxy* new_target_proxy = parser_->scope()->NewUnresolved(
720 factory, parser_->ast_value_factory()->new_target_string(), 716 factory, parser_->ast_value_factory()->new_target_string(),
721 Variable::NORMAL, pos); 717 Variable::NORMAL, pos);
722 VariableProxy* this_function_proxy = scope->NewUnresolved( 718 VariableProxy* this_function_proxy = parser_->scope()->NewUnresolved(
723 factory, parser_->ast_value_factory()->this_function_string(), 719 factory, parser_->ast_value_factory()->this_function_string(),
724 Variable::NORMAL, pos); 720 Variable::NORMAL, pos);
725 return factory->NewSuperCallReference( 721 return factory->NewSuperCallReference(
726 ThisExpression(scope, factory, pos)->AsVariableProxy(), new_target_proxy, 722 ThisExpression(factory, pos)->AsVariableProxy(), new_target_proxy,
727 this_function_proxy, pos); 723 this_function_proxy, pos);
728 } 724 }
729 725
730 726 Expression* ParserTraits::NewTargetExpression(AstNodeFactory* factory,
731 Expression* ParserTraits::NewTargetExpression(Scope* scope,
732 AstNodeFactory* factory,
733 int pos) { 727 int pos) {
734 static const int kNewTargetStringLength = 10; 728 static const int kNewTargetStringLength = 10;
735 auto proxy = scope->NewUnresolved( 729 auto proxy = parser_->scope()->NewUnresolved(
736 factory, parser_->ast_value_factory()->new_target_string(), 730 factory, parser_->ast_value_factory()->new_target_string(),
737 Variable::NORMAL, pos, pos + kNewTargetStringLength); 731 Variable::NORMAL, pos, pos + kNewTargetStringLength);
738 proxy->set_is_new_target(); 732 proxy->set_is_new_target();
739 return proxy; 733 return proxy;
740 } 734 }
741 735
742 736 Expression* ParserTraits::FunctionSentExpression(AstNodeFactory* factory,
743 Expression* ParserTraits::FunctionSentExpression(Scope* scope,
744 AstNodeFactory* factory,
745 int pos) { 737 int pos) {
746 // We desugar function.sent into %_GeneratorGetInputOrDebugPos(generator). 738 // We desugar function.sent into %_GeneratorGetInputOrDebugPos(generator).
747 Zone* zone = parser_->zone(); 739 Zone* zone = parser_->zone();
748 ZoneList<Expression*>* args = new (zone) ZoneList<Expression*>(1, zone); 740 ZoneList<Expression*>* args = new (zone) ZoneList<Expression*>(1, zone);
749 VariableProxy* generator = factory->NewVariableProxy( 741 VariableProxy* generator = factory->NewVariableProxy(
750 parser_->function_state_->generator_object_variable()); 742 parser_->function_state_->generator_object_variable());
751 args->Add(generator, zone); 743 args->Add(generator, zone);
752 return factory->NewCallRuntime(Runtime::kInlineGeneratorGetInputOrDebugPos, 744 return factory->NewCallRuntime(Runtime::kInlineGeneratorGetInputOrDebugPos,
753 args, pos); 745 args, pos);
754 } 746 }
(...skipping 21 matching lines...) Expand all
776 default: 768 default:
777 DCHECK(false); 769 DCHECK(false);
778 } 770 }
779 return NULL; 771 return NULL;
780 } 772 }
781 773
782 774
783 Expression* ParserTraits::ExpressionFromIdentifier(const AstRawString* name, 775 Expression* ParserTraits::ExpressionFromIdentifier(const AstRawString* name,
784 int start_position, 776 int start_position,
785 int end_position, 777 int end_position,
786 Scope* scope,
787 AstNodeFactory* factory) { 778 AstNodeFactory* factory) {
788 if (parser_->fni_ != NULL) parser_->fni_->PushVariableName(name); 779 if (parser_->fni_ != NULL) parser_->fni_->PushVariableName(name);
789 return scope->NewUnresolved(factory, name, Variable::NORMAL, start_position, 780 return parser_->scope()->NewUnresolved(factory, name, Variable::NORMAL,
790 end_position); 781 start_position, end_position);
791 } 782 }
792 783
793 784
794 Expression* ParserTraits::ExpressionFromString(int pos, Scanner* scanner, 785 Expression* ParserTraits::ExpressionFromString(int pos, Scanner* scanner,
795 AstNodeFactory* factory) { 786 AstNodeFactory* factory) {
796 const AstRawString* symbol = GetSymbol(scanner); 787 const AstRawString* symbol = GetSymbol(scanner);
797 if (parser_->fni_ != NULL) parser_->fni_->PushLiteralName(symbol); 788 if (parser_->fni_ != NULL) parser_->fni_->PushLiteralName(symbol);
798 return factory->NewStringLiteral(symbol, pos); 789 return factory->NewStringLiteral(symbol, pos);
799 } 790 }
800 791
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 if ((e_stat = stat->AsExpressionStatement()) != NULL && 1294 if ((e_stat = stat->AsExpressionStatement()) != NULL &&
1304 (literal = e_stat->expression()->AsLiteral()) != NULL && 1295 (literal = e_stat->expression()->AsLiteral()) != NULL &&
1305 literal->raw_value()->IsString()) { 1296 literal->raw_value()->IsString()) {
1306 // Check "use strict" directive (ES5 14.1), "use asm" directive. 1297 // Check "use strict" directive (ES5 14.1), "use asm" directive.
1307 bool use_strict_found = 1298 bool use_strict_found =
1308 literal->raw_value()->AsString() == 1299 literal->raw_value()->AsString() ==
1309 ast_value_factory()->use_strict_string() && 1300 ast_value_factory()->use_strict_string() &&
1310 token_loc.end_pos - token_loc.beg_pos == 1301 token_loc.end_pos - token_loc.beg_pos ==
1311 ast_value_factory()->use_strict_string()->length() + 2; 1302 ast_value_factory()->use_strict_string()->length() + 2;
1312 if (use_strict_found) { 1303 if (use_strict_found) {
1313 if (is_sloppy(this->scope()->language_mode())) { 1304 if (is_sloppy(language_mode())) {
1314 RaiseLanguageMode(STRICT); 1305 RaiseLanguageMode(STRICT);
1315 } 1306 }
1316 1307
1317 if (!this->scope()->HasSimpleParameters()) { 1308 if (!this->scope()->HasSimpleParameters()) {
1318 // TC39 deemed "use strict" directives to be an error when occurring 1309 // TC39 deemed "use strict" directives to be an error when occurring
1319 // in the body of a function with non-simple parameter list, on 1310 // in the body of a function with non-simple parameter list, on
1320 // 29/7/2015. https://goo.gl/ueA7Ln 1311 // 29/7/2015. https://goo.gl/ueA7Ln
1321 const AstRawString* string = literal->raw_value()->AsString(); 1312 const AstRawString* string = literal->raw_value()->AsString();
1322 ParserTraits::ReportMessageAt( 1313 ParserTraits::ReportMessageAt(
1323 token_loc, MessageTemplate::kIllegalLanguageModeDirective, 1314 token_loc, MessageTemplate::kIllegalLanguageModeDirective,
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 Scanner::Location loc = scanner()->location(); 2754 Scanner::Location loc = scanner()->location();
2764 2755
2765 Token::Value tok = peek(); 2756 Token::Value tok = peek();
2766 Statement* result; 2757 Statement* result;
2767 Expression* return_value; 2758 Expression* return_value;
2768 if (scanner()->HasAnyLineTerminatorBeforeNext() || 2759 if (scanner()->HasAnyLineTerminatorBeforeNext() ||
2769 tok == Token::SEMICOLON || 2760 tok == Token::SEMICOLON ||
2770 tok == Token::RBRACE || 2761 tok == Token::RBRACE ||
2771 tok == Token::EOS) { 2762 tok == Token::EOS) {
2772 if (IsSubclassConstructor(function_state_->kind())) { 2763 if (IsSubclassConstructor(function_state_->kind())) {
2773 return_value = ThisExpression(scope(), factory(), loc.beg_pos); 2764 return_value = ThisExpression(factory(), loc.beg_pos);
2774 } else { 2765 } else {
2775 return_value = GetLiteralUndefined(position()); 2766 return_value = GetLiteralUndefined(position());
2776 } 2767 }
2777 } else { 2768 } else {
2778 int pos = peek_position(); 2769 int pos = peek_position();
2779 2770
2780 if (IsSubclassConstructor(function_state_->kind())) { 2771 if (IsSubclassConstructor(function_state_->kind())) {
2781 // Because of the return code rewriting that happens in case of a subclass 2772 // Because of the return code rewriting that happens in case of a subclass
2782 // constructor we don't want to accept tail calls, therefore we don't set 2773 // constructor we don't want to accept tail calls, therefore we don't set
2783 // ReturnExprScope to kInsideValidReturnStatement here. 2774 // ReturnExprScope to kInsideValidReturnStatement here.
(...skipping 27 matching lines...) Expand all
2811 Expression* is_object_conditional = factory()->NewConditional( 2802 Expression* is_object_conditional = factory()->NewConditional(
2812 is_spec_object_call, factory()->NewVariableProxy(temp), 2803 is_spec_object_call, factory()->NewVariableProxy(temp),
2813 factory()->NewSmiLiteral(1, pos), pos); 2804 factory()->NewSmiLiteral(1, pos), pos);
2814 2805
2815 // temp === undefined 2806 // temp === undefined
2816 Expression* is_undefined = factory()->NewCompareOperation( 2807 Expression* is_undefined = factory()->NewCompareOperation(
2817 Token::EQ_STRICT, assign, 2808 Token::EQ_STRICT, assign,
2818 factory()->NewUndefinedLiteral(kNoSourcePosition), pos); 2809 factory()->NewUndefinedLiteral(kNoSourcePosition), pos);
2819 2810
2820 // is_undefined ? this : is_object_conditional 2811 // is_undefined ? this : is_object_conditional
2821 return_value = factory()->NewConditional( 2812 return_value = factory()->NewConditional(is_undefined,
2822 is_undefined, ThisExpression(scope(), factory(), pos), 2813 ThisExpression(factory(), pos),
2823 is_object_conditional, pos); 2814 is_object_conditional, pos);
2824 } else { 2815 } else {
2825 ReturnExprScope maybe_allow_tail_calls( 2816 ReturnExprScope maybe_allow_tail_calls(
2826 function_state_, ReturnExprContext::kInsideValidReturnStatement); 2817 function_state_, ReturnExprContext::kInsideValidReturnStatement);
2827 return_value = ParseExpression(true, CHECK_OK); 2818 return_value = ParseExpression(true, CHECK_OK);
2828 2819
2829 if (allow_tailcalls() && !is_sloppy(language_mode())) { 2820 if (allow_tailcalls() && !is_sloppy(language_mode())) {
2830 // ES6 14.6.1 Static Semantics: IsInTailPosition 2821 // ES6 14.6.1 Static Semantics: IsInTailPosition
2831 function_state_->AddImplicitTailCallExpression(return_value); 2822 function_state_->AddImplicitTailCallExpression(return_value);
2832 } 2823 }
2833 } 2824 }
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after
4646 scope()->RecordSuperPropertyUsage(); 4637 scope()->RecordSuperPropertyUsage();
4647 } 4638 }
4648 if (logger.calls_eval()) { 4639 if (logger.calls_eval()) {
4649 scope()->RecordEvalCall(); 4640 scope()->RecordEvalCall();
4650 } 4641 }
4651 if (produce_cached_parse_data()) { 4642 if (produce_cached_parse_data()) {
4652 DCHECK(log_); 4643 DCHECK(log_);
4653 // Position right after terminal '}'. 4644 // Position right after terminal '}'.
4654 int body_end = scanner()->location().end_pos; 4645 int body_end = scanner()->location().end_pos;
4655 log_->LogFunction(function_block_pos, body_end, *materialized_literal_count, 4646 log_->LogFunction(function_block_pos, body_end, *materialized_literal_count,
4656 *expected_property_count, scope()->language_mode(), 4647 *expected_property_count, language_mode(),
4657 scope()->uses_super_property(), scope()->calls_eval()); 4648 scope()->uses_super_property(), scope()->calls_eval());
4658 } 4649 }
4659 } 4650 }
4660 4651
4661 4652
4662 Statement* Parser::BuildAssertIsCoercible(Variable* var) { 4653 Statement* Parser::BuildAssertIsCoercible(Variable* var) {
4663 // if (var === null || var === undefined) 4654 // if (var === null || var === undefined)
4664 // throw /* type error kNonCoercible) */; 4655 // throw /* type error kNonCoercible) */;
4665 4656
4666 Expression* condition = factory()->NewBinaryOperation( 4657 Expression* condition = factory()->NewBinaryOperation(
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
4821 block->statements()->Add(try_catch_statement, zone()); 4812 block->statements()->Add(try_catch_statement, zone());
4822 return block; 4813 return block;
4823 } 4814 }
4824 4815
4825 Expression* Parser::BuildCreateJSGeneratorObject(int pos, FunctionKind kind) { 4816 Expression* Parser::BuildCreateJSGeneratorObject(int pos, FunctionKind kind) {
4826 DCHECK_NOT_NULL(function_state_->generator_object_variable()); 4817 DCHECK_NOT_NULL(function_state_->generator_object_variable());
4827 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); 4818 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone());
4828 args->Add(factory()->NewThisFunction(pos), zone()); 4819 args->Add(factory()->NewThisFunction(pos), zone());
4829 args->Add(IsArrowFunction(kind) 4820 args->Add(IsArrowFunction(kind)
4830 ? GetLiteralUndefined(pos) 4821 ? GetLiteralUndefined(pos)
4831 : ThisExpression(scope(), factory(), kNoSourcePosition), 4822 : ThisExpression(factory(), kNoSourcePosition),
4832 zone()); 4823 zone());
4833 return factory()->NewCallRuntime(Runtime::kCreateJSGeneratorObject, args, 4824 return factory()->NewCallRuntime(Runtime::kCreateJSGeneratorObject, args,
4834 pos); 4825 pos);
4835 } 4826 }
4836 4827
4837 Expression* Parser::BuildPromiseResolve(Expression* value, int pos) { 4828 Expression* Parser::BuildPromiseResolve(Expression* value, int pos) {
4838 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone()); 4829 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone());
4839 args->Add(value, zone()); 4830 args->Add(value, zone());
4840 return factory()->NewCallRuntime(Context::PROMISE_CREATE_RESOLVED_INDEX, args, 4831 return factory()->NewCallRuntime(Context::PROMISE_CREATE_RESOLVED_INDEX, args,
4841 pos); 4832 pos);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
4942 } else if (IsAsyncFunction(kind)) { 4933 } else if (IsAsyncFunction(kind)) {
4943 const bool accept_IN = true; 4934 const bool accept_IN = true;
4944 DesugarAsyncFunctionBody(function_name, inner_scope, body, nullptr, kind, 4935 DesugarAsyncFunctionBody(function_name, inner_scope, body, nullptr, kind,
4945 FunctionBody::Normal, accept_IN, pos, CHECK_OK); 4936 FunctionBody::Normal, accept_IN, pos, CHECK_OK);
4946 } else { 4937 } else {
4947 ParseStatementList(body, Token::RBRACE, CHECK_OK); 4938 ParseStatementList(body, Token::RBRACE, CHECK_OK);
4948 } 4939 }
4949 4940
4950 if (IsSubclassConstructor(kind)) { 4941 if (IsSubclassConstructor(kind)) {
4951 body->Add(factory()->NewReturnStatement( 4942 body->Add(factory()->NewReturnStatement(
4952 this->ThisExpression(scope(), factory(), kNoSourcePosition), 4943 this->ThisExpression(factory(), kNoSourcePosition),
4953 kNoSourcePosition), 4944 kNoSourcePosition),
4954 zone()); 4945 zone());
4955 } 4946 }
4956 } 4947 }
4957 4948
4958 Expect(Token::RBRACE, CHECK_OK); 4949 Expect(Token::RBRACE, CHECK_OK);
4959 scope()->set_end_position(scanner()->location().end_pos); 4950 scope()->set_end_position(scanner()->location().end_pos);
4960 4951
4961 if (!parameters.is_simple) { 4952 if (!parameters.is_simple) {
4962 DCHECK_NOT_NULL(inner_scope); 4953 DCHECK_NOT_NULL(inner_scope);
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
5760 Expression* super_constructor = factory()->NewCallRuntime( 5751 Expression* super_constructor = factory()->NewCallRuntime(
5761 Runtime::kInlineGetSuperConstructor, tmp, pos); 5752 Runtime::kInlineGetSuperConstructor, tmp, pos);
5762 args->InsertAt(0, super_constructor, zone()); 5753 args->InsertAt(0, super_constructor, zone());
5763 args->Add(function->AsSuperCallReference()->new_target_var(), zone()); 5754 args->Add(function->AsSuperCallReference()->new_target_var(), zone());
5764 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, 5755 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args,
5765 pos); 5756 pos);
5766 } else { 5757 } else {
5767 if (function->IsProperty()) { 5758 if (function->IsProperty()) {
5768 // Method calls 5759 // Method calls
5769 if (function->AsProperty()->IsSuperAccess()) { 5760 if (function->AsProperty()->IsSuperAccess()) {
5770 Expression* home = 5761 Expression* home = ThisExpression(factory(), kNoSourcePosition);
5771 ThisExpression(scope(), factory(), kNoSourcePosition);
5772 args->InsertAt(0, function, zone()); 5762 args->InsertAt(0, function, zone());
5773 args->InsertAt(1, home, zone()); 5763 args->InsertAt(1, home, zone());
5774 } else { 5764 } else {
5775 Variable* temp = 5765 Variable* temp =
5776 scope()->NewTemporary(ast_value_factory()->empty_string()); 5766 scope()->NewTemporary(ast_value_factory()->empty_string());
5777 VariableProxy* obj = factory()->NewVariableProxy(temp); 5767 VariableProxy* obj = factory()->NewVariableProxy(temp);
5778 Assignment* assign_obj = factory()->NewAssignment( 5768 Assignment* assign_obj = factory()->NewAssignment(
5779 Token::ASSIGN, obj, function->AsProperty()->obj(), 5769 Token::ASSIGN, obj, function->AsProperty()->obj(),
5780 kNoSourcePosition); 5770 kNoSourcePosition);
5781 function = factory()->NewProperty( 5771 function = factory()->NewProperty(
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
6006 } 5996 }
6007 5997
6008 Expression* Parser::RewriteAssignExponentiation(Expression* left, 5998 Expression* Parser::RewriteAssignExponentiation(Expression* left,
6009 Expression* right, int pos) { 5999 Expression* right, int pos) {
6010 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone()); 6000 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(2, zone());
6011 if (left->IsVariableProxy()) { 6001 if (left->IsVariableProxy()) {
6012 VariableProxy* lhs = left->AsVariableProxy(); 6002 VariableProxy* lhs = left->AsVariableProxy();
6013 6003
6014 Expression* result; 6004 Expression* result;
6015 DCHECK_NOT_NULL(lhs->raw_name()); 6005 DCHECK_NOT_NULL(lhs->raw_name());
6016 result = 6006 result = this->ExpressionFromIdentifier(lhs->raw_name(), lhs->position(),
6017 this->ExpressionFromIdentifier(lhs->raw_name(), lhs->position(), 6007 lhs->end_position(), factory());
6018 lhs->end_position(), scope(), factory());
6019 args->Add(left, zone()); 6008 args->Add(left, zone());
6020 args->Add(right, zone()); 6009 args->Add(right, zone());
6021 Expression* call = 6010 Expression* call =
6022 factory()->NewCallRuntime(Context::MATH_POW_INDEX, args, pos); 6011 factory()->NewCallRuntime(Context::MATH_POW_INDEX, args, pos);
6023 return factory()->NewAssignment(Token::ASSIGN, result, call, pos); 6012 return factory()->NewAssignment(Token::ASSIGN, result, call, pos);
6024 } else if (left->IsProperty()) { 6013 } else if (left->IsProperty()) {
6025 Property* prop = left->AsProperty(); 6014 Property* prop = left->AsProperty();
6026 auto temp_obj = scope()->NewTemporary(ast_value_factory()->empty_string()); 6015 auto temp_obj = scope()->NewTemporary(ast_value_factory()->empty_string());
6027 auto temp_key = scope()->NewTemporary(ast_value_factory()->empty_string()); 6016 auto temp_key = scope()->NewTemporary(ast_value_factory()->empty_string());
6028 Expression* assign_obj = factory()->NewAssignment( 6017 Expression* assign_obj = factory()->NewAssignment(
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
6539 factory->NewSmiLiteral(JSGeneratorObject::kThrow, nopos); 6528 factory->NewSmiLiteral(JSGeneratorObject::kThrow, nopos);
6540 Expression* assignment = 6529 Expression* assignment =
6541 factory->NewAssignment(Token::ASSIGN, mode_proxy, kthrow, nopos); 6530 factory->NewAssignment(Token::ASSIGN, mode_proxy, kthrow, nopos);
6542 set_mode_throw = factory->NewExpressionStatement(assignment, nopos); 6531 set_mode_throw = factory->NewExpressionStatement(assignment, nopos);
6543 } 6532 }
6544 6533
6545 6534
6546 // input = function.sent; 6535 // input = function.sent;
6547 Statement* get_input; 6536 Statement* get_input;
6548 { 6537 {
6549 Expression* function_sent = FunctionSentExpression(scope, factory, nopos); 6538 Expression* function_sent = FunctionSentExpression(factory, nopos);
6550 Expression* input_proxy = factory->NewVariableProxy(var_input); 6539 Expression* input_proxy = factory->NewVariableProxy(var_input);
6551 Expression* assignment = factory->NewAssignment( 6540 Expression* assignment = factory->NewAssignment(
6552 Token::ASSIGN, input_proxy, function_sent, nopos); 6541 Token::ASSIGN, input_proxy, function_sent, nopos);
6553 get_input = factory->NewExpressionStatement(assignment, nopos); 6542 get_input = factory->NewExpressionStatement(assignment, nopos);
6554 } 6543 }
6555 6544
6556 6545
6557 // if (mode === kReturn) { 6546 // if (mode === kReturn) {
6558 // return {value: output.value, done: true}; 6547 // return {value: output.value, done: true};
6559 // } 6548 // }
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
7165 node->Print(Isolate::Current()); 7154 node->Print(Isolate::Current());
7166 } 7155 }
7167 #endif // DEBUG 7156 #endif // DEBUG
7168 7157
7169 #undef CHECK_OK 7158 #undef CHECK_OK
7170 #undef CHECK_OK_VOID 7159 #undef CHECK_OK_VOID
7171 #undef CHECK_FAILED 7160 #undef CHECK_FAILED
7172 7161
7173 } // namespace internal 7162 } // namespace internal
7174 } // namespace v8 7163 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698