Commit 3c2925ed authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

Reland "[Temporal] Add add/subtract to Duration"

This is a reland of commit a10194cf

Original change's description:
> [Temporal] Add add/subtract to Duration
>
> Also implement AOs: ToRelativeTemporalObject, AddDuration, AddDurationToOrSubtractDurationFromDuration,
>  ParseTemporalRelativeToString, DefaultTemporalLargestUnit,
> DifferenceZonedDateTime
>
> Spec Text:
> https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.add
> https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.subtract
> https://tc39.es/proposal-temporal/#sec-temporal-adddurationtoorsubtractdurationfromduration
> https://tc39.es/proposal-temporal/#sec-temporal-addduration
> https://tc39.es/proposal-temporal/#sec-temporal-torelativetemporalobject
> https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalrelativetostring
> https://tc39.es/proposal-temporal/#sec-temporal-defaulttemporallargestunit
> https://tc39.es/proposal-temporal/#sec-temporal-differencezoneddatetime
>
> Bug: v8:11544
> Change-Id: Id2eff50d7f810042e1b7c53c49a09f9e489d5460
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3699301
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#81650}

Bug: v8:11544
Change-Id: I4bf8055bc328e28cd40a4eaa282d125d69c47e96
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3756745Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81652}
parent cfbe175e
......@@ -64,10 +64,6 @@ TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeSince)
/* Temporal.Duration */
/* Temporal #sec-temporal.duration.compare */
TO_BE_IMPLEMENTED(TemporalDurationCompare)
/* Temporal #sec-temporal.duration.prototype.add */
TO_BE_IMPLEMENTED(TemporalDurationPrototypeAdd)
/* Temporal #sec-temporal.duration.prototype.subtract */
TO_BE_IMPLEMENTED(TemporalDurationPrototypeSubtract)
/* Temporal #sec-temporal.duration.prototype.round */
TO_BE_IMPLEMENTED(TemporalDurationPrototypeRound)
/* Temporal #sec-temporal.duration.prototype.total */
......@@ -230,8 +226,8 @@ TO_BE_IMPLEMENTED(TemporalCalendarPrototypeWeekOfYear)
#define TEMPORAL_GET_BY_INVOKE_CALENDAR_METHOD(T, METHOD, name) \
BUILTIN(Temporal##T##Prototype##METHOD) { \
HandleScope scope(isolate); \
/* 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporal \
* #T]]). */ \
/* 2. Perform ? RequireInternalSlot(temporalDate, */ \
/* [[InitializedTemporal#T]]). */ \
CHECK_RECEIVER(JSTemporal##T, date_like, \
"get Temporal." #T ".prototype." #name); \
/* 3. Let calendar be temporalDate.[[Calendar]]. */ \
......@@ -593,6 +589,8 @@ TEMPORAL_PROTOTYPE_METHOD0(Duration, Sign, sign)
TEMPORAL_PROTOTYPE_METHOD0(Duration, Blank, blank)
TEMPORAL_PROTOTYPE_METHOD0(Duration, Negated, negated)
TEMPORAL_PROTOTYPE_METHOD0(Duration, Abs, abs)
TEMPORAL_PROTOTYPE_METHOD2(Duration, Add, add)
TEMPORAL_PROTOTYPE_METHOD2(Duration, Subtract, subtract)
TEMPORAL_VALUE_OF(Duration)
TEMPORAL_PROTOTYPE_METHOD0(Duration, ToJSON, toJSON)
TEMPORAL_PROTOTYPE_METHOD2(Duration, ToLocaleString, toLocaleString)
......
This diff is collapsed.
......@@ -193,6 +193,16 @@ class JSTemporalDuration
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalDuration> Abs(
Isolate* isolate, Handle<JSTemporalDuration> duration);
// #sec-temporal.duration.prototype.add
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalDuration> Add(
Isolate* isolate, Handle<JSTemporalDuration> duration,
Handle<Object> other, Handle<Object> options);
// #sec-temporal.duration.prototype.subtract
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalDuration> Subtract(
Isolate* isolate, Handle<JSTemporalDuration> duration,
Handle<Object> other, Handle<Object> options);
// #sec-temporal.duration.prototype.tojson
V8_WARN_UNUSED_RESULT static MaybeHandle<String> ToJSON(
Isolate* isolate, Handle<JSTemporalDuration> duration);
......
This diff is collapsed.
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