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

Side by Side Diff: src/builtins/builtins-array.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 | « no previous file | src/builtins/builtins-conversion.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.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 7
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/elements.h" 9 #include "src/elements.h"
10 10
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 void Builtins::Generate_ArrayIsArray(CodeStubAssembler* assembler) { 1229 void Builtins::Generate_ArrayIsArray(CodeStubAssembler* assembler) {
1230 typedef compiler::Node Node; 1230 typedef compiler::Node Node;
1231 typedef CodeStubAssembler::Label Label; 1231 typedef CodeStubAssembler::Label Label;
1232 1232
1233 Node* object = assembler->Parameter(1); 1233 Node* object = assembler->Parameter(1);
1234 Node* context = assembler->Parameter(4); 1234 Node* context = assembler->Parameter(4);
1235 1235
1236 Label call_runtime(assembler), return_true(assembler), 1236 Label call_runtime(assembler), return_true(assembler),
1237 return_false(assembler); 1237 return_false(assembler);
1238 1238
1239 assembler->GotoIf(assembler->WordIsSmi(object), &return_false); 1239 assembler->GotoIf(assembler->TaggedIsSmi(object), &return_false);
1240 Node* instance_type = assembler->LoadInstanceType(object); 1240 Node* instance_type = assembler->LoadInstanceType(object);
1241 1241
1242 assembler->GotoIf(assembler->Word32Equal( 1242 assembler->GotoIf(assembler->Word32Equal(
1243 instance_type, assembler->Int32Constant(JS_ARRAY_TYPE)), 1243 instance_type, assembler->Int32Constant(JS_ARRAY_TYPE)),
1244 &return_true); 1244 &return_true);
1245 1245
1246 // TODO(verwaest): Handle proxies in-place. 1246 // TODO(verwaest): Handle proxies in-place.
1247 assembler->Branch(assembler->Word32Equal( 1247 assembler->Branch(assembler->Word32Equal(
1248 instance_type, assembler->Int32Constant(JS_PROXY_TYPE)), 1248 instance_type, assembler->Int32Constant(JS_PROXY_TYPE)),
1249 &call_runtime, &return_false); 1249 &call_runtime, &return_false);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 len_var.Bind(intptr_zero); 1289 len_var.Bind(intptr_zero);
1290 1290
1291 // Take slow path if not a JSArray, if retrieving elements requires 1291 // Take slow path if not a JSArray, if retrieving elements requires
1292 // traversing prototype, or if access checks are required. 1292 // traversing prototype, or if access checks are required.
1293 assembler->BranchIfFastJSArray(array, context, &init_len, &call_runtime); 1293 assembler->BranchIfFastJSArray(array, context, &init_len, &call_runtime);
1294 1294
1295 assembler->Bind(&init_len); 1295 assembler->Bind(&init_len);
1296 { 1296 {
1297 // Handle case where JSArray length is not an Smi in the runtime 1297 // Handle case where JSArray length is not an Smi in the runtime
1298 Node* len = assembler->LoadObjectField(array, JSArray::kLengthOffset); 1298 Node* len = assembler->LoadObjectField(array, JSArray::kLengthOffset);
1299 assembler->GotoUnless(assembler->WordIsSmi(len), &call_runtime); 1299 assembler->GotoUnless(assembler->TaggedIsSmi(len), &call_runtime);
1300 1300
1301 len_var.Bind(assembler->SmiToWord(len)); 1301 len_var.Bind(assembler->SmiToWord(len));
1302 assembler->Branch(assembler->WordEqual(len_var.value(), intptr_zero), 1302 assembler->Branch(assembler->WordEqual(len_var.value(), intptr_zero),
1303 &return_false, &init_k); 1303 &return_false, &init_k);
1304 } 1304 }
1305 1305
1306 assembler->Bind(&init_k); 1306 assembler->Bind(&init_k);
1307 { 1307 {
1308 Label done(assembler), init_k_smi(assembler), init_k_heap_num(assembler), 1308 Label done(assembler), init_k_smi(assembler), init_k_heap_num(assembler),
1309 init_k_zero(assembler), init_k_n(assembler); 1309 init_k_zero(assembler), init_k_n(assembler);
1310 Node* tagged_n = assembler->ToInteger(context, start_from); 1310 Node* tagged_n = assembler->ToInteger(context, start_from);
1311 1311
1312 assembler->Branch(assembler->WordIsSmi(tagged_n), &init_k_smi, 1312 assembler->Branch(assembler->TaggedIsSmi(tagged_n), &init_k_smi,
1313 &init_k_heap_num); 1313 &init_k_heap_num);
1314 1314
1315 assembler->Bind(&init_k_smi); 1315 assembler->Bind(&init_k_smi);
1316 { 1316 {
1317 start_from_var.Bind(assembler->SmiUntag(tagged_n)); 1317 start_from_var.Bind(assembler->SmiUntag(tagged_n));
1318 assembler->Goto(&init_k_n); 1318 assembler->Goto(&init_k_n);
1319 } 1319 }
1320 1320
1321 assembler->Bind(&init_k_heap_num); 1321 assembler->Bind(&init_k_heap_num);
1322 { 1322 {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 1388
1389 assembler->Bind(&if_smiorobjects); 1389 assembler->Bind(&if_smiorobjects);
1390 { 1390 {
1391 Variable search_num(assembler, MachineRepresentation::kFloat64); 1391 Variable search_num(assembler, MachineRepresentation::kFloat64);
1392 Label ident_loop(assembler, &index_var), 1392 Label ident_loop(assembler, &index_var),
1393 heap_num_loop(assembler, &search_num), 1393 heap_num_loop(assembler, &search_num),
1394 string_loop(assembler, &index_var), simd_loop(assembler), 1394 string_loop(assembler, &index_var), simd_loop(assembler),
1395 undef_loop(assembler, &index_var), not_smi(assembler), 1395 undef_loop(assembler, &index_var), not_smi(assembler),
1396 not_heap_num(assembler); 1396 not_heap_num(assembler);
1397 1397
1398 assembler->GotoUnless(assembler->WordIsSmi(search_element), &not_smi); 1398 assembler->GotoUnless(assembler->TaggedIsSmi(search_element), &not_smi);
1399 search_num.Bind(assembler->SmiToFloat64(search_element)); 1399 search_num.Bind(assembler->SmiToFloat64(search_element));
1400 assembler->Goto(&heap_num_loop); 1400 assembler->Goto(&heap_num_loop);
1401 1401
1402 assembler->Bind(&not_smi); 1402 assembler->Bind(&not_smi);
1403 assembler->GotoIf(assembler->WordEqual(search_element, undefined), 1403 assembler->GotoIf(assembler->WordEqual(search_element, undefined),
1404 &undef_loop); 1404 &undef_loop);
1405 Node* map = assembler->LoadMap(search_element); 1405 Node* map = assembler->LoadMap(search_element);
1406 assembler->GotoIf(assembler->WordNotEqual(map, heap_number_map), 1406 assembler->GotoIf(assembler->WordNotEqual(map, heap_number_map),
1407 &not_heap_num); 1407 &not_heap_num);
1408 search_num.Bind(assembler->LoadHeapNumberValue(search_element)); 1408 search_num.Bind(assembler->LoadHeapNumberValue(search_element));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 1457
1458 assembler->Bind(&not_nan_loop); 1458 assembler->Bind(&not_nan_loop);
1459 { 1459 {
1460 Label continue_loop(assembler), not_smi(assembler); 1460 Label continue_loop(assembler), not_smi(assembler);
1461 assembler->GotoUnless( 1461 assembler->GotoUnless(
1462 assembler->UintPtrLessThan(index_var.value(), len_var.value()), 1462 assembler->UintPtrLessThan(index_var.value(), len_var.value()),
1463 &return_false); 1463 &return_false);
1464 Node* element_k = assembler->LoadFixedArrayElement( 1464 Node* element_k = assembler->LoadFixedArrayElement(
1465 elements, index_var.value(), 0, 1465 elements, index_var.value(), 0,
1466 CodeStubAssembler::INTPTR_PARAMETERS); 1466 CodeStubAssembler::INTPTR_PARAMETERS);
1467 assembler->GotoUnless(assembler->WordIsSmi(element_k), &not_smi); 1467 assembler->GotoUnless(assembler->TaggedIsSmi(element_k), &not_smi);
1468 assembler->Branch( 1468 assembler->Branch(
1469 assembler->Float64Equal(search_num.value(), 1469 assembler->Float64Equal(search_num.value(),
1470 assembler->SmiToFloat64(element_k)), 1470 assembler->SmiToFloat64(element_k)),
1471 &return_true, &continue_loop); 1471 &return_true, &continue_loop);
1472 1472
1473 assembler->Bind(&not_smi); 1473 assembler->Bind(&not_smi);
1474 assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k), 1474 assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k),
1475 heap_number_map), 1475 heap_number_map),
1476 &continue_loop); 1476 &continue_loop);
1477 assembler->BranchIfFloat64Equal( 1477 assembler->BranchIfFloat64Equal(
1478 search_num.value(), assembler->LoadHeapNumberValue(element_k), 1478 search_num.value(), assembler->LoadHeapNumberValue(element_k),
1479 &return_true, &continue_loop); 1479 &return_true, &continue_loop);
1480 1480
1481 assembler->Bind(&continue_loop); 1481 assembler->Bind(&continue_loop);
1482 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); 1482 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
1483 assembler->Goto(&not_nan_loop); 1483 assembler->Goto(&not_nan_loop);
1484 } 1484 }
1485 1485
1486 assembler->Bind(&nan_loop); 1486 assembler->Bind(&nan_loop);
1487 { 1487 {
1488 Label continue_loop(assembler); 1488 Label continue_loop(assembler);
1489 assembler->GotoUnless( 1489 assembler->GotoUnless(
1490 assembler->UintPtrLessThan(index_var.value(), len_var.value()), 1490 assembler->UintPtrLessThan(index_var.value(), len_var.value()),
1491 &return_false); 1491 &return_false);
1492 Node* element_k = assembler->LoadFixedArrayElement( 1492 Node* element_k = assembler->LoadFixedArrayElement(
1493 elements, index_var.value(), 0, 1493 elements, index_var.value(), 0,
1494 CodeStubAssembler::INTPTR_PARAMETERS); 1494 CodeStubAssembler::INTPTR_PARAMETERS);
1495 assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop); 1495 assembler->GotoIf(assembler->TaggedIsSmi(element_k), &continue_loop);
1496 assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k), 1496 assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k),
1497 heap_number_map), 1497 heap_number_map),
1498 &continue_loop); 1498 &continue_loop);
1499 assembler->BranchIfFloat64IsNaN( 1499 assembler->BranchIfFloat64IsNaN(
1500 assembler->LoadHeapNumberValue(element_k), &return_true, 1500 assembler->LoadHeapNumberValue(element_k), &return_true,
1501 &continue_loop); 1501 &continue_loop);
1502 1502
1503 assembler->Bind(&continue_loop); 1503 assembler->Bind(&continue_loop);
1504 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); 1504 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
1505 assembler->Goto(&nan_loop); 1505 assembler->Goto(&nan_loop);
1506 } 1506 }
1507 } 1507 }
1508 1508
1509 assembler->Bind(&string_loop); 1509 assembler->Bind(&string_loop);
1510 { 1510 {
1511 Label continue_loop(assembler); 1511 Label continue_loop(assembler);
1512 assembler->GotoUnless( 1512 assembler->GotoUnless(
1513 assembler->UintPtrLessThan(index_var.value(), len_var.value()), 1513 assembler->UintPtrLessThan(index_var.value(), len_var.value()),
1514 &return_false); 1514 &return_false);
1515 Node* element_k = assembler->LoadFixedArrayElement( 1515 Node* element_k = assembler->LoadFixedArrayElement(
1516 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); 1516 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
1517 assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop); 1517 assembler->GotoIf(assembler->TaggedIsSmi(element_k), &continue_loop);
1518 assembler->GotoUnless(assembler->IsStringInstanceType( 1518 assembler->GotoUnless(assembler->IsStringInstanceType(
1519 assembler->LoadInstanceType(element_k)), 1519 assembler->LoadInstanceType(element_k)),
1520 &continue_loop); 1520 &continue_loop);
1521 1521
1522 // TODO(bmeurer): Consider inlining the StringEqual logic here. 1522 // TODO(bmeurer): Consider inlining the StringEqual logic here.
1523 Callable callable = CodeFactory::StringEqual(assembler->isolate()); 1523 Callable callable = CodeFactory::StringEqual(assembler->isolate());
1524 Node* result = 1524 Node* result =
1525 assembler->CallStub(callable, context, search_element, element_k); 1525 assembler->CallStub(callable, context, search_element, element_k);
1526 assembler->Branch( 1526 assembler->Branch(
1527 assembler->WordEqual(assembler->BooleanConstant(true), result), 1527 assembler->WordEqual(assembler->BooleanConstant(true), result),
(...skipping 11 matching lines...) Expand all
1539 Node* map = assembler->LoadMap(search_element); 1539 Node* map = assembler->LoadMap(search_element);
1540 1540
1541 assembler->Goto(&loop_body); 1541 assembler->Goto(&loop_body);
1542 assembler->Bind(&loop_body); 1542 assembler->Bind(&loop_body);
1543 assembler->GotoUnless( 1543 assembler->GotoUnless(
1544 assembler->UintPtrLessThan(index_var.value(), len_var.value()), 1544 assembler->UintPtrLessThan(index_var.value(), len_var.value()),
1545 &return_false); 1545 &return_false);
1546 1546
1547 Node* element_k = assembler->LoadFixedArrayElement( 1547 Node* element_k = assembler->LoadFixedArrayElement(
1548 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); 1548 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
1549 assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop); 1549 assembler->GotoIf(assembler->TaggedIsSmi(element_k), &continue_loop);
1550 1550
1551 Node* map_k = assembler->LoadMap(element_k); 1551 Node* map_k = assembler->LoadMap(element_k);
1552 assembler->BranchIfSimd128Equal(search_element, map, element_k, map_k, 1552 assembler->BranchIfSimd128Equal(search_element, map, element_k, map_k,
1553 &return_true, &continue_loop); 1553 &return_true, &continue_loop);
1554 1554
1555 assembler->Bind(&continue_loop); 1555 assembler->Bind(&continue_loop);
1556 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); 1556 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
1557 assembler->Goto(&loop_body); 1557 assembler->Goto(&loop_body);
1558 } 1558 }
1559 } 1559 }
1560 1560
1561 assembler->Bind(&if_packed_doubles); 1561 assembler->Bind(&if_packed_doubles);
1562 { 1562 {
1563 Label nan_loop(assembler, &index_var), not_nan_loop(assembler, &index_var), 1563 Label nan_loop(assembler, &index_var), not_nan_loop(assembler, &index_var),
1564 hole_loop(assembler, &index_var), search_notnan(assembler); 1564 hole_loop(assembler, &index_var), search_notnan(assembler);
1565 Variable search_num(assembler, MachineRepresentation::kFloat64); 1565 Variable search_num(assembler, MachineRepresentation::kFloat64);
1566 1566
1567 assembler->GotoUnless(assembler->WordIsSmi(search_element), &search_notnan); 1567 assembler->GotoUnless(assembler->TaggedIsSmi(search_element),
1568 &search_notnan);
1568 search_num.Bind(assembler->SmiToFloat64(search_element)); 1569 search_num.Bind(assembler->SmiToFloat64(search_element));
1569 assembler->Goto(&not_nan_loop); 1570 assembler->Goto(&not_nan_loop);
1570 1571
1571 assembler->Bind(&search_notnan); 1572 assembler->Bind(&search_notnan);
1572 assembler->GotoIf(assembler->WordNotEqual( 1573 assembler->GotoIf(assembler->WordNotEqual(
1573 assembler->LoadMap(search_element), heap_number_map), 1574 assembler->LoadMap(search_element), heap_number_map),
1574 &return_false); 1575 &return_false);
1575 1576
1576 search_num.Bind(assembler->LoadHeapNumberValue(search_element)); 1577 search_num.Bind(assembler->LoadHeapNumberValue(search_element));
1577 1578
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 assembler->Goto(&nan_loop); 1612 assembler->Goto(&nan_loop);
1612 } 1613 }
1613 } 1614 }
1614 1615
1615 assembler->Bind(&if_holey_doubles); 1616 assembler->Bind(&if_holey_doubles);
1616 { 1617 {
1617 Label nan_loop(assembler, &index_var), not_nan_loop(assembler, &index_var), 1618 Label nan_loop(assembler, &index_var), not_nan_loop(assembler, &index_var),
1618 hole_loop(assembler, &index_var), search_notnan(assembler); 1619 hole_loop(assembler, &index_var), search_notnan(assembler);
1619 Variable search_num(assembler, MachineRepresentation::kFloat64); 1620 Variable search_num(assembler, MachineRepresentation::kFloat64);
1620 1621
1621 assembler->GotoUnless(assembler->WordIsSmi(search_element), &search_notnan); 1622 assembler->GotoUnless(assembler->TaggedIsSmi(search_element),
1623 &search_notnan);
1622 search_num.Bind(assembler->SmiToFloat64(search_element)); 1624 search_num.Bind(assembler->SmiToFloat64(search_element));
1623 assembler->Goto(&not_nan_loop); 1625 assembler->Goto(&not_nan_loop);
1624 1626
1625 assembler->Bind(&search_notnan); 1627 assembler->Bind(&search_notnan);
1626 assembler->GotoIf(assembler->WordEqual(search_element, undefined), 1628 assembler->GotoIf(assembler->WordEqual(search_element, undefined),
1627 &hole_loop); 1629 &hole_loop);
1628 assembler->GotoIf(assembler->WordNotEqual( 1630 assembler->GotoIf(assembler->WordNotEqual(
1629 assembler->LoadMap(search_element), heap_number_map), 1631 assembler->LoadMap(search_element), heap_number_map),
1630 &return_false); 1632 &return_false);
1631 1633
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 len_var.Bind(intptr_zero); 1733 len_var.Bind(intptr_zero);
1732 1734
1733 // Take slow path if not a JSArray, if retrieving elements requires 1735 // Take slow path if not a JSArray, if retrieving elements requires
1734 // traversing prototype, or if access checks are required. 1736 // traversing prototype, or if access checks are required.
1735 assembler->BranchIfFastJSArray(array, context, &init_len, &call_runtime); 1737 assembler->BranchIfFastJSArray(array, context, &init_len, &call_runtime);
1736 1738
1737 assembler->Bind(&init_len); 1739 assembler->Bind(&init_len);
1738 { 1740 {
1739 // Handle case where JSArray length is not an Smi in the runtime 1741 // Handle case where JSArray length is not an Smi in the runtime
1740 Node* len = assembler->LoadObjectField(array, JSArray::kLengthOffset); 1742 Node* len = assembler->LoadObjectField(array, JSArray::kLengthOffset);
1741 assembler->GotoUnless(assembler->WordIsSmi(len), &call_runtime); 1743 assembler->GotoUnless(assembler->TaggedIsSmi(len), &call_runtime);
1742 1744
1743 len_var.Bind(assembler->SmiToWord(len)); 1745 len_var.Bind(assembler->SmiToWord(len));
1744 assembler->Branch(assembler->WordEqual(len_var.value(), intptr_zero), 1746 assembler->Branch(assembler->WordEqual(len_var.value(), intptr_zero),
1745 &return_not_found, &init_k); 1747 &return_not_found, &init_k);
1746 } 1748 }
1747 1749
1748 assembler->Bind(&init_k); 1750 assembler->Bind(&init_k);
1749 { 1751 {
1750 Label done(assembler), init_k_smi(assembler), init_k_heap_num(assembler), 1752 Label done(assembler), init_k_smi(assembler), init_k_heap_num(assembler),
1751 init_k_zero(assembler), init_k_n(assembler); 1753 init_k_zero(assembler), init_k_n(assembler);
1752 Node* tagged_n = assembler->ToInteger(context, start_from); 1754 Node* tagged_n = assembler->ToInteger(context, start_from);
1753 1755
1754 assembler->Branch(assembler->WordIsSmi(tagged_n), &init_k_smi, 1756 assembler->Branch(assembler->TaggedIsSmi(tagged_n), &init_k_smi,
1755 &init_k_heap_num); 1757 &init_k_heap_num);
1756 1758
1757 assembler->Bind(&init_k_smi); 1759 assembler->Bind(&init_k_smi);
1758 { 1760 {
1759 start_from_var.Bind(assembler->SmiUntag(tagged_n)); 1761 start_from_var.Bind(assembler->SmiUntag(tagged_n));
1760 assembler->Goto(&init_k_n); 1762 assembler->Goto(&init_k_n);
1761 } 1763 }
1762 1764
1763 assembler->Bind(&init_k_heap_num); 1765 assembler->Bind(&init_k_heap_num);
1764 { 1766 {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 1832
1831 assembler->Bind(&if_smiorobjects); 1833 assembler->Bind(&if_smiorobjects);
1832 { 1834 {
1833 Variable search_num(assembler, MachineRepresentation::kFloat64); 1835 Variable search_num(assembler, MachineRepresentation::kFloat64);
1834 Label ident_loop(assembler, &index_var), 1836 Label ident_loop(assembler, &index_var),
1835 heap_num_loop(assembler, &search_num), 1837 heap_num_loop(assembler, &search_num),
1836 string_loop(assembler, &index_var), simd_loop(assembler), 1838 string_loop(assembler, &index_var), simd_loop(assembler),
1837 undef_loop(assembler, &index_var), not_smi(assembler), 1839 undef_loop(assembler, &index_var), not_smi(assembler),
1838 not_heap_num(assembler); 1840 not_heap_num(assembler);
1839 1841
1840 assembler->GotoUnless(assembler->WordIsSmi(search_element), &not_smi); 1842 assembler->GotoUnless(assembler->TaggedIsSmi(search_element), &not_smi);
1841 search_num.Bind(assembler->SmiToFloat64(search_element)); 1843 search_num.Bind(assembler->SmiToFloat64(search_element));
1842 assembler->Goto(&heap_num_loop); 1844 assembler->Goto(&heap_num_loop);
1843 1845
1844 assembler->Bind(&not_smi); 1846 assembler->Bind(&not_smi);
1845 assembler->GotoIf(assembler->WordEqual(search_element, undefined), 1847 assembler->GotoIf(assembler->WordEqual(search_element, undefined),
1846 &undef_loop); 1848 &undef_loop);
1847 Node* map = assembler->LoadMap(search_element); 1849 Node* map = assembler->LoadMap(search_element);
1848 assembler->GotoIf(assembler->WordNotEqual(map, heap_number_map), 1850 assembler->GotoIf(assembler->WordNotEqual(map, heap_number_map),
1849 &not_heap_num); 1851 &not_heap_num);
1850 search_num.Bind(assembler->LoadHeapNumberValue(search_element)); 1852 search_num.Bind(assembler->LoadHeapNumberValue(search_element));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 1898
1897 assembler->Bind(&not_nan_loop); 1899 assembler->Bind(&not_nan_loop);
1898 { 1900 {
1899 Label continue_loop(assembler), not_smi(assembler); 1901 Label continue_loop(assembler), not_smi(assembler);
1900 assembler->GotoUnless( 1902 assembler->GotoUnless(
1901 assembler->UintPtrLessThan(index_var.value(), len_var.value()), 1903 assembler->UintPtrLessThan(index_var.value(), len_var.value()),
1902 &return_not_found); 1904 &return_not_found);
1903 Node* element_k = assembler->LoadFixedArrayElement( 1905 Node* element_k = assembler->LoadFixedArrayElement(
1904 elements, index_var.value(), 0, 1906 elements, index_var.value(), 0,
1905 CodeStubAssembler::INTPTR_PARAMETERS); 1907 CodeStubAssembler::INTPTR_PARAMETERS);
1906 assembler->GotoUnless(assembler->WordIsSmi(element_k), &not_smi); 1908 assembler->GotoUnless(assembler->TaggedIsSmi(element_k), &not_smi);
1907 assembler->Branch( 1909 assembler->Branch(
1908 assembler->Float64Equal(search_num.value(), 1910 assembler->Float64Equal(search_num.value(),
1909 assembler->SmiToFloat64(element_k)), 1911 assembler->SmiToFloat64(element_k)),
1910 &return_found, &continue_loop); 1912 &return_found, &continue_loop);
1911 1913
1912 assembler->Bind(&not_smi); 1914 assembler->Bind(&not_smi);
1913 assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k), 1915 assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k),
1914 heap_number_map), 1916 heap_number_map),
1915 &continue_loop); 1917 &continue_loop);
1916 assembler->BranchIfFloat64Equal( 1918 assembler->BranchIfFloat64Equal(
1917 search_num.value(), assembler->LoadHeapNumberValue(element_k), 1919 search_num.value(), assembler->LoadHeapNumberValue(element_k),
1918 &return_found, &continue_loop); 1920 &return_found, &continue_loop);
1919 1921
1920 assembler->Bind(&continue_loop); 1922 assembler->Bind(&continue_loop);
1921 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); 1923 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
1922 assembler->Goto(&not_nan_loop); 1924 assembler->Goto(&not_nan_loop);
1923 } 1925 }
1924 } 1926 }
1925 1927
1926 assembler->Bind(&string_loop); 1928 assembler->Bind(&string_loop);
1927 { 1929 {
1928 Label continue_loop(assembler); 1930 Label continue_loop(assembler);
1929 assembler->GotoUnless( 1931 assembler->GotoUnless(
1930 assembler->UintPtrLessThan(index_var.value(), len_var.value()), 1932 assembler->UintPtrLessThan(index_var.value(), len_var.value()),
1931 &return_not_found); 1933 &return_not_found);
1932 Node* element_k = assembler->LoadFixedArrayElement( 1934 Node* element_k = assembler->LoadFixedArrayElement(
1933 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); 1935 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
1934 assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop); 1936 assembler->GotoIf(assembler->TaggedIsSmi(element_k), &continue_loop);
1935 assembler->GotoUnless(assembler->IsStringInstanceType( 1937 assembler->GotoUnless(assembler->IsStringInstanceType(
1936 assembler->LoadInstanceType(element_k)), 1938 assembler->LoadInstanceType(element_k)),
1937 &continue_loop); 1939 &continue_loop);
1938 1940
1939 // TODO(bmeurer): Consider inlining the StringEqual logic here. 1941 // TODO(bmeurer): Consider inlining the StringEqual logic here.
1940 Callable callable = CodeFactory::StringEqual(assembler->isolate()); 1942 Callable callable = CodeFactory::StringEqual(assembler->isolate());
1941 Node* result = 1943 Node* result =
1942 assembler->CallStub(callable, context, search_element, element_k); 1944 assembler->CallStub(callable, context, search_element, element_k);
1943 assembler->Branch( 1945 assembler->Branch(
1944 assembler->WordEqual(assembler->BooleanConstant(true), result), 1946 assembler->WordEqual(assembler->BooleanConstant(true), result),
(...skipping 11 matching lines...) Expand all
1956 Node* map = assembler->LoadMap(search_element); 1958 Node* map = assembler->LoadMap(search_element);
1957 1959
1958 assembler->Goto(&loop_body); 1960 assembler->Goto(&loop_body);
1959 assembler->Bind(&loop_body); 1961 assembler->Bind(&loop_body);
1960 assembler->GotoUnless( 1962 assembler->GotoUnless(
1961 assembler->UintPtrLessThan(index_var.value(), len_var.value()), 1963 assembler->UintPtrLessThan(index_var.value(), len_var.value()),
1962 &return_not_found); 1964 &return_not_found);
1963 1965
1964 Node* element_k = assembler->LoadFixedArrayElement( 1966 Node* element_k = assembler->LoadFixedArrayElement(
1965 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); 1967 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
1966 assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop); 1968 assembler->GotoIf(assembler->TaggedIsSmi(element_k), &continue_loop);
1967 1969
1968 Node* map_k = assembler->LoadMap(element_k); 1970 Node* map_k = assembler->LoadMap(element_k);
1969 assembler->BranchIfSimd128Equal(search_element, map, element_k, map_k, 1971 assembler->BranchIfSimd128Equal(search_element, map, element_k, map_k,
1970 &return_found, &continue_loop); 1972 &return_found, &continue_loop);
1971 1973
1972 assembler->Bind(&continue_loop); 1974 assembler->Bind(&continue_loop);
1973 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); 1975 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
1974 assembler->Goto(&loop_body); 1976 assembler->Goto(&loop_body);
1975 } 1977 }
1976 } 1978 }
1977 1979
1978 assembler->Bind(&if_packed_doubles); 1980 assembler->Bind(&if_packed_doubles);
1979 { 1981 {
1980 Label not_nan_loop(assembler, &index_var), search_notnan(assembler); 1982 Label not_nan_loop(assembler, &index_var), search_notnan(assembler);
1981 Variable search_num(assembler, MachineRepresentation::kFloat64); 1983 Variable search_num(assembler, MachineRepresentation::kFloat64);
1982 1984
1983 assembler->GotoUnless(assembler->WordIsSmi(search_element), &search_notnan); 1985 assembler->GotoUnless(assembler->TaggedIsSmi(search_element),
1986 &search_notnan);
1984 search_num.Bind(assembler->SmiToFloat64(search_element)); 1987 search_num.Bind(assembler->SmiToFloat64(search_element));
1985 assembler->Goto(&not_nan_loop); 1988 assembler->Goto(&not_nan_loop);
1986 1989
1987 assembler->Bind(&search_notnan); 1990 assembler->Bind(&search_notnan);
1988 assembler->GotoIf(assembler->WordNotEqual( 1991 assembler->GotoIf(assembler->WordNotEqual(
1989 assembler->LoadMap(search_element), heap_number_map), 1992 assembler->LoadMap(search_element), heap_number_map),
1990 &return_not_found); 1993 &return_not_found);
1991 1994
1992 search_num.Bind(assembler->LoadHeapNumberValue(search_element)); 1995 search_num.Bind(assembler->LoadHeapNumberValue(search_element));
1993 1996
(...skipping 16 matching lines...) Expand all
2010 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); 2013 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
2011 assembler->Goto(&not_nan_loop); 2014 assembler->Goto(&not_nan_loop);
2012 } 2015 }
2013 } 2016 }
2014 2017
2015 assembler->Bind(&if_holey_doubles); 2018 assembler->Bind(&if_holey_doubles);
2016 { 2019 {
2017 Label not_nan_loop(assembler, &index_var), search_notnan(assembler); 2020 Label not_nan_loop(assembler, &index_var), search_notnan(assembler);
2018 Variable search_num(assembler, MachineRepresentation::kFloat64); 2021 Variable search_num(assembler, MachineRepresentation::kFloat64);
2019 2022
2020 assembler->GotoUnless(assembler->WordIsSmi(search_element), &search_notnan); 2023 assembler->GotoUnless(assembler->TaggedIsSmi(search_element),
2024 &search_notnan);
2021 search_num.Bind(assembler->SmiToFloat64(search_element)); 2025 search_num.Bind(assembler->SmiToFloat64(search_element));
2022 assembler->Goto(&not_nan_loop); 2026 assembler->Goto(&not_nan_loop);
2023 2027
2024 assembler->Bind(&search_notnan); 2028 assembler->Bind(&search_notnan);
2025 assembler->GotoIf(assembler->WordNotEqual( 2029 assembler->GotoIf(assembler->WordNotEqual(
2026 assembler->LoadMap(search_element), heap_number_map), 2030 assembler->LoadMap(search_element), heap_number_map),
2027 &return_not_found); 2031 &return_not_found);
2028 2032
2029 search_num.Bind(assembler->LoadHeapNumberValue(search_element)); 2033 search_num.Bind(assembler->LoadHeapNumberValue(search_element));
2030 2034
(...skipping 27 matching lines...) Expand all
2058 assembler->Bind(&return_not_found); 2062 assembler->Bind(&return_not_found);
2059 assembler->Return(assembler->NumberConstant(-1)); 2063 assembler->Return(assembler->NumberConstant(-1));
2060 2064
2061 assembler->Bind(&call_runtime); 2065 assembler->Bind(&call_runtime);
2062 assembler->Return(assembler->CallRuntime(Runtime::kArrayIndexOf, context, 2066 assembler->Return(assembler->CallRuntime(Runtime::kArrayIndexOf, context,
2063 array, search_element, start_from)); 2067 array, search_element, start_from));
2064 } 2068 }
2065 2069
2066 } // namespace internal 2070 } // namespace internal
2067 } // namespace v8 2071 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins-conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698