From 693b1c9b2329a016901dd5b45146dc1cf4a9dab8 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Tue, 18 Oct 2022 13:36:44 -0700 Subject: Implement `performance.timeOrigin` --- src/bun.js/bindings/ZigGlobalObject.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/bun.js/bindings/ZigGlobalObject.cpp') diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index e69163043..c91a232e6 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -1606,6 +1606,7 @@ JSC_DEFINE_HOST_FUNCTION(functionConcatTypedArrays, (JSGlobalObject * globalObje } extern "C" uint64_t Bun__readOriginTimer(void*); +extern "C" double Bun__readOriginTimerStart(void*); static inline EncodedJSValue functionPerformanceNowBody(JSGlobalObject* globalObject) { @@ -1669,6 +1670,11 @@ private: &DOMJITSignatureForPerformanceNow); this->putDirect(vm, JSC::Identifier::fromString(vm, "now"_s), function, JSC::PropertyAttribute::DOMJITFunction | JSC::PropertyAttribute::Function); + this->putDirect( + vm, + JSC::Identifier::fromString(vm, "timeOrigin"_s), + jsNumber(Bun__readOriginTimerStart(reinterpret_cast(this->globalObject())->bunVM())), + JSC::PropertyAttribute::ReadOnly | 0); } }; const ClassInfo JSPerformanceObject::s_info = { "Performance"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceObject) }; -- cgit v1.2.3