Changeset 286149 in webkit
- Timestamp:
- Nov 24, 2021 7:45:40 AM (8 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/date-to-temporal-instant.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/runtime/CommonIdentifiers.h (modified) (1 diff)
-
Source/JavaScriptCore/runtime/DatePrototype.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r286092 r286149 1 2021-11-24 Aditi Singh <asingh@igalia.com> 2 3 [JSC] Implement Date.prototype.toTemporalInstant() 4 https://bugs.webkit.org/show_bug.cgi?id=232075 5 6 Reviewed by Yusuke Suzuki. 7 8 * stress/date-to-temporal-instant.js: Added. 9 (shouldBe): 10 (shouldThrow): 11 1 12 2021-11-19 Asumu Takikawa <asumu@igalia.com> 2 13 -
trunk/Source/JavaScriptCore/ChangeLog
r286138 r286149 1 2021-11-24 Aditi Singh <asingh@igalia.com> 2 3 [JSC] Implement Date.prototype.toTemporalInstant() 4 https://bugs.webkit.org/show_bug.cgi?id=232075 5 6 Reviewed by Yusuke Suzuki. 7 8 * runtime/CommonIdentifiers.h: 9 * runtime/DatePrototype.cpp: 10 (JSC::DatePrototype::finishCreation): 11 (JSC::JSC_DEFINE_HOST_FUNCTION): 12 1 13 2021-11-23 Don Olmstead <don.olmstead@sony.com> 2 14 -
trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h
r285418 r286149 252 252 macro(toPrecision) \ 253 253 macro(toString) \ 254 macro(toTemporalInstant) \ 254 255 macro(trailingZeroDisplay) \ 255 256 macro(type) \ -
trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp
r270861 r286149 35 35 #include "JSObject.h" 36 36 #include "JSString.h" 37 #include "TemporalInstant.h" 37 38 #include <wtf/Assertions.h> 38 39 … … 80 81 static JSC_DECLARE_HOST_FUNCTION(dateProtoFuncToISOString); 81 82 static JSC_DECLARE_HOST_FUNCTION(dateProtoFuncToJSON); 83 static JSC_DECLARE_HOST_FUNCTION(dateProtoFuncToTemporalInstant); 82 84 83 85 } … … 283 285 putDirectWithoutTransition(vm, vm.propertyNames->toPrimitiveSymbol, toPrimitiveFunction, PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly); 284 286 287 if (Options::useTemporal()) { 288 Identifier toTemporalInstantName = Identifier::fromString(vm, "toTemporalInstant"_s); 289 JSFunction* toTemporalInstantFunction = JSFunction::create(vm, globalObject, 0, toTemporalInstantName.string(), dateProtoFuncToTemporalInstant); 290 putDirectWithoutTransition(vm, toTemporalInstantName, toTemporalInstantFunction, static_cast<unsigned>(PropertyAttribute::DontEnum)); 291 } 285 292 // The constructor will be added later, after DateConstructor has been built. 286 293 } … … 905 912 } 906 913 914 JSC_DEFINE_HOST_FUNCTION(dateProtoFuncToTemporalInstant, (JSGlobalObject* globalObject, CallFrame* callFrame)) 915 { 916 VM& vm = globalObject->vm(); 917 auto scope = DECLARE_THROW_SCOPE(vm); 918 JSValue thisValue = callFrame->thisValue(); 919 auto* thisDateObj = jsDynamicCast<DateInstance*>(vm, thisValue); 920 if (UNLIKELY(!thisDateObj)) 921 return throwVMTypeError(globalObject, scope); 922 923 double epochMilliseconds = thisDateObj->internalNumber(); 924 if (!isInteger(epochMilliseconds)) 925 return throwVMError(globalObject, scope, createRangeError(globalObject, "Invalid integer number of Epoch Millseconds"_s)); 926 927 ASSERT(epochMilliseconds >= std::numeric_limits<int64_t>::min() && epochMilliseconds <= std::numeric_limits<int64_t>::max()); 928 ISO8601::ExactTime exactTime = ISO8601::ExactTime::fromEpochMilliseconds(epochMilliseconds); 929 return JSValue::encode(TemporalInstant::create(vm, globalObject->instantStructure(), exactTime)); 930 } 931 907 932 } // namespace JSC
Note: See TracChangeset
for help on using the changeset viewer.