Use explicit values for ComparisonResult
Change-Id: I2e0d1896b5fae166bb8563d1fcb1cea620e20f0f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4194716 Commit-Queue: Jakob Kummerow <jkummerow@chromium.org> Auto-Submit: Matthias Liedtke <mliedtke@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/main@{#85484}
This commit is contained in:
parent
29d42d0628
commit
a0417c29d8
@ -3106,16 +3106,8 @@ MaybeHandle<JSTemporalZonedDateTime> SystemZonedDateTime(
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CompareResultToSign(ComparisonResult r) {
|
int CompareResultToSign(ComparisonResult r) {
|
||||||
switch (r) {
|
DCHECK_NE(r, ComparisonResult::kUndefined);
|
||||||
case ComparisonResult::kEqual:
|
return static_cast<int>(r);
|
||||||
return 0;
|
|
||||||
case ComparisonResult::kLessThan:
|
|
||||||
return -1;
|
|
||||||
case ComparisonResult::kGreaterThan:
|
|
||||||
return 1;
|
|
||||||
case ComparisonResult::kUndefined:
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// #sec-temporal-formattimezoneoffsetstring
|
// #sec-temporal-formattimezoneoffsetstring
|
||||||
|
@ -262,10 +262,10 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
|
|||||||
// Result of an abstract relational comparison of x and y, implemented according
|
// Result of an abstract relational comparison of x and y, implemented according
|
||||||
// to ES6 section 7.2.11 Abstract Relational Comparison.
|
// to ES6 section 7.2.11 Abstract Relational Comparison.
|
||||||
enum class ComparisonResult {
|
enum class ComparisonResult {
|
||||||
kLessThan, // x < y
|
kLessThan = -1, // x < y
|
||||||
kEqual, // x = y
|
kEqual = 0, // x = y
|
||||||
kGreaterThan, // x > y
|
kGreaterThan = 1, // x > y
|
||||||
kUndefined // at least one of x or y was undefined or NaN
|
kUndefined = 2 // at least one of x or y was undefined or NaN
|
||||||
};
|
};
|
||||||
|
|
||||||
// (Returns false whenever {result} is kUndefined.)
|
// (Returns false whenever {result} is kUndefined.)
|
||||||
|
@ -1369,16 +1369,8 @@ RUNTIME_FUNCTION(Runtime_WasmStringCompare) {
|
|||||||
Handle<String> lhs(String::cast(args[0]), isolate);
|
Handle<String> lhs(String::cast(args[0]), isolate);
|
||||||
Handle<String> rhs(String::cast(args[1]), isolate);
|
Handle<String> rhs(String::cast(args[1]), isolate);
|
||||||
ComparisonResult result = String::Compare(isolate, lhs, rhs);
|
ComparisonResult result = String::Compare(isolate, lhs, rhs);
|
||||||
switch (result) {
|
DCHECK_NE(result, ComparisonResult::kUndefined);
|
||||||
case ComparisonResult::kEqual:
|
return Smi::FromInt(static_cast<int>(result));
|
||||||
return Smi::FromInt(0);
|
|
||||||
case ComparisonResult::kGreaterThan:
|
|
||||||
return Smi::FromInt(1);
|
|
||||||
case ComparisonResult::kLessThan:
|
|
||||||
return Smi::FromInt(-1);
|
|
||||||
case ComparisonResult::kUndefined:
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
Loading…
Reference in New Issue
Block a user