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

Side by Side Diff: test/unittests/compiler/scheduler-unittest.cc

Issue 1140583004: [turbofan] Add frame state before JavaScript comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove obsolete #if 0. Slightly refactor strong mode check. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/unittests/compiler/js-operator-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/access-builder.h" 5 #include "src/compiler/access-builder.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/graph-visualizer.h" 8 #include "src/compiler/graph-visualizer.h"
9 #include "src/compiler/js-operator.h" 9 #include "src/compiler/js-operator.h"
10 #include "src/compiler/node.h" 10 #include "src/compiler/node.h"
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 Node* ret = graph()->NewNode(common()->Return(), p1, graph()->start(), 643 Node* ret = graph()->NewNode(common()->Return(), p1, graph()->start(),
644 graph()->start()); 644 graph()->start());
645 645
646 graph()->SetEnd(graph()->NewNode(common()->End(), ret)); 646 graph()->SetEnd(graph()->NewNode(common()->End(), ret));
647 647
648 USE(Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kNoFlags)); 648 USE(Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kNoFlags));
649 } 649 }
650 650
651 651
652 TEST_F(SchedulerTest, BuildScheduleIfSplit) { 652 TEST_F(SchedulerTest, BuildScheduleIfSplit) {
653 graph()->SetStart(graph()->NewNode(common()->Start(3))); 653 graph()->SetStart(graph()->NewNode(common()->Start(5)));
654 654
655 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start()); 655 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start());
656 Node* p2 = graph()->NewNode(common()->Parameter(1), graph()->start()); 656 Node* p2 = graph()->NewNode(common()->Parameter(1), graph()->start());
657 Node* p3 = graph()->NewNode(common()->Parameter(2), graph()->start()); 657 Node* p3 = graph()->NewNode(common()->Parameter(2), graph()->start());
658 Node* p4 = graph()->NewNode(common()->Parameter(3), graph()->start()); 658 Node* p4 = graph()->NewNode(common()->Parameter(3), graph()->start());
659 Node* p5 = graph()->NewNode(common()->Parameter(4), graph()->start()); 659 Node* p5 = graph()->NewNode(common()->Parameter(4), graph()->start());
660 Node* cmp = graph()->NewNode(js()->LessThanOrEqual(LanguageMode::SLOPPY), p1, 660 Node* cmp = graph()->NewNode(js()->LessThanOrEqual(LanguageMode::SLOPPY), p1,
661 p2, p3, graph()->start(), graph()->start()); 661 p2, p3, p4, graph()->start(), graph()->start());
662 Node* branch = graph()->NewNode(common()->Branch(), cmp, graph()->start()); 662 Node* branch = graph()->NewNode(common()->Branch(), cmp, graph()->start());
663 Node* true_branch = graph()->NewNode(common()->IfTrue(), branch); 663 Node* true_branch = graph()->NewNode(common()->IfTrue(), branch);
664 Node* false_branch = graph()->NewNode(common()->IfFalse(), branch); 664 Node* false_branch = graph()->NewNode(common()->IfFalse(), branch);
665 665
666 Node* ret1 = 666 Node* ret1 =
667 graph()->NewNode(common()->Return(), p4, graph()->start(), true_branch); 667 graph()->NewNode(common()->Return(), p4, graph()->start(), true_branch);
668 Node* ret2 = 668 Node* ret2 =
669 graph()->NewNode(common()->Return(), p5, graph()->start(), false_branch); 669 graph()->NewNode(common()->Return(), p5, graph()->start(), false_branch);
670 Node* merge = graph()->NewNode(common()->Merge(2), ret1, ret2); 670 Node* merge = graph()->NewNode(common()->Merge(2), ret1, ret2);
671 graph()->SetEnd(graph()->NewNode(common()->End(), merge)); 671 graph()->SetEnd(graph()->NewNode(common()->End(), merge));
672 672
673 ComputeAndVerifySchedule(13); 673 ComputeAndVerifySchedule(13);
674 } 674 }
675 675
676 676
677 TEST_F(SchedulerTest, BuildScheduleIfSplitWithEffects) {
678 const Operator* op;
679 Unique<HeapObject> unique_constant =
680 Unique<HeapObject>::CreateImmovable(factory()->undefined_value());
681
682 // Manually transcripted code for:
683 // function turbo_fan_test(a, b, c, y) {
684 // if (a < b) {
685 // return a + b - c * c - a + y;
686 // } else {
687 // return c * c - a;
688 // }
689 // }
690 Node* nil = graph()->NewNode(common()->Dead());
691 op = common()->End();
692 Node* n39 = graph()->NewNode(op, nil);
693 USE(n39);
694 op = common()->Merge(2);
695 Node* n37 = graph()->NewNode(op, nil, nil);
696 USE(n37);
697 op = common()->Return();
698 Node* n29 = graph()->NewNode(op, nil, nil, nil);
699 USE(n29);
700 op = common()->Return();
701 Node* n36 = graph()->NewNode(op, nil, nil, nil);
702 USE(n36);
703 op = js()->Add(LanguageMode::SLOPPY);
704 Node* n27 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
705 USE(n27);
706 op = common()->IfSuccess();
707 Node* n28 = graph()->NewNode(op, nil);
708 USE(n28);
709 op = js()->Subtract(LanguageMode::SLOPPY);
710 Node* n34 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
711 USE(n34);
712 op = common()->IfSuccess();
713 Node* n35 = graph()->NewNode(op, nil);
714 USE(n35);
715 op = js()->Subtract(LanguageMode::SLOPPY);
716 Node* n25 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
717 USE(n25);
718 op = common()->Parameter(4);
719 Node* n5 = graph()->NewNode(op, nil);
720 USE(n5);
721 op = common()->Parameter(5);
722 Node* n7 = graph()->NewNode(op, nil);
723 USE(n7);
724 op = common()->FrameState(JS_FRAME, BailoutId(-1),
725 OutputFrameStateCombine::Ignore());
726 Node* n13 = graph()->NewNode(op, nil, nil, nil, nil, nil);
727 USE(n13);
728 op = common()->IfSuccess();
729 Node* n26 = graph()->NewNode(op, nil);
730 USE(n26);
731 op = js()->Multiply(LanguageMode::SLOPPY);
732 Node* n32 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
733 USE(n32);
734 op = common()->Parameter(1);
735 Node* n2 = graph()->NewNode(op, nil);
736 USE(n2);
737 op = common()->IfSuccess();
738 Node* n33 = graph()->NewNode(op, nil);
739 USE(n33);
740 op = js()->Subtract(LanguageMode::SLOPPY);
741 Node* n23 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
742 USE(n23);
743 op = common()->IfSuccess();
744 Node* n24 = graph()->NewNode(op, nil);
745 USE(n24);
746 op = common()->Start(4);
747 Node* n0 = graph()->NewNode(op);
748 USE(n0);
749 op = common()->StateValues(0);
750 Node* n11 = graph()->NewNode(op);
751 USE(n11);
752 op = common()->NumberConstant(0);
753 Node* n12 = graph()->NewNode(op);
754 USE(n12);
755 op = common()->HeapConstant(unique_constant);
756 Node* n6 = graph()->NewNode(op);
757 USE(n6);
758 op = common()->Parameter(3);
759 Node* n4 = graph()->NewNode(op, nil);
760 USE(n4);
761 op = js()->LessThan(LanguageMode::SLOPPY);
762 Node* n15 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil);
763 USE(n15);
764 op = common()->IfFalse();
765 Node* n31 = graph()->NewNode(op, nil);
766 USE(n31);
767 op = js()->Add(LanguageMode::SLOPPY);
768 Node* n19 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
769 USE(n19);
770 op = js()->Multiply(LanguageMode::SLOPPY);
771 Node* n21 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
772 USE(n21);
773 op = common()->IfSuccess();
774 Node* n22 = graph()->NewNode(op, nil);
775 USE(n22);
776 op = common()->Parameter(2);
777 Node* n3 = graph()->NewNode(op, nil);
778 USE(n3);
779 op = js()->StackCheck();
780 Node* n9 = graph()->NewNode(op, nil, nil, nil, nil);
781 USE(n9);
782 op = common()->IfSuccess();
783 Node* n10 = graph()->NewNode(op, nil);
784 USE(n10);
785 op = common()->Branch();
786 Node* n17 = graph()->NewNode(op, nil, nil);
787 USE(n17);
788 op = common()->IfTrue();
789 Node* n18 = graph()->NewNode(op, nil);
790 USE(n18);
791 op = common()->IfSuccess();
792 Node* n20 = graph()->NewNode(op, nil);
793 USE(n20);
794 op = common()->IfSuccess();
795 Node* n16 = graph()->NewNode(op, nil);
796 USE(n16);
797 n39->ReplaceInput(0, n37);
798 n37->ReplaceInput(0, n29);
799 n37->ReplaceInput(1, n36);
800 n29->ReplaceInput(0, n27);
801 n29->ReplaceInput(1, n27);
802 n29->ReplaceInput(2, n28);
803 n36->ReplaceInput(0, n34);
804 n36->ReplaceInput(1, n34);
805 n36->ReplaceInput(2, n35);
806 n27->ReplaceInput(0, n25);
807 n27->ReplaceInput(1, n5);
808 n27->ReplaceInput(2, n7);
809 n27->ReplaceInput(3, n13);
810 n27->ReplaceInput(4, n13);
811 n27->ReplaceInput(5, n25);
812 n27->ReplaceInput(6, n26);
813 n28->ReplaceInput(0, n27);
814 n34->ReplaceInput(0, n32);
815 n34->ReplaceInput(1, n2);
816 n34->ReplaceInput(2, n7);
817 n34->ReplaceInput(3, n13);
818 n34->ReplaceInput(4, n13);
819 n34->ReplaceInput(5, n32);
820 n34->ReplaceInput(6, n33);
821 n35->ReplaceInput(0, n34);
822 n25->ReplaceInput(0, n23);
823 n25->ReplaceInput(1, n2);
824 n25->ReplaceInput(2, n7);
825 n25->ReplaceInput(3, n13);
826 n25->ReplaceInput(4, n13);
827 n25->ReplaceInput(5, n23);
828 n25->ReplaceInput(6, n24);
829 n5->ReplaceInput(0, n0);
830 n7->ReplaceInput(0, n0);
831 n13->ReplaceInput(0, n11);
832 n13->ReplaceInput(1, n11);
833 n13->ReplaceInput(2, n11);
834 n13->ReplaceInput(3, n12);
835 n13->ReplaceInput(4, n6);
836 n26->ReplaceInput(0, n25);
837 n32->ReplaceInput(0, n4);
838 n32->ReplaceInput(1, n4);
839 n32->ReplaceInput(2, n7);
840 n32->ReplaceInput(3, n13);
841 n32->ReplaceInput(4, n13);
842 n32->ReplaceInput(5, n15);
843 n32->ReplaceInput(6, n31);
844 n2->ReplaceInput(0, n0);
845 n33->ReplaceInput(0, n32);
846 n23->ReplaceInput(0, n19);
847 n23->ReplaceInput(1, n21);
848 n23->ReplaceInput(2, n7);
849 n23->ReplaceInput(3, n13);
850 n23->ReplaceInput(4, n13);
851 n23->ReplaceInput(5, n21);
852 n23->ReplaceInput(6, n22);
853 n24->ReplaceInput(0, n23);
854 n4->ReplaceInput(0, n0);
855 n15->ReplaceInput(0, n2);
856 n15->ReplaceInput(1, n3);
857 n15->ReplaceInput(2, n7);
858 n15->ReplaceInput(3, n13);
859 n15->ReplaceInput(4, n9);
860 n15->ReplaceInput(5, n10);
861 n31->ReplaceInput(0, n17);
862 n19->ReplaceInput(0, n2);
863 n19->ReplaceInput(1, n3);
864 n19->ReplaceInput(2, n7);
865 n19->ReplaceInput(3, n13);
866 n19->ReplaceInput(4, n13);
867 n19->ReplaceInput(5, n15);
868 n19->ReplaceInput(6, n18);
869 n21->ReplaceInput(0, n4);
870 n21->ReplaceInput(1, n4);
871 n21->ReplaceInput(2, n7);
872 n21->ReplaceInput(3, n13);
873 n21->ReplaceInput(4, n13);
874 n21->ReplaceInput(5, n19);
875 n21->ReplaceInput(6, n20);
876 n22->ReplaceInput(0, n21);
877 n3->ReplaceInput(0, n0);
878 n9->ReplaceInput(0, n7);
879 n9->ReplaceInput(1, n13);
880 n9->ReplaceInput(2, n0);
881 n9->ReplaceInput(3, n0);
882 n10->ReplaceInput(0, n9);
883 n17->ReplaceInput(0, n15);
884 n17->ReplaceInput(1, n16);
885 n18->ReplaceInput(0, n17);
886 n20->ReplaceInput(0, n19);
887 n16->ReplaceInput(0, n15);
888
889 graph()->SetStart(n0);
890 graph()->SetEnd(n39);
891
892 ComputeAndVerifySchedule(34);
893 }
894
895
896 TEST_F(SchedulerTest, BuildScheduleSimpleLoop) {
897 const Operator* op;
898 Unique<HeapObject> unique_constant =
899 Unique<HeapObject>::CreateImmovable(factory()->undefined_value());
900
901 // Manually transcripted code for:
902 // function turbo_fan_test(a, b) {
903 // while (a < b) {
904 // a++;
905 // }
906 // return a;
907 // }
908 Node* nil = graph()->NewNode(common()->Dead());
909 op = common()->End();
910 Node* n34 = graph()->NewNode(op, nil);
911 USE(n34);
912 op = common()->Return();
913 Node* n32 = graph()->NewNode(op, nil, nil, nil);
914 USE(n32);
915 op = common()->Phi(kMachAnyTagged, 2);
916 Node* n13 = graph()->NewNode(op, nil, nil, nil);
917 USE(n13);
918 op = js()->LessThan(LanguageMode::SLOPPY);
919 Node* n16 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil);
920 USE(n16);
921 op = common()->IfFalse();
922 Node* n22 = graph()->NewNode(op, nil);
923 USE(n22);
924 op = common()->Parameter(1);
925 Node* n2 = graph()->NewNode(op, nil);
926 USE(n2);
927 op = js()->Add(LanguageMode::SLOPPY);
928 Node* n29 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
929 USE(n29);
930 op = common()->Loop(2);
931 Node* n12 = graph()->NewNode(op, nil, nil);
932 USE(n12);
933 op = common()->Parameter(2);
934 Node* n3 = graph()->NewNode(op, nil);
935 USE(n3);
936 op = common()->Parameter(3);
937 Node* n5 = graph()->NewNode(op, nil);
938 USE(n5);
939 op = common()->FrameState(JS_FRAME, BailoutId(-1),
940 OutputFrameStateCombine::Ignore());
941 Node* n11 = graph()->NewNode(op, nil, nil, nil, nil, nil);
942 USE(n11);
943 op = common()->EffectPhi(2);
944 Node* n14 = graph()->NewNode(op, nil, nil, nil);
945 USE(n14);
946 op = common()->Branch();
947 Node* n19 = graph()->NewNode(op, nil, nil);
948 USE(n19);
949 op = common()->Start(2);
950 Node* n0 = graph()->NewNode(op);
951 USE(n0);
952 op = js()->ToNumber();
953 Node* n26 = graph()->NewNode(op, nil, nil, nil, nil, nil);
954 USE(n26);
955 op = common()->NumberConstant(1);
956 Node* n28 = graph()->NewNode(op);
957 USE(n28);
958 op = common()->IfSuccess();
959 Node* n27 = graph()->NewNode(op, nil);
960 USE(n27);
961 op = common()->IfSuccess();
962 Node* n8 = graph()->NewNode(op, nil);
963 USE(n8);
964 op = common()->IfSuccess();
965 Node* n30 = graph()->NewNode(op, nil);
966 USE(n30);
967 op = common()->StateValues(0);
968 Node* n9 = graph()->NewNode(op);
969 USE(n9);
970 op = common()->NumberConstant(0);
971 Node* n10 = graph()->NewNode(op);
972 USE(n10);
973 op = common()->HeapConstant(unique_constant);
974 Node* n4 = graph()->NewNode(op);
975 USE(n4);
976 op = js()->StackCheck();
977 Node* n7 = graph()->NewNode(op, nil, nil, nil, nil);
978 USE(n7);
979 op = js()->ToBoolean();
980 Node* n18 = graph()->NewNode(op, nil, nil);
981 USE(n18);
982 op = common()->IfSuccess();
983 Node* n17 = graph()->NewNode(op, nil);
984 USE(n17);
985 op = js()->StackCheck();
986 Node* n24 = graph()->NewNode(op, nil, nil, nil, nil);
987 USE(n24);
988 op = common()->IfSuccess();
989 Node* n25 = graph()->NewNode(op, nil);
990 USE(n25);
991 op = common()->IfTrue();
992 Node* n20 = graph()->NewNode(op, nil);
993 USE(n20);
994 n34->ReplaceInput(0, n32);
995 n32->ReplaceInput(0, n13);
996 n32->ReplaceInput(1, n16);
997 n32->ReplaceInput(2, n22);
998 n13->ReplaceInput(0, n2);
999 n13->ReplaceInput(1, n29);
1000 n13->ReplaceInput(2, n12);
1001 n16->ReplaceInput(0, n13);
1002 n16->ReplaceInput(1, n3);
1003 n16->ReplaceInput(2, n5);
1004 n16->ReplaceInput(3, n11);
1005 n16->ReplaceInput(4, n14);
1006 n16->ReplaceInput(5, n12);
1007 n22->ReplaceInput(0, n19);
1008 n2->ReplaceInput(0, n0);
1009 n29->ReplaceInput(0, n26);
1010 n29->ReplaceInput(1, n28);
1011 n29->ReplaceInput(2, n5);
1012 n29->ReplaceInput(3, n11);
1013 n29->ReplaceInput(4, n11);
1014 n29->ReplaceInput(5, n26);
1015 n29->ReplaceInput(6, n27);
1016 n12->ReplaceInput(0, n8);
1017 n12->ReplaceInput(1, n30);
1018 n3->ReplaceInput(0, n0);
1019 n5->ReplaceInput(0, n0);
1020 n11->ReplaceInput(0, n9);
1021 n11->ReplaceInput(1, n9);
1022 n11->ReplaceInput(2, n9);
1023 n11->ReplaceInput(3, n10);
1024 n11->ReplaceInput(4, n4);
1025 n14->ReplaceInput(0, n7);
1026 n14->ReplaceInput(1, n29);
1027 n14->ReplaceInput(2, n12);
1028 n19->ReplaceInput(0, n18);
1029 n19->ReplaceInput(1, n17);
1030 n26->ReplaceInput(0, n13);
1031 n26->ReplaceInput(1, n5);
1032 n26->ReplaceInput(2, n11);
1033 n26->ReplaceInput(3, n24);
1034 n26->ReplaceInput(4, n25);
1035 n27->ReplaceInput(0, n26);
1036 n8->ReplaceInput(0, n7);
1037 n30->ReplaceInput(0, n29);
1038 n7->ReplaceInput(0, n5);
1039 n7->ReplaceInput(1, n11);
1040 n7->ReplaceInput(2, n0);
1041 n7->ReplaceInput(3, n0);
1042 n18->ReplaceInput(0, n16);
1043 n18->ReplaceInput(1, n5);
1044 n17->ReplaceInput(0, n16);
1045 n24->ReplaceInput(0, n5);
1046 n24->ReplaceInput(1, n11);
1047 n24->ReplaceInput(2, n16);
1048 n24->ReplaceInput(3, n20);
1049 n25->ReplaceInput(0, n24);
1050 n20->ReplaceInput(0, n19);
1051
1052 graph()->SetStart(n0);
1053 graph()->SetEnd(n34);
1054
1055 ComputeAndVerifySchedule(30);
1056 }
1057
1058
1059 TEST_F(SchedulerTest, BuildScheduleComplexLoops) {
1060 const Operator* op;
1061 Unique<HeapObject> unique_constant =
1062 Unique<HeapObject>::CreateImmovable(factory()->undefined_value());
1063
1064 // Manually transcripted code for:
1065 // function turbo_fan_test(a, b, c) {
1066 // while (a < b) {
1067 // a++;
1068 // while (c < b) {
1069 // c++;
1070 // }
1071 // }
1072 // while (a < b) {
1073 // a += 2;
1074 // }
1075 // return a;
1076 // }
1077 Node* nil = graph()->NewNode(common()->Dead());
1078 op = common()->End();
1079 Node* n71 = graph()->NewNode(op, nil);
1080 USE(n71);
1081 op = common()->Return();
1082 Node* n69 = graph()->NewNode(op, nil, nil, nil);
1083 USE(n69);
1084 op = common()->Phi(kMachAnyTagged, 2);
1085 Node* n53 = graph()->NewNode(op, nil, nil, nil);
1086 USE(n53);
1087 op = js()->LessThan(LanguageMode::SLOPPY);
1088 Node* n55 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil);
1089 USE(n55);
1090 op = common()->IfFalse();
1091 Node* n61 = graph()->NewNode(op, nil);
1092 USE(n61);
1093 op = common()->Phi(kMachAnyTagged, 2);
1094 Node* n14 = graph()->NewNode(op, nil, nil, nil);
1095 USE(n14);
1096 op = js()->Add(LanguageMode::SLOPPY);
1097 Node* n66 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
1098 USE(n66);
1099 op = common()->Loop(2);
1100 Node* n52 = graph()->NewNode(op, nil, nil);
1101 USE(n52);
1102 op = common()->Parameter(2);
1103 Node* n3 = graph()->NewNode(op, nil);
1104 USE(n3);
1105 op = common()->Parameter(4);
1106 Node* n6 = graph()->NewNode(op, nil);
1107 USE(n6);
1108 op = common()->FrameState(JS_FRAME, BailoutId(-1),
1109 OutputFrameStateCombine::Ignore());
1110 Node* n12 = graph()->NewNode(op, nil, nil, nil, nil, nil);
1111 USE(n12);
1112 op = common()->EffectPhi(2);
1113 Node* n54 = graph()->NewNode(op, nil, nil, nil);
1114 USE(n54);
1115 op = common()->Branch();
1116 Node* n58 = graph()->NewNode(op, nil, nil);
1117 USE(n58);
1118 op = common()->Parameter(1);
1119 Node* n2 = graph()->NewNode(op, nil);
1120 USE(n2);
1121 op = js()->Add(LanguageMode::SLOPPY);
1122 Node* n31 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
1123 USE(n31);
1124 op = common()->Loop(2);
1125 Node* n13 = graph()->NewNode(op, nil, nil);
1126 USE(n13);
1127 op = common()->NumberConstant(2);
1128 Node* n65 = graph()->NewNode(op);
1129 USE(n65);
1130 op = js()->StackCheck();
1131 Node* n63 = graph()->NewNode(op, nil, nil, nil, nil);
1132 USE(n63);
1133 op = common()->IfSuccess();
1134 Node* n64 = graph()->NewNode(op, nil);
1135 USE(n64);
1136 op = common()->IfFalse();
1137 Node* n24 = graph()->NewNode(op, nil);
1138 USE(n24);
1139 op = common()->IfSuccess();
1140 Node* n67 = graph()->NewNode(op, nil);
1141 USE(n67);
1142 op = common()->Start(3);
1143 Node* n0 = graph()->NewNode(op);
1144 USE(n0);
1145 op = common()->StateValues(0);
1146 Node* n10 = graph()->NewNode(op);
1147 USE(n10);
1148 op = common()->NumberConstant(0);
1149 Node* n11 = graph()->NewNode(op);
1150 USE(n11);
1151 op = common()->HeapConstant(unique_constant);
1152 Node* n5 = graph()->NewNode(op);
1153 USE(n5);
1154 op = js()->LessThan(LanguageMode::SLOPPY);
1155 Node* n18 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil);
1156 USE(n18);
1157 op = js()->ToBoolean();
1158 Node* n57 = graph()->NewNode(op, nil, nil);
1159 USE(n57);
1160 op = common()->IfSuccess();
1161 Node* n56 = graph()->NewNode(op, nil);
1162 USE(n56);
1163 op = js()->ToNumber();
1164 Node* n28 = graph()->NewNode(op, nil, nil, nil, nil, nil);
1165 USE(n28);
1166 op = common()->NumberConstant(1);
1167 Node* n30 = graph()->NewNode(op);
1168 USE(n30);
1169 op = common()->IfSuccess();
1170 Node* n29 = graph()->NewNode(op, nil);
1171 USE(n29);
1172 op = common()->IfSuccess();
1173 Node* n9 = graph()->NewNode(op, nil);
1174 USE(n9);
1175 op = common()->IfFalse();
1176 Node* n42 = graph()->NewNode(op, nil);
1177 USE(n42);
1178 op = common()->IfTrue();
1179 Node* n59 = graph()->NewNode(op, nil);
1180 USE(n59);
1181 op = common()->Branch();
1182 Node* n21 = graph()->NewNode(op, nil, nil);
1183 USE(n21);
1184 op = common()->EffectPhi(2);
1185 Node* n16 = graph()->NewNode(op, nil, nil, nil);
1186 USE(n16);
1187 op = js()->StackCheck();
1188 Node* n26 = graph()->NewNode(op, nil, nil, nil, nil);
1189 USE(n26);
1190 op = common()->IfSuccess();
1191 Node* n27 = graph()->NewNode(op, nil);
1192 USE(n27);
1193 op = js()->StackCheck();
1194 Node* n8 = graph()->NewNode(op, nil, nil, nil, nil);
1195 USE(n8);
1196 op = common()->Branch();
1197 Node* n39 = graph()->NewNode(op, nil, nil);
1198 USE(n39);
1199 op = js()->ToBoolean();
1200 Node* n20 = graph()->NewNode(op, nil, nil);
1201 USE(n20);
1202 op = common()->IfSuccess();
1203 Node* n19 = graph()->NewNode(op, nil);
1204 USE(n19);
1205 op = js()->LessThan(LanguageMode::SLOPPY);
1206 Node* n36 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil);
1207 USE(n36);
1208 op = common()->IfTrue();
1209 Node* n22 = graph()->NewNode(op, nil);
1210 USE(n22);
1211 op = js()->ToBoolean();
1212 Node* n38 = graph()->NewNode(op, nil, nil);
1213 USE(n38);
1214 op = common()->IfSuccess();
1215 Node* n37 = graph()->NewNode(op, nil);
1216 USE(n37);
1217 op = common()->Phi(kMachAnyTagged, 2);
1218 Node* n34 = graph()->NewNode(op, nil, nil, nil);
1219 USE(n34);
1220 op = common()->EffectPhi(2);
1221 Node* n35 = graph()->NewNode(op, nil, nil, nil);
1222 USE(n35);
1223 op = common()->Loop(2);
1224 Node* n33 = graph()->NewNode(op, nil, nil);
1225 USE(n33);
1226 op = common()->Phi(kMachAnyTagged, 2);
1227 Node* n15 = graph()->NewNode(op, nil, nil, nil);
1228 USE(n15);
1229 op = js()->Add(LanguageMode::SLOPPY);
1230 Node* n48 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
1231 USE(n48);
1232 op = common()->IfSuccess();
1233 Node* n32 = graph()->NewNode(op, nil);
1234 USE(n32);
1235 op = common()->IfSuccess();
1236 Node* n49 = graph()->NewNode(op, nil);
1237 USE(n49);
1238 op = common()->Parameter(3);
1239 Node* n4 = graph()->NewNode(op, nil);
1240 USE(n4);
1241 op = js()->ToNumber();
1242 Node* n46 = graph()->NewNode(op, nil, nil, nil, nil, nil);
1243 USE(n46);
1244 op = common()->IfSuccess();
1245 Node* n47 = graph()->NewNode(op, nil);
1246 USE(n47);
1247 op = js()->StackCheck();
1248 Node* n44 = graph()->NewNode(op, nil, nil, nil, nil);
1249 USE(n44);
1250 op = common()->IfSuccess();
1251 Node* n45 = graph()->NewNode(op, nil);
1252 USE(n45);
1253 op = common()->IfTrue();
1254 Node* n40 = graph()->NewNode(op, nil);
1255 USE(n40);
1256 n71->ReplaceInput(0, n69);
1257 n69->ReplaceInput(0, n53);
1258 n69->ReplaceInput(1, n55);
1259 n69->ReplaceInput(2, n61);
1260 n53->ReplaceInput(0, n14);
1261 n53->ReplaceInput(1, n66);
1262 n53->ReplaceInput(2, n52);
1263 n55->ReplaceInput(0, n53);
1264 n55->ReplaceInput(1, n3);
1265 n55->ReplaceInput(2, n6);
1266 n55->ReplaceInput(3, n12);
1267 n55->ReplaceInput(4, n54);
1268 n55->ReplaceInput(5, n52);
1269 n61->ReplaceInput(0, n58);
1270 n14->ReplaceInput(0, n2);
1271 n14->ReplaceInput(1, n31);
1272 n14->ReplaceInput(2, n13);
1273 n66->ReplaceInput(0, n53);
1274 n66->ReplaceInput(1, n65);
1275 n66->ReplaceInput(2, n6);
1276 n66->ReplaceInput(3, n12);
1277 n66->ReplaceInput(4, n12);
1278 n66->ReplaceInput(5, n63);
1279 n66->ReplaceInput(6, n64);
1280 n52->ReplaceInput(0, n24);
1281 n52->ReplaceInput(1, n67);
1282 n3->ReplaceInput(0, n0);
1283 n6->ReplaceInput(0, n0);
1284 n12->ReplaceInput(0, n10);
1285 n12->ReplaceInput(1, n10);
1286 n12->ReplaceInput(2, n10);
1287 n12->ReplaceInput(3, n11);
1288 n12->ReplaceInput(4, n5);
1289 n54->ReplaceInput(0, n18);
1290 n54->ReplaceInput(1, n66);
1291 n54->ReplaceInput(2, n52);
1292 n58->ReplaceInput(0, n57);
1293 n58->ReplaceInput(1, n56);
1294 n2->ReplaceInput(0, n0);
1295 n31->ReplaceInput(0, n28);
1296 n31->ReplaceInput(1, n30);
1297 n31->ReplaceInput(2, n6);
1298 n31->ReplaceInput(3, n12);
1299 n31->ReplaceInput(4, n12);
1300 n31->ReplaceInput(5, n28);
1301 n31->ReplaceInput(6, n29);
1302 n13->ReplaceInput(0, n9);
1303 n13->ReplaceInput(1, n42);
1304 n63->ReplaceInput(0, n6);
1305 n63->ReplaceInput(1, n12);
1306 n63->ReplaceInput(2, n55);
1307 n63->ReplaceInput(3, n59);
1308 n64->ReplaceInput(0, n63);
1309 n24->ReplaceInput(0, n21);
1310 n67->ReplaceInput(0, n66);
1311 n18->ReplaceInput(0, n14);
1312 n18->ReplaceInput(1, n3);
1313 n18->ReplaceInput(2, n6);
1314 n18->ReplaceInput(3, n12);
1315 n18->ReplaceInput(4, n16);
1316 n18->ReplaceInput(5, n13);
1317 n57->ReplaceInput(0, n55);
1318 n57->ReplaceInput(1, n6);
1319 n56->ReplaceInput(0, n55);
1320 n28->ReplaceInput(0, n14);
1321 n28->ReplaceInput(1, n6);
1322 n28->ReplaceInput(2, n12);
1323 n28->ReplaceInput(3, n26);
1324 n28->ReplaceInput(4, n27);
1325 n29->ReplaceInput(0, n28);
1326 n9->ReplaceInput(0, n8);
1327 n42->ReplaceInput(0, n39);
1328 n59->ReplaceInput(0, n58);
1329 n21->ReplaceInput(0, n20);
1330 n21->ReplaceInput(1, n19);
1331 n16->ReplaceInput(0, n8);
1332 n16->ReplaceInput(1, n36);
1333 n16->ReplaceInput(2, n13);
1334 n26->ReplaceInput(0, n6);
1335 n26->ReplaceInput(1, n12);
1336 n26->ReplaceInput(2, n18);
1337 n26->ReplaceInput(3, n22);
1338 n27->ReplaceInput(0, n26);
1339 n8->ReplaceInput(0, n6);
1340 n8->ReplaceInput(1, n12);
1341 n8->ReplaceInput(2, n0);
1342 n8->ReplaceInput(3, n0);
1343 n39->ReplaceInput(0, n38);
1344 n39->ReplaceInput(1, n37);
1345 n20->ReplaceInput(0, n18);
1346 n20->ReplaceInput(1, n6);
1347 n19->ReplaceInput(0, n18);
1348 n36->ReplaceInput(0, n34);
1349 n36->ReplaceInput(1, n3);
1350 n36->ReplaceInput(2, n6);
1351 n36->ReplaceInput(3, n12);
1352 n36->ReplaceInput(4, n35);
1353 n36->ReplaceInput(5, n33);
1354 n22->ReplaceInput(0, n21);
1355 n38->ReplaceInput(0, n36);
1356 n38->ReplaceInput(1, n6);
1357 n37->ReplaceInput(0, n36);
1358 n34->ReplaceInput(0, n15);
1359 n34->ReplaceInput(1, n48);
1360 n34->ReplaceInput(2, n33);
1361 n35->ReplaceInput(0, n31);
1362 n35->ReplaceInput(1, n48);
1363 n35->ReplaceInput(2, n33);
1364 n33->ReplaceInput(0, n32);
1365 n33->ReplaceInput(1, n49);
1366 n15->ReplaceInput(0, n4);
1367 n15->ReplaceInput(1, n34);
1368 n15->ReplaceInput(2, n13);
1369 n48->ReplaceInput(0, n46);
1370 n48->ReplaceInput(1, n30);
1371 n48->ReplaceInput(2, n6);
1372 n48->ReplaceInput(3, n12);
1373 n48->ReplaceInput(4, n12);
1374 n48->ReplaceInput(5, n46);
1375 n48->ReplaceInput(6, n47);
1376 n32->ReplaceInput(0, n31);
1377 n49->ReplaceInput(0, n48);
1378 n4->ReplaceInput(0, n0);
1379 n46->ReplaceInput(0, n34);
1380 n46->ReplaceInput(1, n6);
1381 n46->ReplaceInput(2, n12);
1382 n46->ReplaceInput(3, n44);
1383 n46->ReplaceInput(4, n45);
1384 n47->ReplaceInput(0, n46);
1385 n44->ReplaceInput(0, n6);
1386 n44->ReplaceInput(1, n12);
1387 n44->ReplaceInput(2, n36);
1388 n44->ReplaceInput(3, n40);
1389 n45->ReplaceInput(0, n44);
1390 n40->ReplaceInput(0, n39);
1391
1392 graph()->SetStart(n0);
1393 graph()->SetEnd(n71);
1394
1395 ComputeAndVerifySchedule(65);
1396 }
1397
1398
1399 TEST_F(SchedulerTest, BuildScheduleBreakAndContinue) {
1400 const Operator* op;
1401 Unique<HeapObject> unique_constant =
1402 Unique<HeapObject>::CreateImmovable(factory()->undefined_value());
1403
1404 // Manually transcripted code for:
1405 // function turbo_fan_test(a, b, c) {
1406 // var d = 0;
1407 // while (a < b) {
1408 // a++;
1409 // while (c < b) {
1410 // c++;
1411 // if (d == 0) break;
1412 // a++;
1413 // }
1414 // if (a == 1) continue;
1415 // d++;
1416 // }
1417 // return a + d;
1418 // }
1419 Node* nil = graph()->NewNode(common()->Dead());
1420 op = common()->End();
1421 Node* n86 = graph()->NewNode(op, nil);
1422 USE(n86);
1423 op = common()->Return();
1424 Node* n84 = graph()->NewNode(op, nil, nil, nil);
1425 USE(n84);
1426 op = js()->Add(LanguageMode::SLOPPY);
1427 Node* n82 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
1428 USE(n82);
1429 op = common()->IfSuccess();
1430 Node* n83 = graph()->NewNode(op, nil);
1431 USE(n83);
1432 op = common()->Phi(kMachAnyTagged, 2);
1433 Node* n15 = graph()->NewNode(op, nil, nil, nil);
1434 USE(n15);
1435 op = common()->Phi(kMachAnyTagged, 2);
1436 Node* n17 = graph()->NewNode(op, nil, nil, nil);
1437 USE(n17);
1438 op = common()->Parameter(4);
1439 Node* n6 = graph()->NewNode(op, nil);
1440 USE(n6);
1441 op = common()->FrameState(JS_FRAME, BailoutId(-1),
1442 OutputFrameStateCombine::Ignore());
1443 Node* n12 = graph()->NewNode(op, nil, nil, nil, nil, nil);
1444 USE(n12);
1445 op = js()->LessThan(LanguageMode::SLOPPY);
1446 Node* n19 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil);
1447 USE(n19);
1448 op = common()->IfFalse();
1449 Node* n25 = graph()->NewNode(op, nil);
1450 USE(n25);
1451 op = common()->Parameter(1);
1452 Node* n2 = graph()->NewNode(op, nil);
1453 USE(n2);
1454 op = common()->Phi(kMachAnyTagged, 2);
1455 Node* n35 = graph()->NewNode(op, nil, nil, nil);
1456 USE(n35);
1457 op = common()->Loop(2);
1458 Node* n14 = graph()->NewNode(op, nil, nil);
1459 USE(n14);
1460 op = common()->NumberConstant(0);
1461 Node* n11 = graph()->NewNode(op);
1462 USE(n11);
1463 op = common()->Phi(kMachAnyTagged, 2);
1464 Node* n81 = graph()->NewNode(op, nil, nil, nil);
1465 USE(n81);
1466 op = common()->Start(3);
1467 Node* n0 = graph()->NewNode(op);
1468 USE(n0);
1469 op = common()->StateValues(0);
1470 Node* n10 = graph()->NewNode(op);
1471 USE(n10);
1472 op = common()->HeapConstant(unique_constant);
1473 Node* n5 = graph()->NewNode(op);
1474 USE(n5);
1475 op = common()->Parameter(2);
1476 Node* n3 = graph()->NewNode(op, nil);
1477 USE(n3);
1478 op = common()->EffectPhi(2);
1479 Node* n18 = graph()->NewNode(op, nil, nil, nil);
1480 USE(n18);
1481 op = common()->Branch();
1482 Node* n22 = graph()->NewNode(op, nil, nil);
1483 USE(n22);
1484 op = js()->Add(LanguageMode::SLOPPY);
1485 Node* n32 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
1486 USE(n32);
1487 op = js()->Add(LanguageMode::SLOPPY);
1488 Node* n64 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
1489 USE(n64);
1490 op = common()->Loop(2);
1491 Node* n34 = graph()->NewNode(op, nil, nil);
1492 USE(n34);
1493 op = common()->IfSuccess();
1494 Node* n9 = graph()->NewNode(op, nil);
1495 USE(n9);
1496 op = common()->Merge(2);
1497 Node* n72 = graph()->NewNode(op, nil, nil);
1498 USE(n72);
1499 op = js()->Add(LanguageMode::SLOPPY);
1500 Node* n78 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
1501 USE(n78);
1502 op = js()->StackCheck();
1503 Node* n8 = graph()->NewNode(op, nil, nil, nil, nil);
1504 USE(n8);
1505 op = common()->EffectPhi(2);
1506 Node* n80 = graph()->NewNode(op, nil, nil, nil);
1507 USE(n80);
1508 op = js()->ToBoolean();
1509 Node* n21 = graph()->NewNode(op, nil, nil);
1510 USE(n21);
1511 op = common()->IfSuccess();
1512 Node* n20 = graph()->NewNode(op, nil);
1513 USE(n20);
1514 op = js()->ToNumber();
1515 Node* n29 = graph()->NewNode(op, nil, nil, nil, nil, nil);
1516 USE(n29);
1517 op = common()->NumberConstant(1);
1518 Node* n31 = graph()->NewNode(op);
1519 USE(n31);
1520 op = common()->IfSuccess();
1521 Node* n30 = graph()->NewNode(op, nil);
1522 USE(n30);
1523 op = js()->ToNumber();
1524 Node* n62 = graph()->NewNode(op, nil, nil, nil, nil, nil);
1525 USE(n62);
1526 op = common()->IfSuccess();
1527 Node* n63 = graph()->NewNode(op, nil);
1528 USE(n63);
1529 op = common()->IfSuccess();
1530 Node* n33 = graph()->NewNode(op, nil);
1531 USE(n33);
1532 op = common()->IfSuccess();
1533 Node* n65 = graph()->NewNode(op, nil);
1534 USE(n65);
1535 op = common()->IfTrue();
1536 Node* n71 = graph()->NewNode(op, nil);
1537 USE(n71);
1538 op = common()->IfSuccess();
1539 Node* n79 = graph()->NewNode(op, nil);
1540 USE(n79);
1541 op = js()->ToNumber();
1542 Node* n76 = graph()->NewNode(op, nil, nil, nil, nil, nil);
1543 USE(n76);
1544 op = common()->IfSuccess();
1545 Node* n77 = graph()->NewNode(op, nil);
1546 USE(n77);
1547 op = js()->Equal();
1548 Node* n67 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil);
1549 USE(n67);
1550 op = js()->StackCheck();
1551 Node* n27 = graph()->NewNode(op, nil, nil, nil, nil);
1552 USE(n27);
1553 op = common()->IfSuccess();
1554 Node* n28 = graph()->NewNode(op, nil);
1555 USE(n28);
1556 op = js()->Equal();
1557 Node* n52 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil);
1558 USE(n52);
1559 op = common()->IfFalse();
1560 Node* n60 = graph()->NewNode(op, nil);
1561 USE(n60);
1562 op = common()->Branch();
1563 Node* n70 = graph()->NewNode(op, nil, nil);
1564 USE(n70);
1565 op = common()->IfFalse();
1566 Node* n74 = graph()->NewNode(op, nil);
1567 USE(n74);
1568 op = common()->EffectPhi(2);
1569 Node* n57 = graph()->NewNode(op, nil, nil, nil);
1570 USE(n57);
1571 op = common()->Merge(2);
1572 Node* n45 = graph()->NewNode(op, nil, nil);
1573 USE(n45);
1574 op = common()->IfTrue();
1575 Node* n23 = graph()->NewNode(op, nil);
1576 USE(n23);
1577 op = js()->Add(LanguageMode::SLOPPY);
1578 Node* n50 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
1579 USE(n50);
1580 op = common()->IfSuccess();
1581 Node* n51 = graph()->NewNode(op, nil);
1582 USE(n51);
1583 op = common()->Branch();
1584 Node* n55 = graph()->NewNode(op, nil, nil);
1585 USE(n55);
1586 op = js()->ToBoolean();
1587 Node* n69 = graph()->NewNode(op, nil, nil);
1588 USE(n69);
1589 op = common()->IfSuccess();
1590 Node* n68 = graph()->NewNode(op, nil);
1591 USE(n68);
1592 op = js()->LessThan(LanguageMode::SLOPPY);
1593 Node* n38 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil);
1594 USE(n38);
1595 op = common()->IfFalse();
1596 Node* n44 = graph()->NewNode(op, nil);
1597 USE(n44);
1598 op = common()->IfTrue();
1599 Node* n56 = graph()->NewNode(op, nil);
1600 USE(n56);
1601 op = js()->ToNumber();
1602 Node* n48 = graph()->NewNode(op, nil, nil, nil, nil, nil);
1603 USE(n48);
1604 op = common()->IfSuccess();
1605 Node* n49 = graph()->NewNode(op, nil);
1606 USE(n49);
1607 op = js()->ToBoolean();
1608 Node* n54 = graph()->NewNode(op, nil, nil);
1609 USE(n54);
1610 op = common()->IfSuccess();
1611 Node* n53 = graph()->NewNode(op, nil);
1612 USE(n53);
1613 op = common()->Phi(kMachAnyTagged, 2);
1614 Node* n36 = graph()->NewNode(op, nil, nil, nil);
1615 USE(n36);
1616 op = common()->EffectPhi(2);
1617 Node* n37 = graph()->NewNode(op, nil, nil, nil);
1618 USE(n37);
1619 op = common()->Branch();
1620 Node* n41 = graph()->NewNode(op, nil, nil);
1621 USE(n41);
1622 op = js()->StackCheck();
1623 Node* n46 = graph()->NewNode(op, nil, nil, nil, nil);
1624 USE(n46);
1625 op = common()->IfSuccess();
1626 Node* n47 = graph()->NewNode(op, nil);
1627 USE(n47);
1628 op = common()->Phi(kMachAnyTagged, 2);
1629 Node* n16 = graph()->NewNode(op, nil, nil, nil);
1630 USE(n16);
1631 op = js()->ToBoolean();
1632 Node* n40 = graph()->NewNode(op, nil, nil);
1633 USE(n40);
1634 op = common()->IfSuccess();
1635 Node* n39 = graph()->NewNode(op, nil);
1636 USE(n39);
1637 op = common()->IfTrue();
1638 Node* n42 = graph()->NewNode(op, nil);
1639 USE(n42);
1640 op = common()->Parameter(3);
1641 Node* n4 = graph()->NewNode(op, nil);
1642 USE(n4);
1643 op = common()->Phi(kMachAnyTagged, 2);
1644 Node* n58 = graph()->NewNode(op, nil, nil, nil);
1645 USE(n58);
1646 n86->ReplaceInput(0, n84);
1647 n84->ReplaceInput(0, n82);
1648 n84->ReplaceInput(1, n82);
1649 n84->ReplaceInput(2, n83);
1650 n82->ReplaceInput(0, n15);
1651 n82->ReplaceInput(1, n17);
1652 n82->ReplaceInput(2, n6);
1653 n82->ReplaceInput(3, n12);
1654 n82->ReplaceInput(4, n12);
1655 n82->ReplaceInput(5, n19);
1656 n82->ReplaceInput(6, n25);
1657 n83->ReplaceInput(0, n82);
1658 n15->ReplaceInput(0, n2);
1659 n15->ReplaceInput(1, n35);
1660 n15->ReplaceInput(2, n14);
1661 n17->ReplaceInput(0, n11);
1662 n17->ReplaceInput(1, n81);
1663 n17->ReplaceInput(2, n14);
1664 n6->ReplaceInput(0, n0);
1665 n12->ReplaceInput(0, n10);
1666 n12->ReplaceInput(1, n10);
1667 n12->ReplaceInput(2, n10);
1668 n12->ReplaceInput(3, n11);
1669 n12->ReplaceInput(4, n5);
1670 n19->ReplaceInput(0, n15);
1671 n19->ReplaceInput(1, n3);
1672 n19->ReplaceInput(2, n6);
1673 n19->ReplaceInput(3, n12);
1674 n19->ReplaceInput(4, n18);
1675 n19->ReplaceInput(5, n14);
1676 n25->ReplaceInput(0, n22);
1677 n2->ReplaceInput(0, n0);
1678 n35->ReplaceInput(0, n32);
1679 n35->ReplaceInput(1, n64);
1680 n35->ReplaceInput(2, n34);
1681 n14->ReplaceInput(0, n9);
1682 n14->ReplaceInput(1, n72);
1683 n81->ReplaceInput(0, n17);
1684 n81->ReplaceInput(1, n78);
1685 n81->ReplaceInput(2, n72);
1686 n3->ReplaceInput(0, n0);
1687 n18->ReplaceInput(0, n8);
1688 n18->ReplaceInput(1, n80);
1689 n18->ReplaceInput(2, n14);
1690 n22->ReplaceInput(0, n21);
1691 n22->ReplaceInput(1, n20);
1692 n32->ReplaceInput(0, n29);
1693 n32->ReplaceInput(1, n31);
1694 n32->ReplaceInput(2, n6);
1695 n32->ReplaceInput(3, n12);
1696 n32->ReplaceInput(4, n12);
1697 n32->ReplaceInput(5, n29);
1698 n32->ReplaceInput(6, n30);
1699 n64->ReplaceInput(0, n62);
1700 n64->ReplaceInput(1, n31);
1701 n64->ReplaceInput(2, n6);
1702 n64->ReplaceInput(3, n12);
1703 n64->ReplaceInput(4, n12);
1704 n64->ReplaceInput(5, n62);
1705 n64->ReplaceInput(6, n63);
1706 n34->ReplaceInput(0, n33);
1707 n34->ReplaceInput(1, n65);
1708 n9->ReplaceInput(0, n8);
1709 n72->ReplaceInput(0, n71);
1710 n72->ReplaceInput(1, n79);
1711 n78->ReplaceInput(0, n76);
1712 n78->ReplaceInput(1, n31);
1713 n78->ReplaceInput(2, n6);
1714 n78->ReplaceInput(3, n12);
1715 n78->ReplaceInput(4, n12);
1716 n78->ReplaceInput(5, n76);
1717 n78->ReplaceInput(6, n77);
1718 n8->ReplaceInput(0, n6);
1719 n8->ReplaceInput(1, n12);
1720 n8->ReplaceInput(2, n0);
1721 n8->ReplaceInput(3, n0);
1722 n80->ReplaceInput(0, n67);
1723 n80->ReplaceInput(1, n78);
1724 n80->ReplaceInput(2, n72);
1725 n21->ReplaceInput(0, n19);
1726 n21->ReplaceInput(1, n6);
1727 n20->ReplaceInput(0, n19);
1728 n29->ReplaceInput(0, n15);
1729 n29->ReplaceInput(1, n6);
1730 n29->ReplaceInput(2, n12);
1731 n29->ReplaceInput(3, n27);
1732 n29->ReplaceInput(4, n28);
1733 n30->ReplaceInput(0, n29);
1734 n62->ReplaceInput(0, n35);
1735 n62->ReplaceInput(1, n6);
1736 n62->ReplaceInput(2, n12);
1737 n62->ReplaceInput(3, n52);
1738 n62->ReplaceInput(4, n60);
1739 n63->ReplaceInput(0, n62);
1740 n33->ReplaceInput(0, n32);
1741 n65->ReplaceInput(0, n64);
1742 n71->ReplaceInput(0, n70);
1743 n79->ReplaceInput(0, n78);
1744 n76->ReplaceInput(0, n17);
1745 n76->ReplaceInput(1, n6);
1746 n76->ReplaceInput(2, n12);
1747 n76->ReplaceInput(3, n67);
1748 n76->ReplaceInput(4, n74);
1749 n77->ReplaceInput(0, n76);
1750 n67->ReplaceInput(0, n35);
1751 n67->ReplaceInput(1, n31);
1752 n67->ReplaceInput(2, n6);
1753 n67->ReplaceInput(3, n12);
1754 n67->ReplaceInput(4, n57);
1755 n67->ReplaceInput(5, n45);
1756 n27->ReplaceInput(0, n6);
1757 n27->ReplaceInput(1, n12);
1758 n27->ReplaceInput(2, n19);
1759 n27->ReplaceInput(3, n23);
1760 n28->ReplaceInput(0, n27);
1761 n52->ReplaceInput(0, n17);
1762 n52->ReplaceInput(1, n11);
1763 n52->ReplaceInput(2, n6);
1764 n52->ReplaceInput(3, n12);
1765 n52->ReplaceInput(4, n50);
1766 n52->ReplaceInput(5, n51);
1767 n60->ReplaceInput(0, n55);
1768 n70->ReplaceInput(0, n69);
1769 n70->ReplaceInput(1, n68);
1770 n74->ReplaceInput(0, n70);
1771 n57->ReplaceInput(0, n38);
1772 n57->ReplaceInput(1, n52);
1773 n57->ReplaceInput(2, n45);
1774 n45->ReplaceInput(0, n44);
1775 n45->ReplaceInput(1, n56);
1776 n23->ReplaceInput(0, n22);
1777 n50->ReplaceInput(0, n48);
1778 n50->ReplaceInput(1, n31);
1779 n50->ReplaceInput(2, n6);
1780 n50->ReplaceInput(3, n12);
1781 n50->ReplaceInput(4, n12);
1782 n50->ReplaceInput(5, n48);
1783 n50->ReplaceInput(6, n49);
1784 n51->ReplaceInput(0, n50);
1785 n55->ReplaceInput(0, n54);
1786 n55->ReplaceInput(1, n53);
1787 n69->ReplaceInput(0, n67);
1788 n69->ReplaceInput(1, n6);
1789 n68->ReplaceInput(0, n67);
1790 n38->ReplaceInput(0, n36);
1791 n38->ReplaceInput(1, n3);
1792 n38->ReplaceInput(2, n6);
1793 n38->ReplaceInput(3, n12);
1794 n38->ReplaceInput(4, n37);
1795 n38->ReplaceInput(5, n34);
1796 n44->ReplaceInput(0, n41);
1797 n56->ReplaceInput(0, n55);
1798 n48->ReplaceInput(0, n36);
1799 n48->ReplaceInput(1, n6);
1800 n48->ReplaceInput(2, n12);
1801 n48->ReplaceInput(3, n46);
1802 n48->ReplaceInput(4, n47);
1803 n49->ReplaceInput(0, n48);
1804 n54->ReplaceInput(0, n52);
1805 n54->ReplaceInput(1, n6);
1806 n53->ReplaceInput(0, n52);
1807 n36->ReplaceInput(0, n16);
1808 n36->ReplaceInput(1, n50);
1809 n36->ReplaceInput(2, n34);
1810 n37->ReplaceInput(0, n32);
1811 n37->ReplaceInput(1, n64);
1812 n37->ReplaceInput(2, n34);
1813 n41->ReplaceInput(0, n40);
1814 n41->ReplaceInput(1, n39);
1815 n46->ReplaceInput(0, n6);
1816 n46->ReplaceInput(1, n12);
1817 n46->ReplaceInput(2, n38);
1818 n46->ReplaceInput(3, n42);
1819 n47->ReplaceInput(0, n46);
1820 n16->ReplaceInput(0, n4);
1821 n16->ReplaceInput(1, n58);
1822 n16->ReplaceInput(2, n14);
1823 n40->ReplaceInput(0, n38);
1824 n40->ReplaceInput(1, n6);
1825 n39->ReplaceInput(0, n38);
1826 n42->ReplaceInput(0, n41);
1827 n4->ReplaceInput(0, n0);
1828 n58->ReplaceInput(0, n36);
1829 n58->ReplaceInput(1, n50);
1830 n58->ReplaceInput(2, n45);
1831
1832 graph()->SetStart(n0);
1833 graph()->SetEnd(n86);
1834
1835 ComputeAndVerifySchedule(83);
1836 }
1837
1838
1839 TEST_F(SchedulerTest, BuildScheduleSimpleLoopWithCodeMotion) {
1840 const Operator* op;
1841 Unique<HeapObject> unique_constant =
1842 Unique<HeapObject>::CreateImmovable(factory()->undefined_value());
1843
1844 // Manually transcripted code for:
1845 // function turbo_fan_test(a, b, c) {
1846 // while (a < b) {
1847 // a += b + c;
1848 // }
1849 // return a;
1850 // }
1851 Node* nil = graph()->NewNode(common()->Dead());
1852 op = common()->End();
1853 Node* n34 = graph()->NewNode(op, nil);
1854 USE(n34);
1855 op = common()->Return();
1856 Node* n32 = graph()->NewNode(op, nil, nil, nil);
1857 USE(n32);
1858 op = common()->Phi(kMachAnyTagged, 2);
1859 Node* n14 = graph()->NewNode(op, nil, nil, nil);
1860 USE(n14);
1861 op = js()->LessThan(LanguageMode::SLOPPY);
1862 Node* n17 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil);
1863 USE(n17);
1864 op = common()->IfFalse();
1865 Node* n23 = graph()->NewNode(op, nil);
1866 USE(n23);
1867 op = common()->Parameter(1);
1868 Node* n2 = graph()->NewNode(op, nil);
1869 USE(n2);
1870 op = js()->Add(LanguageMode::SLOPPY);
1871 Node* n29 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
1872 USE(n29);
1873 op = common()->Loop(2);
1874 Node* n13 = graph()->NewNode(op, nil, nil);
1875 USE(n13);
1876 op = common()->Parameter(2);
1877 Node* n3 = graph()->NewNode(op, nil);
1878 USE(n3);
1879 op = common()->Parameter(4);
1880 Node* n6 = graph()->NewNode(op, nil);
1881 USE(n6);
1882 op = common()->FrameState(JS_FRAME, BailoutId(-1),
1883 OutputFrameStateCombine::Ignore());
1884 Node* n12 = graph()->NewNode(op, nil, nil, nil, nil, nil);
1885 USE(n12);
1886 op = common()->EffectPhi(2);
1887 Node* n15 = graph()->NewNode(op, nil, nil, nil);
1888 USE(n15);
1889 op = common()->Branch();
1890 Node* n20 = graph()->NewNode(op, nil, nil);
1891 USE(n20);
1892 op = common()->Start(3);
1893 Node* n0 = graph()->NewNode(op);
1894 USE(n0);
1895 op = js()->Add(LanguageMode::SLOPPY);
1896 Node* n27 = graph()->NewNode(op, nil, nil, nil, nil, nil, nil, nil);
1897 USE(n27);
1898 op = common()->IfSuccess();
1899 Node* n28 = graph()->NewNode(op, nil);
1900 USE(n28);
1901 op = common()->IfSuccess();
1902 Node* n9 = graph()->NewNode(op, nil);
1903 USE(n9);
1904 op = common()->IfSuccess();
1905 Node* n30 = graph()->NewNode(op, nil);
1906 USE(n30);
1907 op = common()->StateValues(0);
1908 Node* n10 = graph()->NewNode(op);
1909 USE(n10);
1910 op = common()->NumberConstant(0);
1911 Node* n11 = graph()->NewNode(op);
1912 USE(n11);
1913 op = common()->HeapConstant(unique_constant);
1914 Node* n5 = graph()->NewNode(op);
1915 USE(n5);
1916 op = js()->StackCheck();
1917 Node* n8 = graph()->NewNode(op, nil, nil, nil, nil);
1918 USE(n8);
1919 op = js()->ToBoolean();
1920 Node* n19 = graph()->NewNode(op, nil, nil);
1921 USE(n19);
1922 op = common()->IfSuccess();
1923 Node* n18 = graph()->NewNode(op, nil);
1924 USE(n18);
1925 op = common()->Parameter(3);
1926 Node* n4 = graph()->NewNode(op, nil);
1927 USE(n4);
1928 op = js()->StackCheck();
1929 Node* n25 = graph()->NewNode(op, nil, nil, nil, nil);
1930 USE(n25);
1931 op = common()->IfSuccess();
1932 Node* n26 = graph()->NewNode(op, nil);
1933 USE(n26);
1934 op = common()->IfTrue();
1935 Node* n21 = graph()->NewNode(op, nil);
1936 USE(n21);
1937 n34->ReplaceInput(0, n32);
1938 n32->ReplaceInput(0, n14);
1939 n32->ReplaceInput(1, n17);
1940 n32->ReplaceInput(2, n23);
1941 n14->ReplaceInput(0, n2);
1942 n14->ReplaceInput(1, n29);
1943 n14->ReplaceInput(2, n13);
1944 n17->ReplaceInput(0, n14);
1945 n17->ReplaceInput(1, n3);
1946 n17->ReplaceInput(2, n6);
1947 n17->ReplaceInput(3, n12);
1948 n17->ReplaceInput(4, n15);
1949 n17->ReplaceInput(5, n13);
1950 n23->ReplaceInput(0, n20);
1951 n2->ReplaceInput(0, n0);
1952 n29->ReplaceInput(0, n14);
1953 n29->ReplaceInput(1, n27);
1954 n29->ReplaceInput(2, n6);
1955 n29->ReplaceInput(3, n12);
1956 n29->ReplaceInput(4, n12);
1957 n29->ReplaceInput(5, n27);
1958 n29->ReplaceInput(6, n28);
1959 n13->ReplaceInput(0, n9);
1960 n13->ReplaceInput(1, n30);
1961 n3->ReplaceInput(0, n0);
1962 n6->ReplaceInput(0, n0);
1963 n12->ReplaceInput(0, n10);
1964 n12->ReplaceInput(1, n10);
1965 n12->ReplaceInput(2, n10);
1966 n12->ReplaceInput(3, n11);
1967 n12->ReplaceInput(4, n5);
1968 n15->ReplaceInput(0, n8);
1969 n15->ReplaceInput(1, n29);
1970 n15->ReplaceInput(2, n13);
1971 n20->ReplaceInput(0, n19);
1972 n20->ReplaceInput(1, n18);
1973 n27->ReplaceInput(0, n3);
1974 n27->ReplaceInput(1, n4);
1975 n27->ReplaceInput(2, n6);
1976 n27->ReplaceInput(3, n12);
1977 n27->ReplaceInput(4, n12);
1978 n27->ReplaceInput(5, n25);
1979 n27->ReplaceInput(6, n26);
1980 n28->ReplaceInput(0, n27);
1981 n9->ReplaceInput(0, n8);
1982 n30->ReplaceInput(0, n29);
1983 n8->ReplaceInput(0, n6);
1984 n8->ReplaceInput(1, n12);
1985 n8->ReplaceInput(2, n0);
1986 n8->ReplaceInput(3, n0);
1987 n19->ReplaceInput(0, n17);
1988 n19->ReplaceInput(1, n6);
1989 n18->ReplaceInput(0, n17);
1990 n4->ReplaceInput(0, n0);
1991 n25->ReplaceInput(0, n6);
1992 n25->ReplaceInput(1, n12);
1993 n25->ReplaceInput(2, n17);
1994 n25->ReplaceInput(3, n21);
1995 n26->ReplaceInput(0, n25);
1996 n21->ReplaceInput(0, n20);
1997
1998 graph()->SetStart(n0);
1999 graph()->SetEnd(n34);
2000
2001 ComputeAndVerifySchedule(30);
2002 }
2003
2004
2005 namespace { 677 namespace {
2006 678
2007 Node* CreateDiamond(Graph* graph, CommonOperatorBuilder* common, Node* cond) { 679 Node* CreateDiamond(Graph* graph, CommonOperatorBuilder* common, Node* cond) {
2008 Node* tv = graph->NewNode(common->Int32Constant(6)); 680 Node* tv = graph->NewNode(common->Int32Constant(6));
2009 Node* fv = graph->NewNode(common->Int32Constant(7)); 681 Node* fv = graph->NewNode(common->Int32Constant(7));
2010 Node* br = graph->NewNode(common->Branch(), cond, graph->start()); 682 Node* br = graph->NewNode(common->Branch(), cond, graph->start());
2011 Node* t = graph->NewNode(common->IfTrue(), br); 683 Node* t = graph->NewNode(common->IfTrue(), br);
2012 Node* f = graph->NewNode(common->IfFalse(), br); 684 Node* f = graph->NewNode(common->IfFalse(), br);
2013 Node* m = graph->NewNode(common->Merge(2), t, f); 685 Node* m = graph->NewNode(common->Merge(2), t, f);
2014 Node* phi = graph->NewNode(common->Phi(kMachAnyTagged, 2), tv, fv, m); 686 Node* phi = graph->NewNode(common->Phi(kMachAnyTagged, 2), tv, fv, m);
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
2486 1158
2487 Schedule* schedule = ComputeAndVerifySchedule(6); 1159 Schedule* schedule = ComputeAndVerifySchedule(6);
2488 BasicBlock* block = schedule->block(loop); 1160 BasicBlock* block = schedule->block(loop);
2489 EXPECT_EQ(block, schedule->block(effect)); 1161 EXPECT_EQ(block, schedule->block(effect));
2490 EXPECT_GE(block->rpo_number(), 0); 1162 EXPECT_GE(block->rpo_number(), 0);
2491 } 1163 }
2492 1164
2493 } // namespace compiler 1165 } // namespace compiler
2494 } // namespace internal 1166 } // namespace internal
2495 } // namespace v8 1167 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-operator-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698