From 8dfe2d41564edc7e311fb2b0f49f333b363a35f6 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Wed, 12 Jan 2022 15:33:55 -0800 Subject: [PATCH] [Temporal] Remove unnecessary -0 code Bug: v8:11544 Change-Id: I1f8fa01ece950addac048c5ae94d8c961666f720 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3384241 Reviewed-by: Shu-yu Guo Commit-Queue: Frank Tang Cr-Commit-Position: refs/heads/main@{#78594} --- src/builtins/builtins-temporal.cc | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/builtins/builtins-temporal.cc b/src/builtins/builtins-temporal.cc index a8f7043d2b..beef25d082 100644 --- a/src/builtins/builtins-temporal.cc +++ b/src/builtins/builtins-temporal.cc @@ -603,15 +603,6 @@ TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToLocaleString) return obj->field(); \ } -#define TEMPORAL_GET_NO_NEG_ZERO(T, METHOD, field) \ - BUILTIN(Temporal##T##Prototype##METHOD) { \ - HandleScope scope(isolate); \ - const char* method = "get Temporal." #T ".prototype." #field; \ - CHECK_RECEIVER(JSTemporal##T, obj, method); \ - if (obj->field().IsMinusZero()) return Smi::zero(); \ - return obj->field(); \ - } - // PlainDate BUILTIN(TemporalPlainDateConstructor) { HandleScope scope(isolate); @@ -729,16 +720,16 @@ BUILTIN(TemporalDurationConstructor) { args.atOrUndefined(isolate, 9), // microseconds args.atOrUndefined(isolate, 10))); // nanoseconds } -TEMPORAL_GET_NO_NEG_ZERO(Duration, Years, years) -TEMPORAL_GET_NO_NEG_ZERO(Duration, Months, months) -TEMPORAL_GET_NO_NEG_ZERO(Duration, Weeks, weeks) -TEMPORAL_GET_NO_NEG_ZERO(Duration, Days, days) -TEMPORAL_GET_NO_NEG_ZERO(Duration, Hours, hours) -TEMPORAL_GET_NO_NEG_ZERO(Duration, Minutes, minutes) -TEMPORAL_GET_NO_NEG_ZERO(Duration, Seconds, seconds) -TEMPORAL_GET_NO_NEG_ZERO(Duration, Milliseconds, milliseconds) -TEMPORAL_GET_NO_NEG_ZERO(Duration, Microseconds, microseconds) -TEMPORAL_GET_NO_NEG_ZERO(Duration, Nanoseconds, nanoseconds) +TEMPORAL_GET(Duration, Years, years) +TEMPORAL_GET(Duration, Months, months) +TEMPORAL_GET(Duration, Weeks, weeks) +TEMPORAL_GET(Duration, Days, days) +TEMPORAL_GET(Duration, Hours, hours) +TEMPORAL_GET(Duration, Minutes, minutes) +TEMPORAL_GET(Duration, Seconds, seconds) +TEMPORAL_GET(Duration, Milliseconds, milliseconds) +TEMPORAL_GET(Duration, Microseconds, microseconds) +TEMPORAL_GET(Duration, Nanoseconds, nanoseconds) TEMPORAL_PROTOTYPE_METHOD0(Duration, Sign, sign) TEMPORAL_PROTOTYPE_METHOD0(Duration, Blank, blank) TEMPORAL_VALUE_OF(Duration)