Commit f85a3554 authored by Z Duong Nguyen-Huu's avatar Z Duong Nguyen-Huu Committed by Commit Bot

Handle Date.p.setYear edge cases from test262

The current implementation does not correctly handle the edge case for setYear
where input is something like -0.99

Bug: v8:5139
Change-Id: Ia919814eb6282c7f996cccc4531ed073e843ba27
Reviewed-on: https://chromium-review.googlesource.com/c/1412501Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#58899}
parent 62fa0487
......@@ -939,8 +939,11 @@ BUILTIN(DatePrototypeSetYear) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, year,
Object::ToNumber(isolate, year));
double m = 0.0, dt = 1.0, y = year->Number();
if (0.0 <= y && y <= 99.0) {
y = 1900.0 + DoubleToInteger(y);
if (!std::isnan(y)) {
double y_int = DoubleToInteger(y);
if (0.0 <= y_int && y_int <= 99.0) {
y = 1900.0 + y_int;
}
}
int time_within_day = 0;
if (!std::isnan(date->value()->Number())) {
......
......@@ -388,9 +388,6 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=5116
'built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan': [PASS, FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=5139
'annexB/built-ins/Date/prototype/setYear/year-number-relative': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4698
'language/expressions/call/tco-call-args': [SKIP],
'language/expressions/call/tco-cross-realm-class-construct': [SKIP],
......
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