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

Side by Side Diff: src/builtins/builtins-number.cc

Issue 2407303002: [stubs] Renames WordIsSmi to TaggedIsSmi, introducing an appropriate bitcast of the parameter. (Closed)
Patch Set: Renamed TaggedValueIsSmi to TaggedIsSmi. Created 4 years, 2 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/builtins/builtins-math.cc ('k') | src/builtins/builtins-object.cc » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins/builtins-utils.h" 5 #include "src/builtins/builtins-utils.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 11
12 // ----------------------------------------------------------------------------- 12 // -----------------------------------------------------------------------------
13 // ES6 section 20.1 Number Objects 13 // ES6 section 20.1 Number Objects
14 14
15 // ES6 section 20.1.2.2 Number.isFinite ( number ) 15 // ES6 section 20.1.2.2 Number.isFinite ( number )
16 void Builtins::Generate_NumberIsFinite(CodeStubAssembler* assembler) { 16 void Builtins::Generate_NumberIsFinite(CodeStubAssembler* assembler) {
17 typedef CodeStubAssembler::Label Label; 17 typedef CodeStubAssembler::Label Label;
18 typedef compiler::Node Node; 18 typedef compiler::Node Node;
19 19
20 Node* number = assembler->Parameter(1); 20 Node* number = assembler->Parameter(1);
21 21
22 Label return_true(assembler), return_false(assembler); 22 Label return_true(assembler), return_false(assembler);
23 23
24 // Check if {number} is a Smi. 24 // Check if {number} is a Smi.
25 assembler->GotoIf(assembler->WordIsSmi(number), &return_true); 25 assembler->GotoIf(assembler->TaggedIsSmi(number), &return_true);
26 26
27 // Check if {number} is a HeapNumber. 27 // Check if {number} is a HeapNumber.
28 assembler->GotoUnless( 28 assembler->GotoUnless(
29 assembler->WordEqual(assembler->LoadMap(number), 29 assembler->WordEqual(assembler->LoadMap(number),
30 assembler->HeapNumberMapConstant()), 30 assembler->HeapNumberMapConstant()),
31 &return_false); 31 &return_false);
32 32
33 // Check if {number} contains a finite, non-NaN value. 33 // Check if {number} contains a finite, non-NaN value.
34 Node* number_value = assembler->LoadHeapNumberValue(number); 34 Node* number_value = assembler->LoadHeapNumberValue(number);
35 assembler->BranchIfFloat64IsNaN( 35 assembler->BranchIfFloat64IsNaN(
(...skipping 10 matching lines...) Expand all
46 // ES6 section 20.1.2.3 Number.isInteger ( number ) 46 // ES6 section 20.1.2.3 Number.isInteger ( number )
47 void Builtins::Generate_NumberIsInteger(CodeStubAssembler* assembler) { 47 void Builtins::Generate_NumberIsInteger(CodeStubAssembler* assembler) {
48 typedef CodeStubAssembler::Label Label; 48 typedef CodeStubAssembler::Label Label;
49 typedef compiler::Node Node; 49 typedef compiler::Node Node;
50 50
51 Node* number = assembler->Parameter(1); 51 Node* number = assembler->Parameter(1);
52 52
53 Label return_true(assembler), return_false(assembler); 53 Label return_true(assembler), return_false(assembler);
54 54
55 // Check if {number} is a Smi. 55 // Check if {number} is a Smi.
56 assembler->GotoIf(assembler->WordIsSmi(number), &return_true); 56 assembler->GotoIf(assembler->TaggedIsSmi(number), &return_true);
57 57
58 // Check if {number} is a HeapNumber. 58 // Check if {number} is a HeapNumber.
59 assembler->GotoUnless( 59 assembler->GotoUnless(
60 assembler->WordEqual(assembler->LoadMap(number), 60 assembler->WordEqual(assembler->LoadMap(number),
61 assembler->HeapNumberMapConstant()), 61 assembler->HeapNumberMapConstant()),
62 &return_false); 62 &return_false);
63 63
64 // Load the actual value of {number}. 64 // Load the actual value of {number}.
65 Node* number_value = assembler->LoadHeapNumberValue(number); 65 Node* number_value = assembler->LoadHeapNumberValue(number);
66 66
(...skipping 15 matching lines...) Expand all
82 // ES6 section 20.1.2.4 Number.isNaN ( number ) 82 // ES6 section 20.1.2.4 Number.isNaN ( number )
83 void Builtins::Generate_NumberIsNaN(CodeStubAssembler* assembler) { 83 void Builtins::Generate_NumberIsNaN(CodeStubAssembler* assembler) {
84 typedef CodeStubAssembler::Label Label; 84 typedef CodeStubAssembler::Label Label;
85 typedef compiler::Node Node; 85 typedef compiler::Node Node;
86 86
87 Node* number = assembler->Parameter(1); 87 Node* number = assembler->Parameter(1);
88 88
89 Label return_true(assembler), return_false(assembler); 89 Label return_true(assembler), return_false(assembler);
90 90
91 // Check if {number} is a Smi. 91 // Check if {number} is a Smi.
92 assembler->GotoIf(assembler->WordIsSmi(number), &return_false); 92 assembler->GotoIf(assembler->TaggedIsSmi(number), &return_false);
93 93
94 // Check if {number} is a HeapNumber. 94 // Check if {number} is a HeapNumber.
95 assembler->GotoUnless( 95 assembler->GotoUnless(
96 assembler->WordEqual(assembler->LoadMap(number), 96 assembler->WordEqual(assembler->LoadMap(number),
97 assembler->HeapNumberMapConstant()), 97 assembler->HeapNumberMapConstant()),
98 &return_false); 98 &return_false);
99 99
100 // Check if {number} contains a NaN value. 100 // Check if {number} contains a NaN value.
101 Node* number_value = assembler->LoadHeapNumberValue(number); 101 Node* number_value = assembler->LoadHeapNumberValue(number);
102 assembler->BranchIfFloat64IsNaN(number_value, &return_true, &return_false); 102 assembler->BranchIfFloat64IsNaN(number_value, &return_true, &return_false);
103 103
104 assembler->Bind(&return_true); 104 assembler->Bind(&return_true);
105 assembler->Return(assembler->BooleanConstant(true)); 105 assembler->Return(assembler->BooleanConstant(true));
106 106
107 assembler->Bind(&return_false); 107 assembler->Bind(&return_false);
108 assembler->Return(assembler->BooleanConstant(false)); 108 assembler->Return(assembler->BooleanConstant(false));
109 } 109 }
110 110
111 // ES6 section 20.1.2.5 Number.isSafeInteger ( number ) 111 // ES6 section 20.1.2.5 Number.isSafeInteger ( number )
112 void Builtins::Generate_NumberIsSafeInteger(CodeStubAssembler* assembler) { 112 void Builtins::Generate_NumberIsSafeInteger(CodeStubAssembler* assembler) {
113 typedef CodeStubAssembler::Label Label; 113 typedef CodeStubAssembler::Label Label;
114 typedef compiler::Node Node; 114 typedef compiler::Node Node;
115 115
116 Node* number = assembler->Parameter(1); 116 Node* number = assembler->Parameter(1);
117 117
118 Label return_true(assembler), return_false(assembler); 118 Label return_true(assembler), return_false(assembler);
119 119
120 // Check if {number} is a Smi. 120 // Check if {number} is a Smi.
121 assembler->GotoIf(assembler->WordIsSmi(number), &return_true); 121 assembler->GotoIf(assembler->TaggedIsSmi(number), &return_true);
122 122
123 // Check if {number} is a HeapNumber. 123 // Check if {number} is a HeapNumber.
124 assembler->GotoUnless( 124 assembler->GotoUnless(
125 assembler->WordEqual(assembler->LoadMap(number), 125 assembler->WordEqual(assembler->LoadMap(number),
126 assembler->HeapNumberMapConstant()), 126 assembler->HeapNumberMapConstant()),
127 &return_false); 127 &return_false);
128 128
129 // Load the actual value of {number}. 129 // Load the actual value of {number}.
130 Node* number_value = assembler->LoadHeapNumberValue(number); 130 Node* number_value = assembler->LoadHeapNumberValue(number);
131 131
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 Label loop(assembler, &var_input); 163 Label loop(assembler, &var_input);
164 var_input.Bind(assembler->Parameter(1)); 164 var_input.Bind(assembler->Parameter(1));
165 assembler->Goto(&loop); 165 assembler->Goto(&loop);
166 assembler->Bind(&loop); 166 assembler->Bind(&loop);
167 { 167 {
168 // Load the current {input} value. 168 // Load the current {input} value.
169 Node* input = var_input.value(); 169 Node* input = var_input.value();
170 170
171 // Check if the {input} is a HeapObject or a Smi. 171 // Check if the {input} is a HeapObject or a Smi.
172 Label if_inputissmi(assembler), if_inputisnotsmi(assembler); 172 Label if_inputissmi(assembler), if_inputisnotsmi(assembler);
173 assembler->Branch(assembler->WordIsSmi(input), &if_inputissmi, 173 assembler->Branch(assembler->TaggedIsSmi(input), &if_inputissmi,
174 &if_inputisnotsmi); 174 &if_inputisnotsmi);
175 175
176 assembler->Bind(&if_inputissmi); 176 assembler->Bind(&if_inputissmi);
177 { 177 {
178 // The {input} is already a Number, no need to do anything. 178 // The {input} is already a Number, no need to do anything.
179 assembler->Return(input); 179 assembler->Return(input);
180 } 180 }
181 181
182 assembler->Bind(&if_inputisnotsmi); 182 assembler->Bind(&if_inputisnotsmi);
183 { 183 {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 var_rhs.Bind(right); 504 var_rhs.Bind(right);
505 assembler->Goto(&loop); 505 assembler->Goto(&loop);
506 assembler->Bind(&loop); 506 assembler->Bind(&loop);
507 { 507 {
508 // Load the current {lhs} and {rhs} values. 508 // Load the current {lhs} and {rhs} values.
509 Node* lhs = var_lhs.value(); 509 Node* lhs = var_lhs.value();
510 Node* rhs = var_rhs.value(); 510 Node* rhs = var_rhs.value();
511 511
512 // Check if the {lhs} is a Smi or a HeapObject. 512 // Check if the {lhs} is a Smi or a HeapObject.
513 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); 513 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler);
514 assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); 514 assembler->Branch(assembler->TaggedIsSmi(lhs), &if_lhsissmi,
515 &if_lhsisnotsmi);
515 516
516 assembler->Bind(&if_lhsissmi); 517 assembler->Bind(&if_lhsissmi);
517 { 518 {
518 // Check if the {rhs} is also a Smi. 519 // Check if the {rhs} is also a Smi.
519 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); 520 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
520 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, 521 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi,
521 &if_rhsisnotsmi); 522 &if_rhsisnotsmi);
522 523
523 assembler->Bind(&if_rhsissmi); 524 assembler->Bind(&if_rhsissmi);
524 { 525 {
525 // Try fast Smi addition first. 526 // Try fast Smi addition first.
526 Node* pair = assembler->SmiAddWithOverflow(lhs, rhs); 527 Node* pair = assembler->SmiAddWithOverflow(lhs, rhs);
527 Node* overflow = assembler->Projection(1, pair); 528 Node* overflow = assembler->Projection(1, pair);
528 529
529 // Check if the Smi additon overflowed. 530 // Check if the Smi additon overflowed.
530 Label if_overflow(assembler), if_notoverflow(assembler); 531 Label if_overflow(assembler), if_notoverflow(assembler);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 { 624 {
624 var_lhs.Bind(lhs); 625 var_lhs.Bind(lhs);
625 var_rhs.Bind(rhs); 626 var_rhs.Bind(rhs);
626 assembler->Goto(&string_add_convert_right); 627 assembler->Goto(&string_add_convert_right);
627 } 628 }
628 629
629 assembler->Bind(&if_lhsisnotstring); 630 assembler->Bind(&if_lhsisnotstring);
630 { 631 {
631 // Check if {rhs} is a Smi. 632 // Check if {rhs} is a Smi.
632 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); 633 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
633 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, 634 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi,
634 &if_rhsisnotsmi); 635 &if_rhsisnotsmi);
635 636
636 assembler->Bind(&if_rhsissmi); 637 assembler->Bind(&if_rhsissmi);
637 { 638 {
638 // Check if {lhs} is a Number. 639 // Check if {lhs} is a Number.
639 Label if_lhsisnumber(assembler), 640 Label if_lhsisnumber(assembler),
640 if_lhsisnotnumber(assembler, Label::kDeferred); 641 if_lhsisnotnumber(assembler, Label::kDeferred);
641 assembler->Branch(assembler->Word32Equal( 642 assembler->Branch(assembler->Word32Equal(
642 lhs_instance_type, 643 lhs_instance_type,
643 assembler->Int32Constant(HEAP_NUMBER_TYPE)), 644 assembler->Int32Constant(HEAP_NUMBER_TYPE)),
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 var_rhs.Bind(right); 866 var_rhs.Bind(right);
866 assembler->Goto(&loop); 867 assembler->Goto(&loop);
867 assembler->Bind(&loop); 868 assembler->Bind(&loop);
868 { 869 {
869 // Load the current {lhs} and {rhs} values. 870 // Load the current {lhs} and {rhs} values.
870 Node* lhs = var_lhs.value(); 871 Node* lhs = var_lhs.value();
871 Node* rhs = var_rhs.value(); 872 Node* rhs = var_rhs.value();
872 873
873 // Check if the {lhs} is a Smi or a HeapObject. 874 // Check if the {lhs} is a Smi or a HeapObject.
874 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); 875 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler);
875 assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); 876 assembler->Branch(assembler->TaggedIsSmi(lhs), &if_lhsissmi,
877 &if_lhsisnotsmi);
876 878
877 assembler->Bind(&if_lhsissmi); 879 assembler->Bind(&if_lhsissmi);
878 { 880 {
879 // Check if the {rhs} is also a Smi. 881 // Check if the {rhs} is also a Smi.
880 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); 882 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
881 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, 883 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi,
882 &if_rhsisnotsmi); 884 &if_rhsisnotsmi);
883 885
884 assembler->Bind(&if_rhsissmi); 886 assembler->Bind(&if_rhsissmi);
885 { 887 {
886 // Try a fast Smi subtraction first. 888 // Try a fast Smi subtraction first.
887 Node* pair = assembler->SmiSubWithOverflow(lhs, rhs); 889 Node* pair = assembler->SmiSubWithOverflow(lhs, rhs);
888 Node* overflow = assembler->Projection(1, pair); 890 Node* overflow = assembler->Projection(1, pair);
889 891
890 // Check if the Smi subtraction overflowed. 892 // Check if the Smi subtraction overflowed.
891 Label if_overflow(assembler), if_notoverflow(assembler); 893 Label if_overflow(assembler), if_notoverflow(assembler);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 Label if_lhsisnumber(assembler), 945 Label if_lhsisnumber(assembler),
944 if_lhsisnotnumber(assembler, Label::kDeferred); 946 if_lhsisnotnumber(assembler, Label::kDeferred);
945 Node* number_map = assembler->HeapNumberMapConstant(); 947 Node* number_map = assembler->HeapNumberMapConstant();
946 assembler->Branch(assembler->WordEqual(lhs_map, number_map), 948 assembler->Branch(assembler->WordEqual(lhs_map, number_map),
947 &if_lhsisnumber, &if_lhsisnotnumber); 949 &if_lhsisnumber, &if_lhsisnotnumber);
948 950
949 assembler->Bind(&if_lhsisnumber); 951 assembler->Bind(&if_lhsisnumber);
950 { 952 {
951 // Check if the {rhs} is a Smi. 953 // Check if the {rhs} is a Smi.
952 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); 954 Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
953 assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi, 955 assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi,
954 &if_rhsisnotsmi); 956 &if_rhsisnotsmi);
955 957
956 assembler->Bind(&if_rhsissmi); 958 assembler->Bind(&if_rhsissmi);
957 { 959 {
958 // Perform a floating point subtraction. 960 // Perform a floating point subtraction.
959 var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); 961 var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs));
960 var_fsub_rhs.Bind(assembler->SmiToFloat64(rhs)); 962 var_fsub_rhs.Bind(assembler->SmiToFloat64(rhs));
961 assembler->Goto(&do_fsub); 963 assembler->Goto(&do_fsub);
962 } 964 }
963 965
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 Label loop(assembler, 2, loop_variables); 1040 Label loop(assembler, 2, loop_variables);
1039 var_lhs.Bind(left); 1041 var_lhs.Bind(left);
1040 var_rhs.Bind(right); 1042 var_rhs.Bind(right);
1041 assembler->Goto(&loop); 1043 assembler->Goto(&loop);
1042 assembler->Bind(&loop); 1044 assembler->Bind(&loop);
1043 { 1045 {
1044 Node* lhs = var_lhs.value(); 1046 Node* lhs = var_lhs.value();
1045 Node* rhs = var_rhs.value(); 1047 Node* rhs = var_rhs.value();
1046 1048
1047 Label lhs_is_smi(assembler), lhs_is_not_smi(assembler); 1049 Label lhs_is_smi(assembler), lhs_is_not_smi(assembler);
1048 assembler->Branch(assembler->WordIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi); 1050 assembler->Branch(assembler->TaggedIsSmi(lhs), &lhs_is_smi,
1051 &lhs_is_not_smi);
1049 1052
1050 assembler->Bind(&lhs_is_smi); 1053 assembler->Bind(&lhs_is_smi);
1051 { 1054 {
1052 Label rhs_is_smi(assembler), rhs_is_not_smi(assembler); 1055 Label rhs_is_smi(assembler), rhs_is_not_smi(assembler);
1053 assembler->Branch(assembler->WordIsSmi(rhs), &rhs_is_smi, 1056 assembler->Branch(assembler->TaggedIsSmi(rhs), &rhs_is_smi,
1054 &rhs_is_not_smi); 1057 &rhs_is_not_smi);
1055 1058
1056 assembler->Bind(&rhs_is_smi); 1059 assembler->Bind(&rhs_is_smi);
1057 { 1060 {
1058 // Both {lhs} and {rhs} are Smis. The result is not necessarily a smi, 1061 // Both {lhs} and {rhs} are Smis. The result is not necessarily a smi,
1059 // in case of overflow. 1062 // in case of overflow.
1060 var_result.Bind(assembler->SmiMul(lhs, rhs)); 1063 var_result.Bind(assembler->SmiMul(lhs, rhs));
1061 assembler->Goto(&return_result); 1064 assembler->Goto(&return_result);
1062 } 1065 }
1063 1066
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 // Check if {lhs} is a HeapNumber. 1099 // Check if {lhs} is a HeapNumber.
1097 Label lhs_is_number(assembler), 1100 Label lhs_is_number(assembler),
1098 lhs_is_not_number(assembler, Label::kDeferred); 1101 lhs_is_not_number(assembler, Label::kDeferred);
1099 assembler->Branch(assembler->WordEqual(lhs_map, number_map), 1102 assembler->Branch(assembler->WordEqual(lhs_map, number_map),
1100 &lhs_is_number, &lhs_is_not_number); 1103 &lhs_is_number, &lhs_is_not_number);
1101 1104
1102 assembler->Bind(&lhs_is_number); 1105 assembler->Bind(&lhs_is_number);
1103 { 1106 {
1104 // Check if {rhs} is a Smi. 1107 // Check if {rhs} is a Smi.
1105 Label rhs_is_smi(assembler), rhs_is_not_smi(assembler); 1108 Label rhs_is_smi(assembler), rhs_is_not_smi(assembler);
1106 assembler->Branch(assembler->WordIsSmi(rhs), &rhs_is_smi, 1109 assembler->Branch(assembler->TaggedIsSmi(rhs), &rhs_is_smi,
1107 &rhs_is_not_smi); 1110 &rhs_is_not_smi);
1108 1111
1109 assembler->Bind(&rhs_is_smi); 1112 assembler->Bind(&rhs_is_smi);
1110 { 1113 {
1111 // Convert {rhs} to a double and multiply it with the value of {lhs}. 1114 // Convert {rhs} to a double and multiply it with the value of {lhs}.
1112 var_lhs_float64.Bind(assembler->LoadHeapNumberValue(lhs)); 1115 var_lhs_float64.Bind(assembler->LoadHeapNumberValue(lhs));
1113 var_rhs_float64.Bind(assembler->SmiToFloat64(rhs)); 1116 var_rhs_float64.Bind(assembler->SmiToFloat64(rhs));
1114 assembler->Goto(&do_fmul); 1117 assembler->Goto(&do_fmul);
1115 } 1118 }
1116 1119
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 Label loop(assembler, 2, loop_variables); 1194 Label loop(assembler, 2, loop_variables);
1192 var_dividend.Bind(left); 1195 var_dividend.Bind(left);
1193 var_divisor.Bind(right); 1196 var_divisor.Bind(right);
1194 assembler->Goto(&loop); 1197 assembler->Goto(&loop);
1195 assembler->Bind(&loop); 1198 assembler->Bind(&loop);
1196 { 1199 {
1197 Node* dividend = var_dividend.value(); 1200 Node* dividend = var_dividend.value();
1198 Node* divisor = var_divisor.value(); 1201 Node* divisor = var_divisor.value();
1199 1202
1200 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler); 1203 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
1201 assembler->Branch(assembler->WordIsSmi(dividend), &dividend_is_smi, 1204 assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi,
1202 &dividend_is_not_smi); 1205 &dividend_is_not_smi);
1203 1206
1204 assembler->Bind(&dividend_is_smi); 1207 assembler->Bind(&dividend_is_smi);
1205 { 1208 {
1206 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); 1209 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler);
1207 assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi, 1210 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi,
1208 &divisor_is_not_smi); 1211 &divisor_is_not_smi);
1209 1212
1210 assembler->Bind(&divisor_is_smi); 1213 assembler->Bind(&divisor_is_smi);
1211 { 1214 {
1212 Label bailout(assembler); 1215 Label bailout(assembler);
1213 1216
1214 // Do floating point division if {divisor} is zero. 1217 // Do floating point division if {divisor} is zero.
1215 assembler->GotoIf( 1218 assembler->GotoIf(
1216 assembler->WordEqual(divisor, assembler->IntPtrConstant(0)), 1219 assembler->WordEqual(divisor, assembler->IntPtrConstant(0)),
1217 &bailout); 1220 &bailout);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 // Check if {dividend} is a HeapNumber. 1317 // Check if {dividend} is a HeapNumber.
1315 Label dividend_is_number(assembler), 1318 Label dividend_is_number(assembler),
1316 dividend_is_not_number(assembler, Label::kDeferred); 1319 dividend_is_not_number(assembler, Label::kDeferred);
1317 assembler->Branch(assembler->WordEqual(dividend_map, number_map), 1320 assembler->Branch(assembler->WordEqual(dividend_map, number_map),
1318 &dividend_is_number, &dividend_is_not_number); 1321 &dividend_is_number, &dividend_is_not_number);
1319 1322
1320 assembler->Bind(&dividend_is_number); 1323 assembler->Bind(&dividend_is_number);
1321 { 1324 {
1322 // Check if {divisor} is a Smi. 1325 // Check if {divisor} is a Smi.
1323 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); 1326 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler);
1324 assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi, 1327 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi,
1325 &divisor_is_not_smi); 1328 &divisor_is_not_smi);
1326 1329
1327 assembler->Bind(&divisor_is_smi); 1330 assembler->Bind(&divisor_is_smi);
1328 { 1331 {
1329 // Convert {divisor} to a double and use it for a floating point 1332 // Convert {divisor} to a double and use it for a floating point
1330 // division. 1333 // division.
1331 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend)); 1334 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend));
1332 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor)); 1335 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor));
1333 assembler->Goto(&do_fdiv); 1336 assembler->Goto(&do_fdiv);
1334 } 1337 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 Label loop(assembler, 2, loop_variables); 1414 Label loop(assembler, 2, loop_variables);
1412 var_dividend.Bind(left); 1415 var_dividend.Bind(left);
1413 var_divisor.Bind(right); 1416 var_divisor.Bind(right);
1414 assembler->Goto(&loop); 1417 assembler->Goto(&loop);
1415 assembler->Bind(&loop); 1418 assembler->Bind(&loop);
1416 { 1419 {
1417 Node* dividend = var_dividend.value(); 1420 Node* dividend = var_dividend.value();
1418 Node* divisor = var_divisor.value(); 1421 Node* divisor = var_divisor.value();
1419 1422
1420 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler); 1423 Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
1421 assembler->Branch(assembler->WordIsSmi(dividend), &dividend_is_smi, 1424 assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi,
1422 &dividend_is_not_smi); 1425 &dividend_is_not_smi);
1423 1426
1424 assembler->Bind(&dividend_is_smi); 1427 assembler->Bind(&dividend_is_smi);
1425 { 1428 {
1426 Label dividend_is_not_zero(assembler); 1429 Label dividend_is_not_zero(assembler);
1427 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); 1430 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler);
1428 assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi, 1431 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi,
1429 &divisor_is_not_smi); 1432 &divisor_is_not_smi);
1430 1433
1431 assembler->Bind(&divisor_is_smi); 1434 assembler->Bind(&divisor_is_smi);
1432 { 1435 {
1433 // Compute the modulus of two Smis. 1436 // Compute the modulus of two Smis.
1434 var_result.Bind(assembler->SmiMod(dividend, divisor)); 1437 var_result.Bind(assembler->SmiMod(dividend, divisor));
1435 assembler->Goto(&return_result); 1438 assembler->Goto(&return_result);
1436 } 1439 }
1437 1440
1438 assembler->Bind(&divisor_is_not_smi); 1441 assembler->Bind(&divisor_is_not_smi);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 // Check if {dividend} is a HeapNumber. 1475 // Check if {dividend} is a HeapNumber.
1473 Label dividend_is_number(assembler), 1476 Label dividend_is_number(assembler),
1474 dividend_is_not_number(assembler, Label::kDeferred); 1477 dividend_is_not_number(assembler, Label::kDeferred);
1475 assembler->Branch(assembler->WordEqual(dividend_map, number_map), 1478 assembler->Branch(assembler->WordEqual(dividend_map, number_map),
1476 &dividend_is_number, &dividend_is_not_number); 1479 &dividend_is_number, &dividend_is_not_number);
1477 1480
1478 assembler->Bind(&dividend_is_number); 1481 assembler->Bind(&dividend_is_number);
1479 { 1482 {
1480 // Check if {divisor} is a Smi. 1483 // Check if {divisor} is a Smi.
1481 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler); 1484 Label divisor_is_smi(assembler), divisor_is_not_smi(assembler);
1482 assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi, 1485 assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi,
1483 &divisor_is_not_smi); 1486 &divisor_is_not_smi);
1484 1487
1485 assembler->Bind(&divisor_is_smi); 1488 assembler->Bind(&divisor_is_smi);
1486 { 1489 {
1487 // Convert {divisor} to a double and compute {dividend}'s modulus with 1490 // Convert {divisor} to a double and compute {dividend}'s modulus with
1488 // it. 1491 // it.
1489 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend)); 1492 var_dividend_float64.Bind(assembler->LoadHeapNumberValue(dividend));
1490 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor)); 1493 var_divisor_float64.Bind(assembler->SmiToFloat64(divisor));
1491 assembler->Goto(&do_fmod); 1494 assembler->Goto(&do_fmod);
1492 } 1495 }
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 compiler::Node* lhs = assembler->Parameter(0); 1704 compiler::Node* lhs = assembler->Parameter(0);
1702 compiler::Node* rhs = assembler->Parameter(1); 1705 compiler::Node* rhs = assembler->Parameter(1);
1703 compiler::Node* context = assembler->Parameter(2); 1706 compiler::Node* context = assembler->Parameter(2);
1704 1707
1705 assembler->Return(assembler->StrictEqual(CodeStubAssembler::kNegateResult, 1708 assembler->Return(assembler->StrictEqual(CodeStubAssembler::kNegateResult,
1706 lhs, rhs, context)); 1709 lhs, rhs, context));
1707 } 1710 }
1708 1711
1709 } // namespace internal 1712 } // namespace internal
1710 } // namespace v8 1713 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-math.cc ('k') | src/builtins/builtins-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698