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

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

Issue 2684313003: Remove SIMD.js from V8. (Closed)
Patch Set: Rebase. Created 3 years, 10 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 | « src/bootstrapper.cc ('k') | src/code-factory.h » ('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/code-stub-assembler.h" 9 #include "src/code-stub-assembler.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 Node* elements_kind = assembler.LoadMapElementsKind(map); 1801 Node* elements_kind = assembler.LoadMapElementsKind(map);
1802 Node* elements = assembler.LoadElements(array); 1802 Node* elements = assembler.LoadElements(array);
1803 assembler.Switch(elements_kind, &return_false, kElementsKind, 1803 assembler.Switch(elements_kind, &return_false, kElementsKind,
1804 element_kind_handlers, arraysize(kElementsKind)); 1804 element_kind_handlers, arraysize(kElementsKind));
1805 1805
1806 assembler.Bind(&if_smiorobjects); 1806 assembler.Bind(&if_smiorobjects);
1807 { 1807 {
1808 Variable search_num(&assembler, MachineRepresentation::kFloat64); 1808 Variable search_num(&assembler, MachineRepresentation::kFloat64);
1809 Label ident_loop(&assembler, &index_var), 1809 Label ident_loop(&assembler, &index_var),
1810 heap_num_loop(&assembler, &search_num), 1810 heap_num_loop(&assembler, &search_num),
1811 string_loop(&assembler, &index_var), simd_loop(&assembler), 1811 string_loop(&assembler, &index_var), undef_loop(&assembler, &index_var),
1812 undef_loop(&assembler, &index_var), not_smi(&assembler), 1812 not_smi(&assembler), not_heap_num(&assembler);
1813 not_heap_num(&assembler);
1814 1813
1815 assembler.GotoUnless(assembler.TaggedIsSmi(search_element), &not_smi); 1814 assembler.GotoUnless(assembler.TaggedIsSmi(search_element), &not_smi);
1816 search_num.Bind(assembler.SmiToFloat64(search_element)); 1815 search_num.Bind(assembler.SmiToFloat64(search_element));
1817 assembler.Goto(&heap_num_loop); 1816 assembler.Goto(&heap_num_loop);
1818 1817
1819 assembler.Bind(&not_smi); 1818 assembler.Bind(&not_smi);
1820 assembler.GotoIf(assembler.WordEqual(search_element, undefined), 1819 assembler.GotoIf(assembler.WordEqual(search_element, undefined),
1821 &undef_loop); 1820 &undef_loop);
1822 Node* map = assembler.LoadMap(search_element); 1821 Node* map = assembler.LoadMap(search_element);
1823 assembler.GotoUnless(assembler.IsHeapNumberMap(map), &not_heap_num); 1822 assembler.GotoUnless(assembler.IsHeapNumberMap(map), &not_heap_num);
1824 search_num.Bind(assembler.LoadHeapNumberValue(search_element)); 1823 search_num.Bind(assembler.LoadHeapNumberValue(search_element));
1825 assembler.Goto(&heap_num_loop); 1824 assembler.Goto(&heap_num_loop);
1826 1825
1827 assembler.Bind(&not_heap_num); 1826 assembler.Bind(&not_heap_num);
1828 Node* search_type = assembler.LoadMapInstanceType(map); 1827 Node* search_type = assembler.LoadMapInstanceType(map);
1829 assembler.GotoIf(assembler.IsStringInstanceType(search_type), &string_loop); 1828 assembler.GotoIf(assembler.IsStringInstanceType(search_type), &string_loop);
1830 assembler.GotoIf(
1831 assembler.Word32Equal(search_type,
1832 assembler.Int32Constant(SIMD128_VALUE_TYPE)),
1833 &simd_loop);
1834 assembler.Goto(&ident_loop); 1829 assembler.Goto(&ident_loop);
1835 1830
1836 assembler.Bind(&ident_loop); 1831 assembler.Bind(&ident_loop);
1837 { 1832 {
1838 assembler.GotoUnless( 1833 assembler.GotoUnless(
1839 assembler.UintPtrLessThan(index_var.value(), len_var.value()), 1834 assembler.UintPtrLessThan(index_var.value(), len_var.value()),
1840 &return_false); 1835 &return_false);
1841 Node* element_k = 1836 Node* element_k =
1842 assembler.LoadFixedArrayElement(elements, index_var.value()); 1837 assembler.LoadFixedArrayElement(elements, index_var.value());
1843 assembler.GotoIf(assembler.WordEqual(element_k, search_element), 1838 assembler.GotoIf(assembler.WordEqual(element_k, search_element),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 Node* result = 1930 Node* result =
1936 assembler.CallStub(callable, context, search_element, element_k); 1931 assembler.CallStub(callable, context, search_element, element_k);
1937 assembler.Branch( 1932 assembler.Branch(
1938 assembler.WordEqual(assembler.BooleanConstant(true), result), 1933 assembler.WordEqual(assembler.BooleanConstant(true), result),
1939 &return_true, &continue_loop); 1934 &return_true, &continue_loop);
1940 1935
1941 assembler.Bind(&continue_loop); 1936 assembler.Bind(&continue_loop);
1942 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); 1937 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
1943 assembler.Goto(&string_loop); 1938 assembler.Goto(&string_loop);
1944 } 1939 }
1945
1946 assembler.Bind(&simd_loop);
1947 {
1948 Label continue_loop(&assembler, &index_var),
1949 loop_body(&assembler, &index_var);
1950 Node* map = assembler.LoadMap(search_element);
1951
1952 assembler.Goto(&loop_body);
1953 assembler.Bind(&loop_body);
1954 assembler.GotoUnless(
1955 assembler.UintPtrLessThan(index_var.value(), len_var.value()),
1956 &return_false);
1957
1958 Node* element_k =
1959 assembler.LoadFixedArrayElement(elements, index_var.value());
1960 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop);
1961
1962 Node* map_k = assembler.LoadMap(element_k);
1963 assembler.BranchIfSimd128Equal(search_element, map, element_k, map_k,
1964 &return_true, &continue_loop);
1965
1966 assembler.Bind(&continue_loop);
1967 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
1968 assembler.Goto(&loop_body);
1969 }
1970 } 1940 }
1971 1941
1972 assembler.Bind(&if_packed_doubles); 1942 assembler.Bind(&if_packed_doubles);
1973 { 1943 {
1974 Label nan_loop(&assembler, &index_var), 1944 Label nan_loop(&assembler, &index_var),
1975 not_nan_loop(&assembler, &index_var), hole_loop(&assembler, &index_var), 1945 not_nan_loop(&assembler, &index_var), hole_loop(&assembler, &index_var),
1976 search_notnan(&assembler); 1946 search_notnan(&assembler);
1977 Variable search_num(&assembler, MachineRepresentation::kFloat64); 1947 Variable search_num(&assembler, MachineRepresentation::kFloat64);
1978 1948
1979 assembler.GotoUnless(assembler.TaggedIsSmi(search_element), &search_notnan); 1949 assembler.GotoUnless(assembler.TaggedIsSmi(search_element), &search_notnan);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 Node* elements_kind = assembler.LoadMapElementsKind(map); 2208 Node* elements_kind = assembler.LoadMapElementsKind(map);
2239 Node* elements = assembler.LoadElements(array); 2209 Node* elements = assembler.LoadElements(array);
2240 assembler.Switch(elements_kind, &return_not_found, kElementsKind, 2210 assembler.Switch(elements_kind, &return_not_found, kElementsKind,
2241 element_kind_handlers, arraysize(kElementsKind)); 2211 element_kind_handlers, arraysize(kElementsKind));
2242 2212
2243 assembler.Bind(&if_smiorobjects); 2213 assembler.Bind(&if_smiorobjects);
2244 { 2214 {
2245 Variable search_num(&assembler, MachineRepresentation::kFloat64); 2215 Variable search_num(&assembler, MachineRepresentation::kFloat64);
2246 Label ident_loop(&assembler, &index_var), 2216 Label ident_loop(&assembler, &index_var),
2247 heap_num_loop(&assembler, &search_num), 2217 heap_num_loop(&assembler, &search_num),
2248 string_loop(&assembler, &index_var), simd_loop(&assembler), 2218 string_loop(&assembler, &index_var), undef_loop(&assembler, &index_var),
2249 undef_loop(&assembler, &index_var), not_smi(&assembler), 2219 not_smi(&assembler), not_heap_num(&assembler);
2250 not_heap_num(&assembler);
2251 2220
2252 assembler.GotoUnless(assembler.TaggedIsSmi(search_element), &not_smi); 2221 assembler.GotoUnless(assembler.TaggedIsSmi(search_element), &not_smi);
2253 search_num.Bind(assembler.SmiToFloat64(search_element)); 2222 search_num.Bind(assembler.SmiToFloat64(search_element));
2254 assembler.Goto(&heap_num_loop); 2223 assembler.Goto(&heap_num_loop);
2255 2224
2256 assembler.Bind(&not_smi); 2225 assembler.Bind(&not_smi);
2257 assembler.GotoIf(assembler.WordEqual(search_element, undefined), 2226 assembler.GotoIf(assembler.WordEqual(search_element, undefined),
2258 &undef_loop); 2227 &undef_loop);
2259 Node* map = assembler.LoadMap(search_element); 2228 Node* map = assembler.LoadMap(search_element);
2260 assembler.GotoUnless(assembler.IsHeapNumberMap(map), &not_heap_num); 2229 assembler.GotoUnless(assembler.IsHeapNumberMap(map), &not_heap_num);
2261 search_num.Bind(assembler.LoadHeapNumberValue(search_element)); 2230 search_num.Bind(assembler.LoadHeapNumberValue(search_element));
2262 assembler.Goto(&heap_num_loop); 2231 assembler.Goto(&heap_num_loop);
2263 2232
2264 assembler.Bind(&not_heap_num); 2233 assembler.Bind(&not_heap_num);
2265 Node* search_type = assembler.LoadMapInstanceType(map); 2234 Node* search_type = assembler.LoadMapInstanceType(map);
2266 assembler.GotoIf(assembler.IsStringInstanceType(search_type), &string_loop); 2235 assembler.GotoIf(assembler.IsStringInstanceType(search_type), &string_loop);
2267 assembler.GotoIf(
2268 assembler.Word32Equal(search_type,
2269 assembler.Int32Constant(SIMD128_VALUE_TYPE)),
2270 &simd_loop);
2271 assembler.Goto(&ident_loop); 2236 assembler.Goto(&ident_loop);
2272 2237
2273 assembler.Bind(&ident_loop); 2238 assembler.Bind(&ident_loop);
2274 { 2239 {
2275 assembler.GotoUnless( 2240 assembler.GotoUnless(
2276 assembler.UintPtrLessThan(index_var.value(), len_var.value()), 2241 assembler.UintPtrLessThan(index_var.value(), len_var.value()),
2277 &return_not_found); 2242 &return_not_found);
2278 Node* element_k = 2243 Node* element_k =
2279 assembler.LoadFixedArrayElement(elements, index_var.value()); 2244 assembler.LoadFixedArrayElement(elements, index_var.value());
2280 assembler.GotoIf(assembler.WordEqual(element_k, search_element), 2245 assembler.GotoIf(assembler.WordEqual(element_k, search_element),
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 Node* result = 2316 Node* result =
2352 assembler.CallStub(callable, context, search_element, element_k); 2317 assembler.CallStub(callable, context, search_element, element_k);
2353 assembler.Branch( 2318 assembler.Branch(
2354 assembler.WordEqual(assembler.BooleanConstant(true), result), 2319 assembler.WordEqual(assembler.BooleanConstant(true), result),
2355 &return_found, &continue_loop); 2320 &return_found, &continue_loop);
2356 2321
2357 assembler.Bind(&continue_loop); 2322 assembler.Bind(&continue_loop);
2358 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one)); 2323 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
2359 assembler.Goto(&string_loop); 2324 assembler.Goto(&string_loop);
2360 } 2325 }
2361
2362 assembler.Bind(&simd_loop);
2363 {
2364 Label continue_loop(&assembler, &index_var),
2365 loop_body(&assembler, &index_var);
2366 Node* map = assembler.LoadMap(search_element);
2367
2368 assembler.Goto(&loop_body);
2369 assembler.Bind(&loop_body);
2370 assembler.GotoUnless(
2371 assembler.UintPtrLessThan(index_var.value(), len_var.value()),
2372 &return_not_found);
2373
2374 Node* element_k =
2375 assembler.LoadFixedArrayElement(elements, index_var.value());
2376 assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop);
2377
2378 Node* map_k = assembler.LoadMap(element_k);
2379 assembler.BranchIfSimd128Equal(search_element, map, element_k, map_k,
2380 &return_found, &continue_loop);
2381
2382 assembler.Bind(&continue_loop);
2383 index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
2384 assembler.Goto(&loop_body);
2385 }
2386 } 2326 }
2387 2327
2388 assembler.Bind(&if_packed_doubles); 2328 assembler.Bind(&if_packed_doubles);
2389 { 2329 {
2390 Label not_nan_loop(&assembler, &index_var), search_notnan(&assembler); 2330 Label not_nan_loop(&assembler, &index_var), search_notnan(&assembler);
2391 Variable search_num(&assembler, MachineRepresentation::kFloat64); 2331 Variable search_num(&assembler, MachineRepresentation::kFloat64);
2392 2332
2393 assembler.GotoUnless(assembler.TaggedIsSmi(search_element), &search_notnan); 2333 assembler.GotoUnless(assembler.TaggedIsSmi(search_element), &search_notnan);
2394 search_num.Bind(assembler.SmiToFloat64(search_element)); 2334 search_num.Bind(assembler.SmiToFloat64(search_element));
2395 assembler.Goto(&not_nan_loop); 2335 assembler.Goto(&not_nan_loop);
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
3008 Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation); 2948 Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation);
3009 Node* result = 2949 Node* result =
3010 assembler.CallRuntime(Runtime::kThrowTypeError, context, message, 2950 assembler.CallRuntime(Runtime::kThrowTypeError, context, message,
3011 assembler.HeapConstant(operation)); 2951 assembler.HeapConstant(operation));
3012 assembler.Return(result); 2952 assembler.Return(result);
3013 } 2953 }
3014 } 2954 }
3015 2955
3016 } // namespace internal 2956 } // namespace internal
3017 } // namespace v8 2957 } // namespace v8
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/code-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698