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/contexts.h" | 9 #include "src/contexts.h" |
10 #include "src/elements.h" | 10 #include "src/elements.h" |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 assembler->GotoUnless(assembler->TaggedIsSmi(element_k), ¬_smi); | 1468 assembler->GotoUnless(assembler->TaggedIsSmi(element_k), ¬_smi); |
1469 assembler->Branch( | 1469 assembler->Branch( |
1470 assembler->Float64Equal(search_num.value(), | 1470 assembler->Float64Equal(search_num.value(), |
1471 assembler->SmiToFloat64(element_k)), | 1471 assembler->SmiToFloat64(element_k)), |
1472 &return_true, &continue_loop); | 1472 &return_true, &continue_loop); |
1473 | 1473 |
1474 assembler->Bind(¬_smi); | 1474 assembler->Bind(¬_smi); |
1475 assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k), | 1475 assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k), |
1476 heap_number_map), | 1476 heap_number_map), |
1477 &continue_loop); | 1477 &continue_loop); |
1478 assembler->BranchIfFloat64Equal( | 1478 assembler->Branch( |
1479 search_num.value(), assembler->LoadHeapNumberValue(element_k), | 1479 assembler->Float64Equal(search_num.value(), |
| 1480 assembler->LoadHeapNumberValue(element_k)), |
1480 &return_true, &continue_loop); | 1481 &return_true, &continue_loop); |
1481 | 1482 |
1482 assembler->Bind(&continue_loop); | 1483 assembler->Bind(&continue_loop); |
1483 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); | 1484 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); |
1484 assembler->Goto(¬_nan_loop); | 1485 assembler->Goto(¬_nan_loop); |
1485 } | 1486 } |
1486 | 1487 |
1487 assembler->Bind(&nan_loop); | 1488 assembler->Bind(&nan_loop); |
1488 { | 1489 { |
1489 Label continue_loop(assembler); | 1490 Label continue_loop(assembler); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 // Search for HeapNumber | 1584 // Search for HeapNumber |
1584 assembler->Bind(¬_nan_loop); | 1585 assembler->Bind(¬_nan_loop); |
1585 { | 1586 { |
1586 Label continue_loop(assembler); | 1587 Label continue_loop(assembler); |
1587 assembler->GotoUnless( | 1588 assembler->GotoUnless( |
1588 assembler->UintPtrLessThan(index_var.value(), len_var.value()), | 1589 assembler->UintPtrLessThan(index_var.value(), len_var.value()), |
1589 &return_false); | 1590 &return_false); |
1590 Node* element_k = assembler->LoadFixedDoubleArrayElement( | 1591 Node* element_k = assembler->LoadFixedDoubleArrayElement( |
1591 elements, index_var.value(), MachineType::Float64(), 0, | 1592 elements, index_var.value(), MachineType::Float64(), 0, |
1592 CodeStubAssembler::INTPTR_PARAMETERS); | 1593 CodeStubAssembler::INTPTR_PARAMETERS); |
1593 assembler->BranchIfFloat64Equal(element_k, search_num.value(), | 1594 assembler->Branch(assembler->Float64Equal(element_k, search_num.value()), |
1594 &return_true, &continue_loop); | 1595 &return_true, &continue_loop); |
1595 assembler->Bind(&continue_loop); | 1596 assembler->Bind(&continue_loop); |
1596 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); | 1597 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); |
1597 assembler->Goto(¬_nan_loop); | 1598 assembler->Goto(¬_nan_loop); |
1598 } | 1599 } |
1599 | 1600 |
1600 // Search for NaN | 1601 // Search for NaN |
1601 assembler->Bind(&nan_loop); | 1602 assembler->Bind(&nan_loop); |
1602 { | 1603 { |
1603 Label continue_loop(assembler); | 1604 Label continue_loop(assembler); |
1604 assembler->GotoUnless( | 1605 assembler->GotoUnless( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 Label continue_loop(assembler); | 1644 Label continue_loop(assembler); |
1644 assembler->GotoUnless( | 1645 assembler->GotoUnless( |
1645 assembler->UintPtrLessThan(index_var.value(), len_var.value()), | 1646 assembler->UintPtrLessThan(index_var.value(), len_var.value()), |
1646 &return_false); | 1647 &return_false); |
1647 | 1648 |
1648 // Load double value or continue if it contains a double hole. | 1649 // Load double value or continue if it contains a double hole. |
1649 Node* element_k = assembler->LoadFixedDoubleArrayElement( | 1650 Node* element_k = assembler->LoadFixedDoubleArrayElement( |
1650 elements, index_var.value(), MachineType::Float64(), 0, | 1651 elements, index_var.value(), MachineType::Float64(), 0, |
1651 CodeStubAssembler::INTPTR_PARAMETERS, &continue_loop); | 1652 CodeStubAssembler::INTPTR_PARAMETERS, &continue_loop); |
1652 | 1653 |
1653 assembler->BranchIfFloat64Equal(element_k, search_num.value(), | 1654 assembler->Branch(assembler->Float64Equal(element_k, search_num.value()), |
1654 &return_true, &continue_loop); | 1655 &return_true, &continue_loop); |
1655 assembler->Bind(&continue_loop); | 1656 assembler->Bind(&continue_loop); |
1656 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); | 1657 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); |
1657 assembler->Goto(¬_nan_loop); | 1658 assembler->Goto(¬_nan_loop); |
1658 } | 1659 } |
1659 | 1660 |
1660 // Search for NaN | 1661 // Search for NaN |
1661 assembler->Bind(&nan_loop); | 1662 assembler->Bind(&nan_loop); |
1662 { | 1663 { |
1663 Label continue_loop(assembler); | 1664 Label continue_loop(assembler); |
1664 assembler->GotoUnless( | 1665 assembler->GotoUnless( |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1909 assembler->GotoUnless(assembler->TaggedIsSmi(element_k), ¬_smi); | 1910 assembler->GotoUnless(assembler->TaggedIsSmi(element_k), ¬_smi); |
1910 assembler->Branch( | 1911 assembler->Branch( |
1911 assembler->Float64Equal(search_num.value(), | 1912 assembler->Float64Equal(search_num.value(), |
1912 assembler->SmiToFloat64(element_k)), | 1913 assembler->SmiToFloat64(element_k)), |
1913 &return_found, &continue_loop); | 1914 &return_found, &continue_loop); |
1914 | 1915 |
1915 assembler->Bind(¬_smi); | 1916 assembler->Bind(¬_smi); |
1916 assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k), | 1917 assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k), |
1917 heap_number_map), | 1918 heap_number_map), |
1918 &continue_loop); | 1919 &continue_loop); |
1919 assembler->BranchIfFloat64Equal( | 1920 assembler->Branch( |
1920 search_num.value(), assembler->LoadHeapNumberValue(element_k), | 1921 assembler->Float64Equal(search_num.value(), |
| 1922 assembler->LoadHeapNumberValue(element_k)), |
1921 &return_found, &continue_loop); | 1923 &return_found, &continue_loop); |
1922 | 1924 |
1923 assembler->Bind(&continue_loop); | 1925 assembler->Bind(&continue_loop); |
1924 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); | 1926 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); |
1925 assembler->Goto(¬_nan_loop); | 1927 assembler->Goto(¬_nan_loop); |
1926 } | 1928 } |
1927 } | 1929 } |
1928 | 1930 |
1929 assembler->Bind(&string_loop); | 1931 assembler->Bind(&string_loop); |
1930 { | 1932 { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2001 // Search for HeapNumber | 2003 // Search for HeapNumber |
2002 assembler->Bind(¬_nan_loop); | 2004 assembler->Bind(¬_nan_loop); |
2003 { | 2005 { |
2004 Label continue_loop(assembler); | 2006 Label continue_loop(assembler); |
2005 assembler->GotoUnless( | 2007 assembler->GotoUnless( |
2006 assembler->UintPtrLessThan(index_var.value(), len_var.value()), | 2008 assembler->UintPtrLessThan(index_var.value(), len_var.value()), |
2007 &return_not_found); | 2009 &return_not_found); |
2008 Node* element_k = assembler->LoadFixedDoubleArrayElement( | 2010 Node* element_k = assembler->LoadFixedDoubleArrayElement( |
2009 elements, index_var.value(), MachineType::Float64(), 0, | 2011 elements, index_var.value(), MachineType::Float64(), 0, |
2010 CodeStubAssembler::INTPTR_PARAMETERS); | 2012 CodeStubAssembler::INTPTR_PARAMETERS); |
2011 assembler->BranchIfFloat64Equal(element_k, search_num.value(), | 2013 assembler->Branch(assembler->Float64Equal(element_k, search_num.value()), |
2012 &return_found, &continue_loop); | 2014 &return_found, &continue_loop); |
2013 assembler->Bind(&continue_loop); | 2015 assembler->Bind(&continue_loop); |
2014 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); | 2016 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); |
2015 assembler->Goto(¬_nan_loop); | 2017 assembler->Goto(¬_nan_loop); |
2016 } | 2018 } |
2017 } | 2019 } |
2018 | 2020 |
2019 assembler->Bind(&if_holey_doubles); | 2021 assembler->Bind(&if_holey_doubles); |
2020 { | 2022 { |
2021 Label not_nan_loop(assembler, &index_var), search_notnan(assembler); | 2023 Label not_nan_loop(assembler, &index_var), search_notnan(assembler); |
2022 Variable search_num(assembler, MachineRepresentation::kFloat64); | 2024 Variable search_num(assembler, MachineRepresentation::kFloat64); |
(...skipping 19 matching lines...) Expand all Loading... |
2042 Label continue_loop(assembler); | 2044 Label continue_loop(assembler); |
2043 assembler->GotoUnless( | 2045 assembler->GotoUnless( |
2044 assembler->UintPtrLessThan(index_var.value(), len_var.value()), | 2046 assembler->UintPtrLessThan(index_var.value(), len_var.value()), |
2045 &return_not_found); | 2047 &return_not_found); |
2046 | 2048 |
2047 // Load double value or continue if it contains a double hole. | 2049 // Load double value or continue if it contains a double hole. |
2048 Node* element_k = assembler->LoadFixedDoubleArrayElement( | 2050 Node* element_k = assembler->LoadFixedDoubleArrayElement( |
2049 elements, index_var.value(), MachineType::Float64(), 0, | 2051 elements, index_var.value(), MachineType::Float64(), 0, |
2050 CodeStubAssembler::INTPTR_PARAMETERS, &continue_loop); | 2052 CodeStubAssembler::INTPTR_PARAMETERS, &continue_loop); |
2051 | 2053 |
2052 assembler->BranchIfFloat64Equal(element_k, search_num.value(), | 2054 assembler->Branch(assembler->Float64Equal(element_k, search_num.value()), |
2053 &return_found, &continue_loop); | 2055 &return_found, &continue_loop); |
2054 assembler->Bind(&continue_loop); | 2056 assembler->Bind(&continue_loop); |
2055 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); | 2057 index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one)); |
2056 assembler->Goto(¬_nan_loop); | 2058 assembler->Goto(¬_nan_loop); |
2057 } | 2059 } |
2058 } | 2060 } |
2059 | 2061 |
2060 assembler->Bind(&return_found); | 2062 assembler->Bind(&return_found); |
2061 assembler->Return(assembler->ChangeInt32ToTagged(index_var.value())); | 2063 assembler->Return(assembler->ChangeInt32ToTagged(index_var.value())); |
2062 | 2064 |
2063 assembler->Bind(&return_not_found); | 2065 assembler->Bind(&return_not_found); |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2581 Runtime::kThrowIncompatibleMethodReceiver, context, | 2583 Runtime::kThrowIncompatibleMethodReceiver, context, |
2582 assembler->HeapConstant(assembler->factory()->NewStringFromAsciiChecked( | 2584 assembler->HeapConstant(assembler->factory()->NewStringFromAsciiChecked( |
2583 "Array Iterator.prototype.next", TENURED)), | 2585 "Array Iterator.prototype.next", TENURED)), |
2584 iterator); | 2586 iterator); |
2585 assembler->Return(result); | 2587 assembler->Return(result); |
2586 } | 2588 } |
2587 } | 2589 } |
2588 | 2590 |
2589 } // namespace internal | 2591 } // namespace internal |
2590 } // namespace v8 | 2592 } // namespace v8 |
OLD | NEW |