[test] Handle NaNs in a test callback

Bug: chromium:1382071
Change-Id: I5f48c09f198468a21506a2e6ef238df4dbea926b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4025742
Auto-Submit: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84286}
This commit is contained in:
Maya Lekova 2022-11-14 11:25:57 +01:00 committed by V8 LUCI CQ
parent 0fe2597dd0
commit 6ed26ef882
2 changed files with 2 additions and 1 deletions

View File

@ -885,7 +885,7 @@ class FastCApiObject {
args.GetReturnValue().Set(Number::New(isolate, result));
} else {
IntegerT clamped = std::numeric_limits<IntegerT>::max();
if (std::isnan(checked_arg_dbl)) {
if (std::isnan(checked_arg_dbl) || std::isnan(real_arg)) {
clamped = 0;
} else {
IntegerT lower_bound = std::numeric_limits<IntegerT>::min();

View File

@ -125,3 +125,4 @@ is_in_range_u64(false, 2 ** 64 + 3.15, Number.MAX_SAFE_INTEGER);
// ---------- invalid arguments for clamp_compare ---------
fast_c_api.clamp_compare_i32(true);
fast_c_api.clamp_compare_i32(true, 753801, -2147483650);
fast_c_api.clamp_compare_u32(-2147483648, NaN, -5e-324);