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

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

Issue 2321543003: [stubs] CSA::LoadFixedDoubleArrayElement() is now able to do a hole check. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | src/code-stub-assembler.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 f956fd7da6da68049ccee4c9fdfca386cc944df2..fe83911d34b63daa0c14099fd10da5fd0b89d033 100644
--- a/src/builtins/builtins-array.cc
+++ b/src/builtins/builtins-array.cc
@@ -1648,27 +1648,11 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
- if (kPointerSize == kDoubleSize) {
- Node* element = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint64(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS);
- Node* the_hole = assembler->Int64Constant(kHoleNanInt64);
- assembler->GotoIf(assembler->Word64Equal(element, the_hole),
- &continue_loop);
- } else {
- Node* element_upper = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint32(),
- kIeeeDoubleExponentWordOffset,
- CodeStubAssembler::INTPTR_PARAMETERS);
- assembler->GotoIf(
- assembler->Word32Equal(element_upper,
- assembler->Int32Constant(kHoleNanUpper32)),
- &continue_loop);
- }
-
+ // Load double value or continue if it contains a double hole.
Node* element_k = assembler->LoadFixedDoubleArrayElement(
elements, index_var.value(), MachineType::Float64(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS);
+ CodeStubAssembler::INTPTR_PARAMETERS, &continue_loop);
+
assembler->BranchIfFloat64Equal(element_k, search_num.value(),
&return_true, &continue_loop);
assembler->Bind(&continue_loop);
@@ -1684,27 +1668,11 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
- if (kPointerSize == kDoubleSize) {
- Node* element = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint64(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS);
- Node* the_hole = assembler->Int64Constant(kHoleNanInt64);
- assembler->GotoIf(assembler->Word64Equal(element, the_hole),
- &continue_loop);
- } else {
- Node* element_upper = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint32(),
- kIeeeDoubleExponentWordOffset,
- CodeStubAssembler::INTPTR_PARAMETERS);
- assembler->GotoIf(
- assembler->Word32Equal(element_upper,
- assembler->Int32Constant(kHoleNanUpper32)),
- &continue_loop);
- }
-
+ // Load double value or continue if it contains a double hole.
Node* element_k = assembler->LoadFixedDoubleArrayElement(
elements, index_var.value(), MachineType::Float64(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS);
+ CodeStubAssembler::INTPTR_PARAMETERS, &continue_loop);
+
assembler->BranchIfFloat64IsNaN(element_k, &return_true, &continue_loop);
assembler->Bind(&continue_loop);
index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
@@ -1718,23 +1686,10 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
- if (kPointerSize == kDoubleSize) {
- Node* element = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint64(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS);
- Node* the_hole = assembler->Int64Constant(kHoleNanInt64);
- assembler->GotoIf(assembler->Word64Equal(element, the_hole),
- &return_true);
- } else {
- Node* element_upper = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint32(),
- kIeeeDoubleExponentWordOffset,
- CodeStubAssembler::INTPTR_PARAMETERS);
- assembler->GotoIf(
- assembler->Word32Equal(element_upper,
- assembler->Int32Constant(kHoleNanUpper32)),
- &return_true);
- }
+ // Check if the element is a double hole, but don't load it.
+ assembler->LoadFixedDoubleArrayElement(
+ elements, index_var.value(), MachineType::None(), 0,
+ CodeStubAssembler::INTPTR_PARAMETERS, &return_true);
index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&hole_loop);
@@ -2096,27 +2051,11 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_not_found);
- if (kPointerSize == kDoubleSize) {
- Node* element = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint64(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS);
- Node* the_hole = assembler->Int64Constant(kHoleNanInt64);
- assembler->GotoIf(assembler->Word64Equal(element, the_hole),
- &continue_loop);
- } else {
- Node* element_upper = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint32(),
- kIeeeDoubleExponentWordOffset,
- CodeStubAssembler::INTPTR_PARAMETERS);
- assembler->GotoIf(
- assembler->Word32Equal(element_upper,
- assembler->Int32Constant(kHoleNanUpper32)),
- &continue_loop);
- }
-
+ // Load double value or continue if it contains a double hole.
Node* element_k = assembler->LoadFixedDoubleArrayElement(
elements, index_var.value(), MachineType::Float64(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS);
+ CodeStubAssembler::INTPTR_PARAMETERS, &continue_loop);
+
assembler->BranchIfFloat64Equal(element_k, search_num.value(),
&return_found, &continue_loop);
assembler->Bind(&continue_loop);
« no previous file with comments | « no previous file | src/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698