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

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

Issue 2319243002: [stubs] Fixing loads/stores from arrays by int32 offsets/indices. Step 3. (Closed)
Patch Set: Fixing redness 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 09ee4cc2e2d741cd1fc22f0187552fa189cb7cd6..f956fd7da6da68049ccee4c9fdfca386cc944df2 100644
--- a/src/builtins/builtins-array.cc
+++ b/src/builtins/builtins-array.cc
@@ -1269,24 +1269,24 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
Node* start_from = assembler->Parameter(2);
Node* context = assembler->Parameter(3 + 2);
- Node* int32_zero = assembler->Int32Constant(0);
- Node* int32_one = assembler->Int32Constant(1);
+ Node* intptr_zero = assembler->IntPtrConstant(0);
+ Node* intptr_one = assembler->IntPtrConstant(1);
Node* the_hole = assembler->TheHoleConstant();
Node* undefined = assembler->UndefinedConstant();
Node* heap_number_map = assembler->HeapNumberMapConstant();
- Variable len_var(assembler, MachineRepresentation::kWord32),
- index_var(assembler, MachineRepresentation::kWord32),
- start_from_var(assembler, MachineRepresentation::kWord32);
+ Variable len_var(assembler, MachineType::PointerRepresentation()),
+ index_var(assembler, MachineType::PointerRepresentation()),
+ start_from_var(assembler, MachineType::PointerRepresentation());
Label init_k(assembler), return_true(assembler), return_false(assembler),
call_runtime(assembler);
Label init_len(assembler);
- index_var.Bind(int32_zero);
- len_var.Bind(int32_zero);
+ index_var.Bind(intptr_zero);
+ len_var.Bind(intptr_zero);
// Take slow path if not a JSArray, if retrieving elements requires
// traversing prototype, or if access checks are required.
@@ -1299,7 +1299,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
assembler->GotoUnless(assembler->WordIsSmi(len), &call_runtime);
len_var.Bind(assembler->SmiToWord(len));
- assembler->Branch(assembler->Word32Equal(len_var.value(), int32_zero),
+ assembler->Branch(assembler->WordEqual(len_var.value(), intptr_zero),
&return_false, &init_k);
}
@@ -1315,23 +1315,25 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
assembler->Bind(&init_k_smi);
{
- start_from_var.Bind(assembler->SmiToWord32(tagged_n));
+ start_from_var.Bind(assembler->SmiUntag(tagged_n));
assembler->Goto(&init_k_n);
}
assembler->Bind(&init_k_heap_num);
{
Label do_return_false(assembler);
- Node* fp_len = assembler->ChangeInt32ToFloat64(len_var.value());
+ // This round is lossless for all valid lengths.
+ Node* fp_len = assembler->RoundIntPtrToFloat64(len_var.value());
Node* fp_n = assembler->LoadHeapNumberValue(tagged_n);
assembler->GotoIf(assembler->Float64GreaterThanOrEqual(fp_n, fp_len),
&do_return_false);
- start_from_var.Bind(assembler->TruncateFloat64ToWord32(fp_n));
+ start_from_var.Bind(assembler->ChangeInt32ToIntPtr(
+ assembler->TruncateFloat64ToWord32(fp_n)));
assembler->Goto(&init_k_n);
assembler->Bind(&do_return_false);
{
- index_var.Bind(int32_zero);
+ index_var.Bind(intptr_zero);
assembler->Goto(&return_false);
}
}
@@ -1340,7 +1342,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
{
Label if_positive(assembler), if_negative(assembler), done(assembler);
assembler->Branch(
- assembler->Int32LessThan(start_from_var.value(), int32_zero),
+ assembler->IntPtrLessThan(start_from_var.value(), intptr_zero),
&if_negative, &if_positive);
assembler->Bind(&if_positive);
@@ -1352,15 +1354,15 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
assembler->Bind(&if_negative);
{
index_var.Bind(
- assembler->Int32Add(len_var.value(), start_from_var.value()));
+ assembler->IntPtrAdd(len_var.value(), start_from_var.value()));
assembler->Branch(
- assembler->Int32LessThan(index_var.value(), int32_zero),
+ assembler->IntPtrLessThan(index_var.value(), intptr_zero),
&init_k_zero, &done);
}
assembler->Bind(&init_k_zero);
{
- index_var.Bind(int32_zero);
+ index_var.Bind(intptr_zero);
assembler->Goto(&done);
}
@@ -1416,38 +1418,38 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
search_type, assembler->Int32Constant(FIRST_NONSTRING_TYPE)),
&string_loop);
assembler->GotoIf(
- assembler->WordEqual(search_type,
- assembler->Int32Constant(SIMD128_VALUE_TYPE)),
+ assembler->Word32Equal(search_type,
+ assembler->Int32Constant(SIMD128_VALUE_TYPE)),
&simd_loop);
assembler->Goto(&ident_loop);
assembler->Bind(&ident_loop);
{
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordEqual(element_k, search_element),
&return_true);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&ident_loop);
}
assembler->Bind(&undef_loop);
{
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordEqual(element_k, undefined),
&return_true);
assembler->GotoIf(assembler->WordEqual(element_k, the_hole),
&return_true);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&undef_loop);
}
@@ -1462,10 +1464,11 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler), not_smi(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoUnless(assembler->WordIsSmi(element_k), &not_smi);
assembler->Branch(
assembler->Float64Equal(search_num.value(),
@@ -1481,7 +1484,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
&return_true, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&not_nan_loop);
}
@@ -1489,10 +1492,11 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop);
assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k),
heap_number_map),
@@ -1502,7 +1506,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
&continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&nan_loop);
}
}
@@ -1511,10 +1515,10 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop);
assembler->GotoUnless(assembler->Int32LessThan(
assembler->LoadInstanceType(element_k),
@@ -1530,7 +1534,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
&return_true, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&string_loop);
}
@@ -1543,11 +1547,11 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
assembler->Goto(&loop_body);
assembler->Bind(&loop_body);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop);
Node* map_k = assembler->LoadMap(element_k);
@@ -1555,7 +1559,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
&return_true, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&loop_body);
}
}
@@ -1585,14 +1589,15 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
Node* element_k = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Float64());
+ elements, index_var.value(), MachineType::Float64(), 0,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->BranchIfFloat64Equal(element_k, search_num.value(),
&return_true, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&not_nan_loop);
}
@@ -1601,13 +1606,14 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
Node* element_k = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Float64());
+ elements, index_var.value(), MachineType::Float64(), 0,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->BranchIfFloat64IsNaN(element_k, &return_true, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&nan_loop);
}
}
@@ -1639,19 +1645,21 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
if (kPointerSize == kDoubleSize) {
Node* element = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint64());
+ 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);
+ kIeeeDoubleExponentWordOffset,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(
assembler->Word32Equal(element_upper,
assembler->Int32Constant(kHoleNanUpper32)),
@@ -1659,11 +1667,12 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
}
Node* element_k = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Float64());
+ elements, index_var.value(), MachineType::Float64(), 0,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->BranchIfFloat64Equal(element_k, search_num.value(),
&return_true, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&not_nan_loop);
}
@@ -1672,19 +1681,21 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
if (kPointerSize == kDoubleSize) {
Node* element = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint64());
+ 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);
+ kIeeeDoubleExponentWordOffset,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(
assembler->Word32Equal(element_upper,
assembler->Int32Constant(kHoleNanUpper32)),
@@ -1692,10 +1703,11 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
}
Node* element_k = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Float64());
+ elements, index_var.value(), MachineType::Float64(), 0,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->BranchIfFloat64IsNaN(element_k, &return_true, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&nan_loop);
}
@@ -1703,26 +1715,28 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
assembler->Bind(&hole_loop);
{
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_false);
if (kPointerSize == kDoubleSize) {
Node* element = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint64());
+ 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);
+ kIeeeDoubleExponentWordOffset,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(
assembler->Word32Equal(element_upper,
assembler->Int32Constant(kHoleNanUpper32)),
&return_true);
}
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&hole_loop);
}
}
@@ -1749,23 +1763,23 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
Node* start_from = assembler->Parameter(2);
Node* context = assembler->Parameter(3 + 2);
- Node* int32_zero = assembler->Int32Constant(0);
- Node* int32_one = assembler->Int32Constant(1);
+ Node* intptr_zero = assembler->IntPtrConstant(0);
+ Node* intptr_one = assembler->IntPtrConstant(1);
Node* undefined = assembler->UndefinedConstant();
Node* heap_number_map = assembler->HeapNumberMapConstant();
- Variable len_var(assembler, MachineRepresentation::kWord32),
- index_var(assembler, MachineRepresentation::kWord32),
- start_from_var(assembler, MachineRepresentation::kWord32);
+ Variable len_var(assembler, MachineType::PointerRepresentation()),
+ index_var(assembler, MachineType::PointerRepresentation()),
+ start_from_var(assembler, MachineType::PointerRepresentation());
Label init_k(assembler), return_found(assembler), return_not_found(assembler),
call_runtime(assembler);
Label init_len(assembler);
- index_var.Bind(int32_zero);
- len_var.Bind(int32_zero);
+ index_var.Bind(intptr_zero);
+ len_var.Bind(intptr_zero);
// Take slow path if not a JSArray, if retrieving elements requires
// traversing prototype, or if access checks are required.
@@ -1778,7 +1792,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
assembler->GotoUnless(assembler->WordIsSmi(len), &call_runtime);
len_var.Bind(assembler->SmiToWord(len));
- assembler->Branch(assembler->Word32Equal(len_var.value(), int32_zero),
+ assembler->Branch(assembler->WordEqual(len_var.value(), intptr_zero),
&return_not_found, &init_k);
}
@@ -1794,23 +1808,25 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
assembler->Bind(&init_k_smi);
{
- start_from_var.Bind(assembler->SmiToWord32(tagged_n));
+ start_from_var.Bind(assembler->SmiUntag(tagged_n));
assembler->Goto(&init_k_n);
}
assembler->Bind(&init_k_heap_num);
{
Label do_return_not_found(assembler);
- Node* fp_len = assembler->ChangeInt32ToFloat64(len_var.value());
+ // This round is lossless for all valid lengths.
+ Node* fp_len = assembler->RoundIntPtrToFloat64(len_var.value());
Node* fp_n = assembler->LoadHeapNumberValue(tagged_n);
assembler->GotoIf(assembler->Float64GreaterThanOrEqual(fp_n, fp_len),
&do_return_not_found);
- start_from_var.Bind(assembler->TruncateFloat64ToWord32(fp_n));
+ start_from_var.Bind(assembler->ChangeInt32ToIntPtr(
+ assembler->TruncateFloat64ToWord32(fp_n)));
assembler->Goto(&init_k_n);
assembler->Bind(&do_return_not_found);
{
- index_var.Bind(int32_zero);
+ index_var.Bind(intptr_zero);
assembler->Goto(&return_not_found);
}
}
@@ -1819,7 +1835,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
{
Label if_positive(assembler), if_negative(assembler), done(assembler);
assembler->Branch(
- assembler->Int32LessThan(start_from_var.value(), int32_zero),
+ assembler->IntPtrLessThan(start_from_var.value(), intptr_zero),
&if_negative, &if_positive);
assembler->Bind(&if_positive);
@@ -1831,15 +1847,15 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
assembler->Bind(&if_negative);
{
index_var.Bind(
- assembler->Int32Add(len_var.value(), start_from_var.value()));
+ assembler->IntPtrAdd(len_var.value(), start_from_var.value()));
assembler->Branch(
- assembler->Int32LessThan(index_var.value(), int32_zero),
+ assembler->IntPtrLessThan(index_var.value(), intptr_zero),
&init_k_zero, &done);
}
assembler->Bind(&init_k_zero);
{
- index_var.Bind(int32_zero);
+ index_var.Bind(intptr_zero);
assembler->Goto(&done);
}
@@ -1895,36 +1911,36 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
search_type, assembler->Int32Constant(FIRST_NONSTRING_TYPE)),
&string_loop);
assembler->GotoIf(
- assembler->WordEqual(search_type,
- assembler->Int32Constant(SIMD128_VALUE_TYPE)),
+ assembler->Word32Equal(search_type,
+ assembler->Int32Constant(SIMD128_VALUE_TYPE)),
&simd_loop);
assembler->Goto(&ident_loop);
assembler->Bind(&ident_loop);
{
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_not_found);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordEqual(element_k, search_element),
&return_found);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&ident_loop);
}
assembler->Bind(&undef_loop);
{
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_not_found);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordEqual(element_k, undefined),
&return_found);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&undef_loop);
}
@@ -1938,10 +1954,11 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler), not_smi(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_not_found);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoUnless(assembler->WordIsSmi(element_k), &not_smi);
assembler->Branch(
assembler->Float64Equal(search_num.value(),
@@ -1957,7 +1974,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
&return_found, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&not_nan_loop);
}
}
@@ -1966,10 +1983,10 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_not_found);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop);
assembler->GotoUnless(assembler->Int32LessThan(
assembler->LoadInstanceType(element_k),
@@ -1985,7 +2002,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
&return_found, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&string_loop);
}
@@ -1998,11 +2015,11 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
assembler->Goto(&loop_body);
assembler->Bind(&loop_body);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_not_found);
- Node* element_k =
- assembler->LoadFixedArrayElement(elements, index_var.value());
+ Node* element_k = assembler->LoadFixedArrayElement(
+ elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop);
Node* map_k = assembler->LoadMap(element_k);
@@ -2010,7 +2027,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
&return_found, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&loop_body);
}
}
@@ -2039,14 +2056,15 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_not_found);
Node* element_k = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Float64());
+ elements, index_var.value(), MachineType::Float64(), 0,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->BranchIfFloat64Equal(element_k, search_num.value(),
&return_found, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&not_nan_loop);
}
}
@@ -2075,19 +2093,21 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
{
Label continue_loop(assembler);
assembler->GotoUnless(
- assembler->Int32LessThan(index_var.value(), len_var.value()),
+ assembler->UintPtrLessThan(index_var.value(), len_var.value()),
&return_not_found);
if (kPointerSize == kDoubleSize) {
Node* element = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Uint64());
+ 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);
+ kIeeeDoubleExponentWordOffset,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(
assembler->Word32Equal(element_upper,
assembler->Int32Constant(kHoleNanUpper32)),
@@ -2095,11 +2115,12 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
}
Node* element_k = assembler->LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Float64());
+ elements, index_var.value(), MachineType::Float64(), 0,
+ CodeStubAssembler::INTPTR_PARAMETERS);
assembler->BranchIfFloat64Equal(element_k, search_num.value(),
&return_found, &continue_loop);
assembler->Bind(&continue_loop);
- index_var.Bind(assembler->Int32Add(index_var.value(), int32_one));
+ index_var.Bind(assembler->IntPtrAdd(index_var.value(), intptr_one));
assembler->Goto(&not_nan_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