diff options
author | 2023-09-17 17:38:03 -0700 | |
---|---|---|
committer | 2023-09-17 17:38:03 -0700 | |
commit | bca88b67e33e657380435d440ce847e4573db8b2 (patch) | |
tree | c220eb11e106a27031164009864f1555c81ad524 /src/bun.js/bindings/ZigGlobalObject.cpp | |
parent | c6899940ab5dfce8d32e9e7db79f6b904e15f72b (diff) | |
download | bun-bca88b67e33e657380435d440ce847e4573db8b2.tar.gz bun-bca88b67e33e657380435d440ce847e4573db8b2.tar.zst bun-bca88b67e33e657380435d440ce847e4573db8b2.zip |
Workaround #5604 (#5615)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.cpp')
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 815d6a206..a75135844 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -2068,9 +2068,11 @@ static inline EncodedJSValue functionPerformanceNowBody(JSGlobalObject* globalOb { auto* global = reinterpret_cast<GlobalObject*>(globalObject); // nanoseconds to seconds - uint64_t time = Bun__readOriginTimer(global->bunVM()); + double time = static_cast<double>(Bun__readOriginTimer(global->bunVM())); double result = time / 1000000.0; - return JSValue::encode(jsNumber(result)); + + // https://github.com/oven-sh/bun/issues/5604 + return JSValue::encode(jsDoubleNumber(result)); } extern "C" { @@ -2109,11 +2111,12 @@ private: void finishCreation(JSC::VM& vm) { + static const JSC::DOMJIT::Signature DOMJITSignatureForPerformanceNow( functionPerformanceNowWithoutTypeCheck, JSPerformanceObject::info(), JSC::DOMJIT::Effect::forWriteKinds(DFG::AbstractHeapKind::SideState), - SpecBytecodeDouble); + SpecDoubleReal); JSFunction* now = JSFunction::create( vm, @@ -2122,7 +2125,7 @@ private: String("now"_s), functionPerformanceNow, ImplementationVisibility::Public, NoIntrinsic, functionPerformanceNow, &DOMJITSignatureForPerformanceNow); - this->putDirect(vm, JSC::Identifier::fromString(vm, "now"_s), now, JSC::PropertyAttribute::DOMJITFunction | JSC::PropertyAttribute::Function); + this->putDirect(vm, JSC::Identifier::fromString(vm, "now"_s), now, JSC::PropertyAttribute::Function | 0); JSFunction* noopNotImplemented = JSFunction::create( vm, @@ -2130,10 +2133,11 @@ private: 0, String("noopNotImplemented"_s), functionNoop, ImplementationVisibility::Public, NoIntrinsic, functionNoop, - &DOMJITSignatureForPerformanceNow); - this->putDirect(vm, JSC::Identifier::fromString(vm, "mark"_s), noopNotImplemented, JSC::PropertyAttribute::DOMJITFunction | JSC::PropertyAttribute::Function); - this->putDirect(vm, JSC::Identifier::fromString(vm, "markResourceTiming"_s), noopNotImplemented, JSC::PropertyAttribute::DOMJITFunction | JSC::PropertyAttribute::Function); - this->putDirect(vm, JSC::Identifier::fromString(vm, "measure"_s), noopNotImplemented, JSC::PropertyAttribute::DOMJITFunction | JSC::PropertyAttribute::Function); + nullptr); + + this->putDirect(vm, JSC::Identifier::fromString(vm, "mark"_s), noopNotImplemented, JSC::PropertyAttribute::Function | 0); + this->putDirect(vm, JSC::Identifier::fromString(vm, "markResourceTiming"_s), noopNotImplemented, JSC::PropertyAttribute::Function | 0); + this->putDirect(vm, JSC::Identifier::fromString(vm, "measure"_s), noopNotImplemented, JSC::PropertyAttribute::Function | 0); this->putDirect( vm, |