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

Side by Side Diff: src/code-stubs.cc

Issue 2624753002: [ignition] Use Smis directly for type feedback (Closed)
Patch Set: Created 3 years, 11 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 typedef compiler::Node Node; 546 typedef compiler::Node Node;
547 typedef CodeStubAssembler::Variable Variable; 547 typedef CodeStubAssembler::Variable Variable;
548 548
549 // Shared entry for floating point addition. 549 // Shared entry for floating point addition.
550 Label do_fadd(assembler), if_lhsisnotnumber(assembler, Label::kDeferred), 550 Label do_fadd(assembler), if_lhsisnotnumber(assembler, Label::kDeferred),
551 check_rhsisoddball(assembler, Label::kDeferred), 551 check_rhsisoddball(assembler, Label::kDeferred),
552 call_with_oddball_feedback(assembler), call_with_any_feedback(assembler), 552 call_with_oddball_feedback(assembler), call_with_any_feedback(assembler),
553 call_add_stub(assembler), end(assembler); 553 call_add_stub(assembler), end(assembler);
554 Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64), 554 Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64),
555 var_fadd_rhs(assembler, MachineRepresentation::kFloat64), 555 var_fadd_rhs(assembler, MachineRepresentation::kFloat64),
556 var_type_feedback(assembler, MachineRepresentation::kWord32), 556 var_type_feedback(assembler, MachineRepresentation::kTaggedSigned),
557 var_result(assembler, MachineRepresentation::kTagged); 557 var_result(assembler, MachineRepresentation::kTagged);
558 558
559 // Check if the {lhs} is a Smi or a HeapObject. 559 // Check if the {lhs} is a Smi or a HeapObject.
560 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); 560 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler);
561 assembler->Branch(assembler->TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); 561 assembler->Branch(assembler->TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi);
562 562
563 assembler->Bind(&if_lhsissmi); 563 assembler->Bind(&if_lhsissmi);
564 { 564 {
565 // Check if the {rhs} is also a Smi. 565 // Check if the {rhs} is also a Smi.
566 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); 566 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
(...skipping 15 matching lines...) Expand all
582 assembler->Bind(&if_overflow); 582 assembler->Bind(&if_overflow);
583 { 583 {
584 var_fadd_lhs.Bind(assembler->SmiToFloat64(lhs)); 584 var_fadd_lhs.Bind(assembler->SmiToFloat64(lhs));
585 var_fadd_rhs.Bind(assembler->SmiToFloat64(rhs)); 585 var_fadd_rhs.Bind(assembler->SmiToFloat64(rhs));
586 assembler->Goto(&do_fadd); 586 assembler->Goto(&do_fadd);
587 } 587 }
588 588
589 assembler->Bind(&if_notoverflow); 589 assembler->Bind(&if_notoverflow);
590 { 590 {
591 var_type_feedback.Bind( 591 var_type_feedback.Bind(
592 assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall)); 592 assembler->SmiConstant(BinaryOperationFeedback::kSignedSmall));
593 var_result.Bind(assembler->BitcastWordToTaggedSigned( 593 var_result.Bind(assembler->BitcastWordToTaggedSigned(
594 assembler->Projection(0, pair))); 594 assembler->Projection(0, pair)));
595 assembler->Goto(&end); 595 assembler->Goto(&end);
596 } 596 }
597 } 597 }
598 598
599 assembler->Bind(&if_rhsisnotsmi); 599 assembler->Bind(&if_rhsisnotsmi);
600 { 600 {
601 // Load the map of {rhs}. 601 // Load the map of {rhs}.
602 Node* rhs_map = assembler->LoadMap(rhs); 602 Node* rhs_map = assembler->LoadMap(rhs);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 643
644 var_fadd_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); 644 var_fadd_lhs.Bind(assembler->LoadHeapNumberValue(lhs));
645 var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs)); 645 var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs));
646 assembler->Goto(&do_fadd); 646 assembler->Goto(&do_fadd);
647 } 647 }
648 } 648 }
649 649
650 assembler->Bind(&do_fadd); 650 assembler->Bind(&do_fadd);
651 { 651 {
652 var_type_feedback.Bind( 652 var_type_feedback.Bind(
653 assembler->Int32Constant(BinaryOperationFeedback::kNumber)); 653 assembler->SmiConstant(BinaryOperationFeedback::kNumber));
654 Node* value = 654 Node* value =
655 assembler->Float64Add(var_fadd_lhs.value(), var_fadd_rhs.value()); 655 assembler->Float64Add(var_fadd_lhs.value(), var_fadd_rhs.value());
656 Node* result = assembler->AllocateHeapNumberWithValue(value); 656 Node* result = assembler->AllocateHeapNumberWithValue(value);
657 var_result.Bind(result); 657 var_result.Bind(result);
658 assembler->Goto(&end); 658 assembler->Goto(&end);
659 } 659 }
660 660
661 assembler->Bind(&if_lhsisnotnumber); 661 assembler->Bind(&if_lhsisnotnumber);
662 { 662 {
663 // No checks on rhs are done yet. We just know lhs is not a number or Smi. 663 // No checks on rhs are done yet. We just know lhs is not a number or Smi.
(...skipping 26 matching lines...) Expand all
690 assembler->GotoIf(assembler->TaggedIsSmi(rhs), &call_with_any_feedback); 690 assembler->GotoIf(assembler->TaggedIsSmi(rhs), &call_with_any_feedback);
691 691
692 Node* rhs_instance_type = assembler->LoadInstanceType(rhs); 692 Node* rhs_instance_type = assembler->LoadInstanceType(rhs);
693 693
694 // Exit unless {rhs} is a string. Since {lhs} is a string we no longer 694 // Exit unless {rhs} is a string. Since {lhs} is a string we no longer
695 // need an Oddball check. 695 // need an Oddball check.
696 assembler->GotoUnless(assembler->IsStringInstanceType(rhs_instance_type), 696 assembler->GotoUnless(assembler->IsStringInstanceType(rhs_instance_type),
697 &call_with_any_feedback); 697 &call_with_any_feedback);
698 698
699 var_type_feedback.Bind( 699 var_type_feedback.Bind(
700 assembler->Int32Constant(BinaryOperationFeedback::kString)); 700 assembler->SmiConstant(BinaryOperationFeedback::kString));
701 Callable callable = CodeFactory::StringAdd( 701 Callable callable = CodeFactory::StringAdd(
702 assembler->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); 702 assembler->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
703 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs)); 703 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs));
704 704
705 assembler->Goto(&end); 705 assembler->Goto(&end);
706 } 706 }
707 } 707 }
708 708
709 assembler->Bind(&check_rhsisoddball); 709 assembler->Bind(&check_rhsisoddball);
710 { 710 {
711 // Check if rhs is an oddball. At this point we know lhs is either a 711 // Check if rhs is an oddball. At this point we know lhs is either a
712 // Smi or number or oddball and rhs is not a number or Smi. 712 // Smi or number or oddball and rhs is not a number or Smi.
713 Node* rhs_instance_type = assembler->LoadInstanceType(rhs); 713 Node* rhs_instance_type = assembler->LoadInstanceType(rhs);
714 Node* rhs_is_oddball = assembler->Word32Equal( 714 Node* rhs_is_oddball = assembler->Word32Equal(
715 rhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE)); 715 rhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE));
716 assembler->Branch(rhs_is_oddball, &call_with_oddball_feedback, 716 assembler->Branch(rhs_is_oddball, &call_with_oddball_feedback,
717 &call_with_any_feedback); 717 &call_with_any_feedback);
718 } 718 }
719 719
720 assembler->Bind(&call_with_oddball_feedback); 720 assembler->Bind(&call_with_oddball_feedback);
721 { 721 {
722 var_type_feedback.Bind( 722 var_type_feedback.Bind(
723 assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball)); 723 assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
724 assembler->Goto(&call_add_stub); 724 assembler->Goto(&call_add_stub);
725 } 725 }
726 726
727 assembler->Bind(&call_with_any_feedback); 727 assembler->Bind(&call_with_any_feedback);
728 { 728 {
729 var_type_feedback.Bind( 729 var_type_feedback.Bind(
730 assembler->Int32Constant(BinaryOperationFeedback::kAny)); 730 assembler->SmiConstant(BinaryOperationFeedback::kAny));
731 assembler->Goto(&call_add_stub); 731 assembler->Goto(&call_add_stub);
732 } 732 }
733 733
734 assembler->Bind(&call_add_stub); 734 assembler->Bind(&call_add_stub);
735 { 735 {
736 Callable callable = CodeFactory::Add(assembler->isolate()); 736 Callable callable = CodeFactory::Add(assembler->isolate());
737 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs)); 737 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs));
738 assembler->Goto(&end); 738 assembler->Goto(&end);
739 } 739 }
740 740
(...skipping 11 matching lines...) Expand all
752 typedef CodeStubAssembler::Label Label; 752 typedef CodeStubAssembler::Label Label;
753 typedef compiler::Node Node; 753 typedef compiler::Node Node;
754 typedef CodeStubAssembler::Variable Variable; 754 typedef CodeStubAssembler::Variable Variable;
755 755
756 // Shared entry for floating point subtraction. 756 // Shared entry for floating point subtraction.
757 Label do_fsub(assembler), end(assembler), call_subtract_stub(assembler), 757 Label do_fsub(assembler), end(assembler), call_subtract_stub(assembler),
758 if_lhsisnotnumber(assembler), check_rhsisoddball(assembler), 758 if_lhsisnotnumber(assembler), check_rhsisoddball(assembler),
759 call_with_any_feedback(assembler); 759 call_with_any_feedback(assembler);
760 Variable var_fsub_lhs(assembler, MachineRepresentation::kFloat64), 760 Variable var_fsub_lhs(assembler, MachineRepresentation::kFloat64),
761 var_fsub_rhs(assembler, MachineRepresentation::kFloat64), 761 var_fsub_rhs(assembler, MachineRepresentation::kFloat64),
762 var_type_feedback(assembler, MachineRepresentation::kWord32), 762 var_type_feedback(assembler, MachineRepresentation::kTaggedSigned),
763 var_result(assembler, MachineRepresentation::kTagged); 763 var_result(assembler, MachineRepresentation::kTagged);
764 764
765 // Check if the {lhs} is a Smi or a HeapObject. 765 // Check if the {lhs} is a Smi or a HeapObject.
766 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); 766 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler);
767 assembler->Branch(assembler->TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); 767 assembler->Branch(assembler->TaggedIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi);
768 768
769 assembler->Bind(&if_lhsissmi); 769 assembler->Bind(&if_lhsissmi);
770 { 770 {
771 // Check if the {rhs} is also a Smi. 771 // Check if the {rhs} is also a Smi.
772 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); 772 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
(...skipping 17 matching lines...) Expand all
790 // lhs, rhs - smi and result - number. combined - number. 790 // lhs, rhs - smi and result - number. combined - number.
791 // The result doesn't fit into Smi range. 791 // The result doesn't fit into Smi range.
792 var_fsub_lhs.Bind(assembler->SmiToFloat64(lhs)); 792 var_fsub_lhs.Bind(assembler->SmiToFloat64(lhs));
793 var_fsub_rhs.Bind(assembler->SmiToFloat64(rhs)); 793 var_fsub_rhs.Bind(assembler->SmiToFloat64(rhs));
794 assembler->Goto(&do_fsub); 794 assembler->Goto(&do_fsub);
795 } 795 }
796 796
797 assembler->Bind(&if_notoverflow); 797 assembler->Bind(&if_notoverflow);
798 // lhs, rhs, result smi. combined - smi. 798 // lhs, rhs, result smi. combined - smi.
799 var_type_feedback.Bind( 799 var_type_feedback.Bind(
800 assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall)); 800 assembler->SmiConstant(BinaryOperationFeedback::kSignedSmall));
801 var_result.Bind( 801 var_result.Bind(
802 assembler->BitcastWordToTaggedSigned(assembler->Projection(0, pair))); 802 assembler->BitcastWordToTaggedSigned(assembler->Projection(0, pair)));
803 assembler->Goto(&end); 803 assembler->Goto(&end);
804 } 804 }
805 805
806 assembler->Bind(&if_rhsisnotsmi); 806 assembler->Bind(&if_rhsisnotsmi);
807 { 807 {
808 // Load the map of the {rhs}. 808 // Load the map of the {rhs}.
809 Node* rhs_map = assembler->LoadMap(rhs); 809 Node* rhs_map = assembler->LoadMap(rhs);
810 810
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 // Perform a floating point subtraction. 853 // Perform a floating point subtraction.
854 var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); 854 var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs));
855 var_fsub_rhs.Bind(assembler->LoadHeapNumberValue(rhs)); 855 var_fsub_rhs.Bind(assembler->LoadHeapNumberValue(rhs));
856 assembler->Goto(&do_fsub); 856 assembler->Goto(&do_fsub);
857 } 857 }
858 } 858 }
859 859
860 assembler->Bind(&do_fsub); 860 assembler->Bind(&do_fsub);
861 { 861 {
862 var_type_feedback.Bind( 862 var_type_feedback.Bind(
863 assembler->Int32Constant(BinaryOperationFeedback::kNumber)); 863 assembler->SmiConstant(BinaryOperationFeedback::kNumber));
864 Node* lhs_value = var_fsub_lhs.value(); 864 Node* lhs_value = var_fsub_lhs.value();
865 Node* rhs_value = var_fsub_rhs.value(); 865 Node* rhs_value = var_fsub_rhs.value();
866 Node* value = assembler->Float64Sub(lhs_value, rhs_value); 866 Node* value = assembler->Float64Sub(lhs_value, rhs_value);
867 var_result.Bind(assembler->AllocateHeapNumberWithValue(value)); 867 var_result.Bind(assembler->AllocateHeapNumberWithValue(value));
868 assembler->Goto(&end); 868 assembler->Goto(&end);
869 } 869 }
870 870
871 assembler->Bind(&if_lhsisnotnumber); 871 assembler->Bind(&if_lhsisnotnumber);
872 { 872 {
873 // No checks on rhs are done yet. We just know lhs is not a number or Smi. 873 // No checks on rhs are done yet. We just know lhs is not a number or Smi.
874 // Check if lhs is an oddball. 874 // Check if lhs is an oddball.
875 Node* lhs_instance_type = assembler->LoadInstanceType(lhs); 875 Node* lhs_instance_type = assembler->LoadInstanceType(lhs);
876 Node* lhs_is_oddball = assembler->Word32Equal( 876 Node* lhs_is_oddball = assembler->Word32Equal(
877 lhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE)); 877 lhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE));
878 assembler->GotoUnless(lhs_is_oddball, &call_with_any_feedback); 878 assembler->GotoUnless(lhs_is_oddball, &call_with_any_feedback);
879 879
880 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); 880 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
881 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi, 881 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi,
882 &if_rhsisnotsmi); 882 &if_rhsisnotsmi);
883 883
884 assembler->Bind(&if_rhsissmi); 884 assembler->Bind(&if_rhsissmi);
885 { 885 {
886 var_type_feedback.Bind( 886 var_type_feedback.Bind(
887 assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball)); 887 assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
888 assembler->Goto(&call_subtract_stub); 888 assembler->Goto(&call_subtract_stub);
889 } 889 }
890 890
891 assembler->Bind(&if_rhsisnotsmi); 891 assembler->Bind(&if_rhsisnotsmi);
892 { 892 {
893 // Load the map of the {rhs}. 893 // Load the map of the {rhs}.
894 Node* rhs_map = assembler->LoadMap(rhs); 894 Node* rhs_map = assembler->LoadMap(rhs);
895 895
896 // Check if {rhs} is a HeapNumber. 896 // Check if {rhs} is a HeapNumber.
897 assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map), 897 assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
898 &check_rhsisoddball); 898 &check_rhsisoddball);
899 899
900 var_type_feedback.Bind( 900 var_type_feedback.Bind(
901 assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball)); 901 assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
902 assembler->Goto(&call_subtract_stub); 902 assembler->Goto(&call_subtract_stub);
903 } 903 }
904 } 904 }
905 905
906 assembler->Bind(&check_rhsisoddball); 906 assembler->Bind(&check_rhsisoddball);
907 { 907 {
908 // Check if rhs is an oddball. At this point we know lhs is either a 908 // Check if rhs is an oddball. At this point we know lhs is either a
909 // Smi or number or oddball and rhs is not a number or Smi. 909 // Smi or number or oddball and rhs is not a number or Smi.
910 Node* rhs_instance_type = assembler->LoadInstanceType(rhs); 910 Node* rhs_instance_type = assembler->LoadInstanceType(rhs);
911 Node* rhs_is_oddball = assembler->Word32Equal( 911 Node* rhs_is_oddball = assembler->Word32Equal(
912 rhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE)); 912 rhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE));
913 assembler->GotoUnless(rhs_is_oddball, &call_with_any_feedback); 913 assembler->GotoUnless(rhs_is_oddball, &call_with_any_feedback);
914 914
915 var_type_feedback.Bind( 915 var_type_feedback.Bind(
916 assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball)); 916 assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
917 assembler->Goto(&call_subtract_stub); 917 assembler->Goto(&call_subtract_stub);
918 } 918 }
919 919
920 assembler->Bind(&call_with_any_feedback); 920 assembler->Bind(&call_with_any_feedback);
921 { 921 {
922 var_type_feedback.Bind( 922 var_type_feedback.Bind(
923 assembler->Int32Constant(BinaryOperationFeedback::kAny)); 923 assembler->SmiConstant(BinaryOperationFeedback::kAny));
924 assembler->Goto(&call_subtract_stub); 924 assembler->Goto(&call_subtract_stub);
925 } 925 }
926 926
927 assembler->Bind(&call_subtract_stub); 927 assembler->Bind(&call_subtract_stub);
928 { 928 {
929 Callable callable = CodeFactory::Subtract(assembler->isolate()); 929 Callable callable = CodeFactory::Subtract(assembler->isolate());
930 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs)); 930 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs));
931 assembler->Goto(&end); 931 assembler->Goto(&end);
932 } 932 }
933 933
(...skipping 14 matching lines...) Expand all
948 typedef CodeStubAssembler::Variable Variable; 948 typedef CodeStubAssembler::Variable Variable;
949 949
950 // Shared entry point for floating point multiplication. 950 // Shared entry point for floating point multiplication.
951 Label do_fmul(assembler), if_lhsisnotnumber(assembler, Label::kDeferred), 951 Label do_fmul(assembler), if_lhsisnotnumber(assembler, Label::kDeferred),
952 check_rhsisoddball(assembler, Label::kDeferred), 952 check_rhsisoddball(assembler, Label::kDeferred),
953 call_with_oddball_feedback(assembler), call_with_any_feedback(assembler), 953 call_with_oddball_feedback(assembler), call_with_any_feedback(assembler),
954 call_multiply_stub(assembler), end(assembler); 954 call_multiply_stub(assembler), end(assembler);
955 Variable var_lhs_float64(assembler, MachineRepresentation::kFloat64), 955 Variable var_lhs_float64(assembler, MachineRepresentation::kFloat64),
956 var_rhs_float64(assembler, MachineRepresentation::kFloat64), 956 var_rhs_float64(assembler, MachineRepresentation::kFloat64),
957 var_result(assembler, MachineRepresentation::kTagged), 957 var_result(assembler, MachineRepresentation::kTagged),
958 var_type_feedback(assembler, MachineRepresentation::kWord32); 958 var_type_feedback(assembler, MachineRepresentation::kTaggedSigned);
959 959
960 Label lhs_is_smi(assembler), lhs_is_not_smi(assembler); 960 Label lhs_is_smi(assembler), lhs_is_not_smi(assembler);
961 assembler->Branch(assembler->TaggedIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi); 961 assembler->Branch(assembler->TaggedIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi);
962 962
963 assembler->Bind(&lhs_is_smi); 963 assembler->Bind(&lhs_is_smi);
964 { 964 {
965 Label rhs_is_smi(assembler), rhs_is_not_smi(assembler); 965 Label rhs_is_smi(assembler), rhs_is_not_smi(assembler);
966 assembler->Branch(assembler->TaggedIsSmi(rhs), &rhs_is_smi, 966 assembler->Branch(assembler->TaggedIsSmi(rhs), &rhs_is_smi,
967 &rhs_is_not_smi); 967 &rhs_is_not_smi);
968 968
969 assembler->Bind(&rhs_is_smi); 969 assembler->Bind(&rhs_is_smi);
970 { 970 {
971 // Both {lhs} and {rhs} are Smis. The result is not necessarily a smi, 971 // Both {lhs} and {rhs} are Smis. The result is not necessarily a smi,
972 // in case of overflow. 972 // in case of overflow.
973 var_result.Bind(assembler->SmiMul(lhs, rhs)); 973 var_result.Bind(assembler->SmiMul(lhs, rhs));
974 var_type_feedback.Bind(assembler->SelectInt32Constant( 974 var_type_feedback.Bind(assembler->SelectSmiConstant(
975 assembler->TaggedIsSmi(var_result.value()), 975 assembler->TaggedIsSmi(var_result.value()),
976 BinaryOperationFeedback::kSignedSmall, 976 BinaryOperationFeedback::kSignedSmall,
977 BinaryOperationFeedback::kNumber)); 977 BinaryOperationFeedback::kNumber));
978 assembler->Goto(&end); 978 assembler->Goto(&end);
979 } 979 }
980 980
981 assembler->Bind(&rhs_is_not_smi); 981 assembler->Bind(&rhs_is_not_smi);
982 { 982 {
983 Node* rhs_map = assembler->LoadMap(rhs); 983 Node* rhs_map = assembler->LoadMap(rhs);
984 984
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 // multiply them. 1026 // multiply them.
1027 var_lhs_float64.Bind(assembler->LoadHeapNumberValue(lhs)); 1027 var_lhs_float64.Bind(assembler->LoadHeapNumberValue(lhs));
1028 var_rhs_float64.Bind(assembler->LoadHeapNumberValue(rhs)); 1028 var_rhs_float64.Bind(assembler->LoadHeapNumberValue(rhs));
1029 assembler->Goto(&do_fmul); 1029 assembler->Goto(&do_fmul);
1030 } 1030 }
1031 } 1031 }
1032 1032
1033 assembler->Bind(&do_fmul); 1033 assembler->Bind(&do_fmul);
1034 { 1034 {
1035 var_type_feedback.Bind( 1035 var_type_feedback.Bind(
1036 assembler->Int32Constant(BinaryOperationFeedback::kNumber)); 1036 assembler->SmiConstant(BinaryOperationFeedback::kNumber));
1037 Node* value = 1037 Node* value =
1038 assembler->Float64Mul(var_lhs_float64.value(), var_rhs_float64.value()); 1038 assembler->Float64Mul(var_lhs_float64.value(), var_rhs_float64.value());
1039 Node* result = assembler->AllocateHeapNumberWithValue(value); 1039 Node* result = assembler->AllocateHeapNumberWithValue(value);
1040 var_result.Bind(result); 1040 var_result.Bind(result);
1041 assembler->Goto(&end); 1041 assembler->Goto(&end);
1042 } 1042 }
1043 1043
1044 assembler->Bind(&if_lhsisnotnumber); 1044 assembler->Bind(&if_lhsisnotnumber);
1045 { 1045 {
1046 // No checks on rhs are done yet. We just know lhs is not a number or Smi. 1046 // No checks on rhs are done yet. We just know lhs is not a number or Smi.
(...skipping 20 matching lines...) Expand all
1067 Node* rhs_instance_type = assembler->LoadInstanceType(rhs); 1067 Node* rhs_instance_type = assembler->LoadInstanceType(rhs);
1068 Node* rhs_is_oddball = assembler->Word32Equal( 1068 Node* rhs_is_oddball = assembler->Word32Equal(
1069 rhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE)); 1069 rhs_instance_type, assembler->Int32Constant(ODDBALL_TYPE));
1070 assembler->Branch(rhs_is_oddball, &call_with_oddball_feedback, 1070 assembler->Branch(rhs_is_oddball, &call_with_oddball_feedback,
1071 &call_with_any_feedback); 1071 &call_with_any_feedback);
1072 } 1072 }
1073 1073
1074 assembler->Bind(&call_with_oddball_feedback); 1074 assembler->Bind(&call_with_oddball_feedback);
1075 { 1075 {
1076 var_type_feedback.Bind( 1076 var_type_feedback.Bind(
1077 assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball)); 1077 assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
1078 assembler->Goto(&call_multiply_stub); 1078 assembler->Goto(&call_multiply_stub);
1079 } 1079 }
1080 1080
1081 assembler->Bind(&call_with_any_feedback); 1081 assembler->Bind(&call_with_any_feedback);
1082 { 1082 {
1083 var_type_feedback.Bind( 1083 var_type_feedback.Bind(
1084 assembler->Int32Constant(BinaryOperationFeedback::kAny)); 1084 assembler->SmiConstant(BinaryOperationFeedback::kAny));
1085 assembler->Goto(&call_multiply_stub); 1085 assembler->Goto(&call_multiply_stub);
1086 } 1086 }
1087 1087
1088 assembler->Bind(&call_multiply_stub); 1088 assembler->Bind(&call_multiply_stub);
1089 { 1089 {
1090 Callable callable = CodeFactory::Multiply(assembler->isolate()); 1090 Callable callable = CodeFactory::Multiply(assembler->isolate());
1091 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs)); 1091 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs));
1092 assembler->Goto(&end); 1092 assembler->Goto(&end);
1093 } 1093 }
1094 1094
(...skipping 14 matching lines...) Expand all
1109 typedef CodeStubAssembler::Variable Variable; 1109 typedef CodeStubAssembler::Variable Variable;
1110 1110
1111 // Shared entry point for floating point division. 1111 // Shared entry point for floating point division.
1112 Label do_fdiv(assembler), dividend_is_not_number(assembler, Label::kDeferred), 1112 Label do_fdiv(assembler), dividend_is_not_number(assembler, Label::kDeferred),
1113 check_divisor_for_oddball(assembler, Label::kDeferred), 1113 check_divisor_for_oddball(assembler, Label::kDeferred),
1114 call_with_oddball_feedback(assembler), call_with_any_feedback(assembler), 1114 call_with_oddball_feedback(assembler), call_with_any_feedback(assembler),
1115 call_divide_stub(assembler), end(assembler); 1115 call_divide_stub(assembler), end(assembler);
1116 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), 1116 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64),
1117 var_divisor_float64(assembler, MachineRepresentation::kFloat64), 1117 var_divisor_float64(assembler, MachineRepresentation::kFloat64),
1118 var_result(assembler, MachineRepresentation::kTagged), 1118 var_result(assembler, MachineRepresentation::kTagged),
1119 var_type_feedback(assembler, MachineRepresentation::kWord32); 1119 var_type_feedback(assembler, MachineRepresentation::kTaggedSigned);
1120 1120
1121 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler); 1121 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
1122 assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi, 1122 assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi,
1123 &dividend_is_not_smi); 1123 &dividend_is_not_smi);
1124 1124
1125 assembler->Bind(&dividend_is_smi); 1125 assembler->Bind(&dividend_is_smi);
1126 { 1126 {
1127 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); 1127 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler);
1128 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi, 1128 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi,
1129 &divisor_is_not_smi); 1129 &divisor_is_not_smi);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 } 1175 }
1176 assembler->Bind(&divisor_is_not_minus_one); 1176 assembler->Bind(&divisor_is_not_minus_one);
1177 1177
1178 Node* untagged_result = 1178 Node* untagged_result =
1179 assembler->Int32Div(untagged_dividend, untagged_divisor); 1179 assembler->Int32Div(untagged_dividend, untagged_divisor);
1180 Node* truncated = assembler->Int32Mul(untagged_result, untagged_divisor); 1180 Node* truncated = assembler->Int32Mul(untagged_result, untagged_divisor);
1181 // Do floating point division if the remainder is not 0. 1181 // Do floating point division if the remainder is not 0.
1182 assembler->GotoIf(assembler->Word32NotEqual(untagged_dividend, truncated), 1182 assembler->GotoIf(assembler->Word32NotEqual(untagged_dividend, truncated),
1183 &bailout); 1183 &bailout);
1184 var_type_feedback.Bind( 1184 var_type_feedback.Bind(
1185 assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall)); 1185 assembler->SmiConstant(BinaryOperationFeedback::kSignedSmall));
1186 var_result.Bind(assembler->SmiFromWord32(untagged_result)); 1186 var_result.Bind(assembler->SmiFromWord32(untagged_result));
1187 assembler->Goto(&end); 1187 assembler->Goto(&end);
1188 1188
1189 // Bailout: convert {dividend} and {divisor} to double and do double 1189 // Bailout: convert {dividend} and {divisor} to double and do double
1190 // division. 1190 // division.
1191 assembler->Bind(&bailout); 1191 assembler->Bind(&bailout);
1192 { 1192 {
1193 var_dividend_float64.Bind(assembler->SmiToFloat64(dividend)); 1193 var_dividend_float64.Bind(assembler->SmiToFloat64(dividend));
1194 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor)); 1194 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor));
1195 assembler->Goto(&do_fdiv); 1195 assembler->Goto(&do_fdiv);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend)); 1246 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend));
1247 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor)); 1247 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor));
1248 assembler->Goto(&do_fdiv); 1248 assembler->Goto(&do_fdiv);
1249 } 1249 }
1250 } 1250 }
1251 } 1251 }
1252 1252
1253 assembler->Bind(&do_fdiv); 1253 assembler->Bind(&do_fdiv);
1254 { 1254 {
1255 var_type_feedback.Bind( 1255 var_type_feedback.Bind(
1256 assembler->Int32Constant(BinaryOperationFeedback::kNumber)); 1256 assembler->SmiConstant(BinaryOperationFeedback::kNumber));
1257 Node* value = assembler->Float64Div(var_dividend_float64.value(), 1257 Node* value = assembler->Float64Div(var_dividend_float64.value(),
1258 var_divisor_float64.value()); 1258 var_divisor_float64.value());
1259 var_result.Bind(assembler->AllocateHeapNumberWithValue(value)); 1259 var_result.Bind(assembler->AllocateHeapNumberWithValue(value));
1260 assembler->Goto(&end); 1260 assembler->Goto(&end);
1261 } 1261 }
1262 1262
1263 assembler->Bind(&dividend_is_not_number); 1263 assembler->Bind(&dividend_is_not_number);
1264 { 1264 {
1265 // We just know dividend is not a number or Smi. No checks on divisor yet. 1265 // We just know dividend is not a number or Smi. No checks on divisor yet.
1266 // Check if dividend is an oddball. 1266 // Check if dividend is an oddball.
(...skipping 20 matching lines...) Expand all
1287 Node* divisor_instance_type = assembler->LoadInstanceType(divisor); 1287 Node* divisor_instance_type = assembler->LoadInstanceType(divisor);
1288 Node* divisor_is_oddball = assembler->Word32Equal( 1288 Node* divisor_is_oddball = assembler->Word32Equal(
1289 divisor_instance_type, assembler->Int32Constant(ODDBALL_TYPE)); 1289 divisor_instance_type, assembler->Int32Constant(ODDBALL_TYPE));
1290 assembler->Branch(divisor_is_oddball, &call_with_oddball_feedback, 1290 assembler->Branch(divisor_is_oddball, &call_with_oddball_feedback,
1291 &call_with_any_feedback); 1291 &call_with_any_feedback);
1292 } 1292 }
1293 1293
1294 assembler->Bind(&call_with_oddball_feedback); 1294 assembler->Bind(&call_with_oddball_feedback);
1295 { 1295 {
1296 var_type_feedback.Bind( 1296 var_type_feedback.Bind(
1297 assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball)); 1297 assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
1298 assembler->Goto(&call_divide_stub); 1298 assembler->Goto(&call_divide_stub);
1299 } 1299 }
1300 1300
1301 assembler->Bind(&call_with_any_feedback); 1301 assembler->Bind(&call_with_any_feedback);
1302 { 1302 {
1303 var_type_feedback.Bind( 1303 var_type_feedback.Bind(
1304 assembler->Int32Constant(BinaryOperationFeedback::kAny)); 1304 assembler->SmiConstant(BinaryOperationFeedback::kAny));
1305 assembler->Goto(&call_divide_stub); 1305 assembler->Goto(&call_divide_stub);
1306 } 1306 }
1307 1307
1308 assembler->Bind(&call_divide_stub); 1308 assembler->Bind(&call_divide_stub);
1309 { 1309 {
1310 Callable callable = CodeFactory::Divide(assembler->isolate()); 1310 Callable callable = CodeFactory::Divide(assembler->isolate());
1311 var_result.Bind(assembler->CallStub(callable, context, dividend, divisor)); 1311 var_result.Bind(assembler->CallStub(callable, context, dividend, divisor));
1312 assembler->Goto(&end); 1312 assembler->Goto(&end);
1313 } 1313 }
1314 1314
(...skipping 13 matching lines...) Expand all
1328 typedef CodeStubAssembler::Variable Variable; 1328 typedef CodeStubAssembler::Variable Variable;
1329 1329
1330 // Shared entry point for floating point division. 1330 // Shared entry point for floating point division.
1331 Label do_fmod(assembler), dividend_is_not_number(assembler, Label::kDeferred), 1331 Label do_fmod(assembler), dividend_is_not_number(assembler, Label::kDeferred),
1332 check_divisor_for_oddball(assembler, Label::kDeferred), 1332 check_divisor_for_oddball(assembler, Label::kDeferred),
1333 call_with_oddball_feedback(assembler), call_with_any_feedback(assembler), 1333 call_with_oddball_feedback(assembler), call_with_any_feedback(assembler),
1334 call_modulus_stub(assembler), end(assembler); 1334 call_modulus_stub(assembler), end(assembler);
1335 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), 1335 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64),
1336 var_divisor_float64(assembler, MachineRepresentation::kFloat64), 1336 var_divisor_float64(assembler, MachineRepresentation::kFloat64),
1337 var_result(assembler, MachineRepresentation::kTagged), 1337 var_result(assembler, MachineRepresentation::kTagged),
1338 var_type_feedback(assembler, MachineRepresentation::kWord32); 1338 var_type_feedback(assembler, MachineRepresentation::kTaggedSigned);
1339 1339
1340 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler); 1340 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
1341 assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi, 1341 assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi,
1342 &dividend_is_not_smi); 1342 &dividend_is_not_smi);
1343 1343
1344 assembler->Bind(&dividend_is_smi); 1344 assembler->Bind(&dividend_is_smi);
1345 { 1345 {
1346 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); 1346 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler);
1347 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi, 1347 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi,
1348 &divisor_is_not_smi); 1348 &divisor_is_not_smi);
1349 1349
1350 assembler->Bind(&divisor_is_smi); 1350 assembler->Bind(&divisor_is_smi);
1351 { 1351 {
1352 var_result.Bind(assembler->SmiMod(dividend, divisor)); 1352 var_result.Bind(assembler->SmiMod(dividend, divisor));
1353 var_type_feedback.Bind(assembler->SelectInt32Constant( 1353 var_type_feedback.Bind(assembler->SelectSmiConstant(
1354 assembler->TaggedIsSmi(var_result.value()), 1354 assembler->TaggedIsSmi(var_result.value()),
1355 BinaryOperationFeedback::kSignedSmall, 1355 BinaryOperationFeedback::kSignedSmall,
1356 BinaryOperationFeedback::kNumber)); 1356 BinaryOperationFeedback::kNumber));
1357 assembler->Goto(&end); 1357 assembler->Goto(&end);
1358 } 1358 }
1359 1359
1360 assembler->Bind(&divisor_is_not_smi); 1360 assembler->Bind(&divisor_is_not_smi);
1361 { 1361 {
1362 Node* divisor_map = assembler->LoadMap(divisor); 1362 Node* divisor_map = assembler->LoadMap(divisor);
1363 1363
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 // and divide them. 1407 // and divide them.
1408 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend)); 1408 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend));
1409 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor)); 1409 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor));
1410 assembler->Goto(&do_fmod); 1410 assembler->Goto(&do_fmod);
1411 } 1411 }
1412 } 1412 }
1413 1413
1414 assembler->Bind(&do_fmod); 1414 assembler->Bind(&do_fmod);
1415 { 1415 {
1416 var_type_feedback.Bind( 1416 var_type_feedback.Bind(
1417 assembler->Int32Constant(BinaryOperationFeedback::kNumber)); 1417 assembler->SmiConstant(BinaryOperationFeedback::kNumber));
1418 Node* value = assembler->Float64Mod(var_dividend_float64.value(), 1418 Node* value = assembler->Float64Mod(var_dividend_float64.value(),
1419 var_divisor_float64.value()); 1419 var_divisor_float64.value());
1420 var_result.Bind(assembler->AllocateHeapNumberWithValue(value)); 1420 var_result.Bind(assembler->AllocateHeapNumberWithValue(value));
1421 assembler->Goto(&end); 1421 assembler->Goto(&end);
1422 } 1422 }
1423 1423
1424 assembler->Bind(&dividend_is_not_number); 1424 assembler->Bind(&dividend_is_not_number);
1425 { 1425 {
1426 // No checks on divisor yet. We just know dividend is not a number or Smi. 1426 // No checks on divisor yet. We just know dividend is not a number or Smi.
1427 // Check if dividend is an oddball. 1427 // Check if dividend is an oddball.
(...skipping 20 matching lines...) Expand all
1448 Node* divisor_instance_type = assembler->LoadInstanceType(divisor); 1448 Node* divisor_instance_type = assembler->LoadInstanceType(divisor);
1449 Node* divisor_is_oddball = assembler->Word32Equal( 1449 Node* divisor_is_oddball = assembler->Word32Equal(
1450 divisor_instance_type, assembler->Int32Constant(ODDBALL_TYPE)); 1450 divisor_instance_type, assembler->Int32Constant(ODDBALL_TYPE));
1451 assembler->Branch(divisor_is_oddball, &call_with_oddball_feedback, 1451 assembler->Branch(divisor_is_oddball, &call_with_oddball_feedback,
1452 &call_with_any_feedback); 1452 &call_with_any_feedback);
1453 } 1453 }
1454 1454
1455 assembler->Bind(&call_with_oddball_feedback); 1455 assembler->Bind(&call_with_oddball_feedback);
1456 { 1456 {
1457 var_type_feedback.Bind( 1457 var_type_feedback.Bind(
1458 assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball)); 1458 assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
1459 assembler->Goto(&call_modulus_stub); 1459 assembler->Goto(&call_modulus_stub);
1460 } 1460 }
1461 1461
1462 assembler->Bind(&call_with_any_feedback); 1462 assembler->Bind(&call_with_any_feedback);
1463 { 1463 {
1464 var_type_feedback.Bind( 1464 var_type_feedback.Bind(
1465 assembler->Int32Constant(BinaryOperationFeedback::kAny)); 1465 assembler->SmiConstant(BinaryOperationFeedback::kAny));
1466 assembler->Goto(&call_modulus_stub); 1466 assembler->Goto(&call_modulus_stub);
1467 } 1467 }
1468 1468
1469 assembler->Bind(&call_modulus_stub); 1469 assembler->Bind(&call_modulus_stub);
1470 { 1470 {
1471 Callable callable = CodeFactory::Modulus(assembler->isolate()); 1471 Callable callable = CodeFactory::Modulus(assembler->isolate());
1472 var_result.Bind(assembler->CallStub(callable, context, dividend, divisor)); 1472 var_result.Bind(assembler->CallStub(callable, context, dividend, divisor));
1473 assembler->Goto(&end); 1473 assembler->Goto(&end);
1474 } 1474 }
1475 1475
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 } 2209 }
2210 2210
2211 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) 2211 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
2212 : PlatformCodeStub(isolate) {} 2212 : PlatformCodeStub(isolate) {}
2213 2213
2214 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) 2214 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate)
2215 : PlatformCodeStub(isolate) {} 2215 : PlatformCodeStub(isolate) {}
2216 2216
2217 } // namespace internal 2217 } // namespace internal
2218 } // namespace v8 2218 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698