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) {
|
||||
switch (r) {
|
||||
case ComparisonResult::kEqual:
|
||||
return 0;
|
||||
case ComparisonResult::kLessThan:
|
||||
return -1;
|
||||
case ComparisonResult::kGreaterThan:
|
||||
return 1;
|
||||
case ComparisonResult::kUndefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
DCHECK_NE(r, ComparisonResult::kUndefined);
|
||||
return static_cast<int>(r);
|
||||
}
|
||||
|
||||
// #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
|
||||
// to ES6 section 7.2.11 Abstract Relational Comparison.
|
||||
enum class ComparisonResult {
|
||||
kLessThan, // x < y
|
||||
kEqual, // x = y
|
||||
kGreaterThan, // x > y
|
||||
kUndefined // at least one of x or y was undefined or NaN
|
||||
kLessThan = -1, // x < y
|
||||
kEqual = 0, // x = y
|
||||
kGreaterThan = 1, // x > y
|
||||
kUndefined = 2 // at least one of x or y was undefined or NaN
|
||||
};
|
||||
|
||||
// (Returns false whenever {result} is kUndefined.)
|
||||
|
@ -1369,16 +1369,8 @@ RUNTIME_FUNCTION(Runtime_WasmStringCompare) {
|
||||
Handle<String> lhs(String::cast(args[0]), isolate);
|
||||
Handle<String> rhs(String::cast(args[1]), isolate);
|
||||
ComparisonResult result = String::Compare(isolate, lhs, rhs);
|
||||
switch (result) {
|
||||
case ComparisonResult::kEqual:
|
||||
return Smi::FromInt(0);
|
||||
case ComparisonResult::kGreaterThan:
|
||||
return Smi::FromInt(1);
|
||||
case ComparisonResult::kLessThan:
|
||||
return Smi::FromInt(-1);
|
||||
case ComparisonResult::kUndefined:
|
||||
UNREACHABLE();
|
||||
}
|
||||
DCHECK_NE(result, ComparisonResult::kUndefined);
|
||||
return Smi::FromInt(static_cast<int>(result));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
Loading…
Reference in New Issue
Block a user