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

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 1642893004: [interpreter] Refactor iterator access in BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
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/compiler/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/compiler/bytecode-branch-analysis.h" 7 #include "src/compiler/bytecode-branch-analysis.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/operator-properties.h" 9 #include "src/compiler/operator-properties.h"
10 #include "src/interpreter/bytecodes.h" 10 #include "src/interpreter/bytecodes.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace compiler { 14 namespace compiler {
15 15
16 // Helper for generating frame states for before and after a bytecode. 16 // Helper for generating frame states for before and after a bytecode.
17 class BytecodeGraphBuilder::FrameStateBeforeAndAfter { 17 class BytecodeGraphBuilder::FrameStateBeforeAndAfter {
18 public: 18 public:
19 FrameStateBeforeAndAfter(BytecodeGraphBuilder* builder, 19 explicit FrameStateBeforeAndAfter(BytecodeGraphBuilder* builder)
20 const interpreter::BytecodeArrayIterator& iterator)
21 : builder_(builder), 20 : builder_(builder),
22 id_after_(BailoutId::None()), 21 id_after_(BailoutId::None()),
23 added_to_node_(false), 22 added_to_node_(false),
24 output_poke_offset_(0), 23 output_poke_offset_(0),
25 output_poke_count_(0) { 24 output_poke_count_(0) {
26 BailoutId id_before(iterator.current_offset()); 25 BailoutId id_before(builder->iterator().current_offset());
27 frame_state_before_ = builder_->environment()->Checkpoint( 26 frame_state_before_ = builder_->environment()->Checkpoint(
28 id_before, OutputFrameStateCombine::Ignore()); 27 id_before, OutputFrameStateCombine::Ignore());
29 id_after_ = BailoutId(id_before.ToInt() + iterator.current_bytecode_size()); 28 id_after_ = BailoutId(id_before.ToInt() +
29 builder->iterator().current_bytecode_size());
30 } 30 }
31 31
32 ~FrameStateBeforeAndAfter() { 32 ~FrameStateBeforeAndAfter() {
33 DCHECK(added_to_node_); 33 DCHECK(added_to_node_);
34 DCHECK(builder_->environment()->StateValuesAreUpToDate(output_poke_offset_, 34 DCHECK(builder_->environment()->StateValuesAreUpToDate(output_poke_offset_,
35 output_poke_count_)); 35 output_poke_count_));
36 } 36 }
37 37
38 private: 38 private:
39 friend class Environment; 39 friend class Environment;
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 while (!iterator.done()) { 530 while (!iterator.done()) {
531 int current_offset = iterator.current_offset(); 531 int current_offset = iterator.current_offset();
532 if (analysis.is_reachable(current_offset)) { 532 if (analysis.is_reachable(current_offset)) {
533 EnterAndExitExceptionHandlers(current_offset); 533 EnterAndExitExceptionHandlers(current_offset);
534 MergeEnvironmentsOfForwardBranches(current_offset); 534 MergeEnvironmentsOfForwardBranches(current_offset);
535 BuildLoopHeaderForBackwardBranches(current_offset); 535 BuildLoopHeaderForBackwardBranches(current_offset);
536 536
537 switch (iterator.current_bytecode()) { 537 switch (iterator.current_bytecode()) {
538 #define BYTECODE_CASE(name, ...) \ 538 #define BYTECODE_CASE(name, ...) \
539 case interpreter::Bytecode::k##name: \ 539 case interpreter::Bytecode::k##name: \
540 Visit##name(iterator); \ 540 Visit##name(); \
541 break; 541 break;
542 BYTECODE_LIST(BYTECODE_CASE) 542 BYTECODE_LIST(BYTECODE_CASE)
543 #undef BYTECODE_CODE 543 #undef BYTECODE_CODE
544 } 544 }
545 } 545 }
546 iterator.Advance(); 546 iterator.Advance();
547 } 547 }
548 set_branch_analysis(nullptr); 548 set_branch_analysis(nullptr);
549 set_bytecode_iterator(nullptr); 549 set_bytecode_iterator(nullptr);
550 DCHECK(exception_handlers_.empty()); 550 DCHECK(exception_handlers_.empty());
551 } 551 }
552 552
553 553 void BytecodeGraphBuilder::VisitLdaZero() {
554 void BytecodeGraphBuilder::VisitLdaZero(
555 const interpreter::BytecodeArrayIterator& iterator) {
556 Node* node = jsgraph()->ZeroConstant(); 554 Node* node = jsgraph()->ZeroConstant();
557 environment()->BindAccumulator(node); 555 environment()->BindAccumulator(node);
558 } 556 }
559 557
560 558 void BytecodeGraphBuilder::VisitLdaSmi8() {
561 void BytecodeGraphBuilder::VisitLdaSmi8( 559 Node* node = jsgraph()->Constant(iterator().GetImmediateOperand(0));
562 const interpreter::BytecodeArrayIterator& iterator) {
563 Node* node = jsgraph()->Constant(iterator.GetImmediateOperand(0));
564 environment()->BindAccumulator(node); 560 environment()->BindAccumulator(node);
565 } 561 }
566 562
567 563 void BytecodeGraphBuilder::VisitLdaConstantWide() {
568 void BytecodeGraphBuilder::VisitLdaConstantWide( 564 Node* node = jsgraph()->Constant(iterator().GetConstantForIndexOperand(0));
569 const interpreter::BytecodeArrayIterator& iterator) {
570 Node* node = jsgraph()->Constant(iterator.GetConstantForIndexOperand(0));
571 environment()->BindAccumulator(node); 565 environment()->BindAccumulator(node);
572 } 566 }
573 567
574 568 void BytecodeGraphBuilder::VisitLdaConstant() {
575 void BytecodeGraphBuilder::VisitLdaConstant( 569 Node* node = jsgraph()->Constant(iterator().GetConstantForIndexOperand(0));
576 const interpreter::BytecodeArrayIterator& iterator) {
577 Node* node = jsgraph()->Constant(iterator.GetConstantForIndexOperand(0));
578 environment()->BindAccumulator(node); 570 environment()->BindAccumulator(node);
579 } 571 }
580 572
581 573 void BytecodeGraphBuilder::VisitLdaUndefined() {
582 void BytecodeGraphBuilder::VisitLdaUndefined(
583 const interpreter::BytecodeArrayIterator& iterator) {
584 Node* node = jsgraph()->UndefinedConstant(); 574 Node* node = jsgraph()->UndefinedConstant();
585 environment()->BindAccumulator(node); 575 environment()->BindAccumulator(node);
586 } 576 }
587 577
588 578 void BytecodeGraphBuilder::VisitLdaNull() {
589 void BytecodeGraphBuilder::VisitLdaNull(
590 const interpreter::BytecodeArrayIterator& iterator) {
591 Node* node = jsgraph()->NullConstant(); 579 Node* node = jsgraph()->NullConstant();
592 environment()->BindAccumulator(node); 580 environment()->BindAccumulator(node);
593 } 581 }
594 582
595 583 void BytecodeGraphBuilder::VisitLdaTheHole() {
596 void BytecodeGraphBuilder::VisitLdaTheHole(
597 const interpreter::BytecodeArrayIterator& iterator) {
598 Node* node = jsgraph()->TheHoleConstant(); 584 Node* node = jsgraph()->TheHoleConstant();
599 environment()->BindAccumulator(node); 585 environment()->BindAccumulator(node);
600 } 586 }
601 587
602 588 void BytecodeGraphBuilder::VisitLdaTrue() {
603 void BytecodeGraphBuilder::VisitLdaTrue(
604 const interpreter::BytecodeArrayIterator& iterator) {
605 Node* node = jsgraph()->TrueConstant(); 589 Node* node = jsgraph()->TrueConstant();
606 environment()->BindAccumulator(node); 590 environment()->BindAccumulator(node);
607 } 591 }
608 592
609 593 void BytecodeGraphBuilder::VisitLdaFalse() {
610 void BytecodeGraphBuilder::VisitLdaFalse(
611 const interpreter::BytecodeArrayIterator& iterator) {
612 Node* node = jsgraph()->FalseConstant(); 594 Node* node = jsgraph()->FalseConstant();
613 environment()->BindAccumulator(node); 595 environment()->BindAccumulator(node);
614 } 596 }
615 597
616 598 void BytecodeGraphBuilder::VisitLdar() {
617 void BytecodeGraphBuilder::VisitLdar( 599 Node* value = environment()->LookupRegister(iterator().GetRegisterOperand(0));
618 const interpreter::BytecodeArrayIterator& iterator) {
619 Node* value = environment()->LookupRegister(iterator.GetRegisterOperand(0));
620 environment()->BindAccumulator(value); 600 environment()->BindAccumulator(value);
621 } 601 }
622 602
623 603 void BytecodeGraphBuilder::VisitStar() {
624 void BytecodeGraphBuilder::VisitStar(
625 const interpreter::BytecodeArrayIterator& iterator) {
626 Node* value = environment()->LookupAccumulator(); 604 Node* value = environment()->LookupAccumulator();
627 environment()->BindRegister(iterator.GetRegisterOperand(0), value); 605 environment()->BindRegister(iterator().GetRegisterOperand(0), value);
628 } 606 }
629 607
630 608 void BytecodeGraphBuilder::VisitMov() {
631 void BytecodeGraphBuilder::VisitMov( 609 Node* value = environment()->LookupRegister(iterator().GetRegisterOperand(0));
632 const interpreter::BytecodeArrayIterator& iterator) { 610 environment()->BindRegister(iterator().GetRegisterOperand(1), value);
633 Node* value = environment()->LookupRegister(iterator.GetRegisterOperand(0));
634 environment()->BindRegister(iterator.GetRegisterOperand(1), value);
635 } 611 }
636 612
637 613 void BytecodeGraphBuilder::VisitMovWide() { VisitMov(); }
638 void BytecodeGraphBuilder::VisitMovWide(
639 const interpreter::BytecodeArrayIterator& iterator) {
640 VisitMov(iterator);
641 }
642
643 614
644 void BytecodeGraphBuilder::BuildLoadGlobal( 615 void BytecodeGraphBuilder::BuildLoadGlobal(
645 const interpreter::BytecodeArrayIterator& iterator,
646 TypeofMode typeof_mode) { 616 TypeofMode typeof_mode) {
647 FrameStateBeforeAndAfter states(this, iterator); 617 FrameStateBeforeAndAfter states(this);
648 Handle<Name> name = 618 Handle<Name> name =
649 Handle<Name>::cast(iterator.GetConstantForIndexOperand(0)); 619 Handle<Name>::cast(iterator().GetConstantForIndexOperand(0));
650 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); 620 VectorSlotPair feedback = CreateVectorSlotPair(iterator().GetIndexOperand(1));
651 621
652 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); 622 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode);
653 Node* node = NewNode(op, BuildLoadFeedbackVector()); 623 Node* node = NewNode(op, BuildLoadFeedbackVector());
654 environment()->BindAccumulator(node, &states); 624 environment()->BindAccumulator(node, &states);
655 } 625 }
656 626
657 627 void BytecodeGraphBuilder::VisitLdaGlobalSloppy() {
658 void BytecodeGraphBuilder::VisitLdaGlobalSloppy(
659 const interpreter::BytecodeArrayIterator& iterator) {
660 DCHECK(is_sloppy(language_mode())); 628 DCHECK(is_sloppy(language_mode()));
661 BuildLoadGlobal(iterator, TypeofMode::NOT_INSIDE_TYPEOF); 629 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
662 } 630 }
663 631
664 632 void BytecodeGraphBuilder::VisitLdaGlobalStrict() {
665 void BytecodeGraphBuilder::VisitLdaGlobalStrict(
666 const interpreter::BytecodeArrayIterator& iterator) {
667 DCHECK(is_strict(language_mode())); 633 DCHECK(is_strict(language_mode()));
668 BuildLoadGlobal(iterator, TypeofMode::NOT_INSIDE_TYPEOF); 634 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
669 } 635 }
670 636
671 637 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofSloppy() {
672 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofSloppy(
673 const interpreter::BytecodeArrayIterator& iterator) {
674 DCHECK(is_sloppy(language_mode())); 638 DCHECK(is_sloppy(language_mode()));
675 BuildLoadGlobal(iterator, TypeofMode::INSIDE_TYPEOF); 639 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF);
676 } 640 }
677 641
678 642 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofStrict() {
679 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofStrict(
680 const interpreter::BytecodeArrayIterator& iterator) {
681 DCHECK(is_strict(language_mode())); 643 DCHECK(is_strict(language_mode()));
682 BuildLoadGlobal(iterator, TypeofMode::INSIDE_TYPEOF); 644 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF);
683 } 645 }
684 646
685 647 void BytecodeGraphBuilder::VisitLdaGlobalSloppyWide() {
686 void BytecodeGraphBuilder::VisitLdaGlobalSloppyWide(
687 const interpreter::BytecodeArrayIterator& iterator) {
688 DCHECK(is_sloppy(language_mode())); 648 DCHECK(is_sloppy(language_mode()));
689 BuildLoadGlobal(iterator, TypeofMode::NOT_INSIDE_TYPEOF); 649 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
690 } 650 }
691 651
692 652 void BytecodeGraphBuilder::VisitLdaGlobalStrictWide() {
693 void BytecodeGraphBuilder::VisitLdaGlobalStrictWide(
694 const interpreter::BytecodeArrayIterator& iterator) {
695 DCHECK(is_strict(language_mode())); 653 DCHECK(is_strict(language_mode()));
696 BuildLoadGlobal(iterator, TypeofMode::NOT_INSIDE_TYPEOF); 654 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
697 } 655 }
698 656
699 657 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofSloppyWide() {
700 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofSloppyWide(
701 const interpreter::BytecodeArrayIterator& iterator) {
702 DCHECK(is_sloppy(language_mode())); 658 DCHECK(is_sloppy(language_mode()));
703 BuildLoadGlobal(iterator, TypeofMode::INSIDE_TYPEOF); 659 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF);
704 } 660 }
705 661
706 662 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofStrictWide() {
707 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofStrictWide(
708 const interpreter::BytecodeArrayIterator& iterator) {
709 DCHECK(is_strict(language_mode())); 663 DCHECK(is_strict(language_mode()));
710 BuildLoadGlobal(iterator, TypeofMode::INSIDE_TYPEOF); 664 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF);
711 } 665 }
712 666
713 667 void BytecodeGraphBuilder::BuildStoreGlobal() {
714 void BytecodeGraphBuilder::BuildStoreGlobal( 668 FrameStateBeforeAndAfter states(this);
715 const interpreter::BytecodeArrayIterator& iterator) {
716 FrameStateBeforeAndAfter states(this, iterator);
717 Handle<Name> name = 669 Handle<Name> name =
718 Handle<Name>::cast(iterator.GetConstantForIndexOperand(0)); 670 Handle<Name>::cast(iterator().GetConstantForIndexOperand(0));
719 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); 671 VectorSlotPair feedback = CreateVectorSlotPair(iterator().GetIndexOperand(1));
720 Node* value = environment()->LookupAccumulator(); 672 Node* value = environment()->LookupAccumulator();
721 673
722 const Operator* op = 674 const Operator* op =
723 javascript()->StoreGlobal(language_mode(), name, feedback); 675 javascript()->StoreGlobal(language_mode(), name, feedback);
724 Node* node = NewNode(op, value, BuildLoadFeedbackVector()); 676 Node* node = NewNode(op, value, BuildLoadFeedbackVector());
725 environment()->RecordAfterState(node, &states); 677 environment()->RecordAfterState(node, &states);
726 } 678 }
727 679
728 680 void BytecodeGraphBuilder::VisitStaGlobalSloppy() {
729 void BytecodeGraphBuilder::VisitStaGlobalSloppy(
730 const interpreter::BytecodeArrayIterator& iterator) {
731 DCHECK(is_sloppy(language_mode())); 681 DCHECK(is_sloppy(language_mode()));
732 BuildStoreGlobal(iterator); 682 BuildStoreGlobal();
733 } 683 }
734 684
735 685 void BytecodeGraphBuilder::VisitStaGlobalStrict() {
736 void BytecodeGraphBuilder::VisitStaGlobalStrict(
737 const interpreter::BytecodeArrayIterator& iterator) {
738 DCHECK(is_strict(language_mode())); 686 DCHECK(is_strict(language_mode()));
739 BuildStoreGlobal(iterator); 687 BuildStoreGlobal();
740 } 688 }
741 689
742 void BytecodeGraphBuilder::VisitStaGlobalSloppyWide( 690 void BytecodeGraphBuilder::VisitStaGlobalSloppyWide() {
743 const interpreter::BytecodeArrayIterator& iterator) {
744 DCHECK(is_sloppy(language_mode())); 691 DCHECK(is_sloppy(language_mode()));
745 BuildStoreGlobal(iterator); 692 BuildStoreGlobal();
746 } 693 }
747 694
748 695 void BytecodeGraphBuilder::VisitStaGlobalStrictWide() {
749 void BytecodeGraphBuilder::VisitStaGlobalStrictWide(
750 const interpreter::BytecodeArrayIterator& iterator) {
751 DCHECK(is_strict(language_mode())); 696 DCHECK(is_strict(language_mode()));
752 BuildStoreGlobal(iterator); 697 BuildStoreGlobal();
753 } 698 }
754 699
755 700 void BytecodeGraphBuilder::VisitLdaContextSlot() {
756 void BytecodeGraphBuilder::VisitLdaContextSlot(
757 const interpreter::BytecodeArrayIterator& iterator) {
758 // TODO(mythria): LoadContextSlots are unrolled by the required depth when 701 // TODO(mythria): LoadContextSlots are unrolled by the required depth when
759 // generating bytecode. Hence the value of depth is always 0. Update this 702 // generating bytecode. Hence the value of depth is always 0. Update this
760 // code, when the implementation changes. 703 // code, when the implementation changes.
761 // TODO(mythria): immutable flag is also set to false. This information is not 704 // TODO(mythria): immutable flag is also set to false. This information is not
762 // available in bytecode array. update this code when the implementation 705 // available in bytecode array. update this code when the implementation
763 // changes. 706 // changes.
764 const Operator* op = 707 const Operator* op =
765 javascript()->LoadContext(0, iterator.GetIndexOperand(1), false); 708 javascript()->LoadContext(0, iterator().GetIndexOperand(1), false);
766 Node* context = environment()->LookupRegister(iterator.GetRegisterOperand(0)); 709 Node* context =
710 environment()->LookupRegister(iterator().GetRegisterOperand(0));
767 Node* node = NewNode(op, context); 711 Node* node = NewNode(op, context);
768 environment()->BindAccumulator(node); 712 environment()->BindAccumulator(node);
769 } 713 }
770 714
715 void BytecodeGraphBuilder::VisitLdaContextSlotWide() { VisitLdaContextSlot(); }
771 716
772 void BytecodeGraphBuilder::VisitLdaContextSlotWide( 717 void BytecodeGraphBuilder::VisitStaContextSlot() {
773 const interpreter::BytecodeArrayIterator& iterator) {
774 VisitLdaContextSlot(iterator);
775 }
776
777
778 void BytecodeGraphBuilder::VisitStaContextSlot(
779 const interpreter::BytecodeArrayIterator& iterator) {
780 // TODO(mythria): LoadContextSlots are unrolled by the required depth when 718 // TODO(mythria): LoadContextSlots are unrolled by the required depth when
781 // generating bytecode. Hence the value of depth is always 0. Update this 719 // generating bytecode. Hence the value of depth is always 0. Update this
782 // code, when the implementation changes. 720 // code, when the implementation changes.
783 const Operator* op = 721 const Operator* op =
784 javascript()->StoreContext(0, iterator.GetIndexOperand(1)); 722 javascript()->StoreContext(0, iterator().GetIndexOperand(1));
785 Node* context = environment()->LookupRegister(iterator.GetRegisterOperand(0)); 723 Node* context =
724 environment()->LookupRegister(iterator().GetRegisterOperand(0));
786 Node* value = environment()->LookupAccumulator(); 725 Node* value = environment()->LookupAccumulator();
787 NewNode(op, context, value); 726 NewNode(op, context, value);
788 } 727 }
789 728
729 void BytecodeGraphBuilder::VisitStaContextSlotWide() { VisitStaContextSlot(); }
790 730
791 void BytecodeGraphBuilder::VisitStaContextSlotWide( 731 void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) {
792 const interpreter::BytecodeArrayIterator& iterator) { 732 FrameStateBeforeAndAfter states(this);
793 VisitStaContextSlot(iterator);
794 }
795
796
797 void BytecodeGraphBuilder::BuildLdaLookupSlot(
798 TypeofMode typeof_mode,
799 const interpreter::BytecodeArrayIterator& iterator) {
800 FrameStateBeforeAndAfter states(this, iterator);
801 Handle<String> name = 733 Handle<String> name =
802 Handle<String>::cast(iterator.GetConstantForIndexOperand(0)); 734 Handle<String>::cast(iterator().GetConstantForIndexOperand(0));
803 const Operator* op = javascript()->LoadDynamic(name, typeof_mode); 735 const Operator* op = javascript()->LoadDynamic(name, typeof_mode);
804 Node* value = 736 Node* value =
805 NewNode(op, BuildLoadFeedbackVector(), environment()->Context()); 737 NewNode(op, BuildLoadFeedbackVector(), environment()->Context());
806 environment()->BindAccumulator(value, &states); 738 environment()->BindAccumulator(value, &states);
807 } 739 }
808 740
809 741 void BytecodeGraphBuilder::VisitLdaLookupSlot() {
810 void BytecodeGraphBuilder::VisitLdaLookupSlot( 742 BuildLdaLookupSlot(TypeofMode::NOT_INSIDE_TYPEOF);
811 const interpreter::BytecodeArrayIterator& iterator) {
812 BuildLdaLookupSlot(TypeofMode::NOT_INSIDE_TYPEOF, iterator);
813 } 743 }
814 744
815 745 void BytecodeGraphBuilder::VisitLdaLookupSlotInsideTypeof() {
816 void BytecodeGraphBuilder::VisitLdaLookupSlotInsideTypeof( 746 BuildLdaLookupSlot(TypeofMode::INSIDE_TYPEOF);
817 const interpreter::BytecodeArrayIterator& iterator) {
818 BuildLdaLookupSlot(TypeofMode::INSIDE_TYPEOF, iterator);
819 } 747 }
820 748
821 749 void BytecodeGraphBuilder::BuildStaLookupSlot(LanguageMode language_mode) {
822 void BytecodeGraphBuilder::BuildStaLookupSlot( 750 FrameStateBeforeAndAfter states(this);
823 LanguageMode language_mode,
824 const interpreter::BytecodeArrayIterator& iterator) {
825 FrameStateBeforeAndAfter states(this, iterator);
826 Node* value = environment()->LookupAccumulator(); 751 Node* value = environment()->LookupAccumulator();
827 Node* name = jsgraph()->Constant(iterator.GetConstantForIndexOperand(0)); 752 Node* name = jsgraph()->Constant(iterator().GetConstantForIndexOperand(0));
828 Node* language = jsgraph()->Constant(language_mode); 753 Node* language = jsgraph()->Constant(language_mode);
829 const Operator* op = javascript()->CallRuntime(Runtime::kStoreLookupSlot); 754 const Operator* op = javascript()->CallRuntime(Runtime::kStoreLookupSlot);
830 Node* store = NewNode(op, value, environment()->Context(), name, language); 755 Node* store = NewNode(op, value, environment()->Context(), name, language);
831 environment()->BindAccumulator(store, &states); 756 environment()->BindAccumulator(store, &states);
832 } 757 }
833 758
759 void BytecodeGraphBuilder::VisitLdaLookupSlotWide() { VisitLdaLookupSlot(); }
834 760
835 void BytecodeGraphBuilder::VisitLdaLookupSlotWide( 761 void BytecodeGraphBuilder::VisitLdaLookupSlotInsideTypeofWide() {
836 const interpreter::BytecodeArrayIterator& iterator) { 762 VisitLdaLookupSlotInsideTypeof();
837 VisitLdaLookupSlot(iterator);
838 } 763 }
839 764
840 765 void BytecodeGraphBuilder::VisitStaLookupSlotSloppy() {
841 void BytecodeGraphBuilder::VisitLdaLookupSlotInsideTypeofWide( 766 BuildStaLookupSlot(LanguageMode::SLOPPY);
842 const interpreter::BytecodeArrayIterator& iterator) {
843 VisitLdaLookupSlotInsideTypeof(iterator);
844 } 767 }
845 768
846 769 void BytecodeGraphBuilder::VisitStaLookupSlotStrict() {
847 void BytecodeGraphBuilder::VisitStaLookupSlotSloppy( 770 BuildStaLookupSlot(LanguageMode::STRICT);
848 const interpreter::BytecodeArrayIterator& iterator) {
849 BuildStaLookupSlot(LanguageMode::SLOPPY, iterator);
850 } 771 }
851 772
852 773 void BytecodeGraphBuilder::VisitStaLookupSlotSloppyWide() {
853 void BytecodeGraphBuilder::VisitStaLookupSlotStrict( 774 VisitStaLookupSlotSloppy();
854 const interpreter::BytecodeArrayIterator& iterator) {
855 BuildStaLookupSlot(LanguageMode::STRICT, iterator);
856 } 775 }
857 776
858 777 void BytecodeGraphBuilder::VisitStaLookupSlotStrictWide() {
859 void BytecodeGraphBuilder::VisitStaLookupSlotSloppyWide( 778 VisitStaLookupSlotStrict();
860 const interpreter::BytecodeArrayIterator& iterator) {
861 VisitStaLookupSlotSloppy(iterator);
862 } 779 }
863 780
864 781 void BytecodeGraphBuilder::BuildNamedLoad() {
865 void BytecodeGraphBuilder::VisitStaLookupSlotStrictWide( 782 FrameStateBeforeAndAfter states(this);
866 const interpreter::BytecodeArrayIterator& iterator) { 783 Node* object =
867 VisitStaLookupSlotStrict(iterator); 784 environment()->LookupRegister(iterator().GetRegisterOperand(0));
868 }
869
870
871 void BytecodeGraphBuilder::BuildNamedLoad(
872 const interpreter::BytecodeArrayIterator& iterator) {
873 FrameStateBeforeAndAfter states(this, iterator);
874 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0));
875 Handle<Name> name = 785 Handle<Name> name =
876 Handle<Name>::cast(iterator.GetConstantForIndexOperand(1)); 786 Handle<Name>::cast(iterator().GetConstantForIndexOperand(1));
877 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); 787 VectorSlotPair feedback = CreateVectorSlotPair(iterator().GetIndexOperand(2));
878 788
879 const Operator* op = javascript()->LoadNamed(language_mode(), name, feedback); 789 const Operator* op = javascript()->LoadNamed(language_mode(), name, feedback);
880 Node* node = NewNode(op, object, BuildLoadFeedbackVector()); 790 Node* node = NewNode(op, object, BuildLoadFeedbackVector());
881 environment()->BindAccumulator(node, &states); 791 environment()->BindAccumulator(node, &states);
882 } 792 }
883 793
884 794 void BytecodeGraphBuilder::VisitLoadICSloppy() {
885 void BytecodeGraphBuilder::VisitLoadICSloppy(
886 const interpreter::BytecodeArrayIterator& iterator) {
887 DCHECK(is_sloppy(language_mode())); 795 DCHECK(is_sloppy(language_mode()));
888 BuildNamedLoad(iterator); 796 BuildNamedLoad();
889 } 797 }
890 798
891 799 void BytecodeGraphBuilder::VisitLoadICStrict() {
892 void BytecodeGraphBuilder::VisitLoadICStrict(
893 const interpreter::BytecodeArrayIterator& iterator) {
894 DCHECK(is_strict(language_mode())); 800 DCHECK(is_strict(language_mode()));
895 BuildNamedLoad(iterator); 801 BuildNamedLoad();
896 } 802 }
897 803
898 804 void BytecodeGraphBuilder::VisitLoadICSloppyWide() {
899 void BytecodeGraphBuilder::VisitLoadICSloppyWide(
900 const interpreter::BytecodeArrayIterator& iterator) {
901 DCHECK(is_sloppy(language_mode())); 805 DCHECK(is_sloppy(language_mode()));
902 BuildNamedLoad(iterator); 806 BuildNamedLoad();
903 } 807 }
904 808
905 809 void BytecodeGraphBuilder::VisitLoadICStrictWide() {
906 void BytecodeGraphBuilder::VisitLoadICStrictWide(
907 const interpreter::BytecodeArrayIterator& iterator) {
908 DCHECK(is_strict(language_mode())); 810 DCHECK(is_strict(language_mode()));
909 BuildNamedLoad(iterator); 811 BuildNamedLoad();
910 } 812 }
911 813
912 814 void BytecodeGraphBuilder::BuildKeyedLoad() {
913 void BytecodeGraphBuilder::BuildKeyedLoad( 815 FrameStateBeforeAndAfter states(this);
914 const interpreter::BytecodeArrayIterator& iterator) {
915 FrameStateBeforeAndAfter states(this, iterator);
916 Node* key = environment()->LookupAccumulator(); 816 Node* key = environment()->LookupAccumulator();
917 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); 817 Node* object =
918 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); 818 environment()->LookupRegister(iterator().GetRegisterOperand(0));
819 VectorSlotPair feedback = CreateVectorSlotPair(iterator().GetIndexOperand(1));
919 820
920 const Operator* op = javascript()->LoadProperty(language_mode(), feedback); 821 const Operator* op = javascript()->LoadProperty(language_mode(), feedback);
921 Node* node = NewNode(op, object, key, BuildLoadFeedbackVector()); 822 Node* node = NewNode(op, object, key, BuildLoadFeedbackVector());
922 environment()->BindAccumulator(node, &states); 823 environment()->BindAccumulator(node, &states);
923 } 824 }
924 825
925 826 void BytecodeGraphBuilder::VisitKeyedLoadICSloppy() {
926 void BytecodeGraphBuilder::VisitKeyedLoadICSloppy(
927 const interpreter::BytecodeArrayIterator& iterator) {
928 DCHECK(is_sloppy(language_mode())); 827 DCHECK(is_sloppy(language_mode()));
929 BuildKeyedLoad(iterator); 828 BuildKeyedLoad();
930 } 829 }
931 830
932 831 void BytecodeGraphBuilder::VisitKeyedLoadICStrict() {
933 void BytecodeGraphBuilder::VisitKeyedLoadICStrict(
934 const interpreter::BytecodeArrayIterator& iterator) {
935 DCHECK(is_strict(language_mode())); 832 DCHECK(is_strict(language_mode()));
936 BuildKeyedLoad(iterator); 833 BuildKeyedLoad();
937 } 834 }
938 835
939 836 void BytecodeGraphBuilder::VisitKeyedLoadICSloppyWide() {
940 void BytecodeGraphBuilder::VisitKeyedLoadICSloppyWide(
941 const interpreter::BytecodeArrayIterator& iterator) {
942 DCHECK(is_sloppy(language_mode())); 837 DCHECK(is_sloppy(language_mode()));
943 BuildKeyedLoad(iterator); 838 BuildKeyedLoad();
944 } 839 }
945 840
946 841 void BytecodeGraphBuilder::VisitKeyedLoadICStrictWide() {
947 void BytecodeGraphBuilder::VisitKeyedLoadICStrictWide(
948 const interpreter::BytecodeArrayIterator& iterator) {
949 DCHECK(is_strict(language_mode())); 842 DCHECK(is_strict(language_mode()));
950 BuildKeyedLoad(iterator); 843 BuildKeyedLoad();
951 } 844 }
952 845
953 846 void BytecodeGraphBuilder::BuildNamedStore() {
954 void BytecodeGraphBuilder::BuildNamedStore( 847 FrameStateBeforeAndAfter states(this);
955 const interpreter::BytecodeArrayIterator& iterator) {
956 FrameStateBeforeAndAfter states(this, iterator);
957 Node* value = environment()->LookupAccumulator(); 848 Node* value = environment()->LookupAccumulator();
958 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); 849 Node* object =
850 environment()->LookupRegister(iterator().GetRegisterOperand(0));
959 Handle<Name> name = 851 Handle<Name> name =
960 Handle<Name>::cast(iterator.GetConstantForIndexOperand(1)); 852 Handle<Name>::cast(iterator().GetConstantForIndexOperand(1));
961 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); 853 VectorSlotPair feedback = CreateVectorSlotPair(iterator().GetIndexOperand(2));
962 854
963 const Operator* op = 855 const Operator* op =
964 javascript()->StoreNamed(language_mode(), name, feedback); 856 javascript()->StoreNamed(language_mode(), name, feedback);
965 Node* node = NewNode(op, object, value, BuildLoadFeedbackVector()); 857 Node* node = NewNode(op, object, value, BuildLoadFeedbackVector());
966 environment()->RecordAfterState(node, &states); 858 environment()->RecordAfterState(node, &states);
967 } 859 }
968 860
969 861 void BytecodeGraphBuilder::VisitStoreICSloppy() {
970 void BytecodeGraphBuilder::VisitStoreICSloppy(
971 const interpreter::BytecodeArrayIterator& iterator) {
972 DCHECK(is_sloppy(language_mode())); 862 DCHECK(is_sloppy(language_mode()));
973 BuildNamedStore(iterator); 863 BuildNamedStore();
974 } 864 }
975 865
976 866 void BytecodeGraphBuilder::VisitStoreICStrict() {
977 void BytecodeGraphBuilder::VisitStoreICStrict(
978 const interpreter::BytecodeArrayIterator& iterator) {
979 DCHECK(is_strict(language_mode())); 867 DCHECK(is_strict(language_mode()));
980 BuildNamedStore(iterator); 868 BuildNamedStore();
981 } 869 }
982 870
983 871 void BytecodeGraphBuilder::VisitStoreICSloppyWide() {
984 void BytecodeGraphBuilder::VisitStoreICSloppyWide(
985 const interpreter::BytecodeArrayIterator& iterator) {
986 DCHECK(is_sloppy(language_mode())); 872 DCHECK(is_sloppy(language_mode()));
987 BuildNamedStore(iterator); 873 BuildNamedStore();
988 } 874 }
989 875
990 876 void BytecodeGraphBuilder::VisitStoreICStrictWide() {
991 void BytecodeGraphBuilder::VisitStoreICStrictWide(
992 const interpreter::BytecodeArrayIterator& iterator) {
993 DCHECK(is_strict(language_mode())); 877 DCHECK(is_strict(language_mode()));
994 BuildNamedStore(iterator); 878 BuildNamedStore();
995 } 879 }
996 880
997 881 void BytecodeGraphBuilder::BuildKeyedStore() {
998 void BytecodeGraphBuilder::BuildKeyedStore( 882 FrameStateBeforeAndAfter states(this);
999 const interpreter::BytecodeArrayIterator& iterator) {
1000 FrameStateBeforeAndAfter states(this, iterator);
1001 Node* value = environment()->LookupAccumulator(); 883 Node* value = environment()->LookupAccumulator();
1002 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); 884 Node* object =
1003 Node* key = environment()->LookupRegister(iterator.GetRegisterOperand(1)); 885 environment()->LookupRegister(iterator().GetRegisterOperand(0));
1004 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); 886 Node* key = environment()->LookupRegister(iterator().GetRegisterOperand(1));
887 VectorSlotPair feedback = CreateVectorSlotPair(iterator().GetIndexOperand(2));
1005 888
1006 const Operator* op = javascript()->StoreProperty(language_mode(), feedback); 889 const Operator* op = javascript()->StoreProperty(language_mode(), feedback);
1007 Node* node = NewNode(op, object, key, value, BuildLoadFeedbackVector()); 890 Node* node = NewNode(op, object, key, value, BuildLoadFeedbackVector());
1008 environment()->RecordAfterState(node, &states); 891 environment()->RecordAfterState(node, &states);
1009 } 892 }
1010 893
1011 894 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy() {
1012 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy(
1013 const interpreter::BytecodeArrayIterator& iterator) {
1014 DCHECK(is_sloppy(language_mode())); 895 DCHECK(is_sloppy(language_mode()));
1015 BuildKeyedStore(iterator); 896 BuildKeyedStore();
1016 } 897 }
1017 898
1018 899 void BytecodeGraphBuilder::VisitKeyedStoreICStrict() {
1019 void BytecodeGraphBuilder::VisitKeyedStoreICStrict(
1020 const interpreter::BytecodeArrayIterator& iterator) {
1021 DCHECK(is_strict(language_mode())); 900 DCHECK(is_strict(language_mode()));
1022 BuildKeyedStore(iterator); 901 BuildKeyedStore();
1023 } 902 }
1024 903
1025 904 void BytecodeGraphBuilder::VisitKeyedStoreICSloppyWide() {
1026 void BytecodeGraphBuilder::VisitKeyedStoreICSloppyWide(
1027 const interpreter::BytecodeArrayIterator& iterator) {
1028 DCHECK(is_sloppy(language_mode())); 905 DCHECK(is_sloppy(language_mode()));
1029 BuildKeyedStore(iterator); 906 BuildKeyedStore();
1030 } 907 }
1031 908
1032 909 void BytecodeGraphBuilder::VisitKeyedStoreICStrictWide() {
1033 void BytecodeGraphBuilder::VisitKeyedStoreICStrictWide(
1034 const interpreter::BytecodeArrayIterator& iterator) {
1035 DCHECK(is_strict(language_mode())); 910 DCHECK(is_strict(language_mode()));
1036 BuildKeyedStore(iterator); 911 BuildKeyedStore();
1037 } 912 }
1038 913
1039 914 void BytecodeGraphBuilder::VisitPushContext() {
1040 void BytecodeGraphBuilder::VisitPushContext(
1041 const interpreter::BytecodeArrayIterator& iterator) {
1042 Node* new_context = environment()->LookupAccumulator(); 915 Node* new_context = environment()->LookupAccumulator();
1043 environment()->BindRegister(iterator.GetRegisterOperand(0), 916 environment()->BindRegister(iterator().GetRegisterOperand(0),
1044 environment()->Context()); 917 environment()->Context());
1045 environment()->SetContext(new_context); 918 environment()->SetContext(new_context);
1046 } 919 }
1047 920
1048 921 void BytecodeGraphBuilder::VisitPopContext() {
1049 void BytecodeGraphBuilder::VisitPopContext( 922 Node* context =
1050 const interpreter::BytecodeArrayIterator& iterator) { 923 environment()->LookupRegister(iterator().GetRegisterOperand(0));
1051 Node* context = environment()->LookupRegister(iterator.GetRegisterOperand(0));
1052 environment()->SetContext(context); 924 environment()->SetContext(context);
1053 } 925 }
1054 926
1055 927 void BytecodeGraphBuilder::VisitCreateClosure() {
1056 void BytecodeGraphBuilder::VisitCreateClosure( 928 Handle<SharedFunctionInfo> shared_info = Handle<SharedFunctionInfo>::cast(
1057 const interpreter::BytecodeArrayIterator& iterator) { 929 iterator().GetConstantForIndexOperand(0));
1058 Handle<SharedFunctionInfo> shared_info =
1059 Handle<SharedFunctionInfo>::cast(iterator.GetConstantForIndexOperand(0));
1060 PretenureFlag tenured = 930 PretenureFlag tenured =
1061 iterator.GetImmediateOperand(1) ? TENURED : NOT_TENURED; 931 iterator().GetImmediateOperand(1) ? TENURED : NOT_TENURED;
1062 const Operator* op = javascript()->CreateClosure(shared_info, tenured); 932 const Operator* op = javascript()->CreateClosure(shared_info, tenured);
1063 Node* closure = NewNode(op); 933 Node* closure = NewNode(op);
1064 environment()->BindAccumulator(closure); 934 environment()->BindAccumulator(closure);
1065 } 935 }
1066 936
1067 937 void BytecodeGraphBuilder::VisitCreateClosureWide() { VisitCreateClosure(); }
1068 void BytecodeGraphBuilder::VisitCreateClosureWide(
1069 const interpreter::BytecodeArrayIterator& iterator) {
1070 VisitCreateClosure(iterator);
1071 }
1072
1073 938
1074 void BytecodeGraphBuilder::BuildCreateArguments( 939 void BytecodeGraphBuilder::BuildCreateArguments(
1075 CreateArgumentsParameters::Type type, 940 CreateArgumentsParameters::Type type) {
1076 const interpreter::BytecodeArrayIterator& iterator) { 941 FrameStateBeforeAndAfter states(this);
1077 FrameStateBeforeAndAfter states(this, iterator);
1078 const Operator* op = javascript()->CreateArguments(type, 0); 942 const Operator* op = javascript()->CreateArguments(type, 0);
1079 Node* object = NewNode(op, GetFunctionClosure()); 943 Node* object = NewNode(op, GetFunctionClosure());
1080 environment()->BindAccumulator(object, &states); 944 environment()->BindAccumulator(object, &states);
1081 } 945 }
1082 946
1083 947 void BytecodeGraphBuilder::VisitCreateMappedArguments() {
1084 void BytecodeGraphBuilder::VisitCreateMappedArguments( 948 BuildCreateArguments(CreateArgumentsParameters::kMappedArguments);
1085 const interpreter::BytecodeArrayIterator& iterator) {
1086 BuildCreateArguments(CreateArgumentsParameters::kMappedArguments, iterator);
1087 } 949 }
1088 950
1089 951 void BytecodeGraphBuilder::VisitCreateUnmappedArguments() {
1090 void BytecodeGraphBuilder::VisitCreateUnmappedArguments( 952 BuildCreateArguments(CreateArgumentsParameters::kUnmappedArguments);
1091 const interpreter::BytecodeArrayIterator& iterator) {
1092 BuildCreateArguments(CreateArgumentsParameters::kUnmappedArguments, iterator);
1093 } 953 }
1094 954
1095 955 void BytecodeGraphBuilder::BuildCreateLiteral(const Operator* op) {
1096 void BytecodeGraphBuilder::BuildCreateLiteral( 956 FrameStateBeforeAndAfter states(this);
1097 const Operator* op, const interpreter::BytecodeArrayIterator& iterator) {
1098 FrameStateBeforeAndAfter states(this, iterator);
1099 Node* literal = NewNode(op, GetFunctionClosure()); 957 Node* literal = NewNode(op, GetFunctionClosure());
1100 environment()->BindAccumulator(literal, &states); 958 environment()->BindAccumulator(literal, &states);
1101 } 959 }
1102 960
1103 961 void BytecodeGraphBuilder::BuildCreateRegExpLiteral() {
1104 void BytecodeGraphBuilder::BuildCreateRegExpLiteral(
1105 const interpreter::BytecodeArrayIterator& iterator) {
1106 Handle<String> constant_pattern = 962 Handle<String> constant_pattern =
1107 Handle<String>::cast(iterator.GetConstantForIndexOperand(0)); 963 Handle<String>::cast(iterator().GetConstantForIndexOperand(0));
1108 int literal_index = iterator.GetIndexOperand(1); 964 int literal_index = iterator().GetIndexOperand(1);
1109 int literal_flags = iterator.GetImmediateOperand(2); 965 int literal_flags = iterator().GetImmediateOperand(2);
1110 const Operator* op = javascript()->CreateLiteralRegExp( 966 const Operator* op = javascript()->CreateLiteralRegExp(
1111 constant_pattern, literal_flags, literal_index); 967 constant_pattern, literal_flags, literal_index);
1112 BuildCreateLiteral(op, iterator); 968 BuildCreateLiteral(op);
969 }
970
971 void BytecodeGraphBuilder::VisitCreateRegExpLiteral() {
972 BuildCreateRegExpLiteral();
973 }
974
975 void BytecodeGraphBuilder::VisitCreateRegExpLiteralWide() {
976 BuildCreateRegExpLiteral();
977 }
978
979 void BytecodeGraphBuilder::BuildCreateArrayLiteral() {
980 Handle<FixedArray> constant_elements =
981 Handle<FixedArray>::cast(iterator().GetConstantForIndexOperand(0));
982 int literal_index = iterator().GetIndexOperand(1);
983 int literal_flags = iterator().GetImmediateOperand(2);
984 const Operator* op = javascript()->CreateLiteralArray(
985 constant_elements, literal_flags, literal_index);
986 BuildCreateLiteral(op);
987 }
988
989 void BytecodeGraphBuilder::VisitCreateArrayLiteral() {
990 BuildCreateArrayLiteral();
991 }
992
993 void BytecodeGraphBuilder::VisitCreateArrayLiteralWide() {
994 BuildCreateArrayLiteral();
995 }
996
997 void BytecodeGraphBuilder::BuildCreateObjectLiteral() {
998 Handle<FixedArray> constant_properties =
999 Handle<FixedArray>::cast(iterator().GetConstantForIndexOperand(0));
1000 int literal_index = iterator().GetIndexOperand(1);
1001 int literal_flags = iterator().GetImmediateOperand(2);
1002 const Operator* op = javascript()->CreateLiteralObject(
1003 constant_properties, literal_flags, literal_index);
1004 BuildCreateLiteral(op);
1005 }
1006
1007 void BytecodeGraphBuilder::VisitCreateObjectLiteral() {
1008 BuildCreateObjectLiteral();
1009 }
1010
1011 void BytecodeGraphBuilder::VisitCreateObjectLiteralWide() {
1012 BuildCreateObjectLiteral();
1113 } 1013 }
1114 1014
1115 1015
1116 void BytecodeGraphBuilder::VisitCreateRegExpLiteral(
1117 const interpreter::BytecodeArrayIterator& iterator) {
1118 BuildCreateRegExpLiteral(iterator);
1119 }
1120
1121
1122 void BytecodeGraphBuilder::VisitCreateRegExpLiteralWide(
1123 const interpreter::BytecodeArrayIterator& iterator) {
1124 BuildCreateRegExpLiteral(iterator);
1125 }
1126
1127
1128 void BytecodeGraphBuilder::BuildCreateArrayLiteral(
1129 const interpreter::BytecodeArrayIterator& iterator) {
1130 Handle<FixedArray> constant_elements =
1131 Handle<FixedArray>::cast(iterator.GetConstantForIndexOperand(0));
1132 int literal_index = iterator.GetIndexOperand(1);
1133 int literal_flags = iterator.GetImmediateOperand(2);
1134 const Operator* op = javascript()->CreateLiteralArray(
1135 constant_elements, literal_flags, literal_index);
1136 BuildCreateLiteral(op, iterator);
1137 }
1138
1139
1140 void BytecodeGraphBuilder::VisitCreateArrayLiteral(
1141 const interpreter::BytecodeArrayIterator& iterator) {
1142 BuildCreateArrayLiteral(iterator);
1143 }
1144
1145
1146 void BytecodeGraphBuilder::VisitCreateArrayLiteralWide(
1147 const interpreter::BytecodeArrayIterator& iterator) {
1148 BuildCreateArrayLiteral(iterator);
1149 }
1150
1151
1152 void BytecodeGraphBuilder::BuildCreateObjectLiteral(
1153 const interpreter::BytecodeArrayIterator& iterator) {
1154 Handle<FixedArray> constant_properties =
1155 Handle<FixedArray>::cast(iterator.GetConstantForIndexOperand(0));
1156 int literal_index = iterator.GetIndexOperand(1);
1157 int literal_flags = iterator.GetImmediateOperand(2);
1158 const Operator* op = javascript()->CreateLiteralObject(
1159 constant_properties, literal_flags, literal_index);
1160 BuildCreateLiteral(op, iterator);
1161 }
1162
1163
1164 void BytecodeGraphBuilder::VisitCreateObjectLiteral(
1165 const interpreter::BytecodeArrayIterator& iterator) {
1166 BuildCreateObjectLiteral(iterator);
1167 }
1168
1169
1170 void BytecodeGraphBuilder::VisitCreateObjectLiteralWide(
1171 const interpreter::BytecodeArrayIterator& iterator) {
1172 BuildCreateObjectLiteral(iterator);
1173 }
1174
1175
1176 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, 1016 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op,
1177 Node* callee, 1017 Node* callee,
1178 interpreter::Register receiver, 1018 interpreter::Register receiver,
1179 size_t arity) { 1019 size_t arity) {
1180 Node** all = info()->zone()->NewArray<Node*>(static_cast<int>(arity)); 1020 Node** all = info()->zone()->NewArray<Node*>(static_cast<int>(arity));
1181 all[0] = callee; 1021 all[0] = callee;
1182 all[1] = environment()->LookupRegister(receiver); 1022 all[1] = environment()->LookupRegister(receiver);
1183 int receiver_index = receiver.index(); 1023 int receiver_index = receiver.index();
1184 for (int i = 2; i < static_cast<int>(arity); ++i) { 1024 for (int i = 2; i < static_cast<int>(arity); ++i) {
1185 all[i] = environment()->LookupRegister( 1025 all[i] = environment()->LookupRegister(
1186 interpreter::Register(receiver_index + i - 1)); 1026 interpreter::Register(receiver_index + i - 1));
1187 } 1027 }
1188 Node* value = MakeNode(call_op, static_cast<int>(arity), all, false); 1028 Node* value = MakeNode(call_op, static_cast<int>(arity), all, false);
1189 return value; 1029 return value;
1190 } 1030 }
1191 1031
1192 1032 void BytecodeGraphBuilder::BuildCall() {
1193 void BytecodeGraphBuilder::BuildCall( 1033 FrameStateBeforeAndAfter states(this);
1194 const interpreter::BytecodeArrayIterator& iterator) {
1195 FrameStateBeforeAndAfter states(this, iterator);
1196 // TODO(rmcilroy): Set receiver_hint correctly based on whether the receiver 1034 // TODO(rmcilroy): Set receiver_hint correctly based on whether the receiver
1197 // register has been loaded with null / undefined explicitly or we are sure it 1035 // register has been loaded with null / undefined explicitly or we are sure it
1198 // is not null / undefined. 1036 // is not null / undefined.
1199 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny; 1037 ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny;
1200 Node* callee = environment()->LookupRegister(iterator.GetRegisterOperand(0)); 1038 Node* callee =
1201 interpreter::Register receiver = iterator.GetRegisterOperand(1); 1039 environment()->LookupRegister(iterator().GetRegisterOperand(0));
1202 size_t arg_count = iterator.GetCountOperand(2); 1040 interpreter::Register receiver = iterator().GetRegisterOperand(1);
1203 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(3)); 1041 size_t arg_count = iterator().GetCountOperand(2);
1042 VectorSlotPair feedback = CreateVectorSlotPair(iterator().GetIndexOperand(3));
1204 1043
1205 // TODO(ishell): provide correct tail_call_mode value to CallFunction. 1044 // TODO(ishell): provide correct tail_call_mode value to CallFunction.
1206 const Operator* call = javascript()->CallFunction( 1045 const Operator* call = javascript()->CallFunction(
1207 arg_count + 2, language_mode(), feedback, receiver_hint); 1046 arg_count + 2, language_mode(), feedback, receiver_hint);
1208 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 2); 1047 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 2);
1209 environment()->BindAccumulator(value, &states); 1048 environment()->BindAccumulator(value, &states);
1210 } 1049 }
1211 1050
1051 void BytecodeGraphBuilder::VisitCall() { BuildCall(); }
1212 1052
1213 void BytecodeGraphBuilder::VisitCall( 1053 void BytecodeGraphBuilder::VisitCallWide() { BuildCall(); }
1214 const interpreter::BytecodeArrayIterator& iterator) {
1215 BuildCall(iterator);
1216 }
1217 1054
1218 1055 void BytecodeGraphBuilder::BuildCallJSRuntime() {
1219 void BytecodeGraphBuilder::VisitCallWide( 1056 FrameStateBeforeAndAfter states(this);
1220 const interpreter::BytecodeArrayIterator& iterator) { 1057 Node* callee = BuildLoadNativeContextField(iterator().GetIndexOperand(0));
1221 BuildCall(iterator); 1058 interpreter::Register receiver = iterator().GetRegisterOperand(1);
1222 } 1059 size_t arg_count = iterator().GetCountOperand(2);
1223
1224
1225 void BytecodeGraphBuilder::BuildCallJSRuntime(
1226 const interpreter::BytecodeArrayIterator& iterator) {
1227 FrameStateBeforeAndAfter states(this, iterator);
1228 Node* callee = BuildLoadNativeContextField(iterator.GetIndexOperand(0));
1229 interpreter::Register receiver = iterator.GetRegisterOperand(1);
1230 size_t arg_count = iterator.GetCountOperand(2);
1231 1060
1232 // Create node to perform the JS runtime call. 1061 // Create node to perform the JS runtime call.
1233 const Operator* call = 1062 const Operator* call =
1234 javascript()->CallFunction(arg_count + 2, language_mode()); 1063 javascript()->CallFunction(arg_count + 2, language_mode());
1235 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 2); 1064 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 2);
1236 environment()->BindAccumulator(value, &states); 1065 environment()->BindAccumulator(value, &states);
1237 } 1066 }
1238 1067
1068 void BytecodeGraphBuilder::VisitCallJSRuntime() { BuildCallJSRuntime(); }
1239 1069
1240 void BytecodeGraphBuilder::VisitCallJSRuntime( 1070 void BytecodeGraphBuilder::VisitCallJSRuntimeWide() { BuildCallJSRuntime(); }
1241 const interpreter::BytecodeArrayIterator& iterator) {
1242 BuildCallJSRuntime(iterator);
1243 }
1244
1245
1246 void BytecodeGraphBuilder::VisitCallJSRuntimeWide(
1247 const interpreter::BytecodeArrayIterator& iterator) {
1248 BuildCallJSRuntime(iterator);
1249 }
1250
1251 1071
1252 Node* BytecodeGraphBuilder::ProcessCallRuntimeArguments( 1072 Node* BytecodeGraphBuilder::ProcessCallRuntimeArguments(
1253 const Operator* call_runtime_op, interpreter::Register first_arg, 1073 const Operator* call_runtime_op, interpreter::Register first_arg,
1254 size_t arity) { 1074 size_t arity) {
1255 Node** all = info()->zone()->NewArray<Node*>(arity); 1075 Node** all = info()->zone()->NewArray<Node*>(arity);
1256 int first_arg_index = first_arg.index(); 1076 int first_arg_index = first_arg.index();
1257 for (int i = 0; i < static_cast<int>(arity); ++i) { 1077 for (int i = 0; i < static_cast<int>(arity); ++i) {
1258 all[i] = environment()->LookupRegister( 1078 all[i] = environment()->LookupRegister(
1259 interpreter::Register(first_arg_index + i)); 1079 interpreter::Register(first_arg_index + i));
1260 } 1080 }
1261 Node* value = MakeNode(call_runtime_op, static_cast<int>(arity), all, false); 1081 Node* value = MakeNode(call_runtime_op, static_cast<int>(arity), all, false);
1262 return value; 1082 return value;
1263 } 1083 }
1264 1084
1265 1085 void BytecodeGraphBuilder::BuildCallRuntime() {
1266 void BytecodeGraphBuilder::BuildCallRuntime( 1086 FrameStateBeforeAndAfter states(this);
1267 const interpreter::BytecodeArrayIterator& iterator) {
1268 FrameStateBeforeAndAfter states(this, iterator);
1269 Runtime::FunctionId functionId = 1087 Runtime::FunctionId functionId =
1270 static_cast<Runtime::FunctionId>(iterator.GetIndexOperand(0)); 1088 static_cast<Runtime::FunctionId>(iterator().GetIndexOperand(0));
1271 interpreter::Register first_arg = iterator.GetRegisterOperand(1); 1089 interpreter::Register first_arg = iterator().GetRegisterOperand(1);
1272 size_t arg_count = iterator.GetCountOperand(2); 1090 size_t arg_count = iterator().GetCountOperand(2);
1273 1091
1274 // Create node to perform the runtime call. 1092 // Create node to perform the runtime call.
1275 const Operator* call = javascript()->CallRuntime(functionId, arg_count); 1093 const Operator* call = javascript()->CallRuntime(functionId, arg_count);
1276 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); 1094 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count);
1277 environment()->BindAccumulator(value, &states); 1095 environment()->BindAccumulator(value, &states);
1278 } 1096 }
1279 1097
1098 void BytecodeGraphBuilder::VisitCallRuntime() { BuildCallRuntime(); }
1280 1099
1281 void BytecodeGraphBuilder::VisitCallRuntime( 1100 void BytecodeGraphBuilder::VisitCallRuntimeWide() { BuildCallRuntime(); }
1282 const interpreter::BytecodeArrayIterator& iterator) {
1283 BuildCallRuntime(iterator);
1284 }
1285 1101
1286 1102 void BytecodeGraphBuilder::BuildCallRuntimeForPair() {
1287 void BytecodeGraphBuilder::VisitCallRuntimeWide( 1103 FrameStateBeforeAndAfter states(this);
1288 const interpreter::BytecodeArrayIterator& iterator) {
1289 BuildCallRuntime(iterator);
1290 }
1291
1292
1293 void BytecodeGraphBuilder::BuildCallRuntimeForPair(
1294 const interpreter::BytecodeArrayIterator& iterator) {
1295 FrameStateBeforeAndAfter states(this, iterator);
1296 Runtime::FunctionId functionId = 1104 Runtime::FunctionId functionId =
1297 static_cast<Runtime::FunctionId>(iterator.GetIndexOperand(0)); 1105 static_cast<Runtime::FunctionId>(iterator().GetIndexOperand(0));
1298 interpreter::Register first_arg = iterator.GetRegisterOperand(1); 1106 interpreter::Register first_arg = iterator().GetRegisterOperand(1);
1299 size_t arg_count = iterator.GetCountOperand(2); 1107 size_t arg_count = iterator().GetCountOperand(2);
1300 interpreter::Register first_return = iterator.GetRegisterOperand(3); 1108 interpreter::Register first_return = iterator().GetRegisterOperand(3);
1301 1109
1302 // Create node to perform the runtime call. 1110 // Create node to perform the runtime call.
1303 const Operator* call = javascript()->CallRuntime(functionId, arg_count); 1111 const Operator* call = javascript()->CallRuntime(functionId, arg_count);
1304 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count); 1112 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count);
1305 environment()->BindRegistersToProjections(first_return, return_pair, &states); 1113 environment()->BindRegistersToProjections(first_return, return_pair, &states);
1306 } 1114 }
1307 1115
1116 void BytecodeGraphBuilder::VisitCallRuntimeForPair() {
1117 BuildCallRuntimeForPair();
1118 }
1308 1119
1309 void BytecodeGraphBuilder::VisitCallRuntimeForPair( 1120 void BytecodeGraphBuilder::VisitCallRuntimeForPairWide() {
1310 const interpreter::BytecodeArrayIterator& iterator) { 1121 BuildCallRuntimeForPair();
1311 BuildCallRuntimeForPair(iterator);
1312 } 1122 }
1313 1123
1314 1124
1315 void BytecodeGraphBuilder::VisitCallRuntimeForPairWide(
1316 const interpreter::BytecodeArrayIterator& iterator) {
1317 BuildCallRuntimeForPair(iterator);
1318 }
1319
1320
1321 Node* BytecodeGraphBuilder::ProcessCallNewArguments( 1125 Node* BytecodeGraphBuilder::ProcessCallNewArguments(
1322 const Operator* call_new_op, interpreter::Register callee, 1126 const Operator* call_new_op, interpreter::Register callee,
1323 interpreter::Register first_arg, size_t arity) { 1127 interpreter::Register first_arg, size_t arity) {
1324 Node** all = info()->zone()->NewArray<Node*>(arity); 1128 Node** all = info()->zone()->NewArray<Node*>(arity);
1325 all[0] = environment()->LookupRegister(callee); 1129 all[0] = environment()->LookupRegister(callee);
1326 int first_arg_index = first_arg.index(); 1130 int first_arg_index = first_arg.index();
1327 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { 1131 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) {
1328 all[i] = environment()->LookupRegister( 1132 all[i] = environment()->LookupRegister(
1329 interpreter::Register(first_arg_index + i - 1)); 1133 interpreter::Register(first_arg_index + i - 1));
1330 } 1134 }
1331 // Original constructor is the same as the callee. 1135 // Original constructor is the same as the callee.
1332 all[arity - 1] = environment()->LookupRegister(callee); 1136 all[arity - 1] = environment()->LookupRegister(callee);
1333 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); 1137 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false);
1334 return value; 1138 return value;
1335 } 1139 }
1336 1140
1337 1141 void BytecodeGraphBuilder::BuildCallConstruct() {
1338 void BytecodeGraphBuilder::BuildCallConstruct( 1142 FrameStateBeforeAndAfter states(this);
1339 const interpreter::BytecodeArrayIterator& iterator) { 1143 interpreter::Register callee = iterator().GetRegisterOperand(0);
1340 FrameStateBeforeAndAfter states(this, iterator); 1144 interpreter::Register first_arg = iterator().GetRegisterOperand(1);
1341 interpreter::Register callee = iterator.GetRegisterOperand(0); 1145 size_t arg_count = iterator().GetCountOperand(2);
1342 interpreter::Register first_arg = iterator.GetRegisterOperand(1);
1343 size_t arg_count = iterator.GetCountOperand(2);
1344 1146
1345 // TODO(turbofan): Pass the feedback here. 1147 // TODO(turbofan): Pass the feedback here.
1346 const Operator* call = javascript()->CallConstruct( 1148 const Operator* call = javascript()->CallConstruct(
1347 static_cast<int>(arg_count) + 2, VectorSlotPair()); 1149 static_cast<int>(arg_count) + 2, VectorSlotPair());
1348 Node* value = ProcessCallNewArguments(call, callee, first_arg, arg_count + 2); 1150 Node* value = ProcessCallNewArguments(call, callee, first_arg, arg_count + 2);
1349 environment()->BindAccumulator(value, &states); 1151 environment()->BindAccumulator(value, &states);
1350 } 1152 }
1351 1153
1154 void BytecodeGraphBuilder::VisitNew() { BuildCallConstruct(); }
1352 1155
1353 void BytecodeGraphBuilder::VisitNew( 1156 void BytecodeGraphBuilder::VisitNewWide() { BuildCallConstruct(); }
1354 const interpreter::BytecodeArrayIterator& iterator) {
1355 BuildCallConstruct(iterator);
1356 }
1357 1157
1358 1158 void BytecodeGraphBuilder::VisitThrow() {
1359 void BytecodeGraphBuilder::VisitNewWide( 1159 FrameStateBeforeAndAfter states(this);
1360 const interpreter::BytecodeArrayIterator& iterator) {
1361 BuildCallConstruct(iterator);
1362 }
1363
1364
1365 void BytecodeGraphBuilder::VisitThrow(
1366 const interpreter::BytecodeArrayIterator& iterator) {
1367 FrameStateBeforeAndAfter states(this, iterator);
1368 Node* value = environment()->LookupAccumulator(); 1160 Node* value = environment()->LookupAccumulator();
1369 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); 1161 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value);
1370 environment()->RecordAfterState(call, &states); 1162 environment()->RecordAfterState(call, &states);
1371 Node* control = NewNode(common()->Throw(), value); 1163 Node* control = NewNode(common()->Throw(), value);
1372 UpdateControlDependencyToLeaveFunction(control); 1164 UpdateControlDependencyToLeaveFunction(control);
1373 } 1165 }
1374 1166
1375 1167 void BytecodeGraphBuilder::VisitReThrow() {
1376 void BytecodeGraphBuilder::VisitReThrow( 1168 FrameStateBeforeAndAfter states(this);
1377 const interpreter::BytecodeArrayIterator& iterator) {
1378 FrameStateBeforeAndAfter states(this, iterator);
1379 Node* value = environment()->LookupAccumulator(); 1169 Node* value = environment()->LookupAccumulator();
1380 Node* call = NewNode(javascript()->CallRuntime(Runtime::kReThrow), value); 1170 Node* call = NewNode(javascript()->CallRuntime(Runtime::kReThrow), value);
1381 environment()->RecordAfterState(call, &states); 1171 environment()->RecordAfterState(call, &states);
1382 Node* control = NewNode(common()->Throw(), value); 1172 Node* control = NewNode(common()->Throw(), value);
1383 UpdateControlDependencyToLeaveFunction(control); 1173 UpdateControlDependencyToLeaveFunction(control);
1384 } 1174 }
1385 1175
1386 1176 void BytecodeGraphBuilder::BuildBinaryOp(const Operator* js_op) {
1387 void BytecodeGraphBuilder::BuildBinaryOp( 1177 FrameStateBeforeAndAfter states(this);
1388 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) { 1178 Node* left = environment()->LookupRegister(iterator().GetRegisterOperand(0));
1389 FrameStateBeforeAndAfter states(this, iterator);
1390 Node* left = environment()->LookupRegister(iterator.GetRegisterOperand(0));
1391 Node* right = environment()->LookupAccumulator(); 1179 Node* right = environment()->LookupAccumulator();
1392 Node* node = NewNode(js_op, left, right); 1180 Node* node = NewNode(js_op, left, right);
1393 environment()->BindAccumulator(node, &states); 1181 environment()->BindAccumulator(node, &states);
1394 } 1182 }
1395 1183
1396 1184 void BytecodeGraphBuilder::VisitAdd() {
1397 void BytecodeGraphBuilder::VisitAdd(
1398 const interpreter::BytecodeArrayIterator& iterator) {
1399 BinaryOperationHints hints = BinaryOperationHints::Any(); 1185 BinaryOperationHints hints = BinaryOperationHints::Any();
1400 BuildBinaryOp(javascript()->Add(language_mode(), hints), iterator); 1186 BuildBinaryOp(javascript()->Add(language_mode(), hints));
1401 } 1187 }
1402 1188
1403 1189 void BytecodeGraphBuilder::VisitSub() {
1404 void BytecodeGraphBuilder::VisitSub(
1405 const interpreter::BytecodeArrayIterator& iterator) {
1406 BinaryOperationHints hints = BinaryOperationHints::Any(); 1190 BinaryOperationHints hints = BinaryOperationHints::Any();
1407 BuildBinaryOp(javascript()->Subtract(language_mode(), hints), iterator); 1191 BuildBinaryOp(javascript()->Subtract(language_mode(), hints));
1408 } 1192 }
1409 1193
1410 1194 void BytecodeGraphBuilder::VisitMul() {
1411 void BytecodeGraphBuilder::VisitMul(
1412 const interpreter::BytecodeArrayIterator& iterator) {
1413 BinaryOperationHints hints = BinaryOperationHints::Any(); 1195 BinaryOperationHints hints = BinaryOperationHints::Any();
1414 BuildBinaryOp(javascript()->Multiply(language_mode(), hints), iterator); 1196 BuildBinaryOp(javascript()->Multiply(language_mode(), hints));
1415 } 1197 }
1416 1198
1417 1199 void BytecodeGraphBuilder::VisitDiv() {
1418 void BytecodeGraphBuilder::VisitDiv(
1419 const interpreter::BytecodeArrayIterator& iterator) {
1420 BinaryOperationHints hints = BinaryOperationHints::Any(); 1200 BinaryOperationHints hints = BinaryOperationHints::Any();
1421 BuildBinaryOp(javascript()->Divide(language_mode(), hints), iterator); 1201 BuildBinaryOp(javascript()->Divide(language_mode(), hints));
1422 } 1202 }
1423 1203
1424 1204 void BytecodeGraphBuilder::VisitMod() {
1425 void BytecodeGraphBuilder::VisitMod(
1426 const interpreter::BytecodeArrayIterator& iterator) {
1427 BinaryOperationHints hints = BinaryOperationHints::Any(); 1205 BinaryOperationHints hints = BinaryOperationHints::Any();
1428 BuildBinaryOp(javascript()->Modulus(language_mode(), hints), iterator); 1206 BuildBinaryOp(javascript()->Modulus(language_mode(), hints));
1429 } 1207 }
1430 1208
1431 1209 void BytecodeGraphBuilder::VisitBitwiseOr() {
1432 void BytecodeGraphBuilder::VisitBitwiseOr(
1433 const interpreter::BytecodeArrayIterator& iterator) {
1434 BinaryOperationHints hints = BinaryOperationHints::Any(); 1210 BinaryOperationHints hints = BinaryOperationHints::Any();
1435 BuildBinaryOp(javascript()->BitwiseOr(language_mode(), hints), iterator); 1211 BuildBinaryOp(javascript()->BitwiseOr(language_mode(), hints));
1436 } 1212 }
1437 1213
1438 1214 void BytecodeGraphBuilder::VisitBitwiseXor() {
1439 void BytecodeGraphBuilder::VisitBitwiseXor(
1440 const interpreter::BytecodeArrayIterator& iterator) {
1441 BinaryOperationHints hints = BinaryOperationHints::Any(); 1215 BinaryOperationHints hints = BinaryOperationHints::Any();
1442 BuildBinaryOp(javascript()->BitwiseXor(language_mode(), hints), iterator); 1216 BuildBinaryOp(javascript()->BitwiseXor(language_mode(), hints));
1443 } 1217 }
1444 1218
1445 1219 void BytecodeGraphBuilder::VisitBitwiseAnd() {
1446 void BytecodeGraphBuilder::VisitBitwiseAnd(
1447 const interpreter::BytecodeArrayIterator& iterator) {
1448 BinaryOperationHints hints = BinaryOperationHints::Any(); 1220 BinaryOperationHints hints = BinaryOperationHints::Any();
1449 BuildBinaryOp(javascript()->BitwiseAnd(language_mode(), hints), iterator); 1221 BuildBinaryOp(javascript()->BitwiseAnd(language_mode(), hints));
1450 } 1222 }
1451 1223
1452 1224 void BytecodeGraphBuilder::VisitShiftLeft() {
1453 void BytecodeGraphBuilder::VisitShiftLeft(
1454 const interpreter::BytecodeArrayIterator& iterator) {
1455 BinaryOperationHints hints = BinaryOperationHints::Any(); 1225 BinaryOperationHints hints = BinaryOperationHints::Any();
1456 BuildBinaryOp(javascript()->ShiftLeft(language_mode(), hints), iterator); 1226 BuildBinaryOp(javascript()->ShiftLeft(language_mode(), hints));
1457 } 1227 }
1458 1228
1459 1229 void BytecodeGraphBuilder::VisitShiftRight() {
1460 void BytecodeGraphBuilder::VisitShiftRight(
1461 const interpreter::BytecodeArrayIterator& iterator) {
1462 BinaryOperationHints hints = BinaryOperationHints::Any(); 1230 BinaryOperationHints hints = BinaryOperationHints::Any();
1463 BuildBinaryOp(javascript()->ShiftRight(language_mode(), hints), iterator); 1231 BuildBinaryOp(javascript()->ShiftRight(language_mode(), hints));
1464 } 1232 }
1465 1233
1466 1234 void BytecodeGraphBuilder::VisitShiftRightLogical() {
1467 void BytecodeGraphBuilder::VisitShiftRightLogical(
1468 const interpreter::BytecodeArrayIterator& iterator) {
1469 BinaryOperationHints hints = BinaryOperationHints::Any(); 1235 BinaryOperationHints hints = BinaryOperationHints::Any();
1470 BuildBinaryOp(javascript()->ShiftRightLogical(language_mode(), hints), 1236 BuildBinaryOp(javascript()->ShiftRightLogical(language_mode(), hints));
1471 iterator);
1472 } 1237 }
1473 1238
1474 1239 void BytecodeGraphBuilder::VisitInc() {
1475 void BytecodeGraphBuilder::VisitInc( 1240 FrameStateBeforeAndAfter states(this);
1476 const interpreter::BytecodeArrayIterator& iterator) {
1477 FrameStateBeforeAndAfter states(this, iterator);
1478 const Operator* js_op = 1241 const Operator* js_op =
1479 javascript()->Add(language_mode(), BinaryOperationHints::Any()); 1242 javascript()->Add(language_mode(), BinaryOperationHints::Any());
1480 Node* node = NewNode(js_op, environment()->LookupAccumulator(), 1243 Node* node = NewNode(js_op, environment()->LookupAccumulator(),
1481 jsgraph()->OneConstant()); 1244 jsgraph()->OneConstant());
1482 environment()->BindAccumulator(node, &states); 1245 environment()->BindAccumulator(node, &states);
1483 } 1246 }
1484 1247
1485 1248 void BytecodeGraphBuilder::VisitDec() {
1486 void BytecodeGraphBuilder::VisitDec( 1249 FrameStateBeforeAndAfter states(this);
1487 const interpreter::BytecodeArrayIterator& iterator) {
1488 FrameStateBeforeAndAfter states(this, iterator);
1489 const Operator* js_op = 1250 const Operator* js_op =
1490 javascript()->Subtract(language_mode(), BinaryOperationHints::Any()); 1251 javascript()->Subtract(language_mode(), BinaryOperationHints::Any());
1491 Node* node = NewNode(js_op, environment()->LookupAccumulator(), 1252 Node* node = NewNode(js_op, environment()->LookupAccumulator(),
1492 jsgraph()->OneConstant()); 1253 jsgraph()->OneConstant());
1493 environment()->BindAccumulator(node, &states); 1254 environment()->BindAccumulator(node, &states);
1494 } 1255 }
1495 1256
1496 1257 void BytecodeGraphBuilder::VisitLogicalNot() {
1497 void BytecodeGraphBuilder::VisitLogicalNot(
1498 const interpreter::BytecodeArrayIterator& iterator) {
1499 Node* value = NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), 1258 Node* value = NewNode(javascript()->ToBoolean(ToBooleanHint::kAny),
1500 environment()->LookupAccumulator()); 1259 environment()->LookupAccumulator());
1501 Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value, 1260 Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value,
1502 jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); 1261 jsgraph()->FalseConstant(), jsgraph()->TrueConstant());
1503 environment()->BindAccumulator(node); 1262 environment()->BindAccumulator(node);
1504 } 1263 }
1505 1264
1506 1265 void BytecodeGraphBuilder::VisitTypeOf() {
1507 void BytecodeGraphBuilder::VisitTypeOf(
1508 const interpreter::BytecodeArrayIterator& iterator) {
1509 Node* node = 1266 Node* node =
1510 NewNode(javascript()->TypeOf(), environment()->LookupAccumulator()); 1267 NewNode(javascript()->TypeOf(), environment()->LookupAccumulator());
1511 environment()->BindAccumulator(node); 1268 environment()->BindAccumulator(node);
1512 } 1269 }
1513 1270
1514 1271 void BytecodeGraphBuilder::BuildDelete() {
1515 void BytecodeGraphBuilder::BuildDelete( 1272 FrameStateBeforeAndAfter states(this);
1516 const interpreter::BytecodeArrayIterator& iterator) {
1517 FrameStateBeforeAndAfter states(this, iterator);
1518 Node* key = environment()->LookupAccumulator(); 1273 Node* key = environment()->LookupAccumulator();
1519 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); 1274 Node* object =
1275 environment()->LookupRegister(iterator().GetRegisterOperand(0));
1520 Node* node = 1276 Node* node =
1521 NewNode(javascript()->DeleteProperty(language_mode()), object, key); 1277 NewNode(javascript()->DeleteProperty(language_mode()), object, key);
1522 environment()->BindAccumulator(node, &states); 1278 environment()->BindAccumulator(node, &states);
1523 } 1279 }
1524 1280
1525 1281 void BytecodeGraphBuilder::VisitDeletePropertyStrict() {
1526 void BytecodeGraphBuilder::VisitDeletePropertyStrict(
1527 const interpreter::BytecodeArrayIterator& iterator) {
1528 DCHECK(is_strict(language_mode())); 1282 DCHECK(is_strict(language_mode()));
1529 BuildDelete(iterator); 1283 BuildDelete();
1530 } 1284 }
1531 1285
1532 1286 void BytecodeGraphBuilder::VisitDeletePropertySloppy() {
1533 void BytecodeGraphBuilder::VisitDeletePropertySloppy(
1534 const interpreter::BytecodeArrayIterator& iterator) {
1535 DCHECK(is_sloppy(language_mode())); 1287 DCHECK(is_sloppy(language_mode()));
1536 BuildDelete(iterator); 1288 BuildDelete();
1537 } 1289 }
1538 1290
1539 1291 void BytecodeGraphBuilder::VisitDeleteLookupSlot() {
1540 void BytecodeGraphBuilder::VisitDeleteLookupSlot( 1292 FrameStateBeforeAndAfter states(this);
1541 const interpreter::BytecodeArrayIterator& iterator) {
1542 FrameStateBeforeAndAfter states(this, iterator);
1543 Node* name = environment()->LookupAccumulator(); 1293 Node* name = environment()->LookupAccumulator();
1544 const Operator* op = javascript()->CallRuntime(Runtime::kDeleteLookupSlot); 1294 const Operator* op = javascript()->CallRuntime(Runtime::kDeleteLookupSlot);
1545 Node* result = NewNode(op, environment()->Context(), name); 1295 Node* result = NewNode(op, environment()->Context(), name);
1546 environment()->BindAccumulator(result, &states); 1296 environment()->BindAccumulator(result, &states);
1547 } 1297 }
1548 1298
1549 1299 void BytecodeGraphBuilder::BuildCompareOp(const Operator* js_op) {
1550 void BytecodeGraphBuilder::BuildCompareOp( 1300 FrameStateBeforeAndAfter states(this);
1551 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) { 1301 Node* left = environment()->LookupRegister(iterator().GetRegisterOperand(0));
1552 FrameStateBeforeAndAfter states(this, iterator);
1553 Node* left = environment()->LookupRegister(iterator.GetRegisterOperand(0));
1554 Node* right = environment()->LookupAccumulator(); 1302 Node* right = environment()->LookupAccumulator();
1555 Node* node = NewNode(js_op, left, right); 1303 Node* node = NewNode(js_op, left, right);
1556 environment()->BindAccumulator(node, &states); 1304 environment()->BindAccumulator(node, &states);
1557 } 1305 }
1558 1306
1559 1307 void BytecodeGraphBuilder::VisitTestEqual() {
1560 void BytecodeGraphBuilder::VisitTestEqual( 1308 BuildCompareOp(javascript()->Equal());
1561 const interpreter::BytecodeArrayIterator& iterator) { 1309 }
1562 BuildCompareOp(javascript()->Equal(), iterator); 1310
1563 } 1311 void BytecodeGraphBuilder::VisitTestNotEqual() {
1564 1312 BuildCompareOp(javascript()->NotEqual());
1565 1313 }
1566 void BytecodeGraphBuilder::VisitTestNotEqual( 1314
1567 const interpreter::BytecodeArrayIterator& iterator) { 1315 void BytecodeGraphBuilder::VisitTestEqualStrict() {
1568 BuildCompareOp(javascript()->NotEqual(), iterator); 1316 BuildCompareOp(javascript()->StrictEqual());
1569 } 1317 }
1570 1318
1571 1319 void BytecodeGraphBuilder::VisitTestNotEqualStrict() {
1572 void BytecodeGraphBuilder::VisitTestEqualStrict( 1320 BuildCompareOp(javascript()->StrictNotEqual());
1573 const interpreter::BytecodeArrayIterator& iterator) { 1321 }
1574 BuildCompareOp(javascript()->StrictEqual(), iterator); 1322
1575 } 1323 void BytecodeGraphBuilder::VisitTestLessThan() {
1576 1324 BuildCompareOp(javascript()->LessThan(language_mode()));
1577 1325 }
1578 void BytecodeGraphBuilder::VisitTestNotEqualStrict( 1326
1579 const interpreter::BytecodeArrayIterator& iterator) { 1327 void BytecodeGraphBuilder::VisitTestGreaterThan() {
1580 BuildCompareOp(javascript()->StrictNotEqual(), iterator); 1328 BuildCompareOp(javascript()->GreaterThan(language_mode()));
1581 } 1329 }
1582 1330
1583 1331 void BytecodeGraphBuilder::VisitTestLessThanOrEqual() {
1584 void BytecodeGraphBuilder::VisitTestLessThan( 1332 BuildCompareOp(javascript()->LessThanOrEqual(language_mode()));
1585 const interpreter::BytecodeArrayIterator& iterator) { 1333 }
1586 BuildCompareOp(javascript()->LessThan(language_mode()), iterator); 1334
1587 } 1335 void BytecodeGraphBuilder::VisitTestGreaterThanOrEqual() {
1588 1336 BuildCompareOp(javascript()->GreaterThanOrEqual(language_mode()));
1589 1337 }
1590 void BytecodeGraphBuilder::VisitTestGreaterThan( 1338
1591 const interpreter::BytecodeArrayIterator& iterator) { 1339 void BytecodeGraphBuilder::VisitTestIn() {
1592 BuildCompareOp(javascript()->GreaterThan(language_mode()), iterator); 1340 BuildCompareOp(javascript()->HasProperty());
1593 } 1341 }
1594 1342
1595 1343 void BytecodeGraphBuilder::VisitTestInstanceOf() {
1596 void BytecodeGraphBuilder::VisitTestLessThanOrEqual( 1344 BuildCompareOp(javascript()->InstanceOf());
1597 const interpreter::BytecodeArrayIterator& iterator) { 1345 }
1598 BuildCompareOp(javascript()->LessThanOrEqual(language_mode()), iterator); 1346
1599 } 1347 void BytecodeGraphBuilder::BuildCastOperator(const Operator* js_op) {
1600 1348 FrameStateBeforeAndAfter states(this);
1601
1602 void BytecodeGraphBuilder::VisitTestGreaterThanOrEqual(
1603 const interpreter::BytecodeArrayIterator& iterator) {
1604 BuildCompareOp(javascript()->GreaterThanOrEqual(language_mode()), iterator);
1605 }
1606
1607
1608 void BytecodeGraphBuilder::VisitTestIn(
1609 const interpreter::BytecodeArrayIterator& iterator) {
1610 BuildCompareOp(javascript()->HasProperty(), iterator);
1611 }
1612
1613
1614 void BytecodeGraphBuilder::VisitTestInstanceOf(
1615 const interpreter::BytecodeArrayIterator& iterator) {
1616 BuildCompareOp(javascript()->InstanceOf(), iterator);
1617 }
1618
1619
1620 void BytecodeGraphBuilder::BuildCastOperator(
1621 const Operator* js_op, const interpreter::BytecodeArrayIterator& iterator) {
1622 FrameStateBeforeAndAfter states(this, iterator);
1623 Node* node = NewNode(js_op, environment()->LookupAccumulator()); 1349 Node* node = NewNode(js_op, environment()->LookupAccumulator());
1624 environment()->BindAccumulator(node, &states); 1350 environment()->BindAccumulator(node, &states);
1625 } 1351 }
1626 1352
1627 1353 void BytecodeGraphBuilder::VisitToName() {
1628 void BytecodeGraphBuilder::VisitToName( 1354 BuildCastOperator(javascript()->ToName());
1629 const interpreter::BytecodeArrayIterator& iterator) { 1355 }
1630 BuildCastOperator(javascript()->ToName(), iterator); 1356
1631 } 1357 void BytecodeGraphBuilder::VisitToObject() {
1632 1358 BuildCastOperator(javascript()->ToObject());
1633 1359 }
1634 void BytecodeGraphBuilder::VisitToObject( 1360
1635 const interpreter::BytecodeArrayIterator& iterator) { 1361 void BytecodeGraphBuilder::VisitToNumber() {
1636 BuildCastOperator(javascript()->ToObject(), iterator); 1362 BuildCastOperator(javascript()->ToNumber());
1637 } 1363 }
1638 1364
1639 1365 void BytecodeGraphBuilder::VisitJump() { BuildJump(); }
1640 void BytecodeGraphBuilder::VisitToNumber( 1366
1641 const interpreter::BytecodeArrayIterator& iterator) { 1367 void BytecodeGraphBuilder::VisitJumpConstant() { BuildJump(); }
1642 BuildCastOperator(javascript()->ToNumber(), iterator); 1368
1643 } 1369 void BytecodeGraphBuilder::VisitJumpConstantWide() { BuildJump(); }
1644 1370
1645 1371 void BytecodeGraphBuilder::VisitJumpIfTrue() {
1646 void BytecodeGraphBuilder::VisitJump(
1647 const interpreter::BytecodeArrayIterator& iterator) {
1648 BuildJump();
1649 }
1650
1651
1652 void BytecodeGraphBuilder::VisitJumpConstant(
1653 const interpreter::BytecodeArrayIterator& iterator) {
1654 BuildJump();
1655 }
1656
1657
1658 void BytecodeGraphBuilder::VisitJumpConstantWide(
1659 const interpreter::BytecodeArrayIterator& iterator) {
1660 BuildJump();
1661 }
1662
1663
1664 void BytecodeGraphBuilder::VisitJumpIfTrue(
1665 const interpreter::BytecodeArrayIterator& iterator) {
1666 BuildJumpIfEqual(jsgraph()->TrueConstant()); 1372 BuildJumpIfEqual(jsgraph()->TrueConstant());
1667 } 1373 }
1668 1374
1669 1375 void BytecodeGraphBuilder::VisitJumpIfTrueConstant() {
1670 void BytecodeGraphBuilder::VisitJumpIfTrueConstant(
1671 const interpreter::BytecodeArrayIterator& iterator) {
1672 BuildJumpIfEqual(jsgraph()->TrueConstant()); 1376 BuildJumpIfEqual(jsgraph()->TrueConstant());
1673 } 1377 }
1674 1378
1675 1379 void BytecodeGraphBuilder::VisitJumpIfTrueConstantWide() {
1676 void BytecodeGraphBuilder::VisitJumpIfTrueConstantWide(
1677 const interpreter::BytecodeArrayIterator& iterator) {
1678 BuildJumpIfEqual(jsgraph()->TrueConstant()); 1380 BuildJumpIfEqual(jsgraph()->TrueConstant());
1679 } 1381 }
1680 1382
1681 1383 void BytecodeGraphBuilder::VisitJumpIfFalse() {
1682 void BytecodeGraphBuilder::VisitJumpIfFalse(
1683 const interpreter::BytecodeArrayIterator& iterator) {
1684 BuildJumpIfEqual(jsgraph()->FalseConstant()); 1384 BuildJumpIfEqual(jsgraph()->FalseConstant());
1685 } 1385 }
1686 1386
1687 1387 void BytecodeGraphBuilder::VisitJumpIfFalseConstant() {
1688 void BytecodeGraphBuilder::VisitJumpIfFalseConstant(
1689 const interpreter::BytecodeArrayIterator& iterator) {
1690 BuildJumpIfEqual(jsgraph()->FalseConstant()); 1388 BuildJumpIfEqual(jsgraph()->FalseConstant());
1691 } 1389 }
1692 1390
1693 1391 void BytecodeGraphBuilder::VisitJumpIfFalseConstantWide() {
1694 void BytecodeGraphBuilder::VisitJumpIfFalseConstantWide(
1695 const interpreter::BytecodeArrayIterator& iterator) {
1696 BuildJumpIfEqual(jsgraph()->FalseConstant()); 1392 BuildJumpIfEqual(jsgraph()->FalseConstant());
1697 } 1393 }
1698 1394
1699 1395 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrue() {
1700 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrue(
1701 const interpreter::BytecodeArrayIterator& iterator) {
1702 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant()); 1396 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant());
1703 } 1397 }
1704 1398
1705 1399 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstant() {
1706 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstant(
1707 const interpreter::BytecodeArrayIterator& iterator) {
1708 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant()); 1400 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant());
1709 } 1401 }
1710 1402
1711 1403 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstantWide() {
1712 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstantWide(
1713 const interpreter::BytecodeArrayIterator& iterator) {
1714 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant()); 1404 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant());
1715 } 1405 }
1716 1406
1717 1407 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalse() {
1718 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalse(
1719 const interpreter::BytecodeArrayIterator& iterator) {
1720 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); 1408 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant());
1721 } 1409 }
1722 1410
1723 1411 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant() {
1724 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant(
1725 const interpreter::BytecodeArrayIterator& iterator) {
1726 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); 1412 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant());
1727 } 1413 }
1728 1414
1729 1415 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstantWide() {
1730 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstantWide(
1731 const interpreter::BytecodeArrayIterator& iterator) {
1732 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); 1416 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant());
1733 } 1417 }
1734 1418
1735 1419 void BytecodeGraphBuilder::VisitJumpIfNull() {
1736 void BytecodeGraphBuilder::VisitJumpIfNull(
1737 const interpreter::BytecodeArrayIterator& iterator) {
1738 BuildJumpIfEqual(jsgraph()->NullConstant()); 1420 BuildJumpIfEqual(jsgraph()->NullConstant());
1739 } 1421 }
1740 1422
1741 1423 void BytecodeGraphBuilder::VisitJumpIfNullConstant() {
1742 void BytecodeGraphBuilder::VisitJumpIfNullConstant(
1743 const interpreter::BytecodeArrayIterator& iterator) {
1744 BuildJumpIfEqual(jsgraph()->NullConstant()); 1424 BuildJumpIfEqual(jsgraph()->NullConstant());
1745 } 1425 }
1746 1426
1747 1427 void BytecodeGraphBuilder::VisitJumpIfNullConstantWide() {
1748 void BytecodeGraphBuilder::VisitJumpIfNullConstantWide(
1749 const interpreter::BytecodeArrayIterator& iterator) {
1750 BuildJumpIfEqual(jsgraph()->NullConstant()); 1428 BuildJumpIfEqual(jsgraph()->NullConstant());
1751 } 1429 }
1752 1430
1753 1431 void BytecodeGraphBuilder::VisitJumpIfUndefined() {
1754 void BytecodeGraphBuilder::VisitJumpIfUndefined(
1755 const interpreter::BytecodeArrayIterator& iterator) {
1756 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); 1432 BuildJumpIfEqual(jsgraph()->UndefinedConstant());
1757 } 1433 }
1758 1434
1759 1435 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant() {
1760 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant(
1761 const interpreter::BytecodeArrayIterator& iterator) {
1762 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); 1436 BuildJumpIfEqual(jsgraph()->UndefinedConstant());
1763 } 1437 }
1764 1438
1765 1439 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstantWide() {
1766 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstantWide(
1767 const interpreter::BytecodeArrayIterator& iterator) {
1768 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); 1440 BuildJumpIfEqual(jsgraph()->UndefinedConstant());
1769 } 1441 }
1770 1442
1771 1443 void BytecodeGraphBuilder::VisitReturn() {
1772 void BytecodeGraphBuilder::VisitReturn(
1773 const interpreter::BytecodeArrayIterator& iterator) {
1774 Node* control = 1444 Node* control =
1775 NewNode(common()->Return(), environment()->LookupAccumulator()); 1445 NewNode(common()->Return(), environment()->LookupAccumulator());
1776 UpdateControlDependencyToLeaveFunction(control); 1446 UpdateControlDependencyToLeaveFunction(control);
1777 set_environment(nullptr); 1447 set_environment(nullptr);
1778 } 1448 }
1779 1449
1780 1450 void BytecodeGraphBuilder::BuildForInPrepare() {
1781 void BytecodeGraphBuilder::BuildForInPrepare( 1451 FrameStateBeforeAndAfter states(this);
1782 const interpreter::BytecodeArrayIterator& iterator) {
1783 FrameStateBeforeAndAfter states(this, iterator);
1784 Node* receiver = environment()->LookupAccumulator(); 1452 Node* receiver = environment()->LookupAccumulator();
1785 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver); 1453 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver);
1786 environment()->BindRegistersToProjections(iterator.GetRegisterOperand(0), 1454 environment()->BindRegistersToProjections(iterator().GetRegisterOperand(0),
1787 prepare, &states); 1455 prepare, &states);
1788 } 1456 }
1789 1457
1790 1458 void BytecodeGraphBuilder::VisitForInPrepare() { BuildForInPrepare(); }
1791 void BytecodeGraphBuilder::VisitForInPrepare( 1459
1792 const interpreter::BytecodeArrayIterator& iterator) { 1460 void BytecodeGraphBuilder::VisitForInPrepareWide() { BuildForInPrepare(); }
1793 BuildForInPrepare(iterator); 1461
1794 } 1462 void BytecodeGraphBuilder::VisitForInDone() {
1795 1463 FrameStateBeforeAndAfter states(this);
1796 1464 Node* index = environment()->LookupRegister(iterator().GetRegisterOperand(0));
1797 void BytecodeGraphBuilder::VisitForInPrepareWide(
1798 const interpreter::BytecodeArrayIterator& iterator) {
1799 BuildForInPrepare(iterator);
1800 }
1801
1802
1803 void BytecodeGraphBuilder::VisitForInDone(
1804 const interpreter::BytecodeArrayIterator& iterator) {
1805 FrameStateBeforeAndAfter states(this, iterator);
1806 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0));
1807 Node* cache_length = 1465 Node* cache_length =
1808 environment()->LookupRegister(iterator.GetRegisterOperand(1)); 1466 environment()->LookupRegister(iterator().GetRegisterOperand(1));
1809 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); 1467 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length);
1810 environment()->BindAccumulator(exit_cond, &states); 1468 environment()->BindAccumulator(exit_cond, &states);
1811 } 1469 }
1812 1470
1813 1471 void BytecodeGraphBuilder::BuildForInNext() {
1814 void BytecodeGraphBuilder::BuildForInNext( 1472 FrameStateBeforeAndAfter states(this);
1815 const interpreter::BytecodeArrayIterator& iterator) {
1816 FrameStateBeforeAndAfter states(this, iterator);
1817 Node* receiver = 1473 Node* receiver =
1818 environment()->LookupRegister(iterator.GetRegisterOperand(0)); 1474 environment()->LookupRegister(iterator().GetRegisterOperand(0));
1819 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(1)); 1475 Node* index = environment()->LookupRegister(iterator().GetRegisterOperand(1));
1820 int catch_reg_pair_index = iterator.GetRegisterOperand(2).index(); 1476 int catch_reg_pair_index = iterator().GetRegisterOperand(2).index();
1821 Node* cache_type = environment()->LookupRegister( 1477 Node* cache_type = environment()->LookupRegister(
1822 interpreter::Register(catch_reg_pair_index)); 1478 interpreter::Register(catch_reg_pair_index));
1823 Node* cache_array = environment()->LookupRegister( 1479 Node* cache_array = environment()->LookupRegister(
1824 interpreter::Register(catch_reg_pair_index + 1)); 1480 interpreter::Register(catch_reg_pair_index + 1));
1825 1481
1826 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, 1482 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array,
1827 cache_type, index); 1483 cache_type, index);
1828 environment()->BindAccumulator(value, &states); 1484 environment()->BindAccumulator(value, &states);
1829 } 1485 }
1830 1486
1487 void BytecodeGraphBuilder::VisitForInNext() { BuildForInNext(); }
1831 1488
1832 void BytecodeGraphBuilder::VisitForInNext( 1489 void BytecodeGraphBuilder::VisitForInNextWide() { BuildForInNext(); }
1833 const interpreter::BytecodeArrayIterator& iterator) {
1834 BuildForInNext(iterator);
1835 }
1836 1490
1837 1491 void BytecodeGraphBuilder::VisitForInStep() {
1838 void BytecodeGraphBuilder::VisitForInNextWide( 1492 FrameStateBeforeAndAfter states(this);
1839 const interpreter::BytecodeArrayIterator& iterator) { 1493 Node* index = environment()->LookupRegister(iterator().GetRegisterOperand(0));
1840 BuildForInNext(iterator);
1841 }
1842
1843
1844 void BytecodeGraphBuilder::VisitForInStep(
1845 const interpreter::BytecodeArrayIterator& iterator) {
1846 FrameStateBeforeAndAfter states(this, iterator);
1847 Node* index = environment()->LookupRegister(iterator.GetRegisterOperand(0));
1848 index = NewNode(javascript()->ForInStep(), index); 1494 index = NewNode(javascript()->ForInStep(), index);
1849 environment()->BindAccumulator(index, &states); 1495 environment()->BindAccumulator(index, &states);
1850 } 1496 }
1851 1497
1852 1498
1853 void BytecodeGraphBuilder::MergeEnvironmentsOfBackwardBranches( 1499 void BytecodeGraphBuilder::MergeEnvironmentsOfBackwardBranches(
1854 int source_offset, int target_offset) { 1500 int source_offset, int target_offset) {
1855 DCHECK_GE(source_offset, target_offset); 1501 DCHECK_GE(source_offset, target_offset);
1856 const ZoneVector<int>* branch_sites = 1502 const ZoneVector<int>* branch_sites =
1857 branch_analysis()->BackwardBranchesTargetting(target_offset); 1503 branch_analysis()->BackwardBranchesTargetting(target_offset);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 1794
2149 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { 1795 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) {
2150 if (environment()->IsMarkedAsUnreachable()) return; 1796 if (environment()->IsMarkedAsUnreachable()) return;
2151 environment()->MarkAsUnreachable(); 1797 environment()->MarkAsUnreachable();
2152 exit_controls_.push_back(exit); 1798 exit_controls_.push_back(exit);
2153 } 1799 }
2154 1800
2155 } // namespace compiler 1801 } // namespace compiler
2156 } // namespace internal 1802 } // namespace internal
2157 } // namespace v8 1803 } // namespace v8
OLDNEW
« src/compiler/bytecode-graph-builder.h ('K') | « src/compiler/bytecode-graph-builder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698