aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ZigGlobalObject.h
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-06-13 09:15:05 -0700
committerGravatar GitHub <noreply@github.com> 2023-06-13 09:15:05 -0700
commitbdb1b7124aec3ca42a13dd13309df4c8e4e3cc64 (patch)
tree57a7a278699999521f561959204a533ea9906f8e /src/bun.js/bindings/ZigGlobalObject.h
parentb93bdbb124fc7b1b4a09d414158e0107e8d66b92 (diff)
downloadbun-bdb1b7124aec3ca42a13dd13309df4c8e4e3cc64.tar.gz
bun-bdb1b7124aec3ca42a13dd13309df4c8e4e3cc64.tar.zst
bun-bdb1b7124aec3ca42a13dd13309df4c8e4e3cc64.zip
Fix crash in CJS (#3294)bun-v0.6.9
* Fix crash in CJS * Add std.heap.ArenaAllocator * Use our arena allocator * Reduce JS parser memory usage and make HMR faster * Write some comments * fix test failure & clean up this code * Update javascript.zig * make arena usage safer --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.h')
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.h b/src/bun.js/bindings/ZigGlobalObject.h
index 3cf88bf29..d5f933540 100644
--- a/src/bun.js/bindings/ZigGlobalObject.h
+++ b/src/bun.js/bindings/ZigGlobalObject.h
@@ -388,6 +388,12 @@ public:
BunPlugin::OnResolve onResolvePlugins[BunPluginTargetMax + 1] {};
BunPluginTarget defaultBunPluginTarget = BunPluginTargetBun;
+ // This increases the cache hit rate for JSC::VM's SourceProvider cache
+ // It also avoids an extra allocation for the SourceProvider
+ // The key is a pointer to the source code
+ WTF::HashMap<uintptr_t, Ref<JSC::SourceProvider>> sourceProviderMap;
+ size_t reloadCount = 0;
+
void reload();
JSC::Structure* pendingVirtualModuleResultStructure() { return m_pendingVirtualModuleResultStructure.get(this); }