OLD | NEW |
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/code-stub-assembler.h" | 9 #include "src/code-stub-assembler.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 assembler.Word32Equal(search_type, | 1563 assembler.Word32Equal(search_type, |
1564 assembler.Int32Constant(SIMD128_VALUE_TYPE)), | 1564 assembler.Int32Constant(SIMD128_VALUE_TYPE)), |
1565 &simd_loop); | 1565 &simd_loop); |
1566 assembler.Goto(&ident_loop); | 1566 assembler.Goto(&ident_loop); |
1567 | 1567 |
1568 assembler.Bind(&ident_loop); | 1568 assembler.Bind(&ident_loop); |
1569 { | 1569 { |
1570 assembler.GotoUnless( | 1570 assembler.GotoUnless( |
1571 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 1571 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
1572 &return_false); | 1572 &return_false); |
1573 Node* element_k = assembler.LoadFixedArrayElement( | 1573 Node* element_k = |
1574 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); | 1574 assembler.LoadFixedArrayElement(elements, index_var.value()); |
1575 assembler.GotoIf(assembler.WordEqual(element_k, search_element), | 1575 assembler.GotoIf(assembler.WordEqual(element_k, search_element), |
1576 &return_true); | 1576 &return_true); |
1577 | 1577 |
1578 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 1578 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
1579 assembler.Goto(&ident_loop); | 1579 assembler.Goto(&ident_loop); |
1580 } | 1580 } |
1581 | 1581 |
1582 assembler.Bind(&undef_loop); | 1582 assembler.Bind(&undef_loop); |
1583 { | 1583 { |
1584 assembler.GotoUnless( | 1584 assembler.GotoUnless( |
1585 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 1585 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
1586 &return_false); | 1586 &return_false); |
1587 Node* element_k = assembler.LoadFixedArrayElement( | 1587 Node* element_k = |
1588 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); | 1588 assembler.LoadFixedArrayElement(elements, index_var.value()); |
1589 assembler.GotoIf(assembler.WordEqual(element_k, undefined), &return_true); | 1589 assembler.GotoIf(assembler.WordEqual(element_k, undefined), &return_true); |
1590 assembler.GotoIf(assembler.WordEqual(element_k, the_hole), &return_true); | 1590 assembler.GotoIf(assembler.WordEqual(element_k, the_hole), &return_true); |
1591 | 1591 |
1592 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 1592 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
1593 assembler.Goto(&undef_loop); | 1593 assembler.Goto(&undef_loop); |
1594 } | 1594 } |
1595 | 1595 |
1596 assembler.Bind(&heap_num_loop); | 1596 assembler.Bind(&heap_num_loop); |
1597 { | 1597 { |
1598 Label nan_loop(&assembler, &index_var), | 1598 Label nan_loop(&assembler, &index_var), |
1599 not_nan_loop(&assembler, &index_var); | 1599 not_nan_loop(&assembler, &index_var); |
1600 assembler.BranchIfFloat64IsNaN(search_num.value(), &nan_loop, | 1600 assembler.BranchIfFloat64IsNaN(search_num.value(), &nan_loop, |
1601 ¬_nan_loop); | 1601 ¬_nan_loop); |
1602 | 1602 |
1603 assembler.Bind(¬_nan_loop); | 1603 assembler.Bind(¬_nan_loop); |
1604 { | 1604 { |
1605 Label continue_loop(&assembler), not_smi(&assembler); | 1605 Label continue_loop(&assembler), not_smi(&assembler); |
1606 assembler.GotoUnless( | 1606 assembler.GotoUnless( |
1607 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 1607 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
1608 &return_false); | 1608 &return_false); |
1609 Node* element_k = assembler.LoadFixedArrayElement( | 1609 Node* element_k = |
1610 elements, index_var.value(), 0, | 1610 assembler.LoadFixedArrayElement(elements, index_var.value()); |
1611 CodeStubAssembler::INTPTR_PARAMETERS); | |
1612 assembler.GotoUnless(assembler.TaggedIsSmi(element_k), ¬_smi); | 1611 assembler.GotoUnless(assembler.TaggedIsSmi(element_k), ¬_smi); |
1613 assembler.Branch( | 1612 assembler.Branch( |
1614 assembler.Float64Equal(search_num.value(), | 1613 assembler.Float64Equal(search_num.value(), |
1615 assembler.SmiToFloat64(element_k)), | 1614 assembler.SmiToFloat64(element_k)), |
1616 &return_true, &continue_loop); | 1615 &return_true, &continue_loop); |
1617 | 1616 |
1618 assembler.Bind(¬_smi); | 1617 assembler.Bind(¬_smi); |
1619 assembler.GotoUnless( | 1618 assembler.GotoUnless( |
1620 assembler.IsHeapNumberMap(assembler.LoadMap(element_k)), | 1619 assembler.IsHeapNumberMap(assembler.LoadMap(element_k)), |
1621 &continue_loop); | 1620 &continue_loop); |
1622 assembler.Branch( | 1621 assembler.Branch( |
1623 assembler.Float64Equal(search_num.value(), | 1622 assembler.Float64Equal(search_num.value(), |
1624 assembler.LoadHeapNumberValue(element_k)), | 1623 assembler.LoadHeapNumberValue(element_k)), |
1625 &return_true, &continue_loop); | 1624 &return_true, &continue_loop); |
1626 | 1625 |
1627 assembler.Bind(&continue_loop); | 1626 assembler.Bind(&continue_loop); |
1628 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 1627 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
1629 assembler.Goto(¬_nan_loop); | 1628 assembler.Goto(¬_nan_loop); |
1630 } | 1629 } |
1631 | 1630 |
1632 assembler.Bind(&nan_loop); | 1631 assembler.Bind(&nan_loop); |
1633 { | 1632 { |
1634 Label continue_loop(&assembler); | 1633 Label continue_loop(&assembler); |
1635 assembler.GotoUnless( | 1634 assembler.GotoUnless( |
1636 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 1635 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
1637 &return_false); | 1636 &return_false); |
1638 Node* element_k = assembler.LoadFixedArrayElement( | 1637 Node* element_k = |
1639 elements, index_var.value(), 0, | 1638 assembler.LoadFixedArrayElement(elements, index_var.value()); |
1640 CodeStubAssembler::INTPTR_PARAMETERS); | |
1641 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop); | 1639 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop); |
1642 assembler.GotoUnless( | 1640 assembler.GotoUnless( |
1643 assembler.IsHeapNumberMap(assembler.LoadMap(element_k)), | 1641 assembler.IsHeapNumberMap(assembler.LoadMap(element_k)), |
1644 &continue_loop); | 1642 &continue_loop); |
1645 assembler.BranchIfFloat64IsNaN(assembler.LoadHeapNumberValue(element_k), | 1643 assembler.BranchIfFloat64IsNaN(assembler.LoadHeapNumberValue(element_k), |
1646 &return_true, &continue_loop); | 1644 &return_true, &continue_loop); |
1647 | 1645 |
1648 assembler.Bind(&continue_loop); | 1646 assembler.Bind(&continue_loop); |
1649 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 1647 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
1650 assembler.Goto(&nan_loop); | 1648 assembler.Goto(&nan_loop); |
1651 } | 1649 } |
1652 } | 1650 } |
1653 | 1651 |
1654 assembler.Bind(&string_loop); | 1652 assembler.Bind(&string_loop); |
1655 { | 1653 { |
1656 Label continue_loop(&assembler); | 1654 Label continue_loop(&assembler); |
1657 assembler.GotoUnless( | 1655 assembler.GotoUnless( |
1658 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 1656 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
1659 &return_false); | 1657 &return_false); |
1660 Node* element_k = assembler.LoadFixedArrayElement( | 1658 Node* element_k = |
1661 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); | 1659 assembler.LoadFixedArrayElement(elements, index_var.value()); |
1662 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop); | 1660 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop); |
1663 assembler.GotoUnless( | 1661 assembler.GotoUnless( |
1664 assembler.IsStringInstanceType(assembler.LoadInstanceType(element_k)), | 1662 assembler.IsStringInstanceType(assembler.LoadInstanceType(element_k)), |
1665 &continue_loop); | 1663 &continue_loop); |
1666 | 1664 |
1667 // TODO(bmeurer): Consider inlining the StringEqual logic here. | 1665 // TODO(bmeurer): Consider inlining the StringEqual logic here. |
1668 Callable callable = CodeFactory::StringEqual(assembler.isolate()); | 1666 Callable callable = CodeFactory::StringEqual(assembler.isolate()); |
1669 Node* result = | 1667 Node* result = |
1670 assembler.CallStub(callable, context, search_element, element_k); | 1668 assembler.CallStub(callable, context, search_element, element_k); |
1671 assembler.Branch( | 1669 assembler.Branch( |
(...skipping 10 matching lines...) Expand all Loading... |
1682 Label continue_loop(&assembler, &index_var), | 1680 Label continue_loop(&assembler, &index_var), |
1683 loop_body(&assembler, &index_var); | 1681 loop_body(&assembler, &index_var); |
1684 Node* map = assembler.LoadMap(search_element); | 1682 Node* map = assembler.LoadMap(search_element); |
1685 | 1683 |
1686 assembler.Goto(&loop_body); | 1684 assembler.Goto(&loop_body); |
1687 assembler.Bind(&loop_body); | 1685 assembler.Bind(&loop_body); |
1688 assembler.GotoUnless( | 1686 assembler.GotoUnless( |
1689 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 1687 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
1690 &return_false); | 1688 &return_false); |
1691 | 1689 |
1692 Node* element_k = assembler.LoadFixedArrayElement( | 1690 Node* element_k = |
1693 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); | 1691 assembler.LoadFixedArrayElement(elements, index_var.value()); |
1694 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop); | 1692 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop); |
1695 | 1693 |
1696 Node* map_k = assembler.LoadMap(element_k); | 1694 Node* map_k = assembler.LoadMap(element_k); |
1697 assembler.BranchIfSimd128Equal(search_element, map, element_k, map_k, | 1695 assembler.BranchIfSimd128Equal(search_element, map, element_k, map_k, |
1698 &return_true, &continue_loop); | 1696 &return_true, &continue_loop); |
1699 | 1697 |
1700 assembler.Bind(&continue_loop); | 1698 assembler.Bind(&continue_loop); |
1701 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 1699 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
1702 assembler.Goto(&loop_body); | 1700 assembler.Goto(&loop_body); |
1703 } | 1701 } |
(...skipping 21 matching lines...) Expand all Loading... |
1725 ¬_nan_loop); | 1723 ¬_nan_loop); |
1726 | 1724 |
1727 // Search for HeapNumber | 1725 // Search for HeapNumber |
1728 assembler.Bind(¬_nan_loop); | 1726 assembler.Bind(¬_nan_loop); |
1729 { | 1727 { |
1730 Label continue_loop(&assembler); | 1728 Label continue_loop(&assembler); |
1731 assembler.GotoUnless( | 1729 assembler.GotoUnless( |
1732 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 1730 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
1733 &return_false); | 1731 &return_false); |
1734 Node* element_k = assembler.LoadFixedDoubleArrayElement( | 1732 Node* element_k = assembler.LoadFixedDoubleArrayElement( |
1735 elements, index_var.value(), MachineType::Float64(), 0, | 1733 elements, index_var.value(), MachineType::Float64()); |
1736 CodeStubAssembler::INTPTR_PARAMETERS); | |
1737 assembler.Branch(assembler.Float64Equal(element_k, search_num.value()), | 1734 assembler.Branch(assembler.Float64Equal(element_k, search_num.value()), |
1738 &return_true, &continue_loop); | 1735 &return_true, &continue_loop); |
1739 assembler.Bind(&continue_loop); | 1736 assembler.Bind(&continue_loop); |
1740 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 1737 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
1741 assembler.Goto(¬_nan_loop); | 1738 assembler.Goto(¬_nan_loop); |
1742 } | 1739 } |
1743 | 1740 |
1744 // Search for NaN | 1741 // Search for NaN |
1745 assembler.Bind(&nan_loop); | 1742 assembler.Bind(&nan_loop); |
1746 { | 1743 { |
1747 Label continue_loop(&assembler); | 1744 Label continue_loop(&assembler); |
1748 assembler.GotoUnless( | 1745 assembler.GotoUnless( |
1749 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 1746 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
1750 &return_false); | 1747 &return_false); |
1751 Node* element_k = assembler.LoadFixedDoubleArrayElement( | 1748 Node* element_k = assembler.LoadFixedDoubleArrayElement( |
1752 elements, index_var.value(), MachineType::Float64(), 0, | 1749 elements, index_var.value(), MachineType::Float64()); |
1753 CodeStubAssembler::INTPTR_PARAMETERS); | |
1754 assembler.BranchIfFloat64IsNaN(element_k, &return_true, &continue_loop); | 1750 assembler.BranchIfFloat64IsNaN(element_k, &return_true, &continue_loop); |
1755 assembler.Bind(&continue_loop); | 1751 assembler.Bind(&continue_loop); |
1756 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 1752 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
1757 assembler.Goto(&nan_loop); | 1753 assembler.Goto(&nan_loop); |
1758 } | 1754 } |
1759 } | 1755 } |
1760 | 1756 |
1761 assembler.Bind(&if_holey_doubles); | 1757 assembler.Bind(&if_holey_doubles); |
1762 { | 1758 { |
1763 Label nan_loop(&assembler, &index_var), | 1759 Label nan_loop(&assembler, &index_var), |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 assembler.Word32Equal(search_type, | 2000 assembler.Word32Equal(search_type, |
2005 assembler.Int32Constant(SIMD128_VALUE_TYPE)), | 2001 assembler.Int32Constant(SIMD128_VALUE_TYPE)), |
2006 &simd_loop); | 2002 &simd_loop); |
2007 assembler.Goto(&ident_loop); | 2003 assembler.Goto(&ident_loop); |
2008 | 2004 |
2009 assembler.Bind(&ident_loop); | 2005 assembler.Bind(&ident_loop); |
2010 { | 2006 { |
2011 assembler.GotoUnless( | 2007 assembler.GotoUnless( |
2012 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 2008 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
2013 &return_not_found); | 2009 &return_not_found); |
2014 Node* element_k = assembler.LoadFixedArrayElement( | 2010 Node* element_k = |
2015 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); | 2011 assembler.LoadFixedArrayElement(elements, index_var.value()); |
2016 assembler.GotoIf(assembler.WordEqual(element_k, search_element), | 2012 assembler.GotoIf(assembler.WordEqual(element_k, search_element), |
2017 &return_found); | 2013 &return_found); |
2018 | 2014 |
2019 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 2015 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
2020 assembler.Goto(&ident_loop); | 2016 assembler.Goto(&ident_loop); |
2021 } | 2017 } |
2022 | 2018 |
2023 assembler.Bind(&undef_loop); | 2019 assembler.Bind(&undef_loop); |
2024 { | 2020 { |
2025 assembler.GotoUnless( | 2021 assembler.GotoUnless( |
2026 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 2022 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
2027 &return_not_found); | 2023 &return_not_found); |
2028 Node* element_k = assembler.LoadFixedArrayElement( | 2024 Node* element_k = |
2029 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); | 2025 assembler.LoadFixedArrayElement(elements, index_var.value()); |
2030 assembler.GotoIf(assembler.WordEqual(element_k, undefined), | 2026 assembler.GotoIf(assembler.WordEqual(element_k, undefined), |
2031 &return_found); | 2027 &return_found); |
2032 | 2028 |
2033 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 2029 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
2034 assembler.Goto(&undef_loop); | 2030 assembler.Goto(&undef_loop); |
2035 } | 2031 } |
2036 | 2032 |
2037 assembler.Bind(&heap_num_loop); | 2033 assembler.Bind(&heap_num_loop); |
2038 { | 2034 { |
2039 Label not_nan_loop(&assembler, &index_var); | 2035 Label not_nan_loop(&assembler, &index_var); |
2040 assembler.BranchIfFloat64IsNaN(search_num.value(), &return_not_found, | 2036 assembler.BranchIfFloat64IsNaN(search_num.value(), &return_not_found, |
2041 ¬_nan_loop); | 2037 ¬_nan_loop); |
2042 | 2038 |
2043 assembler.Bind(¬_nan_loop); | 2039 assembler.Bind(¬_nan_loop); |
2044 { | 2040 { |
2045 Label continue_loop(&assembler), not_smi(&assembler); | 2041 Label continue_loop(&assembler), not_smi(&assembler); |
2046 assembler.GotoUnless( | 2042 assembler.GotoUnless( |
2047 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 2043 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
2048 &return_not_found); | 2044 &return_not_found); |
2049 Node* element_k = assembler.LoadFixedArrayElement( | 2045 Node* element_k = |
2050 elements, index_var.value(), 0, | 2046 assembler.LoadFixedArrayElement(elements, index_var.value()); |
2051 CodeStubAssembler::INTPTR_PARAMETERS); | |
2052 assembler.GotoUnless(assembler.TaggedIsSmi(element_k), ¬_smi); | 2047 assembler.GotoUnless(assembler.TaggedIsSmi(element_k), ¬_smi); |
2053 assembler.Branch( | 2048 assembler.Branch( |
2054 assembler.Float64Equal(search_num.value(), | 2049 assembler.Float64Equal(search_num.value(), |
2055 assembler.SmiToFloat64(element_k)), | 2050 assembler.SmiToFloat64(element_k)), |
2056 &return_found, &continue_loop); | 2051 &return_found, &continue_loop); |
2057 | 2052 |
2058 assembler.Bind(¬_smi); | 2053 assembler.Bind(¬_smi); |
2059 assembler.GotoUnless( | 2054 assembler.GotoUnless( |
2060 assembler.IsHeapNumberMap(assembler.LoadMap(element_k)), | 2055 assembler.IsHeapNumberMap(assembler.LoadMap(element_k)), |
2061 &continue_loop); | 2056 &continue_loop); |
2062 assembler.Branch( | 2057 assembler.Branch( |
2063 assembler.Float64Equal(search_num.value(), | 2058 assembler.Float64Equal(search_num.value(), |
2064 assembler.LoadHeapNumberValue(element_k)), | 2059 assembler.LoadHeapNumberValue(element_k)), |
2065 &return_found, &continue_loop); | 2060 &return_found, &continue_loop); |
2066 | 2061 |
2067 assembler.Bind(&continue_loop); | 2062 assembler.Bind(&continue_loop); |
2068 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 2063 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
2069 assembler.Goto(¬_nan_loop); | 2064 assembler.Goto(¬_nan_loop); |
2070 } | 2065 } |
2071 } | 2066 } |
2072 | 2067 |
2073 assembler.Bind(&string_loop); | 2068 assembler.Bind(&string_loop); |
2074 { | 2069 { |
2075 Label continue_loop(&assembler); | 2070 Label continue_loop(&assembler); |
2076 assembler.GotoUnless( | 2071 assembler.GotoUnless( |
2077 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 2072 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
2078 &return_not_found); | 2073 &return_not_found); |
2079 Node* element_k = assembler.LoadFixedArrayElement( | 2074 Node* element_k = |
2080 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); | 2075 assembler.LoadFixedArrayElement(elements, index_var.value()); |
2081 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop); | 2076 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop); |
2082 assembler.GotoUnless( | 2077 assembler.GotoUnless( |
2083 assembler.IsStringInstanceType(assembler.LoadInstanceType(element_k)), | 2078 assembler.IsStringInstanceType(assembler.LoadInstanceType(element_k)), |
2084 &continue_loop); | 2079 &continue_loop); |
2085 | 2080 |
2086 // TODO(bmeurer): Consider inlining the StringEqual logic here. | 2081 // TODO(bmeurer): Consider inlining the StringEqual logic here. |
2087 Callable callable = CodeFactory::StringEqual(assembler.isolate()); | 2082 Callable callable = CodeFactory::StringEqual(assembler.isolate()); |
2088 Node* result = | 2083 Node* result = |
2089 assembler.CallStub(callable, context, search_element, element_k); | 2084 assembler.CallStub(callable, context, search_element, element_k); |
2090 assembler.Branch( | 2085 assembler.Branch( |
(...skipping 10 matching lines...) Expand all Loading... |
2101 Label continue_loop(&assembler, &index_var), | 2096 Label continue_loop(&assembler, &index_var), |
2102 loop_body(&assembler, &index_var); | 2097 loop_body(&assembler, &index_var); |
2103 Node* map = assembler.LoadMap(search_element); | 2098 Node* map = assembler.LoadMap(search_element); |
2104 | 2099 |
2105 assembler.Goto(&loop_body); | 2100 assembler.Goto(&loop_body); |
2106 assembler.Bind(&loop_body); | 2101 assembler.Bind(&loop_body); |
2107 assembler.GotoUnless( | 2102 assembler.GotoUnless( |
2108 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 2103 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
2109 &return_not_found); | 2104 &return_not_found); |
2110 | 2105 |
2111 Node* element_k = assembler.LoadFixedArrayElement( | 2106 Node* element_k = |
2112 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); | 2107 assembler.LoadFixedArrayElement(elements, index_var.value()); |
2113 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop); | 2108 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop); |
2114 | 2109 |
2115 Node* map_k = assembler.LoadMap(element_k); | 2110 Node* map_k = assembler.LoadMap(element_k); |
2116 assembler.BranchIfSimd128Equal(search_element, map, element_k, map_k, | 2111 assembler.BranchIfSimd128Equal(search_element, map, element_k, map_k, |
2117 &return_found, &continue_loop); | 2112 &return_found, &continue_loop); |
2118 | 2113 |
2119 assembler.Bind(&continue_loop); | 2114 assembler.Bind(&continue_loop); |
2120 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 2115 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
2121 assembler.Goto(&loop_body); | 2116 assembler.Goto(&loop_body); |
2122 } | 2117 } |
(...skipping 19 matching lines...) Expand all Loading... |
2142 ¬_nan_loop); | 2137 ¬_nan_loop); |
2143 | 2138 |
2144 // Search for HeapNumber | 2139 // Search for HeapNumber |
2145 assembler.Bind(¬_nan_loop); | 2140 assembler.Bind(¬_nan_loop); |
2146 { | 2141 { |
2147 Label continue_loop(&assembler); | 2142 Label continue_loop(&assembler); |
2148 assembler.GotoUnless( | 2143 assembler.GotoUnless( |
2149 assembler.UintPtrLessThan(index_var.value(), len_var.value()), | 2144 assembler.UintPtrLessThan(index_var.value(), len_var.value()), |
2150 &return_not_found); | 2145 &return_not_found); |
2151 Node* element_k = assembler.LoadFixedDoubleArrayElement( | 2146 Node* element_k = assembler.LoadFixedDoubleArrayElement( |
2152 elements, index_var.value(), MachineType::Float64(), 0, | 2147 elements, index_var.value(), MachineType::Float64()); |
2153 CodeStubAssembler::INTPTR_PARAMETERS); | |
2154 assembler.Branch(assembler.Float64Equal(element_k, search_num.value()), | 2148 assembler.Branch(assembler.Float64Equal(element_k, search_num.value()), |
2155 &return_found, &continue_loop); | 2149 &return_found, &continue_loop); |
2156 assembler.Bind(&continue_loop); | 2150 assembler.Bind(&continue_loop); |
2157 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); | 2151 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); |
2158 assembler.Goto(¬_nan_loop); | 2152 assembler.Goto(¬_nan_loop); |
2159 } | 2153 } |
2160 } | 2154 } |
2161 | 2155 |
2162 assembler.Bind(&if_holey_doubles); | 2156 assembler.Bind(&if_holey_doubles); |
2163 { | 2157 { |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2702 } | 2696 } |
2703 | 2697 |
2704 assembler.Bind(&allocate_entry_if_needed); | 2698 assembler.Bind(&allocate_entry_if_needed); |
2705 { | 2699 { |
2706 assembler.GotoIf( | 2700 assembler.GotoIf( |
2707 assembler.Int32GreaterThan( | 2701 assembler.Int32GreaterThan( |
2708 instance_type, | 2702 instance_type, |
2709 assembler.Int32Constant(LAST_ARRAY_KEY_VALUE_ITERATOR_TYPE)), | 2703 assembler.Int32Constant(LAST_ARRAY_KEY_VALUE_ITERATOR_TYPE)), |
2710 &allocate_iterator_result); | 2704 &allocate_iterator_result); |
2711 | 2705 |
2712 Node* elements = | 2706 Node* elements = assembler.AllocateFixedArray(FAST_ELEMENTS, |
2713 assembler.AllocateFixedArray(FAST_ELEMENTS, assembler.Int32Constant(2)); | 2707 assembler.IntPtrConstant(2)); |
2714 assembler.StoreFixedArrayElement(elements, 0, index, SKIP_WRITE_BARRIER); | 2708 assembler.StoreFixedArrayElement(elements, 0, index, SKIP_WRITE_BARRIER); |
2715 assembler.StoreFixedArrayElement(elements, 1, var_value.value(), | 2709 assembler.StoreFixedArrayElement(elements, 1, var_value.value(), |
2716 SKIP_WRITE_BARRIER); | 2710 SKIP_WRITE_BARRIER); |
2717 | 2711 |
2718 Node* entry = assembler.Allocate(JSArray::kSize); | 2712 Node* entry = assembler.Allocate(JSArray::kSize); |
2719 Node* map = | 2713 Node* map = |
2720 assembler.LoadContextElement(assembler.LoadNativeContext(context), | 2714 assembler.LoadContextElement(assembler.LoadNativeContext(context), |
2721 Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX); | 2715 Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX); |
2722 | 2716 |
2723 assembler.StoreMapNoWriteBarrier(entry, map); | 2717 assembler.StoreMapNoWriteBarrier(entry, map); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2757 Runtime::kThrowIncompatibleMethodReceiver, context, | 2751 Runtime::kThrowIncompatibleMethodReceiver, context, |
2758 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( | 2752 assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( |
2759 "Array Iterator.prototype.next", TENURED)), | 2753 "Array Iterator.prototype.next", TENURED)), |
2760 iterator); | 2754 iterator); |
2761 assembler.Return(result); | 2755 assembler.Return(result); |
2762 } | 2756 } |
2763 } | 2757 } |
2764 | 2758 |
2765 } // namespace internal | 2759 } // namespace internal |
2766 } // namespace v8 | 2760 } // namespace v8 |
OLD | NEW |