Commit 741213d6 authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[cleanup] Clean up CSA::RelationalComparison for readability

Bug: v8:7109
Change-Id: I6384546566a760bd2956685a09d2327616eabd6d
Reviewed-on: https://chromium-review.googlesource.com/810266
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50093}
parent e520f4e5
......@@ -563,11 +563,11 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
{
if (direction == ForEachDirection::kForward) {
// 8. Repeat, while k < len
GotoIfNumericGreaterThanOrEqual(k(), len_, &after_loop);
GotoIfNumberGreaterThanOrEqual(k(), len_, &after_loop);
} else {
// OR
// 10. Repeat, while k >= 0
GotoIfNumericGreaterThanOrEqual(SmiConstant(-1), k(), &after_loop);
GotoIfNumberGreaterThanOrEqual(SmiConstant(-1), k(), &after_loop);
}
Label done_element(this, &to_);
......@@ -1364,8 +1364,8 @@ TF_BUILTIN(FastArraySlice, FastArraySliceCodeStubAssembler) {
// else let k be min(relativeStart, len.value()).
VARIABLE(k, MachineRepresentation::kTagged);
Label relative_start_positive(this), relative_start_done(this);
GotoIfNumericGreaterThanOrEqual(relative_start, SmiConstant(0),
&relative_start_positive);
GotoIfNumberGreaterThanOrEqual(relative_start, SmiConstant(0),
&relative_start_positive);
k.Bind(NumberMax(NumberAdd(len.value(), relative_start), NumberConstant(0)));
Goto(&relative_start_done);
BIND(&relative_start_positive);
......@@ -1391,8 +1391,8 @@ TF_BUILTIN(FastArraySlice, FastArraySliceCodeStubAssembler) {
// else let final be min(relativeEnd, len).
VARIABLE(final, MachineRepresentation::kTagged);
Label relative_end_positive(this), relative_end_done(this);
GotoIfNumericGreaterThanOrEqual(relative_end.value(), NumberConstant(0),
&relative_end_positive);
GotoIfNumberGreaterThanOrEqual(relative_end.value(), NumberConstant(0),
&relative_end_positive);
final.Bind(NumberMax(NumberAdd(len.value(), relative_end.value()),
NumberConstant(0)));
Goto(&relative_end_done);
......@@ -1430,7 +1430,7 @@ TF_BUILTIN(FastArraySlice, FastArraySliceCodeStubAssembler) {
BIND(&loop);
{
// 15. Repeat, while k < final
GotoIfNumericGreaterThanOrEqual(k.value(), final.value(), &after_loop);
GotoIfNumberGreaterThanOrEqual(k.value(), final.value(), &after_loop);
Node* p_k = k.value(); // ToString(context, k.value()) is no-op
......@@ -3054,7 +3054,7 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
length = var_length.value();
}
GotoIfNumericGreaterThanOrEqual(index, length, &set_done);
GotoIfNumberGreaterThanOrEqual(index, length, &set_done);
StoreObjectField(iterator, JSArrayIterator::kNextIndexOffset,
NumberInc(index));
......
This diff is collapsed.
......@@ -1764,11 +1764,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
void InitializeFieldsWithRoot(Node* object, Node* start_offset,
Node* end_offset, Heap::RootListIndex root);
Node* RelationalComparison(Operation op, Node* lhs, Node* rhs, Node* context,
Node* RelationalComparison(Operation op, Node* left, Node* right,
Node* context,
Variable* var_type_feedback = nullptr);
void BranchIfNumericRelationalComparison(Operation op, Node* lhs, Node* rhs,
Label* if_true, Label* if_false);
void BranchIfNumberRelationalComparison(Operation op, Node* left, Node* right,
Label* if_true, Label* if_false);
void BranchIfAccessorPair(Node* value, Label* if_accessor_pair,
Label* if_not_accessor_pair) {
......@@ -1776,7 +1777,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Branch(IsAccessorPair(value), if_accessor_pair, if_not_accessor_pair);
}
void GotoIfNumericGreaterThanOrEqual(Node* lhs, Node* rhs, Label* if_false);
void GotoIfNumberGreaterThanOrEqual(Node* left, Node* right, Label* if_false);
Node* Equal(Node* lhs, Node* rhs, Node* context,
Variable* var_type_feedback = nullptr);
......
......@@ -2663,7 +2663,7 @@ TEST(GotoIfNotWhiteSpaceOrLineTerminator) {
}
}
TEST(BranchIfNumericRelationalComparison) {
TEST(BranchIfNumberRelationalComparison) {
Isolate* isolate(CcTest::InitIsolateOnce());
Factory* f = isolate->factory();
const int kNumParams = 2;
......@@ -2671,9 +2671,9 @@ TEST(BranchIfNumericRelationalComparison) {
{
CodeStubAssembler m(asm_tester.state());
Label return_true(&m), return_false(&m);
m.BranchIfNumericRelationalComparison(Operation::kGreaterThanOrEqual,
m.Parameter(0), m.Parameter(1),
&return_true, &return_false);
m.BranchIfNumberRelationalComparison(Operation::kGreaterThanOrEqual,
m.Parameter(0), m.Parameter(1),
&return_true, &return_false);
m.BIND(&return_true);
m.Return(m.BooleanConstant(true));
m.BIND(&return_false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment