aboutsummaryrefslogtreecommitdiff
path: root/src/javascript/jsc/bindings/bindings.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-03-26 20:35:37 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-03-26 20:35:37 -0700
commit29a759a65512278f1c20d1089ba05dbae268ef24 (patch)
tree8f922320d54f6a99639bcfe8b53d971cab6a029c /src/javascript/jsc/bindings/bindings.cpp
parentb54a51adb96b3eea6aacff4f83f3ac39ddbc933e (diff)
downloadbun-29a759a65512278f1c20d1089ba05dbae268ef24.tar.gz
bun-29a759a65512278f1c20d1089ba05dbae268ef24.tar.zst
bun-29a759a65512278f1c20d1089ba05dbae268ef24.zip
improve performance of accessing `Bun.Transpiler` and `Bun.unsafe`
Diffstat (limited to 'src/javascript/jsc/bindings/bindings.cpp')
-rw-r--r--src/javascript/jsc/bindings/bindings.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/javascript/jsc/bindings/bindings.cpp b/src/javascript/jsc/bindings/bindings.cpp
index e4dbdc949..3a155f5dd 100644
--- a/src/javascript/jsc/bindings/bindings.cpp
+++ b/src/javascript/jsc/bindings/bindings.cpp
@@ -317,6 +317,25 @@ JSC__JSValue JSC__JSValue__parseJSON(JSC__JSValue JSValue0, JSC__JSGlobalObject*
return JSC::JSValue::encode(result);
}
+JSC__JSValue JSC__JSGlobalObject__getCachedObject(JSC__JSGlobalObject* globalObject, const ZigString* arg1)
+{
+ JSC::VM& vm = globalObject->vm();
+ WTF::String string = Zig::toString(*arg1);
+ auto symbol = vm.privateSymbolRegistry().symbolForKey(string);
+ JSC::Identifier ident = JSC::Identifier::fromUid(symbol);
+ JSC::JSValue result = globalObject->getIfPropertyExists(globalObject, ident);
+ return JSC::JSValue::encode(result);
+}
+JSC__JSValue JSC__JSGlobalObject__putCachedObject(JSC__JSGlobalObject* globalObject, const ZigString* arg1, JSC__JSValue JSValue2)
+{
+ JSC::VM& vm = globalObject->vm();
+ WTF::String string = Zig::toString(*arg1);
+ auto symbol = vm.privateSymbolRegistry().symbolForKey(string);
+ JSC::Identifier ident = JSC::Identifier::fromUid(symbol);
+ globalObject->putDirect(vm, ident, JSC::JSValue::decode(JSValue2), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::DontEnum);
+ return JSValue2;
+}
+
void JSC__JSGlobalObject__deleteModuleRegistryEntry(JSC__JSGlobalObject* global, ZigString* arg1)
{
JSC::JSMap* map = JSC::jsDynamicCast<JSC::JSMap*>(