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

Unified Diff: src/builtins/builtins-array.cc

Issue 2695653005: Revert of Remove SIMD.js from V8. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/bootstrapper.cc ('k') | src/code-factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-array.cc
diff --git a/src/builtins/builtins-array.cc b/src/builtins/builtins-array.cc
index 5111f966b170addf9f1b0c11399cdddc4755a615..a82a1a98a646675ba0cc242633607cbee81d063f 100644
--- a/src/builtins/builtins-array.cc
+++ b/src/builtins/builtins-array.cc
@@ -1808,8 +1808,9 @@
Variable search_num(&assembler, MachineRepresentation::kFloat64);
Label ident_loop(&assembler, &index_var),
heap_num_loop(&assembler, &search_num),
- string_loop(&assembler, &index_var), undef_loop(&assembler, &index_var),
- not_smi(&assembler), not_heap_num(&assembler);
+ string_loop(&assembler, &index_var), simd_loop(&assembler),
+ undef_loop(&assembler, &index_var), not_smi(&assembler),
+ not_heap_num(&assembler);
assembler.GotoUnless(assembler.TaggedIsSmi(search_element), &not_smi);
search_num.Bind(assembler.SmiToFloat64(search_element));
@@ -1826,6 +1827,10 @@
assembler.Bind(&not_heap_num);
Node* search_type = assembler.LoadMapInstanceType(map);
assembler.GotoIf(assembler.IsStringInstanceType(search_type), &string_loop);
+ assembler.GotoIf(
+ assembler.Word32Equal(search_type,
+ assembler.Int32Constant(SIMD128_VALUE_TYPE)),
+ &simd_loop);
assembler.Goto(&ident_loop);
assembler.Bind(&ident_loop);
@@ -1937,6 +1942,31 @@
index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
assembler.Goto(&string_loop);
}
+
+ assembler.Bind(&simd_loop);
+ {
+ Label continue_loop(&assembler, &index_var),
+ loop_body(&assembler, &index_var);
+ Node* map = assembler.LoadMap(search_element);
+
+ assembler.Goto(&loop_body);
+ assembler.Bind(&loop_body);
+ assembler.GotoUnless(
+ assembler.UintPtrLessThan(index_var.value(), len_var.value()),
+ &return_false);
+
+ Node* element_k =
+ assembler.LoadFixedArrayElement(elements, index_var.value());
+ assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop);
+
+ Node* map_k = assembler.LoadMap(element_k);
+ assembler.BranchIfSimd128Equal(search_element, map, element_k, map_k,
+ &return_true, &continue_loop);
+
+ assembler.Bind(&continue_loop);
+ index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
+ assembler.Goto(&loop_body);
+ }
}
assembler.Bind(&if_packed_doubles);
@@ -2215,8 +2245,9 @@
Variable search_num(&assembler, MachineRepresentation::kFloat64);
Label ident_loop(&assembler, &index_var),
heap_num_loop(&assembler, &search_num),
- string_loop(&assembler, &index_var), undef_loop(&assembler, &index_var),
- not_smi(&assembler), not_heap_num(&assembler);
+ string_loop(&assembler, &index_var), simd_loop(&assembler),
+ undef_loop(&assembler, &index_var), not_smi(&assembler),
+ not_heap_num(&assembler);
assembler.GotoUnless(assembler.TaggedIsSmi(search_element), &not_smi);
search_num.Bind(assembler.SmiToFloat64(search_element));
@@ -2233,6 +2264,10 @@
assembler.Bind(&not_heap_num);
Node* search_type = assembler.LoadMapInstanceType(map);
assembler.GotoIf(assembler.IsStringInstanceType(search_type), &string_loop);
+ assembler.GotoIf(
+ assembler.Word32Equal(search_type,
+ assembler.Int32Constant(SIMD128_VALUE_TYPE)),
+ &simd_loop);
assembler.Goto(&ident_loop);
assembler.Bind(&ident_loop);
@@ -2322,6 +2357,31 @@
assembler.Bind(&continue_loop);
index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
assembler.Goto(&string_loop);
+ }
+
+ assembler.Bind(&simd_loop);
+ {
+ Label continue_loop(&assembler, &index_var),
+ loop_body(&assembler, &index_var);
+ Node* map = assembler.LoadMap(search_element);
+
+ assembler.Goto(&loop_body);
+ assembler.Bind(&loop_body);
+ assembler.GotoUnless(
+ assembler.UintPtrLessThan(index_var.value(), len_var.value()),
+ &return_not_found);
+
+ Node* element_k =
+ assembler.LoadFixedArrayElement(elements, index_var.value());
+ assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop);
+
+ Node* map_k = assembler.LoadMap(element_k);
+ assembler.BranchIfSimd128Equal(search_element, map, element_k, map_k,
+ &return_found, &continue_loop);
+
+ assembler.Bind(&continue_loop);
+ index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
+ assembler.Goto(&loop_body);
}
}
« 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