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

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

Issue 1783483002: [interpreter] Add support for scalable operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor comment tweaks. Created 4 years, 9 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"
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 set_branch_analysis(nullptr); 563 set_branch_analysis(nullptr);
564 set_bytecode_iterator(nullptr); 564 set_bytecode_iterator(nullptr);
565 DCHECK(exception_handlers_.empty()); 565 DCHECK(exception_handlers_.empty());
566 } 566 }
567 567
568 void BytecodeGraphBuilder::VisitLdaZero() { 568 void BytecodeGraphBuilder::VisitLdaZero() {
569 Node* node = jsgraph()->ZeroConstant(); 569 Node* node = jsgraph()->ZeroConstant();
570 environment()->BindAccumulator(node); 570 environment()->BindAccumulator(node);
571 } 571 }
572 572
573 void BytecodeGraphBuilder::VisitLdaSmi8() { 573 void BytecodeGraphBuilder::VisitLdaSmi() {
574 Node* node = jsgraph()->Constant(bytecode_iterator().GetImmediateOperand(0)); 574 Node* node = jsgraph()->Constant(bytecode_iterator().GetImmediateOperand(0));
575 environment()->BindAccumulator(node); 575 environment()->BindAccumulator(node);
576 } 576 }
577 577
578 void BytecodeGraphBuilder::VisitLdaConstantWide() {
579 Node* node =
580 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
581 environment()->BindAccumulator(node);
582 }
583
584 void BytecodeGraphBuilder::VisitLdaConstant() { 578 void BytecodeGraphBuilder::VisitLdaConstant() {
585 Node* node = 579 Node* node =
586 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); 580 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
587 environment()->BindAccumulator(node); 581 environment()->BindAccumulator(node);
588 } 582 }
589 583
590 void BytecodeGraphBuilder::VisitLdaUndefined() { 584 void BytecodeGraphBuilder::VisitLdaUndefined() {
591 Node* node = jsgraph()->UndefinedConstant(); 585 Node* node = jsgraph()->UndefinedConstant();
592 environment()->BindAccumulator(node); 586 environment()->BindAccumulator(node);
593 } 587 }
(...skipping 28 matching lines...) Expand all
622 Node* value = environment()->LookupAccumulator(); 616 Node* value = environment()->LookupAccumulator();
623 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), value); 617 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), value);
624 } 618 }
625 619
626 void BytecodeGraphBuilder::VisitMov() { 620 void BytecodeGraphBuilder::VisitMov() {
627 Node* value = 621 Node* value =
628 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 622 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
629 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), value); 623 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(1), value);
630 } 624 }
631 625
632 void BytecodeGraphBuilder::VisitMovWide() { VisitMov(); }
633
634 void BytecodeGraphBuilder::BuildLoadGlobal( 626 void BytecodeGraphBuilder::BuildLoadGlobal(
635 TypeofMode typeof_mode) { 627 TypeofMode typeof_mode) {
636 FrameStateBeforeAndAfter states(this); 628 FrameStateBeforeAndAfter states(this);
637 Handle<Name> name = 629 Handle<Name> name =
638 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); 630 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
639 VectorSlotPair feedback = 631 VectorSlotPair feedback =
640 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); 632 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
641 633
642 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode); 634 const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode);
643 Node* node = NewNode(op, GetFunctionClosure()); 635 Node* node = NewNode(op, GetFunctionClosure());
644 environment()->BindAccumulator(node, &states); 636 environment()->BindAccumulator(node, &states);
645 } 637 }
646 638
647 void BytecodeGraphBuilder::VisitLdaGlobal() { 639 void BytecodeGraphBuilder::VisitLdaGlobal() {
648 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF); 640 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
649 } 641 }
650 642
651 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() { 643 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeof() {
652 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF); 644 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF);
653 } 645 }
654 646
655 void BytecodeGraphBuilder::VisitLdaGlobalWide() {
656 BuildLoadGlobal(TypeofMode::NOT_INSIDE_TYPEOF);
657 }
658
659 void BytecodeGraphBuilder::VisitLdaGlobalInsideTypeofWide() {
660 BuildLoadGlobal(TypeofMode::INSIDE_TYPEOF);
661 }
662
663 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) { 647 void BytecodeGraphBuilder::BuildStoreGlobal(LanguageMode language_mode) {
664 FrameStateBeforeAndAfter states(this); 648 FrameStateBeforeAndAfter states(this);
665 Handle<Name> name = 649 Handle<Name> name =
666 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); 650 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
667 VectorSlotPair feedback = 651 VectorSlotPair feedback =
668 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); 652 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
669 Node* value = environment()->LookupAccumulator(); 653 Node* value = environment()->LookupAccumulator();
670 654
671 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback); 655 const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback);
672 Node* node = NewNode(op, value, GetFunctionClosure()); 656 Node* node = NewNode(op, value, GetFunctionClosure());
673 environment()->RecordAfterState(node, &states); 657 environment()->RecordAfterState(node, &states);
674 } 658 }
675 659
676 void BytecodeGraphBuilder::VisitStaGlobalSloppy() { 660 void BytecodeGraphBuilder::VisitStaGlobalSloppy() {
677 BuildStoreGlobal(LanguageMode::SLOPPY); 661 BuildStoreGlobal(LanguageMode::SLOPPY);
678 } 662 }
679 663
680 void BytecodeGraphBuilder::VisitStaGlobalStrict() { 664 void BytecodeGraphBuilder::VisitStaGlobalStrict() {
681 BuildStoreGlobal(LanguageMode::STRICT); 665 BuildStoreGlobal(LanguageMode::STRICT);
682 } 666 }
683 667
684 void BytecodeGraphBuilder::VisitStaGlobalSloppyWide() {
685 BuildStoreGlobal(LanguageMode::SLOPPY);
686 }
687
688 void BytecodeGraphBuilder::VisitStaGlobalStrictWide() {
689 BuildStoreGlobal(LanguageMode::STRICT);
690 }
691
692 void BytecodeGraphBuilder::VisitLdaContextSlot() { 668 void BytecodeGraphBuilder::VisitLdaContextSlot() {
693 // TODO(mythria): LoadContextSlots are unrolled by the required depth when 669 // TODO(mythria): LoadContextSlots are unrolled by the required depth when
694 // generating bytecode. Hence the value of depth is always 0. Update this 670 // generating bytecode. Hence the value of depth is always 0. Update this
695 // code, when the implementation changes. 671 // code, when the implementation changes.
696 // TODO(mythria): immutable flag is also set to false. This information is not 672 // TODO(mythria): immutable flag is also set to false. This information is not
697 // available in bytecode array. update this code when the implementation 673 // available in bytecode array. update this code when the implementation
698 // changes. 674 // changes.
699 const Operator* op = javascript()->LoadContext( 675 const Operator* op = javascript()->LoadContext(
700 0, bytecode_iterator().GetIndexOperand(1), false); 676 0, bytecode_iterator().GetIndexOperand(1), false);
701 Node* context = 677 Node* context =
702 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 678 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
703 Node* node = NewNode(op, context); 679 Node* node = NewNode(op, context);
704 environment()->BindAccumulator(node); 680 environment()->BindAccumulator(node);
705 } 681 }
706 682
707 void BytecodeGraphBuilder::VisitLdaContextSlotWide() { VisitLdaContextSlot(); }
708
709 void BytecodeGraphBuilder::VisitStaContextSlot() { 683 void BytecodeGraphBuilder::VisitStaContextSlot() {
710 // TODO(mythria): LoadContextSlots are unrolled by the required depth when 684 // TODO(mythria): LoadContextSlots are unrolled by the required depth when
711 // generating bytecode. Hence the value of depth is always 0. Update this 685 // generating bytecode. Hence the value of depth is always 0. Update this
712 // code, when the implementation changes. 686 // code, when the implementation changes.
713 const Operator* op = 687 const Operator* op =
714 javascript()->StoreContext(0, bytecode_iterator().GetIndexOperand(1)); 688 javascript()->StoreContext(0, bytecode_iterator().GetIndexOperand(1));
715 Node* context = 689 Node* context =
716 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 690 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
717 Node* value = environment()->LookupAccumulator(); 691 Node* value = environment()->LookupAccumulator();
718 NewNode(op, context, value); 692 NewNode(op, context, value);
719 } 693 }
720 694
721 void BytecodeGraphBuilder::VisitStaContextSlotWide() { VisitStaContextSlot(); }
722
723 void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) { 695 void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) {
724 FrameStateBeforeAndAfter states(this); 696 FrameStateBeforeAndAfter states(this);
725 Node* name = 697 Node* name =
726 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); 698 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
727 const Operator* op = 699 const Operator* op =
728 javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF 700 javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
729 ? Runtime::kLoadLookupSlot 701 ? Runtime::kLoadLookupSlot
730 : Runtime::kLoadLookupSlotInsideTypeof); 702 : Runtime::kLoadLookupSlotInsideTypeof);
731 Node* value = NewNode(op, name); 703 Node* value = NewNode(op, name);
732 environment()->BindAccumulator(value, &states); 704 environment()->BindAccumulator(value, &states);
(...skipping 12 matching lines...) Expand all
745 Node* value = environment()->LookupAccumulator(); 717 Node* value = environment()->LookupAccumulator();
746 Node* name = 718 Node* name =
747 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); 719 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
748 const Operator* op = javascript()->CallRuntime( 720 const Operator* op = javascript()->CallRuntime(
749 is_strict(language_mode) ? Runtime::kStoreLookupSlot_Strict 721 is_strict(language_mode) ? Runtime::kStoreLookupSlot_Strict
750 : Runtime::kStoreLookupSlot_Sloppy); 722 : Runtime::kStoreLookupSlot_Sloppy);
751 Node* store = NewNode(op, name, value); 723 Node* store = NewNode(op, name, value);
752 environment()->BindAccumulator(store, &states); 724 environment()->BindAccumulator(store, &states);
753 } 725 }
754 726
755 void BytecodeGraphBuilder::VisitLdaLookupSlotWide() { VisitLdaLookupSlot(); }
756
757 void BytecodeGraphBuilder::VisitLdaLookupSlotInsideTypeofWide() {
758 VisitLdaLookupSlotInsideTypeof();
759 }
760
761 void BytecodeGraphBuilder::VisitStaLookupSlotSloppy() { 727 void BytecodeGraphBuilder::VisitStaLookupSlotSloppy() {
762 BuildStaLookupSlot(LanguageMode::SLOPPY); 728 BuildStaLookupSlot(LanguageMode::SLOPPY);
763 } 729 }
764 730
765 void BytecodeGraphBuilder::VisitStaLookupSlotStrict() { 731 void BytecodeGraphBuilder::VisitStaLookupSlotStrict() {
766 BuildStaLookupSlot(LanguageMode::STRICT); 732 BuildStaLookupSlot(LanguageMode::STRICT);
767 } 733 }
768 734
769 void BytecodeGraphBuilder::VisitStaLookupSlotSloppyWide() {
770 VisitStaLookupSlotSloppy();
771 }
772
773 void BytecodeGraphBuilder::VisitStaLookupSlotStrictWide() {
774 VisitStaLookupSlotStrict();
775 }
776
777 void BytecodeGraphBuilder::BuildNamedLoad() { 735 void BytecodeGraphBuilder::BuildNamedLoad() {
778 FrameStateBeforeAndAfter states(this); 736 FrameStateBeforeAndAfter states(this);
779 Node* object = 737 Node* object =
780 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 738 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
781 Handle<Name> name = 739 Handle<Name> name =
782 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); 740 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1));
783 VectorSlotPair feedback = 741 VectorSlotPair feedback =
784 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); 742 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
785 743
786 const Operator* op = javascript()->LoadNamed(name, feedback); 744 const Operator* op = javascript()->LoadNamed(name, feedback);
787 Node* node = NewNode(op, object, GetFunctionClosure()); 745 Node* node = NewNode(op, object, GetFunctionClosure());
788 environment()->BindAccumulator(node, &states); 746 environment()->BindAccumulator(node, &states);
789 } 747 }
790 748
791 void BytecodeGraphBuilder::VisitLoadIC() { BuildNamedLoad(); } 749 void BytecodeGraphBuilder::VisitLoadIC() { BuildNamedLoad(); }
792 750
793 void BytecodeGraphBuilder::VisitLoadICWide() { BuildNamedLoad(); }
794
795 void BytecodeGraphBuilder::BuildKeyedLoad() { 751 void BytecodeGraphBuilder::BuildKeyedLoad() {
796 FrameStateBeforeAndAfter states(this); 752 FrameStateBeforeAndAfter states(this);
797 Node* key = environment()->LookupAccumulator(); 753 Node* key = environment()->LookupAccumulator();
798 Node* object = 754 Node* object =
799 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 755 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
800 VectorSlotPair feedback = 756 VectorSlotPair feedback =
801 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1)); 757 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(1));
802 758
803 const Operator* op = javascript()->LoadProperty(feedback); 759 const Operator* op = javascript()->LoadProperty(feedback);
804 Node* node = NewNode(op, object, key, GetFunctionClosure()); 760 Node* node = NewNode(op, object, key, GetFunctionClosure());
805 environment()->BindAccumulator(node, &states); 761 environment()->BindAccumulator(node, &states);
806 } 762 }
807 763
808 void BytecodeGraphBuilder::VisitKeyedLoadIC() { BuildKeyedLoad(); } 764 void BytecodeGraphBuilder::VisitKeyedLoadIC() { BuildKeyedLoad(); }
809 765
810 void BytecodeGraphBuilder::VisitKeyedLoadICWide() { BuildKeyedLoad(); }
811
812 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) { 766 void BytecodeGraphBuilder::BuildNamedStore(LanguageMode language_mode) {
813 FrameStateBeforeAndAfter states(this); 767 FrameStateBeforeAndAfter states(this);
814 Node* value = environment()->LookupAccumulator(); 768 Node* value = environment()->LookupAccumulator();
815 Node* object = 769 Node* object =
816 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 770 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
817 Handle<Name> name = 771 Handle<Name> name =
818 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1)); 772 Handle<Name>::cast(bytecode_iterator().GetConstantForIndexOperand(1));
819 VectorSlotPair feedback = 773 VectorSlotPair feedback =
820 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); 774 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
821 775
822 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback); 776 const Operator* op = javascript()->StoreNamed(language_mode, name, feedback);
823 Node* node = NewNode(op, object, value, GetFunctionClosure()); 777 Node* node = NewNode(op, object, value, GetFunctionClosure());
824 environment()->RecordAfterState(node, &states); 778 environment()->RecordAfterState(node, &states);
825 } 779 }
826 780
827 void BytecodeGraphBuilder::VisitStoreICSloppy() { 781 void BytecodeGraphBuilder::VisitStoreICSloppy() {
828 BuildNamedStore(LanguageMode::SLOPPY); 782 BuildNamedStore(LanguageMode::SLOPPY);
829 } 783 }
830 784
831 void BytecodeGraphBuilder::VisitStoreICStrict() { 785 void BytecodeGraphBuilder::VisitStoreICStrict() {
832 BuildNamedStore(LanguageMode::STRICT); 786 BuildNamedStore(LanguageMode::STRICT);
833 } 787 }
834 788
835 void BytecodeGraphBuilder::VisitStoreICSloppyWide() {
836 BuildNamedStore(LanguageMode::SLOPPY);
837 }
838
839 void BytecodeGraphBuilder::VisitStoreICStrictWide() {
840 BuildNamedStore(LanguageMode::STRICT);
841 }
842
843 void BytecodeGraphBuilder::BuildKeyedStore(LanguageMode language_mode) { 789 void BytecodeGraphBuilder::BuildKeyedStore(LanguageMode language_mode) {
844 FrameStateBeforeAndAfter states(this); 790 FrameStateBeforeAndAfter states(this);
845 Node* value = environment()->LookupAccumulator(); 791 Node* value = environment()->LookupAccumulator();
846 Node* object = 792 Node* object =
847 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 793 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
848 Node* key = 794 Node* key =
849 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); 795 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1));
850 VectorSlotPair feedback = 796 VectorSlotPair feedback =
851 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2)); 797 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(2));
852 798
853 const Operator* op = javascript()->StoreProperty(language_mode, feedback); 799 const Operator* op = javascript()->StoreProperty(language_mode, feedback);
854 Node* node = NewNode(op, object, key, value, GetFunctionClosure()); 800 Node* node = NewNode(op, object, key, value, GetFunctionClosure());
855 environment()->RecordAfterState(node, &states); 801 environment()->RecordAfterState(node, &states);
856 } 802 }
857 803
858 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy() { 804 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy() {
859 BuildKeyedStore(LanguageMode::SLOPPY); 805 BuildKeyedStore(LanguageMode::SLOPPY);
860 } 806 }
861 807
862 void BytecodeGraphBuilder::VisitKeyedStoreICStrict() { 808 void BytecodeGraphBuilder::VisitKeyedStoreICStrict() {
863 BuildKeyedStore(LanguageMode::STRICT); 809 BuildKeyedStore(LanguageMode::STRICT);
864 } 810 }
865 811
866 void BytecodeGraphBuilder::VisitKeyedStoreICSloppyWide() {
867 BuildKeyedStore(LanguageMode::SLOPPY);
868 }
869
870 void BytecodeGraphBuilder::VisitKeyedStoreICStrictWide() {
871 BuildKeyedStore(LanguageMode::STRICT);
872 }
873
874 void BytecodeGraphBuilder::VisitPushContext() { 812 void BytecodeGraphBuilder::VisitPushContext() {
875 Node* new_context = environment()->LookupAccumulator(); 813 Node* new_context = environment()->LookupAccumulator();
876 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0), 814 environment()->BindRegister(bytecode_iterator().GetRegisterOperand(0),
877 environment()->Context()); 815 environment()->Context());
878 environment()->SetContext(new_context); 816 environment()->SetContext(new_context);
879 } 817 }
880 818
881 void BytecodeGraphBuilder::VisitPopContext() { 819 void BytecodeGraphBuilder::VisitPopContext() {
882 Node* context = 820 Node* context =
883 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 821 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
884 environment()->SetContext(context); 822 environment()->SetContext(context);
885 } 823 }
886 824
887 void BytecodeGraphBuilder::VisitCreateClosure() { 825 void BytecodeGraphBuilder::VisitCreateClosure() {
888 Handle<SharedFunctionInfo> shared_info = Handle<SharedFunctionInfo>::cast( 826 Handle<SharedFunctionInfo> shared_info = Handle<SharedFunctionInfo>::cast(
889 bytecode_iterator().GetConstantForIndexOperand(0)); 827 bytecode_iterator().GetConstantForIndexOperand(0));
890 PretenureFlag tenured = 828 PretenureFlag tenured =
891 bytecode_iterator().GetImmediateOperand(1) ? TENURED : NOT_TENURED; 829 bytecode_iterator().GetFlagOperand(1) ? TENURED : NOT_TENURED;
892 const Operator* op = javascript()->CreateClosure(shared_info, tenured); 830 const Operator* op = javascript()->CreateClosure(shared_info, tenured);
893 Node* closure = NewNode(op); 831 Node* closure = NewNode(op);
894 environment()->BindAccumulator(closure); 832 environment()->BindAccumulator(closure);
895 } 833 }
896 834
897 void BytecodeGraphBuilder::VisitCreateClosureWide() { VisitCreateClosure(); }
898
899 void BytecodeGraphBuilder::BuildCreateArguments(CreateArgumentsType type) { 835 void BytecodeGraphBuilder::BuildCreateArguments(CreateArgumentsType type) {
900 FrameStateBeforeAndAfter states(this); 836 FrameStateBeforeAndAfter states(this);
901 const Operator* op = javascript()->CreateArguments(type); 837 const Operator* op = javascript()->CreateArguments(type);
902 Node* object = NewNode(op, GetFunctionClosure()); 838 Node* object = NewNode(op, GetFunctionClosure());
903 environment()->BindAccumulator(object, &states); 839 environment()->BindAccumulator(object, &states);
904 } 840 }
905 841
906 void BytecodeGraphBuilder::VisitCreateMappedArguments() { 842 void BytecodeGraphBuilder::VisitCreateMappedArguments() {
907 BuildCreateArguments(CreateArgumentsType::kMappedArguments); 843 BuildCreateArguments(CreateArgumentsType::kMappedArguments);
908 } 844 }
909 845
910 void BytecodeGraphBuilder::VisitCreateUnmappedArguments() { 846 void BytecodeGraphBuilder::VisitCreateUnmappedArguments() {
911 BuildCreateArguments(CreateArgumentsType::kUnmappedArguments); 847 BuildCreateArguments(CreateArgumentsType::kUnmappedArguments);
912 } 848 }
913 849
914 void BytecodeGraphBuilder::VisitCreateRestParameter() { 850 void BytecodeGraphBuilder::VisitCreateRestParameter() {
915 BuildCreateArguments(CreateArgumentsType::kRestParameter); 851 BuildCreateArguments(CreateArgumentsType::kRestParameter);
916 } 852 }
917 853
918 void BytecodeGraphBuilder::BuildCreateLiteral(const Operator* op) { 854 void BytecodeGraphBuilder::BuildCreateLiteral(const Operator* op) {
919 FrameStateBeforeAndAfter states(this); 855 FrameStateBeforeAndAfter states(this);
920 Node* literal = NewNode(op, GetFunctionClosure()); 856 Node* literal = NewNode(op, GetFunctionClosure());
921 environment()->BindAccumulator(literal, &states); 857 environment()->BindAccumulator(literal, &states);
922 } 858 }
923 859
924 void BytecodeGraphBuilder::BuildCreateRegExpLiteral() { 860 void BytecodeGraphBuilder::VisitCreateRegExpLiteral() {
925 Handle<String> constant_pattern = 861 Handle<String> constant_pattern =
926 Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(0)); 862 Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(0));
927 int literal_index = bytecode_iterator().GetIndexOperand(1); 863 int literal_index = bytecode_iterator().GetIndexOperand(1);
928 int literal_flags = bytecode_iterator().GetImmediateOperand(2); 864 int literal_flags = bytecode_iterator().GetFlagOperand(2);
929 const Operator* op = javascript()->CreateLiteralRegExp( 865 const Operator* op = javascript()->CreateLiteralRegExp(
930 constant_pattern, literal_flags, literal_index); 866 constant_pattern, literal_flags, literal_index);
931 BuildCreateLiteral(op); 867 BuildCreateLiteral(op);
932 } 868 }
933 869
934 void BytecodeGraphBuilder::VisitCreateRegExpLiteral() { 870 void BytecodeGraphBuilder::VisitCreateArrayLiteral() {
935 BuildCreateRegExpLiteral();
936 }
937
938 void BytecodeGraphBuilder::VisitCreateRegExpLiteralWide() {
939 BuildCreateRegExpLiteral();
940 }
941
942 void BytecodeGraphBuilder::BuildCreateArrayLiteral() {
943 Handle<FixedArray> constant_elements = Handle<FixedArray>::cast( 871 Handle<FixedArray> constant_elements = Handle<FixedArray>::cast(
944 bytecode_iterator().GetConstantForIndexOperand(0)); 872 bytecode_iterator().GetConstantForIndexOperand(0));
945 int literal_index = bytecode_iterator().GetIndexOperand(1); 873 int literal_index = bytecode_iterator().GetIndexOperand(1);
946 int literal_flags = bytecode_iterator().GetImmediateOperand(2); 874 int literal_flags = bytecode_iterator().GetFlagOperand(2);
947 int number_of_elements = constant_elements->length(); 875 int number_of_elements = constant_elements->length();
948 const Operator* op = javascript()->CreateLiteralArray( 876 const Operator* op = javascript()->CreateLiteralArray(
949 constant_elements, literal_flags, literal_index, number_of_elements); 877 constant_elements, literal_flags, literal_index, number_of_elements);
950 BuildCreateLiteral(op); 878 BuildCreateLiteral(op);
951 } 879 }
952 880
953 void BytecodeGraphBuilder::VisitCreateArrayLiteral() { 881 void BytecodeGraphBuilder::VisitCreateObjectLiteral() {
954 BuildCreateArrayLiteral();
955 }
956
957 void BytecodeGraphBuilder::VisitCreateArrayLiteralWide() {
958 BuildCreateArrayLiteral();
959 }
960
961 void BytecodeGraphBuilder::BuildCreateObjectLiteral() {
962 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast( 882 Handle<FixedArray> constant_properties = Handle<FixedArray>::cast(
963 bytecode_iterator().GetConstantForIndexOperand(0)); 883 bytecode_iterator().GetConstantForIndexOperand(0));
964 int literal_index = bytecode_iterator().GetIndexOperand(1); 884 int literal_index = bytecode_iterator().GetIndexOperand(1);
965 int literal_flags = bytecode_iterator().GetImmediateOperand(2); 885 int literal_flags = bytecode_iterator().GetFlagOperand(2);
966 // TODO(mstarzinger): Thread through number of properties. 886 // TODO(mstarzinger): Thread through number of properties.
967 int number_of_properties = constant_properties->length() / 2; 887 int number_of_properties = constant_properties->length() / 2;
968 const Operator* op = javascript()->CreateLiteralObject( 888 const Operator* op = javascript()->CreateLiteralObject(
969 constant_properties, literal_flags, literal_index, number_of_properties); 889 constant_properties, literal_flags, literal_index, number_of_properties);
970 BuildCreateLiteral(op); 890 BuildCreateLiteral(op);
971 } 891 }
972 892
973 void BytecodeGraphBuilder::VisitCreateObjectLiteral() {
974 BuildCreateObjectLiteral();
975 }
976
977 void BytecodeGraphBuilder::VisitCreateObjectLiteralWide() {
978 BuildCreateObjectLiteral();
979 }
980
981
982 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, 893 Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op,
983 Node* callee, 894 Node* callee,
984 interpreter::Register receiver, 895 interpreter::Register receiver,
985 size_t arity) { 896 size_t arity) {
986 Node** all = local_zone()->NewArray<Node*>(static_cast<int>(arity)); 897 Node** all = local_zone()->NewArray<Node*>(static_cast<int>(arity));
987 all[0] = callee; 898 all[0] = callee;
988 all[1] = environment()->LookupRegister(receiver); 899 all[1] = environment()->LookupRegister(receiver);
989 int receiver_index = receiver.index(); 900 int receiver_index = receiver.index();
990 for (int i = 2; i < static_cast<int>(arity); ++i) { 901 for (int i = 2; i < static_cast<int>(arity); ++i) {
991 all[i] = environment()->LookupRegister( 902 all[i] = environment()->LookupRegister(
(...skipping 17 matching lines...) Expand all
1009 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3)); 920 CreateVectorSlotPair(bytecode_iterator().GetIndexOperand(3));
1010 921
1011 const Operator* call = javascript()->CallFunction( 922 const Operator* call = javascript()->CallFunction(
1012 arg_count + 1, feedback, receiver_hint, tail_call_mode); 923 arg_count + 1, feedback, receiver_hint, tail_call_mode);
1013 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); 924 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1);
1014 environment()->BindAccumulator(value, &states); 925 environment()->BindAccumulator(value, &states);
1015 } 926 }
1016 927
1017 void BytecodeGraphBuilder::VisitCall() { BuildCall(TailCallMode::kDisallow); } 928 void BytecodeGraphBuilder::VisitCall() { BuildCall(TailCallMode::kDisallow); }
1018 929
1019 void BytecodeGraphBuilder::VisitCallWide() {
1020 BuildCall(TailCallMode::kDisallow);
1021 }
1022
1023 void BytecodeGraphBuilder::VisitTailCall() { BuildCall(TailCallMode::kAllow); } 930 void BytecodeGraphBuilder::VisitTailCall() { BuildCall(TailCallMode::kAllow); }
1024 931
1025 void BytecodeGraphBuilder::VisitTailCallWide() { 932 void BytecodeGraphBuilder::VisitCallJSRuntime() {
1026 BuildCall(TailCallMode::kAllow);
1027 }
1028
1029 void BytecodeGraphBuilder::BuildCallJSRuntime() {
1030 FrameStateBeforeAndAfter states(this); 933 FrameStateBeforeAndAfter states(this);
1031 Node* callee = 934 Node* callee =
1032 BuildLoadNativeContextField(bytecode_iterator().GetIndexOperand(0)); 935 BuildLoadNativeContextField(bytecode_iterator().GetIndexOperand(0));
1033 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1); 936 interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1);
1034 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 937 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1035 938
1036 // Create node to perform the JS runtime call. 939 // Create node to perform the JS runtime call.
1037 const Operator* call = javascript()->CallFunction(arg_count + 1); 940 const Operator* call = javascript()->CallFunction(arg_count + 1);
1038 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); 941 Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1);
1039 environment()->BindAccumulator(value, &states); 942 environment()->BindAccumulator(value, &states);
1040 } 943 }
1041 944
1042 void BytecodeGraphBuilder::VisitCallJSRuntime() { BuildCallJSRuntime(); }
1043
1044 void BytecodeGraphBuilder::VisitCallJSRuntimeWide() { BuildCallJSRuntime(); }
1045
1046 Node* BytecodeGraphBuilder::ProcessCallRuntimeArguments( 945 Node* BytecodeGraphBuilder::ProcessCallRuntimeArguments(
1047 const Operator* call_runtime_op, interpreter::Register first_arg, 946 const Operator* call_runtime_op, interpreter::Register first_arg,
1048 size_t arity) { 947 size_t arity) {
1049 Node** all = local_zone()->NewArray<Node*>(arity); 948 Node** all = local_zone()->NewArray<Node*>(arity);
1050 int first_arg_index = first_arg.index(); 949 int first_arg_index = first_arg.index();
1051 for (int i = 0; i < static_cast<int>(arity); ++i) { 950 for (int i = 0; i < static_cast<int>(arity); ++i) {
1052 all[i] = environment()->LookupRegister( 951 all[i] = environment()->LookupRegister(
1053 interpreter::Register(first_arg_index + i)); 952 interpreter::Register(first_arg_index + i));
1054 } 953 }
1055 Node* value = MakeNode(call_runtime_op, static_cast<int>(arity), all, false); 954 Node* value = MakeNode(call_runtime_op, static_cast<int>(arity), all, false);
1056 return value; 955 return value;
1057 } 956 }
1058 957
1059 void BytecodeGraphBuilder::BuildCallRuntime() { 958 void BytecodeGraphBuilder::VisitCallRuntime() {
1060 FrameStateBeforeAndAfter states(this); 959 FrameStateBeforeAndAfter states(this);
1061 Runtime::FunctionId functionId = 960 Runtime::FunctionId functionId = static_cast<Runtime::FunctionId>(
1062 static_cast<Runtime::FunctionId>(bytecode_iterator().GetIndexOperand(0)); 961 bytecode_iterator().GetRuntimeIdOperand(0));
1063 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); 962 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
1064 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 963 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1065 964
1066 // Create node to perform the runtime call. 965 // Create node to perform the runtime call.
1067 const Operator* call = javascript()->CallRuntime(functionId, arg_count); 966 const Operator* call = javascript()->CallRuntime(functionId, arg_count);
1068 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count); 967 Node* value = ProcessCallRuntimeArguments(call, first_arg, arg_count);
1069 environment()->BindAccumulator(value, &states); 968 environment()->BindAccumulator(value, &states);
1070 } 969 }
1071 970
1072 void BytecodeGraphBuilder::VisitCallRuntime() { BuildCallRuntime(); } 971 void BytecodeGraphBuilder::VisitCallRuntimeForPair() {
1073
1074 void BytecodeGraphBuilder::VisitCallRuntimeWide() { BuildCallRuntime(); }
1075
1076 void BytecodeGraphBuilder::BuildCallRuntimeForPair() {
1077 FrameStateBeforeAndAfter states(this); 972 FrameStateBeforeAndAfter states(this);
1078 Runtime::FunctionId functionId = 973 Runtime::FunctionId functionId = static_cast<Runtime::FunctionId>(
1079 static_cast<Runtime::FunctionId>(bytecode_iterator().GetIndexOperand(0)); 974 bytecode_iterator().GetRuntimeIdOperand(0));
1080 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); 975 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
1081 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 976 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1082 interpreter::Register first_return = 977 interpreter::Register first_return =
1083 bytecode_iterator().GetRegisterOperand(3); 978 bytecode_iterator().GetRegisterOperand(3);
1084 979
1085 // Create node to perform the runtime call. 980 // Create node to perform the runtime call.
1086 const Operator* call = javascript()->CallRuntime(functionId, arg_count); 981 const Operator* call = javascript()->CallRuntime(functionId, arg_count);
1087 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count); 982 Node* return_pair = ProcessCallRuntimeArguments(call, first_arg, arg_count);
1088 environment()->BindRegistersToProjections(first_return, return_pair, &states); 983 environment()->BindRegistersToProjections(first_return, return_pair, &states);
1089 } 984 }
1090 985
1091 void BytecodeGraphBuilder::VisitCallRuntimeForPair() {
1092 BuildCallRuntimeForPair();
1093 }
1094
1095 void BytecodeGraphBuilder::VisitCallRuntimeForPairWide() {
1096 BuildCallRuntimeForPair();
1097 }
1098
1099 Node* BytecodeGraphBuilder::ProcessCallNewArguments( 986 Node* BytecodeGraphBuilder::ProcessCallNewArguments(
1100 const Operator* call_new_op, Node* callee, Node* new_target, 987 const Operator* call_new_op, Node* callee, Node* new_target,
1101 interpreter::Register first_arg, size_t arity) { 988 interpreter::Register first_arg, size_t arity) {
1102 Node** all = local_zone()->NewArray<Node*>(arity); 989 Node** all = local_zone()->NewArray<Node*>(arity);
1103 all[0] = new_target; 990 all[0] = new_target;
1104 int first_arg_index = first_arg.index(); 991 int first_arg_index = first_arg.index();
1105 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) { 992 for (int i = 1; i < static_cast<int>(arity) - 1; ++i) {
1106 all[i] = environment()->LookupRegister( 993 all[i] = environment()->LookupRegister(
1107 interpreter::Register(first_arg_index + i - 1)); 994 interpreter::Register(first_arg_index + i - 1));
1108 } 995 }
1109 all[arity - 1] = callee; 996 all[arity - 1] = callee;
1110 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false); 997 Node* value = MakeNode(call_new_op, static_cast<int>(arity), all, false);
1111 return value; 998 return value;
1112 } 999 }
1113 1000
1114 void BytecodeGraphBuilder::BuildCallConstruct() { 1001 void BytecodeGraphBuilder::VisitNew() {
1115 FrameStateBeforeAndAfter states(this); 1002 FrameStateBeforeAndAfter states(this);
1116 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0); 1003 interpreter::Register callee_reg = bytecode_iterator().GetRegisterOperand(0);
1117 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1); 1004 interpreter::Register first_arg = bytecode_iterator().GetRegisterOperand(1);
1118 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); 1005 size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2);
1119 1006
1120 Node* new_target = environment()->LookupAccumulator(); 1007 Node* new_target = environment()->LookupAccumulator();
1121 Node* callee = environment()->LookupRegister(callee_reg); 1008 Node* callee = environment()->LookupRegister(callee_reg);
1122 // TODO(turbofan): Pass the feedback here. 1009 // TODO(turbofan): Pass the feedback here.
1123 const Operator* call = javascript()->CallConstruct( 1010 const Operator* call = javascript()->CallConstruct(
1124 static_cast<int>(arg_count) + 2, VectorSlotPair()); 1011 static_cast<int>(arg_count) + 2, VectorSlotPair());
1125 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg, 1012 Node* value = ProcessCallNewArguments(call, callee, new_target, first_arg,
1126 arg_count + 2); 1013 arg_count + 2);
1127 environment()->BindAccumulator(value, &states); 1014 environment()->BindAccumulator(value, &states);
1128 } 1015 }
1129 1016
1130 void BytecodeGraphBuilder::VisitNew() { BuildCallConstruct(); }
1131
1132 void BytecodeGraphBuilder::VisitNewWide() { BuildCallConstruct(); }
1133
1134 void BytecodeGraphBuilder::BuildThrow() { 1017 void BytecodeGraphBuilder::BuildThrow() {
1135 FrameStateBeforeAndAfter states(this); 1018 FrameStateBeforeAndAfter states(this);
1136 Node* value = environment()->LookupAccumulator(); 1019 Node* value = environment()->LookupAccumulator();
1137 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value); 1020 Node* call = NewNode(javascript()->CallRuntime(Runtime::kThrow), value);
1138 environment()->BindAccumulator(call, &states); 1021 environment()->BindAccumulator(call, &states);
1139 } 1022 }
1140 1023
1141 void BytecodeGraphBuilder::VisitThrow() { 1024 void BytecodeGraphBuilder::VisitThrow() {
1142 BuildThrow(); 1025 BuildThrow();
1143 Node* call = environment()->LookupAccumulator(); 1026 Node* call = environment()->LookupAccumulator();
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 } 1207 }
1325 1208
1326 void BytecodeGraphBuilder::VisitToNumber() { 1209 void BytecodeGraphBuilder::VisitToNumber() {
1327 BuildCastOperator(javascript()->ToNumber()); 1210 BuildCastOperator(javascript()->ToNumber());
1328 } 1211 }
1329 1212
1330 void BytecodeGraphBuilder::VisitJump() { BuildJump(); } 1213 void BytecodeGraphBuilder::VisitJump() { BuildJump(); }
1331 1214
1332 void BytecodeGraphBuilder::VisitJumpConstant() { BuildJump(); } 1215 void BytecodeGraphBuilder::VisitJumpConstant() { BuildJump(); }
1333 1216
1334 void BytecodeGraphBuilder::VisitJumpConstantWide() { BuildJump(); }
1335 1217
1336 void BytecodeGraphBuilder::VisitJumpIfTrue() { 1218 void BytecodeGraphBuilder::VisitJumpIfTrue() {
1337 BuildJumpIfEqual(jsgraph()->TrueConstant()); 1219 BuildJumpIfEqual(jsgraph()->TrueConstant());
1338 } 1220 }
1339 1221
1340 void BytecodeGraphBuilder::VisitJumpIfTrueConstant() { 1222 void BytecodeGraphBuilder::VisitJumpIfTrueConstant() {
1341 BuildJumpIfEqual(jsgraph()->TrueConstant()); 1223 BuildJumpIfEqual(jsgraph()->TrueConstant());
1342 } 1224 }
1343 1225
1344 void BytecodeGraphBuilder::VisitJumpIfTrueConstantWide() {
1345 BuildJumpIfEqual(jsgraph()->TrueConstant());
1346 }
1347
1348 void BytecodeGraphBuilder::VisitJumpIfFalse() { 1226 void BytecodeGraphBuilder::VisitJumpIfFalse() {
1349 BuildJumpIfEqual(jsgraph()->FalseConstant()); 1227 BuildJumpIfEqual(jsgraph()->FalseConstant());
1350 } 1228 }
1351 1229
1352 void BytecodeGraphBuilder::VisitJumpIfFalseConstant() { 1230 void BytecodeGraphBuilder::VisitJumpIfFalseConstant() {
1353 BuildJumpIfEqual(jsgraph()->FalseConstant()); 1231 BuildJumpIfEqual(jsgraph()->FalseConstant());
1354 } 1232 }
1355 1233
1356 void BytecodeGraphBuilder::VisitJumpIfFalseConstantWide() {
1357 BuildJumpIfEqual(jsgraph()->FalseConstant());
1358 }
1359
1360 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrue() { 1234 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrue() {
1361 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant()); 1235 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant());
1362 } 1236 }
1363 1237
1364 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstant() { 1238 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstant() {
1365 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant()); 1239 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant());
1366 } 1240 }
1367 1241
1368 void BytecodeGraphBuilder::VisitJumpIfToBooleanTrueConstantWide() {
1369 BuildJumpIfToBooleanEqual(jsgraph()->TrueConstant());
1370 }
1371
1372 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalse() { 1242 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalse() {
1373 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); 1243 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant());
1374 } 1244 }
1375 1245
1376 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant() { 1246 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstant() {
1377 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant()); 1247 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant());
1378 } 1248 }
1379 1249
1380 void BytecodeGraphBuilder::VisitJumpIfToBooleanFalseConstantWide() {
1381 BuildJumpIfToBooleanEqual(jsgraph()->FalseConstant());
1382 }
1383
1384 void BytecodeGraphBuilder::VisitJumpIfNotHole() { BuildJumpIfNotHole(); } 1250 void BytecodeGraphBuilder::VisitJumpIfNotHole() { BuildJumpIfNotHole(); }
1385 1251
1386 void BytecodeGraphBuilder::VisitJumpIfNotHoleConstant() { 1252 void BytecodeGraphBuilder::VisitJumpIfNotHoleConstant() {
1387 BuildJumpIfNotHole(); 1253 BuildJumpIfNotHole();
1388 } 1254 }
1389 1255
1390 void BytecodeGraphBuilder::VisitJumpIfNotHoleConstantWide() {
1391 BuildJumpIfNotHole();
1392 }
1393
1394 void BytecodeGraphBuilder::VisitJumpIfNull() { 1256 void BytecodeGraphBuilder::VisitJumpIfNull() {
1395 BuildJumpIfEqual(jsgraph()->NullConstant()); 1257 BuildJumpIfEqual(jsgraph()->NullConstant());
1396 } 1258 }
1397 1259
1398 void BytecodeGraphBuilder::VisitJumpIfNullConstant() { 1260 void BytecodeGraphBuilder::VisitJumpIfNullConstant() {
1399 BuildJumpIfEqual(jsgraph()->NullConstant()); 1261 BuildJumpIfEqual(jsgraph()->NullConstant());
1400 } 1262 }
1401 1263
1402 void BytecodeGraphBuilder::VisitJumpIfNullConstantWide() {
1403 BuildJumpIfEqual(jsgraph()->NullConstant());
1404 }
1405
1406 void BytecodeGraphBuilder::VisitJumpIfUndefined() { 1264 void BytecodeGraphBuilder::VisitJumpIfUndefined() {
1407 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); 1265 BuildJumpIfEqual(jsgraph()->UndefinedConstant());
1408 } 1266 }
1409 1267
1410 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant() { 1268 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant() {
1411 BuildJumpIfEqual(jsgraph()->UndefinedConstant()); 1269 BuildJumpIfEqual(jsgraph()->UndefinedConstant());
1412 } 1270 }
1413 1271
1414 void BytecodeGraphBuilder::VisitJumpIfUndefinedConstantWide() {
1415 BuildJumpIfEqual(jsgraph()->UndefinedConstant());
1416 }
1417
1418 void BytecodeGraphBuilder::VisitStackCheck() { 1272 void BytecodeGraphBuilder::VisitStackCheck() {
1419 FrameStateBeforeAndAfter states(this); 1273 FrameStateBeforeAndAfter states(this);
1420 Node* node = NewNode(javascript()->StackCheck()); 1274 Node* node = NewNode(javascript()->StackCheck());
1421 environment()->RecordAfterState(node, &states); 1275 environment()->RecordAfterState(node, &states);
1422 } 1276 }
1423 1277
1424 void BytecodeGraphBuilder::VisitReturn() { 1278 void BytecodeGraphBuilder::VisitReturn() {
1425 Node* control = 1279 Node* control =
1426 NewNode(common()->Return(), environment()->LookupAccumulator()); 1280 NewNode(common()->Return(), environment()->LookupAccumulator());
1427 MergeControlToLeaveFunction(control); 1281 MergeControlToLeaveFunction(control);
(...skipping 15 matching lines...) Expand all
1443 void BytecodeGraphBuilder::BuildForInPrepare() { 1297 void BytecodeGraphBuilder::BuildForInPrepare() {
1444 FrameStateBeforeAndAfter states(this); 1298 FrameStateBeforeAndAfter states(this);
1445 Node* receiver = environment()->LookupAccumulator(); 1299 Node* receiver = environment()->LookupAccumulator();
1446 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver); 1300 Node* prepare = NewNode(javascript()->ForInPrepare(), receiver);
1447 environment()->BindRegistersToProjections( 1301 environment()->BindRegistersToProjections(
1448 bytecode_iterator().GetRegisterOperand(0), prepare, &states); 1302 bytecode_iterator().GetRegisterOperand(0), prepare, &states);
1449 } 1303 }
1450 1304
1451 void BytecodeGraphBuilder::VisitForInPrepare() { BuildForInPrepare(); } 1305 void BytecodeGraphBuilder::VisitForInPrepare() { BuildForInPrepare(); }
1452 1306
1453 void BytecodeGraphBuilder::VisitForInPrepareWide() { BuildForInPrepare(); }
1454
1455 void BytecodeGraphBuilder::VisitForInDone() { 1307 void BytecodeGraphBuilder::VisitForInDone() {
1456 FrameStateBeforeAndAfter states(this); 1308 FrameStateBeforeAndAfter states(this);
1457 Node* index = 1309 Node* index =
1458 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1310 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1459 Node* cache_length = 1311 Node* cache_length =
1460 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); 1312 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1));
1461 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length); 1313 Node* exit_cond = NewNode(javascript()->ForInDone(), index, cache_length);
1462 environment()->BindAccumulator(exit_cond, &states); 1314 environment()->BindAccumulator(exit_cond, &states);
1463 } 1315 }
1464 1316
1465 void BytecodeGraphBuilder::BuildForInNext() { 1317 void BytecodeGraphBuilder::BuildForInNext() {
1466 FrameStateBeforeAndAfter states(this); 1318 FrameStateBeforeAndAfter states(this);
1467 Node* receiver = 1319 Node* receiver =
1468 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1320 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1469 Node* index = 1321 Node* index =
1470 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); 1322 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1));
1471 int catch_reg_pair_index = bytecode_iterator().GetRegisterOperand(2).index(); 1323 int catch_reg_pair_index = bytecode_iterator().GetRegisterOperand(2).index();
1472 Node* cache_type = environment()->LookupRegister( 1324 Node* cache_type = environment()->LookupRegister(
1473 interpreter::Register(catch_reg_pair_index)); 1325 interpreter::Register(catch_reg_pair_index));
1474 Node* cache_array = environment()->LookupRegister( 1326 Node* cache_array = environment()->LookupRegister(
1475 interpreter::Register(catch_reg_pair_index + 1)); 1327 interpreter::Register(catch_reg_pair_index + 1));
1476 1328
1477 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array, 1329 Node* value = NewNode(javascript()->ForInNext(), receiver, cache_array,
1478 cache_type, index); 1330 cache_type, index);
1479 environment()->BindAccumulator(value, &states); 1331 environment()->BindAccumulator(value, &states);
1480 } 1332 }
1481 1333
1482 void BytecodeGraphBuilder::VisitForInNext() { BuildForInNext(); } 1334 void BytecodeGraphBuilder::VisitForInNext() { BuildForInNext(); }
1483 1335
1484 void BytecodeGraphBuilder::VisitForInNextWide() { BuildForInNext(); }
1485
1486 void BytecodeGraphBuilder::VisitForInStep() { 1336 void BytecodeGraphBuilder::VisitForInStep() {
1487 FrameStateBeforeAndAfter states(this); 1337 FrameStateBeforeAndAfter states(this);
1488 Node* index = 1338 Node* index =
1489 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); 1339 environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
1490 index = NewNode(javascript()->ForInStep(), index); 1340 index = NewNode(javascript()->ForInStep(), index);
1491 environment()->BindAccumulator(index, &states); 1341 environment()->BindAccumulator(index, &states);
1492 } 1342 }
1493 1343
1344 void BytecodeGraphBuilder::VisitWide() {
1345 // Consumed by the BytecodeArrayIterator.
1346 UNREACHABLE();
1347 }
1348
1349 void BytecodeGraphBuilder::VisitExtraWide() {
1350 // Consumed by the BytecodeArrayIterator.
1351 UNREACHABLE();
1352 }
1353
1354 void BytecodeGraphBuilder::VisitIllegal() {
1355 // Never present in valid bytecode.
1356 UNREACHABLE();
1357 }
1358
1494 void BytecodeGraphBuilder::SwitchToMergeEnvironment(int current_offset) { 1359 void BytecodeGraphBuilder::SwitchToMergeEnvironment(int current_offset) {
1495 if (merge_environments_[current_offset] != nullptr) { 1360 if (merge_environments_[current_offset] != nullptr) {
1496 if (environment() != nullptr) { 1361 if (environment() != nullptr) {
1497 merge_environments_[current_offset]->Merge(environment()); 1362 merge_environments_[current_offset]->Merge(environment());
1498 } 1363 }
1499 set_environment(merge_environments_[current_offset]); 1364 set_environment(merge_environments_[current_offset]);
1500 } 1365 }
1501 } 1366 }
1502 1367
1503 void BytecodeGraphBuilder::BuildLoopHeaderEnvironment(int current_offset) { 1368 void BytecodeGraphBuilder::BuildLoopHeaderEnvironment(int current_offset) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 // Phi does not exist yet, introduce one. 1621 // Phi does not exist yet, introduce one.
1757 value = NewPhi(inputs, value, control); 1622 value = NewPhi(inputs, value, control);
1758 value->ReplaceInput(inputs - 1, other); 1623 value->ReplaceInput(inputs - 1, other);
1759 } 1624 }
1760 return value; 1625 return value;
1761 } 1626 }
1762 1627
1763 } // namespace compiler 1628 } // namespace compiler
1764 } // namespace internal 1629 } // namespace internal
1765 } // namespace v8 1630 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/debug/debug.cc » ('j') | src/debug/debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698