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/elements.h" | 9 #include "src/elements.h" |
10 | 10 |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ¬_heap_num); | 1407 ¬_heap_num); |
1408 search_num.Bind(assembler->LoadHeapNumberValue(search_element)); | 1408 search_num.Bind(assembler->LoadHeapNumberValue(search_element)); |
1409 assembler->Goto(&heap_num_loop); | 1409 assembler->Goto(&heap_num_loop); |
1410 | 1410 |
1411 assembler->Bind(¬_heap_num); | 1411 assembler->Bind(¬_heap_num); |
1412 Node* search_type = assembler->LoadMapInstanceType(map); | 1412 Node* search_type = assembler->LoadMapInstanceType(map); |
1413 assembler->GotoIf( | 1413 assembler->GotoIf(assembler->IsStringInstanceType(search_type), |
1414 assembler->Int32LessThan( | 1414 &string_loop); |
1415 search_type, assembler->Int32Constant(FIRST_NONSTRING_TYPE)), | |
1416 &string_loop); | |
1417 assembler->GotoIf( | 1415 assembler->GotoIf( |
1418 assembler->Word32Equal(search_type, | 1416 assembler->Word32Equal(search_type, |
1419 assembler->Int32Constant(SIMD128_VALUE_TYPE)), | 1417 assembler->Int32Constant(SIMD128_VALUE_TYPE)), |
1420 &simd_loop); | 1418 &simd_loop); |
1421 assembler->Goto(&ident_loop); | 1419 assembler->Goto(&ident_loop); |
1422 | 1420 |
1423 assembler->Bind(&ident_loop); | 1421 assembler->Bind(&ident_loop); |
1424 { | 1422 { |
1425 assembler->GotoUnless( | 1423 assembler->GotoUnless( |
1426 assembler->UintPtrLessThan(index_var.value(), len_var.value()), | 1424 assembler->UintPtrLessThan(index_var.value(), len_var.value()), |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 | 1508 |
1511 assembler->Bind(&string_loop); | 1509 assembler->Bind(&string_loop); |
1512 { | 1510 { |
1513 Label continue_loop(assembler); | 1511 Label continue_loop(assembler); |
1514 assembler->GotoUnless( | 1512 assembler->GotoUnless( |
1515 assembler->UintPtrLessThan(index_var.value(), len_var.value()), | 1513 assembler->UintPtrLessThan(index_var.value(), len_var.value()), |
1516 &return_false); | 1514 &return_false); |
1517 Node* element_k = assembler->LoadFixedArrayElement( | 1515 Node* element_k = assembler->LoadFixedArrayElement( |
1518 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); | 1516 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); |
1519 assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop); | 1517 assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop); |
1520 assembler->GotoUnless(assembler->Int32LessThan( | 1518 assembler->GotoUnless(assembler->IsStringInstanceType( |
1521 assembler->LoadInstanceType(element_k), | 1519 assembler->LoadInstanceType(element_k)), |
1522 assembler->Int32Constant(FIRST_NONSTRING_TYPE)), | |
1523 &continue_loop); | 1520 &continue_loop); |
1524 | 1521 |
1525 // TODO(bmeurer): Consider inlining the StringEqual logic here. | 1522 // TODO(bmeurer): Consider inlining the StringEqual logic here. |
1526 Callable callable = CodeFactory::StringEqual(assembler->isolate()); | 1523 Callable callable = CodeFactory::StringEqual(assembler->isolate()); |
1527 Node* result = | 1524 Node* result = |
1528 assembler->CallStub(callable, context, search_element, element_k); | 1525 assembler->CallStub(callable, context, search_element, element_k); |
1529 assembler->Branch( | 1526 assembler->Branch( |
1530 assembler->WordEqual(assembler->BooleanConstant(true), result), | 1527 assembler->WordEqual(assembler->BooleanConstant(true), result), |
1531 &return_true, &continue_loop); | 1528 &return_true, &continue_loop); |
1532 | 1529 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 assembler->GotoIf(assembler->WordEqual(search_element, undefined), | 1845 assembler->GotoIf(assembler->WordEqual(search_element, undefined), |
1849 &undef_loop); | 1846 &undef_loop); |
1850 Node* map = assembler->LoadMap(search_element); | 1847 Node* map = assembler->LoadMap(search_element); |
1851 assembler->GotoIf(assembler->WordNotEqual(map, heap_number_map), | 1848 assembler->GotoIf(assembler->WordNotEqual(map, heap_number_map), |
1852 ¬_heap_num); | 1849 ¬_heap_num); |
1853 search_num.Bind(assembler->LoadHeapNumberValue(search_element)); | 1850 search_num.Bind(assembler->LoadHeapNumberValue(search_element)); |
1854 assembler->Goto(&heap_num_loop); | 1851 assembler->Goto(&heap_num_loop); |
1855 | 1852 |
1856 assembler->Bind(¬_heap_num); | 1853 assembler->Bind(¬_heap_num); |
1857 Node* search_type = assembler->LoadMapInstanceType(map); | 1854 Node* search_type = assembler->LoadMapInstanceType(map); |
1858 assembler->GotoIf( | 1855 assembler->GotoIf(assembler->IsStringInstanceType(search_type), |
1859 assembler->Int32LessThan( | 1856 &string_loop); |
1860 search_type, assembler->Int32Constant(FIRST_NONSTRING_TYPE)), | |
1861 &string_loop); | |
1862 assembler->GotoIf( | 1857 assembler->GotoIf( |
1863 assembler->Word32Equal(search_type, | 1858 assembler->Word32Equal(search_type, |
1864 assembler->Int32Constant(SIMD128_VALUE_TYPE)), | 1859 assembler->Int32Constant(SIMD128_VALUE_TYPE)), |
1865 &simd_loop); | 1860 &simd_loop); |
1866 assembler->Goto(&ident_loop); | 1861 assembler->Goto(&ident_loop); |
1867 | 1862 |
1868 assembler->Bind(&ident_loop); | 1863 assembler->Bind(&ident_loop); |
1869 { | 1864 { |
1870 assembler->GotoUnless( | 1865 assembler->GotoUnless( |
1871 assembler->UintPtrLessThan(index_var.value(), len_var.value()), | 1866 assembler->UintPtrLessThan(index_var.value(), len_var.value()), |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 | 1925 |
1931 assembler->Bind(&string_loop); | 1926 assembler->Bind(&string_loop); |
1932 { | 1927 { |
1933 Label continue_loop(assembler); | 1928 Label continue_loop(assembler); |
1934 assembler->GotoUnless( | 1929 assembler->GotoUnless( |
1935 assembler->UintPtrLessThan(index_var.value(), len_var.value()), | 1930 assembler->UintPtrLessThan(index_var.value(), len_var.value()), |
1936 &return_not_found); | 1931 &return_not_found); |
1937 Node* element_k = assembler->LoadFixedArrayElement( | 1932 Node* element_k = assembler->LoadFixedArrayElement( |
1938 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); | 1933 elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS); |
1939 assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop); | 1934 assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop); |
1940 assembler->GotoUnless(assembler->Int32LessThan( | 1935 assembler->GotoUnless(assembler->IsStringInstanceType( |
1941 assembler->LoadInstanceType(element_k), | 1936 assembler->LoadInstanceType(element_k)), |
1942 assembler->Int32Constant(FIRST_NONSTRING_TYPE)), | |
1943 &continue_loop); | 1937 &continue_loop); |
1944 | 1938 |
1945 // TODO(bmeurer): Consider inlining the StringEqual logic here. | 1939 // TODO(bmeurer): Consider inlining the StringEqual logic here. |
1946 Callable callable = CodeFactory::StringEqual(assembler->isolate()); | 1940 Callable callable = CodeFactory::StringEqual(assembler->isolate()); |
1947 Node* result = | 1941 Node* result = |
1948 assembler->CallStub(callable, context, search_element, element_k); | 1942 assembler->CallStub(callable, context, search_element, element_k); |
1949 assembler->Branch( | 1943 assembler->Branch( |
1950 assembler->WordEqual(assembler->BooleanConstant(true), result), | 1944 assembler->WordEqual(assembler->BooleanConstant(true), result), |
1951 &return_found, &continue_loop); | 1945 &return_found, &continue_loop); |
1952 | 1946 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2064 assembler->Bind(&return_not_found); | 2058 assembler->Bind(&return_not_found); |
2065 assembler->Return(assembler->NumberConstant(-1)); | 2059 assembler->Return(assembler->NumberConstant(-1)); |
2066 | 2060 |
2067 assembler->Bind(&call_runtime); | 2061 assembler->Bind(&call_runtime); |
2068 assembler->Return(assembler->CallRuntime(Runtime::kArrayIndexOf, context, | 2062 assembler->Return(assembler->CallRuntime(Runtime::kArrayIndexOf, context, |
2069 array, search_element, start_from)); | 2063 array, search_element, start_from)); |
2070 } | 2064 } |
2071 | 2065 |
2072 } // namespace internal | 2066 } // namespace internal |
2073 } // namespace v8 | 2067 } // namespace v8 |
OLD | NEW |