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

Side by Side Diff: src/parsing/pattern-rewriter.cc

Issue 2096933002: Remove all harmony runtime flags which shipped in M51 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review comments Created 4 years, 6 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-base.h ('k') | src/parsing/scanner.cc » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/ast/ast.h" 5 #include "src/ast/ast.h"
6 #include "src/messages.h" 6 #include "src/messages.h"
7 #include "src/parsing/parameter-initializer-rewriter.h" 7 #include "src/parsing/parameter-initializer-rewriter.h"
8 #include "src/parsing/parser.h" 8 #include "src/parsing/parser.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 auto v = CreateTempVar(); 418 auto v = CreateTempVar();
419 auto completion = CreateTempVar(); 419 auto completion = CreateTempVar();
420 auto nopos = RelocInfo::kNoPosition; 420 auto nopos = RelocInfo::kNoPosition;
421 421
422 // For the purpose of iterator finalization, we temporarily set block_ to a 422 // For the purpose of iterator finalization, we temporarily set block_ to a
423 // new block. In the main body of this function, we write to block_ (both 423 // new block. In the main body of this function, we write to block_ (both
424 // explicitly and implicitly via recursion). At the end of the function, we 424 // explicitly and implicitly via recursion). At the end of the function, we
425 // wrap this new block in a try-finally statement, restore block_ to its 425 // wrap this new block in a try-finally statement, restore block_ to its
426 // original value, and add the try-finally statement to block_. 426 // original value, and add the try-finally statement to block_.
427 auto target = block_; 427 auto target = block_;
428 if (FLAG_harmony_iterator_close) { 428 block_ = factory()->NewBlock(nullptr, 8, true, nopos);
429 block_ = factory()->NewBlock(nullptr, 8, true, nopos);
430 }
431 429
432 Spread* spread = nullptr; 430 Spread* spread = nullptr;
433 for (Expression* value : *node->values()) { 431 for (Expression* value : *node->values()) {
434 if (value->IsSpread()) { 432 if (value->IsSpread()) {
435 spread = value->AsSpread(); 433 spread = value->AsSpread();
436 break; 434 break;
437 } 435 }
438 436
439 PatternContext context = SetInitializerContextIfNeeded(value); 437 PatternContext context = SetInitializerContextIfNeeded(value);
440 438
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 if_not_done = factory()->NewIfStatement( 506 if_not_done = factory()->NewIfStatement(
509 factory()->NewUnaryOperation(Token::NOT, 507 factory()->NewUnaryOperation(Token::NOT,
510 factory()->NewVariableProxy(done), 508 factory()->NewVariableProxy(done),
511 RelocInfo::kNoPosition), 509 RelocInfo::kNoPosition),
512 next_block, factory()->NewEmptyStatement(RelocInfo::kNoPosition), 510 next_block, factory()->NewEmptyStatement(RelocInfo::kNoPosition),
513 RelocInfo::kNoPosition); 511 RelocInfo::kNoPosition);
514 } 512 }
515 block_->statements()->Add(if_not_done, zone()); 513 block_->statements()->Add(if_not_done, zone());
516 514
517 if (!(value->IsLiteral() && value->AsLiteral()->raw_value()->IsTheHole())) { 515 if (!(value->IsLiteral() && value->AsLiteral()->raw_value()->IsTheHole())) {
518 if (FLAG_harmony_iterator_close) { 516 {
519 // completion = kAbruptCompletion; 517 // completion = kAbruptCompletion;
520 Expression* proxy = factory()->NewVariableProxy(completion); 518 Expression* proxy = factory()->NewVariableProxy(completion);
521 Expression* assignment = factory()->NewAssignment( 519 Expression* assignment = factory()->NewAssignment(
522 Token::ASSIGN, proxy, 520 Token::ASSIGN, proxy,
523 factory()->NewSmiLiteral(kAbruptCompletion, nopos), nopos); 521 factory()->NewSmiLiteral(kAbruptCompletion, nopos), nopos);
524 block_->statements()->Add( 522 block_->statements()->Add(
525 factory()->NewExpressionStatement(assignment, nopos), zone()); 523 factory()->NewExpressionStatement(assignment, nopos), zone());
526 } 524 }
527 525
528 RecurseIntoSubpattern(value, factory()->NewVariableProxy(v)); 526 RecurseIntoSubpattern(value, factory()->NewVariableProxy(v));
529 527
530 if (FLAG_harmony_iterator_close) { 528 {
531 // completion = kNormalCompletion; 529 // completion = kNormalCompletion;
532 Expression* proxy = factory()->NewVariableProxy(completion); 530 Expression* proxy = factory()->NewVariableProxy(completion);
533 Expression* assignment = factory()->NewAssignment( 531 Expression* assignment = factory()->NewAssignment(
534 Token::ASSIGN, proxy, 532 Token::ASSIGN, proxy,
535 factory()->NewSmiLiteral(kNormalCompletion, nopos), nopos); 533 factory()->NewSmiLiteral(kNormalCompletion, nopos), nopos);
536 block_->statements()->Add( 534 block_->statements()->Add(
537 factory()->NewExpressionStatement(assignment, nopos), zone()); 535 factory()->NewExpressionStatement(assignment, nopos), zone());
538 } 536 }
539 } 537 }
540 set_context(context); 538 set_context(context);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 body->statements()->Add(get_next, zone()); 631 body->statements()->Add(get_next, zone());
634 body->statements()->Add(maybe_append_and_unset_done, zone()); 632 body->statements()->Add(maybe_append_and_unset_done, zone());
635 loop->Initialize(condition, body); 633 loop->Initialize(condition, body);
636 } 634 }
637 635
638 block_->statements()->Add(loop, zone()); 636 block_->statements()->Add(loop, zone());
639 RecurseIntoSubpattern(spread->expression(), 637 RecurseIntoSubpattern(spread->expression(),
640 factory()->NewVariableProxy(array)); 638 factory()->NewVariableProxy(array));
641 } 639 }
642 640
643 if (FLAG_harmony_iterator_close) { 641 Expression* closing_condition = factory()->NewUnaryOperation(
644 Expression* closing_condition = factory()->NewUnaryOperation( 642 Token::NOT, factory()->NewVariableProxy(done), nopos);
645 Token::NOT, factory()->NewVariableProxy(done), nopos); 643 parser_->FinalizeIteratorUse(completion, closing_condition, iterator, block_,
646 parser_->FinalizeIteratorUse(completion, closing_condition, iterator, 644 target);
647 block_, target); 645 block_ = target;
648 block_ = target;
649 }
650 } 646 }
651 647
652 648
653 void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node) { 649 void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node) {
654 Variable* temp_var = nullptr; 650 Variable* temp_var = nullptr;
655 VisitArrayLiteral(node, &temp_var); 651 VisitArrayLiteral(node, &temp_var);
656 } 652 }
657 653
658 654
659 void Parser::PatternRewriter::VisitAssignment(Assignment* node) { 655 void Parser::PatternRewriter::VisitAssignment(Assignment* node) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 NOT_A_PATTERN(TryFinallyStatement) 771 NOT_A_PATTERN(TryFinallyStatement)
776 NOT_A_PATTERN(UnaryOperation) 772 NOT_A_PATTERN(UnaryOperation)
777 NOT_A_PATTERN(VariableDeclaration) 773 NOT_A_PATTERN(VariableDeclaration)
778 NOT_A_PATTERN(WhileStatement) 774 NOT_A_PATTERN(WhileStatement)
779 NOT_A_PATTERN(WithStatement) 775 NOT_A_PATTERN(WithStatement)
780 NOT_A_PATTERN(Yield) 776 NOT_A_PATTERN(Yield)
781 777
782 #undef NOT_A_PATTERN 778 #undef NOT_A_PATTERN
783 } // namespace internal 779 } // namespace internal
784 } // namespace v8 780 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698