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

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

Issue 2543873003: [stubs] Use CSA::IsHeapNumberMap() instead of manual map comparing. (Closed)
Patch Set: Created 4 years 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 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 #include "src/code-stub-assembler.h" 8 #include "src/code-stub-assembler.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 } 982 }
983 } 983 }
984 984
985 Bind(&if_lhsisnotsmi); 985 Bind(&if_lhsisnotsmi);
986 { 986 {
987 // Load the map of the {lhs}. 987 // Load the map of the {lhs}.
988 Node* lhs_map = LoadMap(lhs); 988 Node* lhs_map = LoadMap(lhs);
989 989
990 // Check if the {lhs} is a HeapNumber. 990 // Check if the {lhs} is a HeapNumber.
991 Label if_lhsisnumber(this), if_lhsisnotnumber(this, Label::kDeferred); 991 Label if_lhsisnumber(this), if_lhsisnotnumber(this, Label::kDeferred);
992 Node* number_map = HeapNumberMapConstant(); 992 Branch(IsHeapNumberMap(lhs_map), &if_lhsisnumber, &if_lhsisnotnumber);
993 Branch(WordEqual(lhs_map, number_map), &if_lhsisnumber,
994 &if_lhsisnotnumber);
995 993
996 Bind(&if_lhsisnumber); 994 Bind(&if_lhsisnumber);
997 { 995 {
998 // Check if the {rhs} is a Smi. 996 // Check if the {rhs} is a Smi.
999 Label if_rhsissmi(this), if_rhsisnotsmi(this); 997 Label if_rhsissmi(this), if_rhsisnotsmi(this);
1000 Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi); 998 Branch(TaggedIsSmi(rhs), &if_rhsissmi, &if_rhsisnotsmi);
1001 999
1002 Bind(&if_rhsissmi); 1000 Bind(&if_rhsissmi);
1003 { 1001 {
1004 // Perform a floating point subtraction. 1002 // Perform a floating point subtraction.
1005 var_fsub_lhs.Bind(LoadHeapNumberValue(lhs)); 1003 var_fsub_lhs.Bind(LoadHeapNumberValue(lhs));
1006 var_fsub_rhs.Bind(SmiToFloat64(rhs)); 1004 var_fsub_rhs.Bind(SmiToFloat64(rhs));
1007 Goto(&do_fsub); 1005 Goto(&do_fsub);
1008 } 1006 }
1009 1007
1010 Bind(&if_rhsisnotsmi); 1008 Bind(&if_rhsisnotsmi);
1011 { 1009 {
1012 // Load the map of the {rhs}. 1010 // Load the map of the {rhs}.
1013 Node* rhs_map = LoadMap(rhs); 1011 Node* rhs_map = LoadMap(rhs);
1014 1012
1015 // Check if the {rhs} is a HeapNumber. 1013 // Check if the {rhs} is a HeapNumber.
1016 Label if_rhsisnumber(this), if_rhsisnotnumber(this, Label::kDeferred); 1014 Label if_rhsisnumber(this), if_rhsisnotnumber(this, Label::kDeferred);
1017 Branch(WordEqual(rhs_map, number_map), &if_rhsisnumber, 1015 Branch(IsHeapNumberMap(rhs_map), &if_rhsisnumber, &if_rhsisnotnumber);
1018 &if_rhsisnotnumber);
1019 1016
1020 Bind(&if_rhsisnumber); 1017 Bind(&if_rhsisnumber);
1021 { 1018 {
1022 // Perform a floating point subtraction. 1019 // Perform a floating point subtraction.
1023 var_fsub_lhs.Bind(LoadHeapNumberValue(lhs)); 1020 var_fsub_lhs.Bind(LoadHeapNumberValue(lhs));
1024 var_fsub_rhs.Bind(LoadHeapNumberValue(rhs)); 1021 var_fsub_rhs.Bind(LoadHeapNumberValue(rhs));
1025 Goto(&do_fsub); 1022 Goto(&do_fsub);
1026 } 1023 }
1027 1024
1028 Bind(&if_rhsisnotnumber); 1025 Bind(&if_rhsisnotnumber);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 TF_BUILTIN(Multiply, CodeStubAssembler) { 1057 TF_BUILTIN(Multiply, CodeStubAssembler) {
1061 Node* left = Parameter(0); 1058 Node* left = Parameter(0);
1062 Node* right = Parameter(1); 1059 Node* right = Parameter(1);
1063 Node* context = Parameter(2); 1060 Node* context = Parameter(2);
1064 1061
1065 // Shared entry point for floating point multiplication. 1062 // Shared entry point for floating point multiplication.
1066 Label do_fmul(this), return_result(this); 1063 Label do_fmul(this), return_result(this);
1067 Variable var_lhs_float64(this, MachineRepresentation::kFloat64), 1064 Variable var_lhs_float64(this, MachineRepresentation::kFloat64),
1068 var_rhs_float64(this, MachineRepresentation::kFloat64); 1065 var_rhs_float64(this, MachineRepresentation::kFloat64);
1069 1066
1070 Node* number_map = HeapNumberMapConstant();
1071
1072 // We might need to loop one or two times due to ToNumber conversions. 1067 // We might need to loop one or two times due to ToNumber conversions.
1073 Variable var_lhs(this, MachineRepresentation::kTagged), 1068 Variable var_lhs(this, MachineRepresentation::kTagged),
1074 var_rhs(this, MachineRepresentation::kTagged), 1069 var_rhs(this, MachineRepresentation::kTagged),
1075 var_result(this, MachineRepresentation::kTagged); 1070 var_result(this, MachineRepresentation::kTagged);
1076 Variable* loop_variables[] = {&var_lhs, &var_rhs}; 1071 Variable* loop_variables[] = {&var_lhs, &var_rhs};
1077 Label loop(this, 2, loop_variables); 1072 Label loop(this, 2, loop_variables);
1078 var_lhs.Bind(left); 1073 var_lhs.Bind(left);
1079 var_rhs.Bind(right); 1074 var_rhs.Bind(right);
1080 Goto(&loop); 1075 Goto(&loop);
1081 Bind(&loop); 1076 Bind(&loop);
(...skipping 16 matching lines...) Expand all
1098 var_result.Bind(SmiMul(lhs, rhs)); 1093 var_result.Bind(SmiMul(lhs, rhs));
1099 Goto(&return_result); 1094 Goto(&return_result);
1100 } 1095 }
1101 1096
1102 Bind(&rhs_is_not_smi); 1097 Bind(&rhs_is_not_smi);
1103 { 1098 {
1104 Node* rhs_map = LoadMap(rhs); 1099 Node* rhs_map = LoadMap(rhs);
1105 1100
1106 // Check if {rhs} is a HeapNumber. 1101 // Check if {rhs} is a HeapNumber.
1107 Label rhs_is_number(this), rhs_is_not_number(this, Label::kDeferred); 1102 Label rhs_is_number(this), rhs_is_not_number(this, Label::kDeferred);
1108 Branch(WordEqual(rhs_map, number_map), &rhs_is_number, 1103 Branch(IsHeapNumberMap(rhs_map), &rhs_is_number, &rhs_is_not_number);
1109 &rhs_is_not_number);
1110 1104
1111 Bind(&rhs_is_number); 1105 Bind(&rhs_is_number);
1112 { 1106 {
1113 // Convert {lhs} to a double and multiply it with the value of {rhs}. 1107 // Convert {lhs} to a double and multiply it with the value of {rhs}.
1114 var_lhs_float64.Bind(SmiToFloat64(lhs)); 1108 var_lhs_float64.Bind(SmiToFloat64(lhs));
1115 var_rhs_float64.Bind(LoadHeapNumberValue(rhs)); 1109 var_rhs_float64.Bind(LoadHeapNumberValue(rhs));
1116 Goto(&do_fmul); 1110 Goto(&do_fmul);
1117 } 1111 }
1118 1112
1119 Bind(&rhs_is_not_number); 1113 Bind(&rhs_is_not_number);
1120 { 1114 {
1121 // Multiplication is commutative, swap {lhs} with {rhs} and loop. 1115 // Multiplication is commutative, swap {lhs} with {rhs} and loop.
1122 var_lhs.Bind(rhs); 1116 var_lhs.Bind(rhs);
1123 var_rhs.Bind(lhs); 1117 var_rhs.Bind(lhs);
1124 Goto(&loop); 1118 Goto(&loop);
1125 } 1119 }
1126 } 1120 }
1127 } 1121 }
1128 1122
1129 Bind(&lhs_is_not_smi); 1123 Bind(&lhs_is_not_smi);
1130 { 1124 {
1131 Node* lhs_map = LoadMap(lhs); 1125 Node* lhs_map = LoadMap(lhs);
1132 1126
1133 // Check if {lhs} is a HeapNumber. 1127 // Check if {lhs} is a HeapNumber.
1134 Label lhs_is_number(this), lhs_is_not_number(this, Label::kDeferred); 1128 Label lhs_is_number(this), lhs_is_not_number(this, Label::kDeferred);
1135 Branch(WordEqual(lhs_map, number_map), &lhs_is_number, 1129 Branch(IsHeapNumberMap(lhs_map), &lhs_is_number, &lhs_is_not_number);
1136 &lhs_is_not_number);
1137 1130
1138 Bind(&lhs_is_number); 1131 Bind(&lhs_is_number);
1139 { 1132 {
1140 // Check if {rhs} is a Smi. 1133 // Check if {rhs} is a Smi.
1141 Label rhs_is_smi(this), rhs_is_not_smi(this); 1134 Label rhs_is_smi(this), rhs_is_not_smi(this);
1142 Branch(TaggedIsSmi(rhs), &rhs_is_smi, &rhs_is_not_smi); 1135 Branch(TaggedIsSmi(rhs), &rhs_is_smi, &rhs_is_not_smi);
1143 1136
1144 Bind(&rhs_is_smi); 1137 Bind(&rhs_is_smi);
1145 { 1138 {
1146 // Convert {rhs} to a double and multiply it with the value of {lhs}. 1139 // Convert {rhs} to a double and multiply it with the value of {lhs}.
1147 var_lhs_float64.Bind(LoadHeapNumberValue(lhs)); 1140 var_lhs_float64.Bind(LoadHeapNumberValue(lhs));
1148 var_rhs_float64.Bind(SmiToFloat64(rhs)); 1141 var_rhs_float64.Bind(SmiToFloat64(rhs));
1149 Goto(&do_fmul); 1142 Goto(&do_fmul);
1150 } 1143 }
1151 1144
1152 Bind(&rhs_is_not_smi); 1145 Bind(&rhs_is_not_smi);
1153 { 1146 {
1154 Node* rhs_map = LoadMap(rhs); 1147 Node* rhs_map = LoadMap(rhs);
1155 1148
1156 // Check if {rhs} is a HeapNumber. 1149 // Check if {rhs} is a HeapNumber.
1157 Label rhs_is_number(this), rhs_is_not_number(this, Label::kDeferred); 1150 Label rhs_is_number(this), rhs_is_not_number(this, Label::kDeferred);
1158 Branch(WordEqual(rhs_map, number_map), &rhs_is_number, 1151 Branch(IsHeapNumberMap(rhs_map), &rhs_is_number, &rhs_is_not_number);
1159 &rhs_is_not_number);
1160 1152
1161 Bind(&rhs_is_number); 1153 Bind(&rhs_is_number);
1162 { 1154 {
1163 // Both {lhs} and {rhs} are HeapNumbers. Load their values and 1155 // Both {lhs} and {rhs} are HeapNumbers. Load their values and
1164 // multiply them. 1156 // multiply them.
1165 var_lhs_float64.Bind(LoadHeapNumberValue(lhs)); 1157 var_lhs_float64.Bind(LoadHeapNumberValue(lhs));
1166 var_rhs_float64.Bind(LoadHeapNumberValue(rhs)); 1158 var_rhs_float64.Bind(LoadHeapNumberValue(rhs));
1167 Goto(&do_fmul); 1159 Goto(&do_fmul);
1168 } 1160 }
1169 1161
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 TF_BUILTIN(Divide, CodeStubAssembler) { 1194 TF_BUILTIN(Divide, CodeStubAssembler) {
1203 Node* left = Parameter(0); 1195 Node* left = Parameter(0);
1204 Node* right = Parameter(1); 1196 Node* right = Parameter(1);
1205 Node* context = Parameter(2); 1197 Node* context = Parameter(2);
1206 1198
1207 // Shared entry point for floating point division. 1199 // Shared entry point for floating point division.
1208 Label do_fdiv(this), end(this); 1200 Label do_fdiv(this), end(this);
1209 Variable var_dividend_float64(this, MachineRepresentation::kFloat64), 1201 Variable var_dividend_float64(this, MachineRepresentation::kFloat64),
1210 var_divisor_float64(this, MachineRepresentation::kFloat64); 1202 var_divisor_float64(this, MachineRepresentation::kFloat64);
1211 1203
1212 Node* number_map = HeapNumberMapConstant();
1213
1214 // We might need to loop one or two times due to ToNumber conversions. 1204 // We might need to loop one or two times due to ToNumber conversions.
1215 Variable var_dividend(this, MachineRepresentation::kTagged), 1205 Variable var_dividend(this, MachineRepresentation::kTagged),
1216 var_divisor(this, MachineRepresentation::kTagged), 1206 var_divisor(this, MachineRepresentation::kTagged),
1217 var_result(this, MachineRepresentation::kTagged); 1207 var_result(this, MachineRepresentation::kTagged);
1218 Variable* loop_variables[] = {&var_dividend, &var_divisor}; 1208 Variable* loop_variables[] = {&var_dividend, &var_divisor};
1219 Label loop(this, 2, loop_variables); 1209 Label loop(this, 2, loop_variables);
1220 var_dividend.Bind(left); 1210 var_dividend.Bind(left);
1221 var_divisor.Bind(right); 1211 var_divisor.Bind(right);
1222 Goto(&loop); 1212 Goto(&loop);
1223 Bind(&loop); 1213 Bind(&loop);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 } 1282 }
1293 } 1283 }
1294 1284
1295 Bind(&divisor_is_not_smi); 1285 Bind(&divisor_is_not_smi);
1296 { 1286 {
1297 Node* divisor_map = LoadMap(divisor); 1287 Node* divisor_map = LoadMap(divisor);
1298 1288
1299 // Check if {divisor} is a HeapNumber. 1289 // Check if {divisor} is a HeapNumber.
1300 Label divisor_is_number(this), 1290 Label divisor_is_number(this),
1301 divisor_is_not_number(this, Label::kDeferred); 1291 divisor_is_not_number(this, Label::kDeferred);
1302 Branch(WordEqual(divisor_map, number_map), &divisor_is_number, 1292 Branch(IsHeapNumberMap(divisor_map), &divisor_is_number,
1303 &divisor_is_not_number); 1293 &divisor_is_not_number);
1304 1294
1305 Bind(&divisor_is_number); 1295 Bind(&divisor_is_number);
1306 { 1296 {
1307 // Convert {dividend} to a double and divide it with the value of 1297 // Convert {dividend} to a double and divide it with the value of
1308 // {divisor}. 1298 // {divisor}.
1309 var_dividend_float64.Bind(SmiToFloat64(dividend)); 1299 var_dividend_float64.Bind(SmiToFloat64(dividend));
1310 var_divisor_float64.Bind(LoadHeapNumberValue(divisor)); 1300 var_divisor_float64.Bind(LoadHeapNumberValue(divisor));
1311 Goto(&do_fdiv); 1301 Goto(&do_fdiv);
1312 } 1302 }
1313 1303
1314 Bind(&divisor_is_not_number); 1304 Bind(&divisor_is_not_number);
1315 { 1305 {
1316 // Convert {divisor} to a number and loop. 1306 // Convert {divisor} to a number and loop.
1317 Callable callable = CodeFactory::NonNumberToNumber(isolate()); 1307 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1318 var_divisor.Bind(CallStub(callable, context, divisor)); 1308 var_divisor.Bind(CallStub(callable, context, divisor));
1319 Goto(&loop); 1309 Goto(&loop);
1320 } 1310 }
1321 } 1311 }
1322 } 1312 }
1323 1313
1324 Bind(&dividend_is_not_smi); 1314 Bind(&dividend_is_not_smi);
1325 { 1315 {
1326 Node* dividend_map = LoadMap(dividend); 1316 Node* dividend_map = LoadMap(dividend);
1327 1317
1328 // Check if {dividend} is a HeapNumber. 1318 // Check if {dividend} is a HeapNumber.
1329 Label dividend_is_number(this), 1319 Label dividend_is_number(this),
1330 dividend_is_not_number(this, Label::kDeferred); 1320 dividend_is_not_number(this, Label::kDeferred);
1331 Branch(WordEqual(dividend_map, number_map), &dividend_is_number, 1321 Branch(IsHeapNumberMap(dividend_map), &dividend_is_number,
1332 &dividend_is_not_number); 1322 &dividend_is_not_number);
1333 1323
1334 Bind(&dividend_is_number); 1324 Bind(&dividend_is_number);
1335 { 1325 {
1336 // Check if {divisor} is a Smi. 1326 // Check if {divisor} is a Smi.
1337 Label divisor_is_smi(this), divisor_is_not_smi(this); 1327 Label divisor_is_smi(this), divisor_is_not_smi(this);
1338 Branch(TaggedIsSmi(divisor), &divisor_is_smi, &divisor_is_not_smi); 1328 Branch(TaggedIsSmi(divisor), &divisor_is_smi, &divisor_is_not_smi);
1339 1329
1340 Bind(&divisor_is_smi); 1330 Bind(&divisor_is_smi);
1341 { 1331 {
1342 // 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
1343 // division. 1333 // division.
1344 var_dividend_float64.Bind(LoadHeapNumberValue(dividend)); 1334 var_dividend_float64.Bind(LoadHeapNumberValue(dividend));
1345 var_divisor_float64.Bind(SmiToFloat64(divisor)); 1335 var_divisor_float64.Bind(SmiToFloat64(divisor));
1346 Goto(&do_fdiv); 1336 Goto(&do_fdiv);
1347 } 1337 }
1348 1338
1349 Bind(&divisor_is_not_smi); 1339 Bind(&divisor_is_not_smi);
1350 { 1340 {
1351 Node* divisor_map = LoadMap(divisor); 1341 Node* divisor_map = LoadMap(divisor);
1352 1342
1353 // Check if {divisor} is a HeapNumber. 1343 // Check if {divisor} is a HeapNumber.
1354 Label divisor_is_number(this), 1344 Label divisor_is_number(this),
1355 divisor_is_not_number(this, Label::kDeferred); 1345 divisor_is_not_number(this, Label::kDeferred);
1356 Branch(WordEqual(divisor_map, number_map), &divisor_is_number, 1346 Branch(IsHeapNumberMap(divisor_map), &divisor_is_number,
1357 &divisor_is_not_number); 1347 &divisor_is_not_number);
1358 1348
1359 Bind(&divisor_is_number); 1349 Bind(&divisor_is_number);
1360 { 1350 {
1361 // Both {dividend} and {divisor} are HeapNumbers. Load their values 1351 // Both {dividend} and {divisor} are HeapNumbers. Load their values
1362 // and divide them. 1352 // and divide them.
1363 var_dividend_float64.Bind(LoadHeapNumberValue(dividend)); 1353 var_dividend_float64.Bind(LoadHeapNumberValue(dividend));
1364 var_divisor_float64.Bind(LoadHeapNumberValue(divisor)); 1354 var_divisor_float64.Bind(LoadHeapNumberValue(divisor));
1365 Goto(&do_fdiv); 1355 Goto(&do_fdiv);
1366 } 1356 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 Node* context = Parameter(2); 1392 Node* context = Parameter(2);
1403 1393
1404 Variable var_result(this, MachineRepresentation::kTagged); 1394 Variable var_result(this, MachineRepresentation::kTagged);
1405 Label return_result(this, &var_result); 1395 Label return_result(this, &var_result);
1406 1396
1407 // Shared entry point for floating point modulus. 1397 // Shared entry point for floating point modulus.
1408 Label do_fmod(this); 1398 Label do_fmod(this);
1409 Variable var_dividend_float64(this, MachineRepresentation::kFloat64), 1399 Variable var_dividend_float64(this, MachineRepresentation::kFloat64),
1410 var_divisor_float64(this, MachineRepresentation::kFloat64); 1400 var_divisor_float64(this, MachineRepresentation::kFloat64);
1411 1401
1412 Node* number_map = HeapNumberMapConstant();
1413
1414 // We might need to loop one or two times due to ToNumber conversions. 1402 // We might need to loop one or two times due to ToNumber conversions.
1415 Variable var_dividend(this, MachineRepresentation::kTagged), 1403 Variable var_dividend(this, MachineRepresentation::kTagged),
1416 var_divisor(this, MachineRepresentation::kTagged); 1404 var_divisor(this, MachineRepresentation::kTagged);
1417 Variable* loop_variables[] = {&var_dividend, &var_divisor}; 1405 Variable* loop_variables[] = {&var_dividend, &var_divisor};
1418 Label loop(this, 2, loop_variables); 1406 Label loop(this, 2, loop_variables);
1419 var_dividend.Bind(left); 1407 var_dividend.Bind(left);
1420 var_divisor.Bind(right); 1408 var_divisor.Bind(right);
1421 Goto(&loop); 1409 Goto(&loop);
1422 Bind(&loop); 1410 Bind(&loop);
1423 { 1411 {
(...skipping 16 matching lines...) Expand all
1440 Goto(&return_result); 1428 Goto(&return_result);
1441 } 1429 }
1442 1430
1443 Bind(&divisor_is_not_smi); 1431 Bind(&divisor_is_not_smi);
1444 { 1432 {
1445 Node* divisor_map = LoadMap(divisor); 1433 Node* divisor_map = LoadMap(divisor);
1446 1434
1447 // Check if {divisor} is a HeapNumber. 1435 // Check if {divisor} is a HeapNumber.
1448 Label divisor_is_number(this), 1436 Label divisor_is_number(this),
1449 divisor_is_not_number(this, Label::kDeferred); 1437 divisor_is_not_number(this, Label::kDeferred);
1450 Branch(WordEqual(divisor_map, number_map), &divisor_is_number, 1438 Branch(IsHeapNumberMap(divisor_map), &divisor_is_number,
1451 &divisor_is_not_number); 1439 &divisor_is_not_number);
1452 1440
1453 Bind(&divisor_is_number); 1441 Bind(&divisor_is_number);
1454 { 1442 {
1455 // Convert {dividend} to a double and compute its modulus with the 1443 // Convert {dividend} to a double and compute its modulus with the
1456 // value of {dividend}. 1444 // value of {dividend}.
1457 var_dividend_float64.Bind(SmiToFloat64(dividend)); 1445 var_dividend_float64.Bind(SmiToFloat64(dividend));
1458 var_divisor_float64.Bind(LoadHeapNumberValue(divisor)); 1446 var_divisor_float64.Bind(LoadHeapNumberValue(divisor));
1459 Goto(&do_fmod); 1447 Goto(&do_fmod);
1460 } 1448 }
1461 1449
1462 Bind(&divisor_is_not_number); 1450 Bind(&divisor_is_not_number);
1463 { 1451 {
1464 // Convert {divisor} to a number and loop. 1452 // Convert {divisor} to a number and loop.
1465 Callable callable = CodeFactory::NonNumberToNumber(isolate()); 1453 Callable callable = CodeFactory::NonNumberToNumber(isolate());
1466 var_divisor.Bind(CallStub(callable, context, divisor)); 1454 var_divisor.Bind(CallStub(callable, context, divisor));
1467 Goto(&loop); 1455 Goto(&loop);
1468 } 1456 }
1469 } 1457 }
1470 } 1458 }
1471 1459
1472 Bind(&dividend_is_not_smi); 1460 Bind(&dividend_is_not_smi);
1473 { 1461 {
1474 Node* dividend_map = LoadMap(dividend); 1462 Node* dividend_map = LoadMap(dividend);
1475 1463
1476 // Check if {dividend} is a HeapNumber. 1464 // Check if {dividend} is a HeapNumber.
1477 Label dividend_is_number(this), 1465 Label dividend_is_number(this),
1478 dividend_is_not_number(this, Label::kDeferred); 1466 dividend_is_not_number(this, Label::kDeferred);
1479 Branch(WordEqual(dividend_map, number_map), &dividend_is_number, 1467 Branch(IsHeapNumberMap(dividend_map), &dividend_is_number,
1480 &dividend_is_not_number); 1468 &dividend_is_not_number);
1481 1469
1482 Bind(&dividend_is_number); 1470 Bind(&dividend_is_number);
1483 { 1471 {
1484 // Check if {divisor} is a Smi. 1472 // Check if {divisor} is a Smi.
1485 Label divisor_is_smi(this), divisor_is_not_smi(this); 1473 Label divisor_is_smi(this), divisor_is_not_smi(this);
1486 Branch(TaggedIsSmi(divisor), &divisor_is_smi, &divisor_is_not_smi); 1474 Branch(TaggedIsSmi(divisor), &divisor_is_smi, &divisor_is_not_smi);
1487 1475
1488 Bind(&divisor_is_smi); 1476 Bind(&divisor_is_smi);
1489 { 1477 {
1490 // Convert {divisor} to a double and compute {dividend}'s modulus with 1478 // Convert {divisor} to a double and compute {dividend}'s modulus with
1491 // it. 1479 // it.
1492 var_dividend_float64.Bind(LoadHeapNumberValue(dividend)); 1480 var_dividend_float64.Bind(LoadHeapNumberValue(dividend));
1493 var_divisor_float64.Bind(SmiToFloat64(divisor)); 1481 var_divisor_float64.Bind(SmiToFloat64(divisor));
1494 Goto(&do_fmod); 1482 Goto(&do_fmod);
1495 } 1483 }
1496 1484
1497 Bind(&divisor_is_not_smi); 1485 Bind(&divisor_is_not_smi);
1498 { 1486 {
1499 Node* divisor_map = LoadMap(divisor); 1487 Node* divisor_map = LoadMap(divisor);
1500 1488
1501 // Check if {divisor} is a HeapNumber. 1489 // Check if {divisor} is a HeapNumber.
1502 Label divisor_is_number(this), 1490 Label divisor_is_number(this),
1503 divisor_is_not_number(this, Label::kDeferred); 1491 divisor_is_not_number(this, Label::kDeferred);
1504 Branch(WordEqual(divisor_map, number_map), &divisor_is_number, 1492 Branch(IsHeapNumberMap(divisor_map), &divisor_is_number,
1505 &divisor_is_not_number); 1493 &divisor_is_not_number);
1506 1494
1507 Bind(&divisor_is_number); 1495 Bind(&divisor_is_number);
1508 { 1496 {
1509 // Both {dividend} and {divisor} are HeapNumbers. Load their values 1497 // Both {dividend} and {divisor} are HeapNumbers. Load their values
1510 // and compute their modulus. 1498 // and compute their modulus.
1511 var_dividend_float64.Bind(LoadHeapNumberValue(dividend)); 1499 var_dividend_float64.Bind(LoadHeapNumberValue(dividend));
1512 var_divisor_float64.Bind(LoadHeapNumberValue(divisor)); 1500 var_divisor_float64.Bind(LoadHeapNumberValue(divisor));
1513 Goto(&do_fmod); 1501 Goto(&do_fmod);
1514 } 1502 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 TF_BUILTIN(StrictNotEqual, CodeStubAssembler) { 1606 TF_BUILTIN(StrictNotEqual, CodeStubAssembler) {
1619 Node* lhs = Parameter(0); 1607 Node* lhs = Parameter(0);
1620 Node* rhs = Parameter(1); 1608 Node* rhs = Parameter(1);
1621 Node* context = Parameter(2); 1609 Node* context = Parameter(2);
1622 1610
1623 Return(StrictEqual(kNegateResult, lhs, rhs, context)); 1611 Return(StrictEqual(kNegateResult, lhs, rhs, context));
1624 } 1612 }
1625 1613
1626 } // namespace internal 1614 } // namespace internal
1627 } // namespace v8 1615 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698