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

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

Issue 1927873002: Revert of [ignition] Inline the binary op TurboFan code stubs in the bytecode handlers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Merged. Created 4 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 | « src/code-stubs.h ('k') | src/interpreter/interpreter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 491
492 void StringLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const { 492 void StringLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const {
493 compiler::Node* value = assembler->Parameter(0); 493 compiler::Node* value = assembler->Parameter(0);
494 compiler::Node* string = 494 compiler::Node* string =
495 assembler->LoadObjectField(value, JSValue::kValueOffset); 495 assembler->LoadObjectField(value, JSValue::kValueOffset);
496 compiler::Node* result = 496 compiler::Node* result =
497 assembler->LoadObjectField(string, String::kLengthOffset); 497 assembler->LoadObjectField(string, String::kLengthOffset);
498 assembler->Return(result); 498 assembler->Return(result);
499 } 499 }
500 500
501 compiler::Node* AddStub::Generate(CodeStubAssembler* assembler, 501 void AddStub::GenerateAssembly(CodeStubAssembler* assembler) const {
502 compiler::Node* left, compiler::Node* right,
503 compiler::Node* context) {
504 typedef CodeStubAssembler::Label Label; 502 typedef CodeStubAssembler::Label Label;
505 typedef compiler::Node Node; 503 typedef compiler::Node Node;
506 typedef CodeStubAssembler::Variable Variable; 504 typedef CodeStubAssembler::Variable Variable;
507 505
506 Node* context = assembler->Parameter(2);
507
508 // Shared entry for floating point addition. 508 // Shared entry for floating point addition.
509 Label do_fadd(assembler), end(assembler); 509 Label do_fadd(assembler);
510 Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64), 510 Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64),
511 var_fadd_rhs(assembler, MachineRepresentation::kFloat64); 511 var_fadd_rhs(assembler, MachineRepresentation::kFloat64);
512 512
513 // We might need to loop several times due to ToPrimitive, ToString and/or 513 // We might need to loop several times due to ToPrimitive, ToString and/or
514 // ToNumber conversions. 514 // ToNumber conversions.
515 Variable var_lhs(assembler, MachineRepresentation::kTagged), 515 Variable var_lhs(assembler, MachineRepresentation::kTagged),
516 var_rhs(assembler, MachineRepresentation::kTagged), 516 var_rhs(assembler, MachineRepresentation::kTagged);
517 var_result(assembler, MachineRepresentation::kTagged);
518 Variable* loop_vars[2] = {&var_lhs, &var_rhs}; 517 Variable* loop_vars[2] = {&var_lhs, &var_rhs};
519 Label loop(assembler, 2, loop_vars); 518 Label loop(assembler, 2, loop_vars);
520 var_lhs.Bind(left); 519 var_lhs.Bind(assembler->Parameter(0));
521 var_rhs.Bind(right); 520 var_rhs.Bind(assembler->Parameter(1));
522 assembler->Goto(&loop); 521 assembler->Goto(&loop);
523 assembler->Bind(&loop); 522 assembler->Bind(&loop);
524 { 523 {
525 // Load the current {lhs} and {rhs} values. 524 // Load the current {lhs} and {rhs} values.
526 Node* lhs = var_lhs.value(); 525 Node* lhs = var_lhs.value();
527 Node* rhs = var_rhs.value(); 526 Node* rhs = var_rhs.value();
528 527
529 // Check if the {lhs} is a Smi or a HeapObject. 528 // Check if the {lhs} is a Smi or a HeapObject.
530 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); 529 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler);
531 assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); 530 assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi);
(...skipping 16 matching lines...) Expand all
548 assembler->Branch(overflow, &if_overflow, &if_notoverflow); 547 assembler->Branch(overflow, &if_overflow, &if_notoverflow);
549 548
550 assembler->Bind(&if_overflow); 549 assembler->Bind(&if_overflow);
551 { 550 {
552 var_fadd_lhs.Bind(assembler->SmiToFloat64(lhs)); 551 var_fadd_lhs.Bind(assembler->SmiToFloat64(lhs));
553 var_fadd_rhs.Bind(assembler->SmiToFloat64(rhs)); 552 var_fadd_rhs.Bind(assembler->SmiToFloat64(rhs));
554 assembler->Goto(&do_fadd); 553 assembler->Goto(&do_fadd);
555 } 554 }
556 555
557 assembler->Bind(&if_notoverflow); 556 assembler->Bind(&if_notoverflow);
558 var_result.Bind(assembler->Projection(0, pair)); 557 assembler->Return(assembler->Projection(0, pair));
559 assembler->Goto(&end);
560 } 558 }
561 559
562 assembler->Bind(&if_rhsisnotsmi); 560 assembler->Bind(&if_rhsisnotsmi);
563 { 561 {
564 // Load the map of {rhs}. 562 // Load the map of {rhs}.
565 Node* rhs_map = assembler->LoadObjectField(rhs, HeapObject::kMapOffset); 563 Node* rhs_map = assembler->LoadObjectField(rhs, HeapObject::kMapOffset);
566 564
567 // Check if the {rhs} is a HeapNumber. 565 // Check if the {rhs} is a HeapNumber.
568 Label if_rhsisnumber(assembler), 566 Label if_rhsisnumber(assembler),
569 if_rhsisnotnumber(assembler, Label::kDeferred); 567 if_rhsisnotnumber(assembler, Label::kDeferred);
(...skipping 20 matching lines...) Expand all
590 rhs_instance_type, 588 rhs_instance_type,
591 assembler->Int32Constant(FIRST_NONSTRING_TYPE)), 589 assembler->Int32Constant(FIRST_NONSTRING_TYPE)),
592 &if_rhsisstring, &if_rhsisnotstring); 590 &if_rhsisstring, &if_rhsisnotstring);
593 591
594 assembler->Bind(&if_rhsisstring); 592 assembler->Bind(&if_rhsisstring);
595 { 593 {
596 // Convert {lhs}, which is a Smi, to a String and concatenate the 594 // Convert {lhs}, which is a Smi, to a String and concatenate the
597 // resulting string with the String {rhs}. 595 // resulting string with the String {rhs}.
598 Callable callable = CodeFactory::StringAdd( 596 Callable callable = CodeFactory::StringAdd(
599 assembler->isolate(), STRING_ADD_CONVERT_LEFT, NOT_TENURED); 597 assembler->isolate(), STRING_ADD_CONVERT_LEFT, NOT_TENURED);
600 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs)); 598 assembler->TailCallStub(callable, context, lhs, rhs);
601 assembler->Goto(&end);
602 } 599 }
603 600
604 assembler->Bind(&if_rhsisnotstring); 601 assembler->Bind(&if_rhsisnotstring);
605 { 602 {
606 // Check if {rhs} is a JSReceiver. 603 // Check if {rhs} is a JSReceiver.
607 Label if_rhsisreceiver(assembler, Label::kDeferred), 604 Label if_rhsisreceiver(assembler, Label::kDeferred),
608 if_rhsisnotreceiver(assembler, Label::kDeferred); 605 if_rhsisnotreceiver(assembler, Label::kDeferred);
609 assembler->Branch( 606 assembler->Branch(
610 assembler->Int32LessThanOrEqual( 607 assembler->Int32LessThanOrEqual(
611 assembler->Int32Constant(FIRST_JS_RECEIVER_TYPE), 608 assembler->Int32Constant(FIRST_JS_RECEIVER_TYPE),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 lhs_instance_type, 642 lhs_instance_type,
646 assembler->Int32Constant(FIRST_NONSTRING_TYPE)), 643 assembler->Int32Constant(FIRST_NONSTRING_TYPE)),
647 &if_lhsisstring, &if_lhsisnotstring); 644 &if_lhsisstring, &if_lhsisnotstring);
648 645
649 assembler->Bind(&if_lhsisstring); 646 assembler->Bind(&if_lhsisstring);
650 { 647 {
651 // Convert {rhs} to a String (using the sequence of ToPrimitive with 648 // Convert {rhs} to a String (using the sequence of ToPrimitive with
652 // no hint followed by ToString) and concatenate the strings. 649 // no hint followed by ToString) and concatenate the strings.
653 Callable callable = CodeFactory::StringAdd( 650 Callable callable = CodeFactory::StringAdd(
654 assembler->isolate(), STRING_ADD_CONVERT_RIGHT, NOT_TENURED); 651 assembler->isolate(), STRING_ADD_CONVERT_RIGHT, NOT_TENURED);
655 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs)); 652 assembler->TailCallStub(callable, context, lhs, rhs);
656 assembler->Goto(&end);
657 } 653 }
658 654
659 assembler->Bind(&if_lhsisnotstring); 655 assembler->Bind(&if_lhsisnotstring);
660 { 656 {
661 // Check if {rhs} is a Smi. 657 // Check if {rhs} is a Smi.
662 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); 658 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
663 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, 659 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi,
664 &if_rhsisnotsmi); 660 &if_rhsisnotsmi);
665 661
666 assembler->Bind(&if_rhsissmi); 662 assembler->Bind(&if_rhsissmi);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 rhs_instance_type, 720 rhs_instance_type,
725 assembler->Int32Constant(FIRST_NONSTRING_TYPE)), 721 assembler->Int32Constant(FIRST_NONSTRING_TYPE)),
726 &if_rhsisstring, &if_rhsisnotstring); 722 &if_rhsisstring, &if_rhsisnotstring);
727 723
728 assembler->Bind(&if_rhsisstring); 724 assembler->Bind(&if_rhsisstring);
729 { 725 {
730 // Convert {lhs} to a String (using the sequence of ToPrimitive with 726 // Convert {lhs} to a String (using the sequence of ToPrimitive with
731 // no hint followed by ToString) and concatenate the strings. 727 // no hint followed by ToString) and concatenate the strings.
732 Callable callable = CodeFactory::StringAdd( 728 Callable callable = CodeFactory::StringAdd(
733 assembler->isolate(), STRING_ADD_CONVERT_LEFT, NOT_TENURED); 729 assembler->isolate(), STRING_ADD_CONVERT_LEFT, NOT_TENURED);
734 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs)); 730 assembler->TailCallStub(callable, context, lhs, rhs);
735 assembler->Goto(&end);
736 } 731 }
737 732
738 assembler->Bind(&if_rhsisnotstring); 733 assembler->Bind(&if_rhsisnotstring);
739 { 734 {
740 // Check if {lhs} is a HeapNumber. 735 // Check if {lhs} is a HeapNumber.
741 Label if_lhsisnumber(assembler), if_lhsisnotnumber(assembler); 736 Label if_lhsisnumber(assembler), if_lhsisnotnumber(assembler);
742 assembler->Branch(assembler->Word32Equal( 737 assembler->Branch(assembler->Word32Equal(
743 lhs_instance_type, 738 lhs_instance_type,
744 assembler->Int32Constant(HEAP_NUMBER_TYPE)), 739 assembler->Int32Constant(HEAP_NUMBER_TYPE)),
745 &if_lhsisnumber, &if_lhsisnotnumber); 740 &if_lhsisnumber, &if_lhsisnotnumber);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 } 842 }
848 } 843 }
849 } 844 }
850 } 845 }
851 846
852 assembler->Bind(&do_fadd); 847 assembler->Bind(&do_fadd);
853 { 848 {
854 Node* lhs_value = var_fadd_lhs.value(); 849 Node* lhs_value = var_fadd_lhs.value();
855 Node* rhs_value = var_fadd_rhs.value(); 850 Node* rhs_value = var_fadd_rhs.value();
856 Node* value = assembler->Float64Add(lhs_value, rhs_value); 851 Node* value = assembler->Float64Add(lhs_value, rhs_value);
857 var_result.Bind(assembler->ChangeFloat64ToTagged(value)); 852 Node* result = assembler->ChangeFloat64ToTagged(value);
858 assembler->Goto(&end); 853 assembler->Return(result);
859 } 854 }
860 assembler->Bind(&end);
861 return var_result.value();
862 } 855 }
863 856
864 compiler::Node* SubtractStub::Generate(CodeStubAssembler* assembler, 857 void SubtractStub::GenerateAssembly(CodeStubAssembler* assembler) const {
865 compiler::Node* left,
866 compiler::Node* right,
867 compiler::Node* context) {
868 typedef CodeStubAssembler::Label Label; 858 typedef CodeStubAssembler::Label Label;
869 typedef compiler::Node Node; 859 typedef compiler::Node Node;
870 typedef CodeStubAssembler::Variable Variable; 860 typedef CodeStubAssembler::Variable Variable;
871 861
862 Node* context = assembler->Parameter(2);
863
872 // Shared entry for floating point subtraction. 864 // Shared entry for floating point subtraction.
873 Label do_fsub(assembler), end(assembler); 865 Label do_fsub(assembler);
874 Variable var_fsub_lhs(assembler, MachineRepresentation::kFloat64), 866 Variable var_fsub_lhs(assembler, MachineRepresentation::kFloat64),
875 var_fsub_rhs(assembler, MachineRepresentation::kFloat64); 867 var_fsub_rhs(assembler, MachineRepresentation::kFloat64);
876 868
877 // We might need to loop several times due to ToPrimitive and/or ToNumber 869 // We might need to loop several times due to ToPrimitive and/or ToNumber
878 // conversions. 870 // conversions.
879 Variable var_lhs(assembler, MachineRepresentation::kTagged), 871 Variable var_lhs(assembler, MachineRepresentation::kTagged),
880 var_rhs(assembler, MachineRepresentation::kTagged), 872 var_rhs(assembler, MachineRepresentation::kTagged);
881 var_result(assembler, MachineRepresentation::kTagged);
882 Variable* loop_vars[2] = {&var_lhs, &var_rhs}; 873 Variable* loop_vars[2] = {&var_lhs, &var_rhs};
883 Label loop(assembler, 2, loop_vars); 874 Label loop(assembler, 2, loop_vars);
884 var_lhs.Bind(left); 875 var_lhs.Bind(assembler->Parameter(0));
885 var_rhs.Bind(right); 876 var_rhs.Bind(assembler->Parameter(1));
886 assembler->Goto(&loop); 877 assembler->Goto(&loop);
887 assembler->Bind(&loop); 878 assembler->Bind(&loop);
888 { 879 {
889 // Load the current {lhs} and {rhs} values. 880 // Load the current {lhs} and {rhs} values.
890 Node* lhs = var_lhs.value(); 881 Node* lhs = var_lhs.value();
891 Node* rhs = var_rhs.value(); 882 Node* rhs = var_rhs.value();
892 883
893 // Check if the {lhs} is a Smi or a HeapObject. 884 // Check if the {lhs} is a Smi or a HeapObject.
894 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); 885 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler);
895 assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); 886 assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi);
(...skipping 17 matching lines...) Expand all
913 904
914 assembler->Bind(&if_overflow); 905 assembler->Bind(&if_overflow);
915 { 906 {
916 // The result doesn't fit into Smi range. 907 // The result doesn't fit into Smi range.
917 var_fsub_lhs.Bind(assembler->SmiToFloat64(lhs)); 908 var_fsub_lhs.Bind(assembler->SmiToFloat64(lhs));
918 var_fsub_rhs.Bind(assembler->SmiToFloat64(rhs)); 909 var_fsub_rhs.Bind(assembler->SmiToFloat64(rhs));
919 assembler->Goto(&do_fsub); 910 assembler->Goto(&do_fsub);
920 } 911 }
921 912
922 assembler->Bind(&if_notoverflow); 913 assembler->Bind(&if_notoverflow);
923 var_result.Bind(assembler->Projection(0, pair)); 914 assembler->Return(assembler->Projection(0, pair));
924 assembler->Goto(&end);
925 } 915 }
926 916
927 assembler->Bind(&if_rhsisnotsmi); 917 assembler->Bind(&if_rhsisnotsmi);
928 { 918 {
929 // Load the map of the {rhs}. 919 // Load the map of the {rhs}.
930 Node* rhs_map = assembler->LoadMap(rhs); 920 Node* rhs_map = assembler->LoadMap(rhs);
931 921
932 // Check if {rhs} is a HeapNumber. 922 // Check if {rhs} is a HeapNumber.
933 Label if_rhsisnumber(assembler), 923 Label if_rhsisnumber(assembler),
934 if_rhsisnotnumber(assembler, Label::kDeferred); 924 if_rhsisnotnumber(assembler, Label::kDeferred);
935 Node* number_map = assembler->HeapNumberMapConstant(); 925 Node* number_map = assembler->HeapNumberMapConstant();
936 assembler->Branch(assembler->WordEqual(rhs_map, number_map), 926 assembler->Branch(assembler->WordEqual(rhs_map, number_map),
937 &if_rhsisnumber, &if_rhsisnotnumber); 927 &if_rhsisnumber, &if_rhsisnotnumber);
938 928
939 assembler->Bind(&if_rhsisnumber); 929 assembler->Bind(&if_rhsisnumber);
940 { 930 {
941 // Perform a floating point subtraction. 931 // Perform a floating point subtraction.
942 var_fsub_lhs.Bind(assembler->SmiToFloat64(lhs)); 932 var_fsub_lhs.Bind(assembler->SmiToFloat64(lhs));
943 var_fsub_rhs.Bind(assembler->LoadHeapNumberValue(rhs)); 933 var_fsub_rhs.Bind(assembler->LoadHeapNumberValue(rhs));
944 assembler->Goto(&do_fsub); 934 assembler->Goto(&do_fsub);
945 } 935 }
946 936
947 assembler->Bind(&if_rhsisnotnumber); 937 assembler->Bind(&if_rhsisnotnumber);
948 { 938 {
949 // Convert the {rhs} to a Number first. 939 // Convert the {rhs} to a Number first.
950 Callable callable = 940 Callable callable = CodeFactory::NonNumberToNumber(isolate());
951 CodeFactory::NonNumberToNumber(assembler->isolate());
952 var_rhs.Bind(assembler->CallStub(callable, context, rhs)); 941 var_rhs.Bind(assembler->CallStub(callable, context, rhs));
953 assembler->Goto(&loop); 942 assembler->Goto(&loop);
954 } 943 }
955 } 944 }
956 } 945 }
957 946
958 assembler->Bind(&if_lhsisnotsmi); 947 assembler->Bind(&if_lhsisnotsmi);
959 { 948 {
960 // Load the map of the {lhs}. 949 // Load the map of the {lhs}.
961 Node* lhs_map = assembler->LoadMap(lhs); 950 Node* lhs_map = assembler->LoadMap(lhs);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 { 986 {
998 // Perform a floating point subtraction. 987 // Perform a floating point subtraction.
999 var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); 988 var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs));
1000 var_fsub_rhs.Bind(assembler->LoadHeapNumberValue(rhs)); 989 var_fsub_rhs.Bind(assembler->LoadHeapNumberValue(rhs));
1001 assembler->Goto(&do_fsub); 990 assembler->Goto(&do_fsub);
1002 } 991 }
1003 992
1004 assembler->Bind(&if_rhsisnotnumber); 993 assembler->Bind(&if_rhsisnotnumber);
1005 { 994 {
1006 // Convert the {rhs} to a Number first. 995 // Convert the {rhs} to a Number first.
1007 Callable callable = 996 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1008 CodeFactory::NonNumberToNumber(assembler->isolate());
1009 var_rhs.Bind(assembler->CallStub(callable, context, rhs)); 997 var_rhs.Bind(assembler->CallStub(callable, context, rhs));
1010 assembler->Goto(&loop); 998 assembler->Goto(&loop);
1011 } 999 }
1012 } 1000 }
1013 } 1001 }
1014 1002
1015 assembler->Bind(&if_lhsisnotnumber); 1003 assembler->Bind(&if_lhsisnotnumber);
1016 { 1004 {
1017 // Convert the {lhs} to a Number first. 1005 // Convert the {lhs} to a Number first.
1018 Callable callable = 1006 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1019 CodeFactory::NonNumberToNumber(assembler->isolate());
1020 var_lhs.Bind(assembler->CallStub(callable, context, lhs)); 1007 var_lhs.Bind(assembler->CallStub(callable, context, lhs));
1021 assembler->Goto(&loop); 1008 assembler->Goto(&loop);
1022 } 1009 }
1023 } 1010 }
1024 } 1011 }
1025 1012
1026 assembler->Bind(&do_fsub); 1013 assembler->Bind(&do_fsub);
1027 { 1014 {
1028 Node* lhs_value = var_fsub_lhs.value(); 1015 Node* lhs_value = var_fsub_lhs.value();
1029 Node* rhs_value = var_fsub_rhs.value(); 1016 Node* rhs_value = var_fsub_rhs.value();
1030 Node* value = assembler->Float64Sub(lhs_value, rhs_value); 1017 Node* value = assembler->Float64Sub(lhs_value, rhs_value);
1031 var_result.Bind(assembler->ChangeFloat64ToTagged(value)); 1018 Node* result = assembler->ChangeFloat64ToTagged(value);
1032 assembler->Goto(&end); 1019 assembler->Return(result);
1033 } 1020 }
1034 assembler->Bind(&end);
1035 return var_result.value();
1036 } 1021 }
1037 1022
1038 // static 1023 void MultiplyStub::GenerateAssembly(CodeStubAssembler* assembler) const {
1039 compiler::Node* MultiplyStub::Generate(CodeStubAssembler* assembler,
1040 compiler::Node* left,
1041 compiler::Node* right,
1042 compiler::Node* context) {
1043 using compiler::Node; 1024 using compiler::Node;
1044 typedef CodeStubAssembler::Label Label; 1025 typedef CodeStubAssembler::Label Label;
1045 typedef CodeStubAssembler::Variable Variable; 1026 typedef CodeStubAssembler::Variable Variable;
1046 1027
1028 Node* context = assembler->Parameter(2);
1029
1047 // Shared entry point for floating point multiplication. 1030 // Shared entry point for floating point multiplication.
1048 Label do_fmul(assembler); 1031 Label do_fmul(assembler);
1049 Variable var_lhs_float64(assembler, MachineRepresentation::kFloat64), 1032 Variable var_lhs_float64(assembler, MachineRepresentation::kFloat64),
1050 var_rhs_float64(assembler, MachineRepresentation::kFloat64); 1033 var_rhs_float64(assembler, MachineRepresentation::kFloat64);
1051 1034
1052 Node* number_map = assembler->HeapNumberMapConstant(); 1035 Node* number_map = assembler->HeapNumberMapConstant();
1053 1036
1054 // We might need to loop one or two times due to ToNumber conversions. 1037 // We might need to loop one or two times due to ToNumber conversions.
1055 Variable var_lhs(assembler, MachineRepresentation::kTagged), 1038 Variable var_lhs(assembler, MachineRepresentation::kTagged),
1056 var_rhs(assembler, MachineRepresentation::kTagged); 1039 var_rhs(assembler, MachineRepresentation::kTagged);
1057 Variable* loop_variables[] = {&var_lhs, &var_rhs}; 1040 Variable* loop_variables[] = {&var_lhs, &var_rhs};
1058 Label loop(assembler, 2, loop_variables); 1041 Label loop(assembler, 2, loop_variables);
1059 var_lhs.Bind(left); 1042 var_lhs.Bind(assembler->Parameter(0));
1060 var_rhs.Bind(right); 1043 var_rhs.Bind(assembler->Parameter(1));
1061 assembler->Goto(&loop); 1044 assembler->Goto(&loop);
1062 assembler->Bind(&loop); 1045 assembler->Bind(&loop);
1063 { 1046 {
1064 Node* lhs = var_lhs.value(); 1047 Node* lhs = var_lhs.value();
1065 Node* rhs = var_rhs.value(); 1048 Node* rhs = var_rhs.value();
1066 1049
1067 Label lhs_is_smi(assembler), lhs_is_not_smi(assembler); 1050 Label lhs_is_smi(assembler), lhs_is_not_smi(assembler);
1068 assembler->Branch(assembler->WordIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi); 1051 assembler->Branch(assembler->WordIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi);
1069 1052
1070 assembler->Bind(&lhs_is_smi); 1053 assembler->Bind(&lhs_is_smi);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 var_lhs.Bind(rhs); 1143 var_lhs.Bind(rhs);
1161 var_rhs.Bind(lhs); 1144 var_rhs.Bind(lhs);
1162 assembler->Goto(&loop); 1145 assembler->Goto(&loop);
1163 } 1146 }
1164 } 1147 }
1165 } 1148 }
1166 1149
1167 assembler->Bind(&lhs_is_not_number); 1150 assembler->Bind(&lhs_is_not_number);
1168 { 1151 {
1169 // Convert {lhs} to a Number and loop. 1152 // Convert {lhs} to a Number and loop.
1170 Callable callable = 1153 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1171 CodeFactory::NonNumberToNumber(assembler->isolate());
1172 var_lhs.Bind(assembler->CallStub(callable, context, lhs)); 1154 var_lhs.Bind(assembler->CallStub(callable, context, lhs));
1173 assembler->Goto(&loop); 1155 assembler->Goto(&loop);
1174 } 1156 }
1175 } 1157 }
1176 } 1158 }
1177 1159
1178 assembler->Bind(&do_fmul); 1160 assembler->Bind(&do_fmul);
1179 { 1161 {
1180 Node* value = 1162 Node* value =
1181 assembler->Float64Mul(var_lhs_float64.value(), var_rhs_float64.value()); 1163 assembler->Float64Mul(var_lhs_float64.value(), var_rhs_float64.value());
1182 Node* result = assembler->ChangeFloat64ToTagged(value); 1164 Node* result = assembler->ChangeFloat64ToTagged(value);
1183 return result; 1165 assembler->Return(result);
1184 } 1166 }
1185 } 1167 }
1186 1168
1187 // static 1169 void DivideStub::GenerateAssembly(CodeStubAssembler* assembler) const {
1188 compiler::Node* DivideStub::Generate(CodeStubAssembler* assembler,
1189 compiler::Node* left,
1190 compiler::Node* right,
1191 compiler::Node* context) {
1192 using compiler::Node; 1170 using compiler::Node;
1193 typedef CodeStubAssembler::Label Label; 1171 typedef CodeStubAssembler::Label Label;
1194 typedef CodeStubAssembler::Variable Variable; 1172 typedef CodeStubAssembler::Variable Variable;
1195 1173
1174 Node* context = assembler->Parameter(2);
1175
1196 // Shared entry point for floating point division. 1176 // Shared entry point for floating point division.
1197 Label do_fdiv(assembler), end(assembler); 1177 Label do_fdiv(assembler);
1198 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), 1178 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64),
1199 var_divisor_float64(assembler, MachineRepresentation::kFloat64); 1179 var_divisor_float64(assembler, MachineRepresentation::kFloat64);
1200 1180
1201 Node* number_map = assembler->HeapNumberMapConstant(); 1181 Node* number_map = assembler->HeapNumberMapConstant();
1202 1182
1203 // We might need to loop one or two times due to ToNumber conversions. 1183 // We might need to loop one or two times due to ToNumber conversions.
1204 Variable var_dividend(assembler, MachineRepresentation::kTagged), 1184 Variable var_dividend(assembler, MachineRepresentation::kTagged),
1205 var_divisor(assembler, MachineRepresentation::kTagged), 1185 var_divisor(assembler, MachineRepresentation::kTagged);
1206 var_result(assembler, MachineRepresentation::kTagged);
1207 Variable* loop_variables[] = {&var_dividend, &var_divisor}; 1186 Variable* loop_variables[] = {&var_dividend, &var_divisor};
1208 Label loop(assembler, 2, loop_variables); 1187 Label loop(assembler, 2, loop_variables);
1209 var_dividend.Bind(left); 1188 var_dividend.Bind(assembler->Parameter(0));
1210 var_divisor.Bind(right); 1189 var_divisor.Bind(assembler->Parameter(1));
1211 assembler->Goto(&loop); 1190 assembler->Goto(&loop);
1212 assembler->Bind(&loop); 1191 assembler->Bind(&loop);
1213 { 1192 {
1214 Node* dividend = var_dividend.value(); 1193 Node* dividend = var_dividend.value();
1215 Node* divisor = var_divisor.value(); 1194 Node* divisor = var_divisor.value();
1216 1195
1217 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler); 1196 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
1218 assembler->Branch(assembler->WordIsSmi(dividend), &dividend_is_smi, 1197 assembler->Branch(assembler->WordIsSmi(dividend), &dividend_is_smi,
1219 &dividend_is_not_smi); 1198 &dividend_is_not_smi);
1220 1199
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 1253
1275 // TODO(epertoso): consider adding a machine instruction that returns 1254 // TODO(epertoso): consider adding a machine instruction that returns
1276 // both the result and the remainder. 1255 // both the result and the remainder.
1277 Node* untagged_result = 1256 Node* untagged_result =
1278 assembler->Int32Div(untagged_dividend, untagged_divisor); 1257 assembler->Int32Div(untagged_dividend, untagged_divisor);
1279 Node* truncated = 1258 Node* truncated =
1280 assembler->IntPtrMul(untagged_result, untagged_divisor); 1259 assembler->IntPtrMul(untagged_result, untagged_divisor);
1281 // Do floating point division if the remainder is not 0. 1260 // Do floating point division if the remainder is not 0.
1282 assembler->GotoIf( 1261 assembler->GotoIf(
1283 assembler->Word32NotEqual(untagged_dividend, truncated), &bailout); 1262 assembler->Word32NotEqual(untagged_dividend, truncated), &bailout);
1284 var_result.Bind(assembler->SmiTag(untagged_result)); 1263 assembler->Return(assembler->SmiTag(untagged_result));
1285 assembler->Goto(&end);
1286 1264
1287 // Bailout: convert {dividend} and {divisor} to double and do double 1265 // Bailout: convert {dividend} and {divisor} to double and do double
1288 // division. 1266 // division.
1289 assembler->Bind(&bailout); 1267 assembler->Bind(&bailout);
1290 { 1268 {
1291 var_dividend_float64.Bind(assembler->SmiToFloat64(dividend)); 1269 var_dividend_float64.Bind(assembler->SmiToFloat64(dividend));
1292 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor)); 1270 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor));
1293 assembler->Goto(&do_fdiv); 1271 assembler->Goto(&do_fdiv);
1294 } 1272 }
1295 } 1273 }
(...skipping 13 matching lines...) Expand all
1309 // Convert {dividend} to a double and divide it with the value of 1287 // Convert {dividend} to a double and divide it with the value of
1310 // {divisor}. 1288 // {divisor}.
1311 var_dividend_float64.Bind(assembler->SmiToFloat64(dividend)); 1289 var_dividend_float64.Bind(assembler->SmiToFloat64(dividend));
1312 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor)); 1290 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor));
1313 assembler->Goto(&do_fdiv); 1291 assembler->Goto(&do_fdiv);
1314 } 1292 }
1315 1293
1316 assembler->Bind(&divisor_is_not_number); 1294 assembler->Bind(&divisor_is_not_number);
1317 { 1295 {
1318 // Convert {divisor} to a number and loop. 1296 // Convert {divisor} to a number and loop.
1319 Callable callable = 1297 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1320 CodeFactory::NonNumberToNumber(assembler->isolate());
1321 var_divisor.Bind(assembler->CallStub(callable, context, divisor)); 1298 var_divisor.Bind(assembler->CallStub(callable, context, divisor));
1322 assembler->Goto(&loop); 1299 assembler->Goto(&loop);
1323 } 1300 }
1324 } 1301 }
1325 } 1302 }
1326 1303
1327 assembler->Bind(&dividend_is_not_smi); 1304 assembler->Bind(&dividend_is_not_smi);
1328 { 1305 {
1329 Node* dividend_map = assembler->LoadMap(dividend); 1306 Node* dividend_map = assembler->LoadMap(dividend);
1330 1307
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 // Both {dividend} and {divisor} are HeapNumbers. Load their values 1342 // Both {dividend} and {divisor} are HeapNumbers. Load their values
1366 // and divide them. 1343 // and divide them.
1367 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend)); 1344 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend));
1368 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor)); 1345 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor));
1369 assembler->Goto(&do_fdiv); 1346 assembler->Goto(&do_fdiv);
1370 } 1347 }
1371 1348
1372 assembler->Bind(&divisor_is_not_number); 1349 assembler->Bind(&divisor_is_not_number);
1373 { 1350 {
1374 // Convert {divisor} to a number and loop. 1351 // Convert {divisor} to a number and loop.
1375 Callable callable = 1352 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1376 CodeFactory::NonNumberToNumber(assembler->isolate());
1377 var_divisor.Bind(assembler->CallStub(callable, context, divisor)); 1353 var_divisor.Bind(assembler->CallStub(callable, context, divisor));
1378 assembler->Goto(&loop); 1354 assembler->Goto(&loop);
1379 } 1355 }
1380 } 1356 }
1381 } 1357 }
1382 1358
1383 assembler->Bind(&dividend_is_not_number); 1359 assembler->Bind(&dividend_is_not_number);
1384 { 1360 {
1385 // Convert {dividend} to a Number and loop. 1361 // Convert {dividend} to a Number and loop.
1386 Callable callable = 1362 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1387 CodeFactory::NonNumberToNumber(assembler->isolate());
1388 var_dividend.Bind(assembler->CallStub(callable, context, dividend)); 1363 var_dividend.Bind(assembler->CallStub(callable, context, dividend));
1389 assembler->Goto(&loop); 1364 assembler->Goto(&loop);
1390 } 1365 }
1391 } 1366 }
1392 } 1367 }
1393 1368
1394 assembler->Bind(&do_fdiv); 1369 assembler->Bind(&do_fdiv);
1395 { 1370 {
1396 Node* value = assembler->Float64Div(var_dividend_float64.value(), 1371 Node* value = assembler->Float64Div(var_dividend_float64.value(),
1397 var_divisor_float64.value()); 1372 var_divisor_float64.value());
1398 var_result.Bind(assembler->ChangeFloat64ToTagged(value)); 1373 Node* result = assembler->ChangeFloat64ToTagged(value);
1399 assembler->Goto(&end); 1374 assembler->Return(result);
1400 } 1375 }
1401 assembler->Bind(&end);
1402 return var_result.value();
1403 } 1376 }
1404 1377
1405 // static 1378 void BitwiseAndStub::GenerateAssembly(CodeStubAssembler* assembler) const {
1406 compiler::Node* ModulusStub::Generate(CodeStubAssembler* assembler, 1379 using compiler::Node;
1407 compiler::Node* left, 1380
1408 compiler::Node* right, 1381 Node* lhs = assembler->Parameter(0);
1409 compiler::Node* context) { 1382 Node* rhs = assembler->Parameter(1);
1383 Node* context = assembler->Parameter(2);
1384 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs);
1385 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs);
1386 Node* value = assembler->Word32And(lhs_value, rhs_value);
1387 Node* result = assembler->ChangeInt32ToTagged(value);
1388 assembler->Return(result);
1389 }
1390
1391 void ModulusStub::GenerateAssembly(CodeStubAssembler* assembler) const {
1410 using compiler::Node; 1392 using compiler::Node;
1411 typedef CodeStubAssembler::Label Label; 1393 typedef CodeStubAssembler::Label Label;
1412 typedef CodeStubAssembler::Variable Variable; 1394 typedef CodeStubAssembler::Variable Variable;
1413 1395
1396 Node* context = assembler->Parameter(2);
1397
1414 // Shared entry point for floating point modulus. 1398 // Shared entry point for floating point modulus.
1415 Label do_fmod(assembler); 1399 Label do_fmod(assembler);
1416 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), 1400 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64),
1417 var_divisor_float64(assembler, MachineRepresentation::kFloat64); 1401 var_divisor_float64(assembler, MachineRepresentation::kFloat64);
1418 1402
1419 Node* number_map = assembler->HeapNumberMapConstant(); 1403 Node* number_map = assembler->HeapNumberMapConstant();
1420 1404
1421 // We might need to loop one or two times due to ToNumber conversions. 1405 // We might need to loop one or two times due to ToNumber conversions.
1422 Variable var_dividend(assembler, MachineRepresentation::kTagged), 1406 Variable var_dividend(assembler, MachineRepresentation::kTagged),
1423 var_divisor(assembler, MachineRepresentation::kTagged); 1407 var_divisor(assembler, MachineRepresentation::kTagged);
1424 Variable* loop_variables[] = {&var_dividend, &var_divisor}; 1408 Variable* loop_variables[] = {&var_dividend, &var_divisor};
1425 Label loop(assembler, 2, loop_variables); 1409 Label loop(assembler, 2, loop_variables);
1426 var_dividend.Bind(left); 1410 var_dividend.Bind(assembler->Parameter(0));
1427 var_divisor.Bind(right); 1411 var_divisor.Bind(assembler->Parameter(1));
1428 assembler->Goto(&loop); 1412 assembler->Goto(&loop);
1429 assembler->Bind(&loop); 1413 assembler->Bind(&loop);
1430 { 1414 {
1431 Node* dividend = var_dividend.value(); 1415 Node* dividend = var_dividend.value();
1432 Node* divisor = var_divisor.value(); 1416 Node* divisor = var_divisor.value();
1433 1417
1434 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler); 1418 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
1435 assembler->Branch(assembler->WordIsSmi(dividend), &dividend_is_smi, 1419 assembler->Branch(assembler->WordIsSmi(dividend), &dividend_is_smi,
1436 &dividend_is_not_smi); 1420 &dividend_is_not_smi);
1437 1421
(...skipping 26 matching lines...) Expand all
1464 // Convert {dividend} to a double and compute its modulus with the 1448 // Convert {dividend} to a double and compute its modulus with the
1465 // value of {dividend}. 1449 // value of {dividend}.
1466 var_dividend_float64.Bind(assembler->SmiToFloat64(dividend)); 1450 var_dividend_float64.Bind(assembler->SmiToFloat64(dividend));
1467 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor)); 1451 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor));
1468 assembler->Goto(&do_fmod); 1452 assembler->Goto(&do_fmod);
1469 } 1453 }
1470 1454
1471 assembler->Bind(&divisor_is_not_number); 1455 assembler->Bind(&divisor_is_not_number);
1472 { 1456 {
1473 // Convert {divisor} to a number and loop. 1457 // Convert {divisor} to a number and loop.
1474 Callable callable = 1458 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1475 CodeFactory::NonNumberToNumber(assembler->isolate());
1476 var_divisor.Bind(assembler->CallStub(callable, context, divisor)); 1459 var_divisor.Bind(assembler->CallStub(callable, context, divisor));
1477 assembler->Goto(&loop); 1460 assembler->Goto(&loop);
1478 } 1461 }
1479 } 1462 }
1480 } 1463 }
1481 1464
1482 assembler->Bind(&dividend_is_not_smi); 1465 assembler->Bind(&dividend_is_not_smi);
1483 { 1466 {
1484 Node* dividend_map = assembler->LoadMap(dividend); 1467 Node* dividend_map = assembler->LoadMap(dividend);
1485 1468
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 // Both {dividend} and {divisor} are HeapNumbers. Load their values 1503 // Both {dividend} and {divisor} are HeapNumbers. Load their values
1521 // and compute their modulus. 1504 // and compute their modulus.
1522 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend)); 1505 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend));
1523 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor)); 1506 var_divisor_float64.Bind(assembler->LoadHeapNumberValue(divisor));
1524 assembler->Goto(&do_fmod); 1507 assembler->Goto(&do_fmod);
1525 } 1508 }
1526 1509
1527 assembler->Bind(&divisor_is_not_number); 1510 assembler->Bind(&divisor_is_not_number);
1528 { 1511 {
1529 // Convert {divisor} to a number and loop. 1512 // Convert {divisor} to a number and loop.
1530 Callable callable = 1513 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1531 CodeFactory::NonNumberToNumber(assembler->isolate());
1532 var_divisor.Bind(assembler->CallStub(callable, context, divisor)); 1514 var_divisor.Bind(assembler->CallStub(callable, context, divisor));
1533 assembler->Goto(&loop); 1515 assembler->Goto(&loop);
1534 } 1516 }
1535 } 1517 }
1536 } 1518 }
1537 1519
1538 assembler->Bind(&dividend_is_not_number); 1520 assembler->Bind(&dividend_is_not_number);
1539 { 1521 {
1540 // Convert {dividend} to a Number and loop. 1522 // Convert {dividend} to a Number and loop.
1541 Callable callable = 1523 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1542 CodeFactory::NonNumberToNumber(assembler->isolate());
1543 var_dividend.Bind(assembler->CallStub(callable, context, dividend)); 1524 var_dividend.Bind(assembler->CallStub(callable, context, dividend));
1544 assembler->Goto(&loop); 1525 assembler->Goto(&loop);
1545 } 1526 }
1546 } 1527 }
1547 } 1528 }
1548 1529
1549 assembler->Bind(&do_fmod); 1530 assembler->Bind(&do_fmod);
1550 { 1531 {
1551 Node* value = assembler->Float64Mod(var_dividend_float64.value(), 1532 Node* value = assembler->Float64Mod(var_dividend_float64.value(),
1552 var_divisor_float64.value()); 1533 var_divisor_float64.value());
1553 Node* result = assembler->ChangeFloat64ToTagged(value); 1534 Node* result = assembler->ChangeFloat64ToTagged(value);
1554 return result; 1535 assembler->Return(result);
1555 } 1536 }
1556 } 1537 }
1557 1538
1558 // static 1539 void ShiftLeftStub::GenerateAssembly(CodeStubAssembler* assembler) const {
1559 compiler::Node* ShiftLeftStub::Generate(CodeStubAssembler* assembler,
1560 compiler::Node* left,
1561 compiler::Node* right,
1562 compiler::Node* context) {
1563 using compiler::Node; 1540 using compiler::Node;
1564 1541
1565 Node* lhs_value = assembler->TruncateTaggedToWord32(context, left); 1542 Node* lhs = assembler->Parameter(0);
1566 Node* rhs_value = assembler->TruncateTaggedToWord32(context, right); 1543 Node* rhs = assembler->Parameter(1);
1544 Node* context = assembler->Parameter(2);
1545 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs);
1546 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs);
1567 Node* shift_count = 1547 Node* shift_count =
1568 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f)); 1548 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f));
1569 Node* value = assembler->Word32Shl(lhs_value, shift_count); 1549 Node* value = assembler->Word32Shl(lhs_value, shift_count);
1570 Node* result = assembler->ChangeInt32ToTagged(value); 1550 Node* result = assembler->ChangeInt32ToTagged(value);
1571 return result; 1551 assembler->Return(result);
1572 } 1552 }
1573 1553
1574 compiler::Node* ShiftRightStub::Generate(CodeStubAssembler* assembler, 1554 void ShiftRightStub::GenerateAssembly(CodeStubAssembler* assembler) const {
1575 compiler::Node* left,
1576 compiler::Node* right,
1577 compiler::Node* context) {
1578 using compiler::Node; 1555 using compiler::Node;
1579 1556
1580 Node* lhs_value = assembler->TruncateTaggedToWord32(context, left); 1557 Node* lhs = assembler->Parameter(0);
1581 Node* rhs_value = assembler->TruncateTaggedToWord32(context, right); 1558 Node* rhs = assembler->Parameter(1);
1559 Node* context = assembler->Parameter(2);
1560 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs);
1561 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs);
1582 Node* shift_count = 1562 Node* shift_count =
1583 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f)); 1563 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f));
1584 Node* value = assembler->Word32Sar(lhs_value, shift_count); 1564 Node* value = assembler->Word32Sar(lhs_value, shift_count);
1585 Node* result = assembler->ChangeInt32ToTagged(value); 1565 Node* result = assembler->ChangeInt32ToTagged(value);
1586 return result; 1566 assembler->Return(result);
1587 } 1567 }
1588 1568
1589 compiler::Node* ShiftRightLogicalStub::Generate(CodeStubAssembler* assembler, 1569 void ShiftRightLogicalStub::GenerateAssembly(
1590 compiler::Node* left, 1570 CodeStubAssembler* assembler) const {
1591 compiler::Node* right,
1592 compiler::Node* context) {
1593 using compiler::Node; 1571 using compiler::Node;
1594 1572
1595 Node* lhs_value = assembler->TruncateTaggedToWord32(context, left); 1573 Node* lhs = assembler->Parameter(0);
1596 Node* rhs_value = assembler->TruncateTaggedToWord32(context, right); 1574 Node* rhs = assembler->Parameter(1);
1575 Node* context = assembler->Parameter(2);
1576 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs);
1577 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs);
1597 Node* shift_count = 1578 Node* shift_count =
1598 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f)); 1579 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f));
1599 Node* value = assembler->Word32Shr(lhs_value, shift_count); 1580 Node* value = assembler->Word32Shr(lhs_value, shift_count);
1600 Node* result = assembler->ChangeUint32ToTagged(value); 1581 Node* result = assembler->ChangeUint32ToTagged(value);
1601 return result; 1582 assembler->Return(result);
1602 } 1583 }
1603 1584
1604 compiler::Node* BitwiseAndStub::Generate(CodeStubAssembler* assembler, 1585 void BitwiseOrStub::GenerateAssembly(CodeStubAssembler* assembler) const {
1605 compiler::Node* left,
1606 compiler::Node* right,
1607 compiler::Node* context) {
1608 using compiler::Node; 1586 using compiler::Node;
1609 1587
1610 Node* lhs_value = assembler->TruncateTaggedToWord32(context, left); 1588 Node* lhs = assembler->Parameter(0);
1611 Node* rhs_value = assembler->TruncateTaggedToWord32(context, right); 1589 Node* rhs = assembler->Parameter(1);
1612 Node* value = assembler->Word32And(lhs_value, rhs_value); 1590 Node* context = assembler->Parameter(2);
1591 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs);
1592 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs);
1593 Node* value = assembler->Word32Or(lhs_value, rhs_value);
1613 Node* result = assembler->ChangeInt32ToTagged(value); 1594 Node* result = assembler->ChangeInt32ToTagged(value);
1614 return result; 1595 assembler->Return(result);
1615 } 1596 }
1616 1597
1617 compiler::Node* BitwiseOrStub::Generate(CodeStubAssembler* assembler, 1598 void BitwiseXorStub::GenerateAssembly(CodeStubAssembler* assembler) const {
1618 compiler::Node* left,
1619 compiler::Node* right,
1620 compiler::Node* context) {
1621 using compiler::Node; 1599 using compiler::Node;
1622 1600
1623 Node* lhs_value = assembler->TruncateTaggedToWord32(context, left); 1601 Node* lhs = assembler->Parameter(0);
1624 Node* rhs_value = assembler->TruncateTaggedToWord32(context, right); 1602 Node* rhs = assembler->Parameter(1);
1625 Node* value = assembler->Word32Or(lhs_value, rhs_value); 1603 Node* context = assembler->Parameter(2);
1626 Node* result = assembler->ChangeInt32ToTagged(value); 1604 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs);
1627 return result; 1605 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs);
1628 }
1629
1630 compiler::Node* BitwiseXorStub::Generate(CodeStubAssembler* assembler,
1631 compiler::Node* left,
1632 compiler::Node* right,
1633 compiler::Node* context) {
1634 using compiler::Node;
1635 Node* lhs_value = assembler->TruncateTaggedToWord32(context, left);
1636 Node* rhs_value = assembler->TruncateTaggedToWord32(context, right);
1637 Node* value = assembler->Word32Xor(lhs_value, rhs_value); 1606 Node* value = assembler->Word32Xor(lhs_value, rhs_value);
1638 Node* result = assembler->ChangeInt32ToTagged(value); 1607 Node* result = assembler->ChangeInt32ToTagged(value);
1639 return result; 1608 assembler->Return(result);
1640 } 1609 }
1641 1610
1642 void IncStub::GenerateAssembly(CodeStubAssembler* assembler) const { 1611 void IncStub::GenerateAssembly(CodeStubAssembler* assembler) const {
1643 typedef CodeStubAssembler::Label Label; 1612 typedef CodeStubAssembler::Label Label;
1644 typedef compiler::Node Node; 1613 typedef compiler::Node Node;
1645 typedef CodeStubAssembler::Variable Variable; 1614 typedef CodeStubAssembler::Variable Variable;
1646 1615
1647 Node* context = assembler->Parameter(1); 1616 Node* context = assembler->Parameter(1);
1648 1617
1649 // Shared entry for floating point increment. 1618 // Shared entry for floating point increment.
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
4306 if (type->Is(Type::UntaggedPointer())) { 4275 if (type->Is(Type::UntaggedPointer())) {
4307 return Representation::External(); 4276 return Representation::External();
4308 } 4277 }
4309 4278
4310 DCHECK(!type->Is(Type::Untagged())); 4279 DCHECK(!type->Is(Type::Untagged()));
4311 return Representation::Tagged(); 4280 return Representation::Tagged();
4312 } 4281 }
4313 4282
4314 } // namespace internal 4283 } // namespace internal
4315 } // namespace v8 4284 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/interpreter/interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698