aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-09-15 11:22:06 -0400
committerGravatar GitHub <noreply@github.com> 2023-09-15 08:22:06 -0700
commit29b22175bf6fc726d0b028c7bf5619ab89fca09a (patch)
treef0664d677e6cd2d130c76db9fb135402ae2c1110 /src
parent75697890ce1040d2c2f9bc50499faf54b3205915 (diff)
downloadbun-29b22175bf6fc726d0b028c7bf5619ab89fca09a.tar.gz
bun-29b22175bf6fc726d0b028c7bf5619ab89fca09a.tar.zst
bun-29b22175bf6fc726d0b028c7bf5619ab89fca09a.zip
feat(runtime): add `process.binding` `uv`/`natives`/`config` + make global object properties lazy (#5355)
* binding uv * we did that * some more bindings * fix doc * fix uv * yo * static hash table nonsense <3 * huge refactor to the global object i am not ready for merge conflicts * it works part 3 * lose --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/bindings/BunDebugger.cpp5
-rw-r--r--src/bun.js/bindings/BunObject.cpp6
-rw-r--r--src/bun.js/bindings/BunObject.h2
-rw-r--r--src/bun.js/bindings/BunObject.lut.h2
-rw-r--r--src/bun.js/bindings/CommonJSModuleRecord.cpp6
-rw-r--r--src/bun.js/bindings/ModuleLoader.h3
-rw-r--r--src/bun.js/bindings/Process.cpp117
-rw-r--r--src/bun.js/bindings/Process.h17
-rw-r--r--src/bun.js/bindings/Process.lut.h4
-rw-r--r--src/bun.js/bindings/ProcessBindingConstants.cpp20
-rw-r--r--src/bun.js/bindings/ProcessBindingConstants.h3
-rw-r--r--src/bun.js/bindings/ProcessBindingConstants.lut.h31
-rw-r--r--src/bun.js/bindings/ProcessBindingNatives.cpp131
-rw-r--r--src/bun.js/bindings/ProcessBindingNatives.h35
-rw-r--r--src/bun.js/bindings/ProcessBindingNatives.lut.h339
-rw-r--r--src/bun.js/bindings/ProcessBindingUV.cpp158
-rw-r--r--src/bun.js/bindings/ProcessBindingUV.h13
-rw-r--r--src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h302
-rw-r--r--src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h100
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.cpp782
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.h144
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.lut.h342
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.lut.txt84
-rw-r--r--src/bun.js/bindings/process.d.ts8
-rw-r--r--src/bun.js/modules/BunJSCModule.h2
-rw-r--r--src/bun.js/scripts/generate-classes.ts41
-rw-r--r--src/js/_codegen/build-functions.ts33
-rw-r--r--src/js/_codegen/static-hash-tables.ts42
-rw-r--r--src/js/builtins/ProcessObjectInternals.ts21
-rw-r--r--src/js/out/WebCoreJSBuiltins.cpp8
-rw-r--r--src/js/out/WebCoreJSBuiltins.h11
31 files changed, 1637 insertions, 1175 deletions
diff --git a/src/bun.js/bindings/BunDebugger.cpp b/src/bun.js/bindings/BunDebugger.cpp
index 046739923..55942d2f6 100644
--- a/src/bun.js/bindings/BunDebugger.cpp
+++ b/src/bun.js/bindings/BunDebugger.cpp
@@ -452,12 +452,13 @@ extern "C" void Bun__ensureDebugger(ScriptExecutionContextIdentifier scriptId, b
}
}
-extern "C" void BunDebugger__willHotReload() {
+extern "C" void BunDebugger__willHotReload()
+{
if (debuggerScriptExecutionContext == nullptr) {
return;
}
- debuggerScriptExecutionContext->postTaskConcurrently([](ScriptExecutionContext &context){
+ debuggerScriptExecutionContext->postTaskConcurrently([](ScriptExecutionContext& context) {
WTF::LockHolder locker(inspectorConnectionsLock);
for (auto& connections : *inspectorConnections) {
for (auto* connection : connections.value) {
diff --git a/src/bun.js/bindings/BunObject.cpp b/src/bun.js/bindings/BunObject.cpp
index 0b78d1367..91fc810da 100644
--- a/src/bun.js/bindings/BunObject.cpp
+++ b/src/bun.js/bindings/BunObject.cpp
@@ -602,7 +602,7 @@ JSC_DEFINE_HOST_FUNCTION(functionHashCode,
hash BunObject_getter_wrap_hash DontDelete|PropertyCallback
indexOfLine BunObject_callback_indexOfLine DontDelete|Function 1
inflateSync BunObject_callback_inflateSync DontDelete|Function 1
- inspect BunObject_getter_wrap_inspect DontDelete|PropertyCallback
+ inspect BunObject_getter_wrap_inspect DontDelete|PropertyCallback
isMainThread constructIsMainThread ReadOnly|DontDelete|PropertyCallback
jest BunObject_callback_jest DontEnum|DontDelete|Function 1
listen BunObject_callback_listen DontDelete|Function 1
@@ -701,9 +701,9 @@ public:
const JSC::ClassInfo JSBunObject::s_info = { "Bun"_s, &JSNonFinalObject::s_info, &bunObjectTable, nullptr, CREATE_METHOD_TABLE(JSBunObject) };
-JSValue createBunObject(Zig::GlobalObject* globalObject)
+JSC::JSObject* createBunObject(VM& vm, JSObject* globalObject)
{
- return JSBunObject::create(globalObject->vm(), globalObject);
+ return JSBunObject::create(vm, static_cast<Zig::GlobalObject*>(globalObject));
}
}
diff --git a/src/bun.js/bindings/BunObject.h b/src/bun.js/bindings/BunObject.h
index c2abfe06f..f527f5729 100644
--- a/src/bun.js/bindings/BunObject.h
+++ b/src/bun.js/bindings/BunObject.h
@@ -13,5 +13,5 @@ JSC_DECLARE_HOST_FUNCTION(functionBunNanoseconds);
JSC_DECLARE_HOST_FUNCTION(functionPathToFileURL);
JSC_DECLARE_HOST_FUNCTION(functionFileURLToPath);
-JSC::JSValue createBunObject(Zig::GlobalObject* globalObject);
+JSC::JSObject* createBunObject(VM& vm, JSObject* globalObject);
}
diff --git a/src/bun.js/bindings/BunObject.lut.h b/src/bun.js/bindings/BunObject.lut.h
index 1971cb8da..a2aa95fda 100644
--- a/src/bun.js/bindings/BunObject.lut.h
+++ b/src/bun.js/bindings/BunObject.lut.h
@@ -1,4 +1,4 @@
-// File generated via `make generate-builtins`
+// File generated via `make static-hash-table` / `make cpp`
static const struct CompactHashIndex bunObjectTableIndex[269] = {
{ 75, -1 },
{ -1, -1 },
diff --git a/src/bun.js/bindings/CommonJSModuleRecord.cpp b/src/bun.js/bindings/CommonJSModuleRecord.cpp
index dad8294d9..8fbb780a8 100644
--- a/src/bun.js/bindings/CommonJSModuleRecord.cpp
+++ b/src/bun.js/bindings/CommonJSModuleRecord.cpp
@@ -118,6 +118,8 @@ static bool evaluateCommonJSModuleOnce(JSC::VM& vm, Zig::GlobalObject* globalObj
globalObject->m_BunCommonJSModuleValue.set(vm, globalObject, thisObject);
JSValue empty = JSC::evaluate(globalObject, moduleObject->sourceCode.get()->sourceCode(), thisObject, exception);
+
+ globalObject->m_BunCommonJSModuleValue.clear();
moduleObject->sourceCode.clear();
return exception.get() == nullptr;
@@ -740,7 +742,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionRequireCommonJS, (JSGlobalObject * lexicalGlo
// Special-case for "process" to just return the process object directly.
if (UNLIKELY(specifier == "process"_s || specifier == "node:process"_s)) {
- jsDynamicCast<JSCommonJSModule*>(callframe->argument(1))->putDirect(vm, builtinNames(vm).exportsPublicName(), globalObject->processObject(), 0);
+ jsCast<JSCommonJSModule*>(callframe->argument(1))->putDirect(vm, builtinNames(vm).exportsPublicName(), globalObject->processObject(), 0);
return JSValue::encode(globalObject->processObject());
}
@@ -752,7 +754,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionRequireCommonJS, (JSGlobalObject * lexicalGlo
JSValue fetchResult = Bun::fetchCommonJSModule(
globalObject,
- jsDynamicCast<JSCommonJSModule*>(callframe->argument(1)),
+ jsCast<JSCommonJSModule*>(callframe->argument(1)),
specifierValue,
&specifierStr,
&referrerStr);
diff --git a/src/bun.js/bindings/ModuleLoader.h b/src/bun.js/bindings/ModuleLoader.h
index ee726ebcf..72dd8b49a 100644
--- a/src/bun.js/bindings/ModuleLoader.h
+++ b/src/bun.js/bindings/ModuleLoader.h
@@ -4,6 +4,9 @@
#include "JavaScriptCore/JSCInlines.h"
#include "BunClientData.h"
+extern "C" JSC::EncodedJSValue jsFunctionOnLoadObjectResultResolve(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame);
+extern "C" JSC::EncodedJSValue jsFunctionOnLoadObjectResultReject(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame);
+
namespace Zig {
class GlobalObject;
}
diff --git a/src/bun.js/bindings/Process.cpp b/src/bun.js/bindings/Process.cpp
index c63e7cf6c..69ec133e1 100644
--- a/src/bun.js/bindings/Process.cpp
+++ b/src/bun.js/bindings/Process.cpp
@@ -20,6 +20,8 @@
#include <errno.h>
#include <sys/ioctl.h>
#include "JSNextTickQueue.h"
+#include "ProcessBindingUV.h"
+#include "ProcessBindingNatives.h"
#pragma mark - Node.js Process
@@ -39,7 +41,7 @@
#include <unistd.h> // setuid, getuid
#endif
-namespace Zig {
+namespace Bun {
using namespace JSC;
@@ -1121,6 +1123,91 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionAssert, (JSGlobalObject * globalObject,
return JSValue::encode(jsUndefined());
}
+#define PROCESS_BINDING_NOT_IMPLEMENTED_ISSUE(str, issue) \
+ { \
+ throwScope.throwException(globalObject, createError(globalObject, String("process.binding(\"" str "\") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/" issue ""_s))); \
+ return JSValue::encode(JSValue {}); \
+ }
+
+#define PROCESS_BINDING_NOT_IMPLEMENTED(str) \
+ { \
+ throwScope.throwException(globalObject, createError(globalObject, String("process.binding(\"" str "\") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample."_s))); \
+ return JSValue::encode(JSValue {}); \
+ }
+
+inline JSValue processBindingUtil(Zig::GlobalObject* globalObject, JSC::VM& vm)
+{
+ auto& builtinNames = WebCore::builtinNames(vm);
+ auto fn = globalObject->getDirect(vm, builtinNames.requireNativeModulePrivateName());
+ auto callData = JSC::getCallData(fn);
+ JSC::MarkedArgumentBuffer args;
+ args.append(jsString(vm, String("util/types"_s)));
+ return JSC::call(globalObject, fn, callData, globalObject, args);
+}
+
+inline JSValue processBindingConfig(Zig::GlobalObject* globalObject, JSC::VM& vm)
+{
+ auto config = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype(), 9);
+#ifdef BUN_DEBUG
+ config->putDirect(vm, Identifier::fromString(vm, "isDebugBuild"_s), jsBoolean(true), 0);
+#else
+ config->putDirect(vm, Identifier::fromString(vm, "isDebugBuild"_s), jsBoolean(false), 0);
+#endif
+ config->putDirect(vm, Identifier::fromString(vm, "hasOpenSSL"_s), jsBoolean(true), 0);
+ config->putDirect(vm, Identifier::fromString(vm, "fipsMode"_s), jsBoolean(true), 0);
+ config->putDirect(vm, Identifier::fromString(vm, "hasIntl"_s), jsBoolean(true), 0);
+ config->putDirect(vm, Identifier::fromString(vm, "hasTracing"_s), jsBoolean(true), 0);
+ config->putDirect(vm, Identifier::fromString(vm, "hasNodeOptions"_s), jsBoolean(true), 0);
+ config->putDirect(vm, Identifier::fromString(vm, "hasInspector"_s), jsBoolean(true), 0);
+ config->putDirect(vm, Identifier::fromString(vm, "noBrowserGlobals"_s), jsBoolean(false), 0);
+ config->putDirect(vm, Identifier::fromString(vm, "bits"_s), jsNumber(64), 0);
+ return config;
+}
+
+JSC_DEFINE_HOST_FUNCTION(Process_functionBinding, (JSGlobalObject * jsGlobalObject, CallFrame* callFrame))
+{
+ auto& vm = jsGlobalObject->vm();
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ auto globalObject = static_cast<Zig::GlobalObject*>(jsGlobalObject);
+ auto process = jsCast<Process*>(globalObject->processObject());
+ auto moduleName = callFrame->argument(0).toWTFString(globalObject);
+
+ // clang-format off
+ if (moduleName == "async_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED("async_wrap");
+ if (moduleName == "buffer"_s) PROCESS_BINDING_NOT_IMPLEMENTED_ISSUE("buffer", "2020");
+ if (moduleName == "cares_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED("cares_wrap");
+ if (moduleName == "config"_s) return JSValue::encode(processBindingConfig(globalObject, vm));
+ if (moduleName == "constants"_s) return JSValue::encode(globalObject->processBindingConstants());
+ if (moduleName == "contextify"_s) PROCESS_BINDING_NOT_IMPLEMENTED("contextify");
+ if (moduleName == "crypto"_s) PROCESS_BINDING_NOT_IMPLEMENTED("crypto");
+ if (moduleName == "fs"_s) PROCESS_BINDING_NOT_IMPLEMENTED_ISSUE("fs", "3546");
+ if (moduleName == "fs_event_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED("fs_event_wrap");
+ if (moduleName == "http_parser"_s) PROCESS_BINDING_NOT_IMPLEMENTED("http_parser");
+ if (moduleName == "icu"_s) PROCESS_BINDING_NOT_IMPLEMENTED("icu");
+ if (moduleName == "inspector"_s) PROCESS_BINDING_NOT_IMPLEMENTED("inspector");
+ if (moduleName == "js_stream"_s) PROCESS_BINDING_NOT_IMPLEMENTED("js_stream");
+ if (moduleName == "natives"_s) return JSValue::encode(process->bindingNatives());
+ if (moduleName == "os"_s) PROCESS_BINDING_NOT_IMPLEMENTED("os");
+ if (moduleName == "pipe_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED("pipe_wrap");
+ if (moduleName == "process_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED("process_wrap");
+ if (moduleName == "signal_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED("signal_wrap");
+ if (moduleName == "spawn_sync"_s) PROCESS_BINDING_NOT_IMPLEMENTED("spawn_sync");
+ if (moduleName == "stream_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED_ISSUE("stream_wrap", "4957");
+ if (moduleName == "tcp_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED("tcp_wrap");
+ if (moduleName == "tls_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED("tls_wrap");
+ if (moduleName == "tty_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED_ISSUE("tty_wrap", "4694");
+ if (moduleName == "udp_wrap"_s) PROCESS_BINDING_NOT_IMPLEMENTED("udp_wrap");
+ if (moduleName == "url"_s) PROCESS_BINDING_NOT_IMPLEMENTED("url");
+ if (moduleName == "util"_s) return JSValue::encode(processBindingUtil(globalObject, vm));
+ if (moduleName == "uv"_s) return JSValue::encode(process->bindingUV());
+ if (moduleName == "v8"_s) PROCESS_BINDING_NOT_IMPLEMENTED("v8");
+ if (moduleName == "zlib"_s) PROCESS_BINDING_NOT_IMPLEMENTED("zlib");
+ // clang-format on
+
+ throwScope.throwException(globalObject, createError(globalObject, makeString("No such module: "_s, moduleName)));
+ return JSValue::encode(jsUndefined());
+}
+
JSC_DEFINE_HOST_FUNCTION(Process_functionReallyExit, (JSGlobalObject * globalObject, CallFrame* callFrame))
{
auto& vm = globalObject->vm();
@@ -1158,8 +1245,8 @@ void Process::visitChildrenImpl(JSCell* cell, Visitor& visitor)
Process* thisObject = jsCast<Process*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
Base::visitChildren(thisObject, visitor);
- thisObject->cpuUsageStructure.visit(visitor);
- thisObject->memoryUsageStructure.visit(visitor);
+ thisObject->m_cpuUsageStructure.visit(visitor);
+ thisObject->m_memoryUsageStructure.visit(visitor);
}
DEFINE_VISIT_CHILDREN(Process);
@@ -1252,7 +1339,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionCpuUsage,
auto* process = getProcessObject(globalObject, callFrame->thisValue());
- Structure* cpuUsageStructure = process->cpuUsageStructure.getInitializedOnMainThread(process);
+ Structure* cpuUsageStructure = process->cpuUsageStructure();
constexpr double MICROS_PER_SEC = 1000000.0;
@@ -1405,7 +1492,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionMemoryUsage,
return JSC::JSValue::encode(JSC::JSValue {});
}
- JSC::JSObject* result = JSC::constructEmptyObject(vm, process->memoryUsageStructure.getInitializedOnMainThread(process));
+ JSC::JSObject* result = JSC::constructEmptyObject(vm, process->memoryUsageStructure());
if (UNLIKELY(throwScope.exception())) {
return JSC::JSValue::encode(JSC::JSValue {});
}
@@ -1770,7 +1857,7 @@ extern "C" void Process__emitDisconnectEvent(Zig::GlobalObject* global)
argv constructArgv PropertyCallback
argv0 constructArgv0 PropertyCallback
assert Process_functionAssert Function 1
- binding JSBuiltin Function 1
+ binding Process_functionBinding Function 1
browser constructBrowser PropertyCallback
chdir Process_functionChdir Function 1
config constructProcessConfigObject PropertyCallback
@@ -1831,7 +1918,6 @@ extern "C" void Process__emitDisconnectEvent(Zig::GlobalObject* global)
_kill Process_functionReallyKill Function 2
@end
*/
-
#include "Process.lut.h"
const JSC::ClassInfo Process::s_info = { "Process"_s, &Base::s_info, &processObjectTable, nullptr,
CREATE_METHOD_TABLE(Process) };
@@ -1840,17 +1926,24 @@ void Process::finishCreation(JSC::VM& vm)
{
Base::finishCreation(vm);
- this->wrapped().onDidChangeListener = &onDidChangeListeners;
+ wrapped().onDidChangeListener = &onDidChangeListeners;
- this->cpuUsageStructure.initLater([](const JSC::LazyProperty<JSC::JSObject, JSC::Structure>::Initializer& init) {
+ m_cpuUsageStructure.initLater([](const JSC::LazyProperty<Process, JSC::Structure>::Initializer& init) {
init.set(constructCPUUsageStructure(init.vm, init.owner->globalObject()));
});
- this->memoryUsageStructure.initLater([](const JSC::LazyProperty<JSC::JSObject, JSC::Structure>::Initializer& init) {
+ m_memoryUsageStructure.initLater([](const JSC::LazyProperty<Process, JSC::Structure>::Initializer& init) {
init.set(constructMemoryUsageStructure(init.vm, init.owner->globalObject()));
});
- this->putDirect(vm, vm.propertyNames->toStringTagSymbol, jsString(vm, String("process"_s)), 0);
+ m_bindingUV.initLater([](const JSC::LazyProperty<Process, JSC::JSObject>::Initializer& init) {
+ init.set(Bun::ProcessBindingUV::create(init.vm, init.owner->globalObject()));
+ });
+ m_bindingNatives.initLater([](const JSC::LazyProperty<Process, JSC::JSObject>::Initializer& init) {
+ init.set(Bun::ProcessBindingNatives::create(init.vm, ProcessBindingNatives::createStructure(init.vm, init.owner->globalObject())));
+ });
+
+ putDirect(vm, vm.propertyNames->toStringTagSymbol, jsString(vm, String("process"_s)), 0);
}
-} // namespace Zig
+} // namespace Bun
diff --git a/src/bun.js/bindings/Process.h b/src/bun.js/bindings/Process.h
index ab344c7fe..1615aabdd 100644
--- a/src/bun.js/bindings/Process.h
+++ b/src/bun.js/bindings/Process.h
@@ -6,7 +6,7 @@
#include "BunClientData.h"
#include "JSEventEmitter.h"
-namespace Zig {
+namespace Bun {
// TODO: find a better place for this
int getRSS(size_t* rss);
@@ -16,6 +16,11 @@ using namespace JSC;
class Process : public WebCore::JSEventEmitter {
using Base = WebCore::JSEventEmitter;
+ LazyProperty<Process, Structure> m_cpuUsageStructure;
+ LazyProperty<Process, Structure> m_memoryUsageStructure;
+ LazyProperty<Process, JSObject> m_bindingUV;
+ LazyProperty<Process, JSObject> m_bindingNatives;
+
public:
Process(JSC::Structure* structure, WebCore::JSDOMGlobalObject& globalObject, Ref<WebCore::EventEmitter>&& impl)
: Base(structure, globalObject, WTFMove(impl))
@@ -50,9 +55,6 @@ public:
return accessor;
}
- LazyProperty<JSObject, Structure> cpuUsageStructure;
- LazyProperty<JSObject, Structure> memoryUsageStructure;
-
DECLARE_VISIT_CHILDREN;
template<typename, SubspaceAccess mode>
@@ -69,6 +71,11 @@ public:
}
void finishCreation(JSC::VM& vm);
+
+ inline Structure* cpuUsageStructure() { return m_cpuUsageStructure.getInitializedOnMainThread(this); }
+ inline Structure* memoryUsageStructure() { return m_memoryUsageStructure.getInitializedOnMainThread(this); }
+ inline JSObject* bindingUV() { return m_bindingUV.getInitializedOnMainThread(this); }
+ inline JSObject* bindingNatives() { return m_bindingNatives.getInitializedOnMainThread(this); }
};
-} // namespace Zig \ No newline at end of file
+} // namespace Bun \ No newline at end of file
diff --git a/src/bun.js/bindings/Process.lut.h b/src/bun.js/bindings/Process.lut.h
index dda54ff01..620acdb64 100644
--- a/src/bun.js/bindings/Process.lut.h
+++ b/src/bun.js/bindings/Process.lut.h
@@ -1,4 +1,4 @@
-// File generated via `make generate-builtins`
+// File generated via `make static-hash-table` / `make cpp`
static const struct CompactHashIndex processObjectTableIndex[267] = {
{ 47, -1 },
{ -1, -1 },
@@ -276,7 +276,7 @@ static const struct HashTableValue processObjectTableValues[65] = {
{ "argv"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructArgv } },
{ "argv0"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructArgv0 } },
{ "assert"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionAssert, 1 } },
- { "binding"_s, ((static_cast<unsigned>(PropertyAttribute::Function)) & ~PropertyAttribute::Function) | PropertyAttribute::Builtin, NoIntrinsic, { HashTableValue::BuiltinGeneratorType, processObjectBindingCodeGenerator, 1 } },
+ { "binding"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionBinding, 1 } },
{ "browser"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructBrowser } },
{ "chdir"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Process_functionChdir, 1 } },
{ "config"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, constructProcessConfigObject } },
diff --git a/src/bun.js/bindings/ProcessBindingConstants.cpp b/src/bun.js/bindings/ProcessBindingConstants.cpp
index 36a4a7f96..86b34d19f 100644
--- a/src/bun.js/bindings/ProcessBindingConstants.cpp
+++ b/src/bun.js/bindings/ProcessBindingConstants.cpp
@@ -1082,15 +1082,18 @@ static JSValue processBindingConstantsGetZlib(VM& vm, JSObject* bindingObject)
return object;
}
-static const HashTableValue ProcessBindingConstantsValues[] = {
- { "os"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetOs } },
- { "fs"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetFs } },
- { "crypto"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetCrypto } },
- { "zlib"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetZlib } },
- { "trace"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetTrace } },
-};
+/* Source for ProcessBindingConstants.lut.h
+@begin processBindingConstantsTable
+ os processBindingConstantsGetOs PropertyCallback
+ fs processBindingConstantsGetFs PropertyCallback
+ crypto processBindingConstantsGetCrypto PropertyCallback
+ zlib processBindingConstantsGetZlib PropertyCallback
+ trace processBindingConstantsGetTrace PropertyCallback
+@end
+*/
+#include "ProcessBindingConstants.lut.h"
-const ClassInfo ProcessBindingConstants::s_info = { "ProcessBindingConstants"_s, Base::info(), nullptr, nullptr, CREATE_METHOD_TABLE(ProcessBindingConstants) };
+const ClassInfo ProcessBindingConstants::s_info = { "ProcessBindingConstants"_s, Base::info(), &processBindingConstantsTable, nullptr, CREATE_METHOD_TABLE(ProcessBindingConstants) };
ProcessBindingConstants* ProcessBindingConstants::create(VM& vm, Structure* structure)
{
@@ -1107,7 +1110,6 @@ Structure* ProcessBindingConstants::createStructure(VM& vm, JSGlobalObject* glob
void ProcessBindingConstants::finishCreation(JSC::VM& vm)
{
Base::finishCreation(vm);
- reifyStaticProperties(vm, ProcessBindingConstants::info(), ProcessBindingConstantsValues, *this);
ASSERT(inherits(vm, info()));
}
diff --git a/src/bun.js/bindings/ProcessBindingConstants.h b/src/bun.js/bindings/ProcessBindingConstants.h
index 5a9be7ce7..912cc7a3e 100644
--- a/src/bun.js/bindings/ProcessBindingConstants.h
+++ b/src/bun.js/bindings/ProcessBindingConstants.h
@@ -1,3 +1,4 @@
+#pragma once
#include "root.h"
namespace Bun {
@@ -11,6 +12,8 @@ public:
using Base = JSC::JSNonFinalObject;
+ static constexpr unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
+
static ProcessBindingConstants* create(JSC::VM& vm, JSC::Structure* structure);
static Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject);
diff --git a/src/bun.js/bindings/ProcessBindingConstants.lut.h b/src/bun.js/bindings/ProcessBindingConstants.lut.h
new file mode 100644
index 000000000..4ad86860d
--- /dev/null
+++ b/src/bun.js/bindings/ProcessBindingConstants.lut.h
@@ -0,0 +1,31 @@
+// File generated via `make static-hash-table` / `make cpp`
+static const struct CompactHashIndex processBindingConstantsTableIndex[17] = {
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 2, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 0, 16 },
+ { -1, -1 },
+ { -1, -1 },
+ { 4, -1 },
+ { 3, -1 },
+};
+
+static const struct HashTableValue processBindingConstantsTableValues[5] = {
+ { "os"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetOs } },
+ { "fs"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetFs } },
+ { "crypto"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetCrypto } },
+ { "zlib"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetZlib } },
+ { "trace"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingConstantsGetTrace } },
+};
+
+static const struct HashTable processBindingConstantsTable =
+ { 5, 15, false, nullptr, processBindingConstantsTableValues, processBindingConstantsTableIndex };
diff --git a/src/bun.js/bindings/ProcessBindingNatives.cpp b/src/bun.js/bindings/ProcessBindingNatives.cpp
new file mode 100644
index 000000000..fc481f1ae
--- /dev/null
+++ b/src/bun.js/bindings/ProcessBindingNatives.cpp
@@ -0,0 +1,131 @@
+// Modelled off of https://github.com/nodejs/node/blob/main/src/node_constants.cc
+// Note that if you change any of this code, you probably also have to change NodeConstantsModule.h
+#include "ProcessBindingNatives.h"
+#include "JavaScriptCore/ObjectConstructor.h"
+
+namespace Bun {
+using namespace JSC;
+
+static JSValue processBindingNativesGetter(VM& vm, JSObject* bindingObject)
+{
+ // Instead of actually returning our source code, we just return a dummy string.
+ // Most people just use `process.binding('natives')` to get a list of builtin modules
+ // We also don't report internal modules.
+ // If any of this breaks your package, please open an issue.
+ return jsString(vm, String("/* [native code] */"_s));
+}
+
+static JSValue processBindingNativesReturnUndefined(VM& vm, JSObject* bindingObject)
+{
+ // process.binding('natives').config === undefined
+ return jsUndefined();
+}
+
+/* Source for ProcessBindingNatives.lut.h
+@begin processBindingNativesTable
+ _http_agent processBindingNativesGetter PropertyCallback
+ _http_client processBindingNativesGetter PropertyCallback
+ _http_common processBindingNativesGetter PropertyCallback
+ _http_incoming processBindingNativesGetter PropertyCallback
+ _http_outgoing processBindingNativesGetter PropertyCallback
+ _http_server processBindingNativesGetter PropertyCallback
+ _stream_duplex processBindingNativesGetter PropertyCallback
+ _stream_passthrough processBindingNativesGetter PropertyCallback
+ _stream_readable processBindingNativesGetter PropertyCallback
+ _stream_transform processBindingNativesGetter PropertyCallback
+ _stream_wrap processBindingNativesGetter PropertyCallback
+ _stream_writable processBindingNativesGetter PropertyCallback
+ _tls_common processBindingNativesGetter PropertyCallback
+ _tls_wrap processBindingNativesGetter PropertyCallback
+ assert processBindingNativesGetter PropertyCallback
+ assert/strict processBindingNativesGetter PropertyCallback
+ async_hooks processBindingNativesGetter PropertyCallback
+ buffer processBindingNativesGetter PropertyCallback
+ child_process processBindingNativesGetter PropertyCallback
+ cluster processBindingNativesGetter PropertyCallback
+ console processBindingNativesGetter PropertyCallback
+ constants processBindingNativesGetter PropertyCallback
+ crypto processBindingNativesGetter PropertyCallback
+ dgram processBindingNativesGetter PropertyCallback
+ diagnostics_channel processBindingNativesGetter PropertyCallback
+ dns processBindingNativesGetter PropertyCallback
+ dns/promises processBindingNativesGetter PropertyCallback
+ domain processBindingNativesGetter PropertyCallback
+ events processBindingNativesGetter PropertyCallback
+ fs processBindingNativesGetter PropertyCallback
+ fs/promises processBindingNativesGetter PropertyCallback
+ http processBindingNativesGetter PropertyCallback
+ http2 processBindingNativesGetter PropertyCallback
+ https processBindingNativesGetter PropertyCallback
+ inspector processBindingNativesGetter PropertyCallback
+ inspector/promises processBindingNativesGetter PropertyCallback
+ module processBindingNativesGetter PropertyCallback
+ net processBindingNativesGetter PropertyCallback
+ os processBindingNativesGetter PropertyCallback
+ path processBindingNativesGetter PropertyCallback
+ path/posix processBindingNativesGetter PropertyCallback
+ path/win32 processBindingNativesGetter PropertyCallback
+ perf_hooks processBindingNativesGetter PropertyCallback
+ process processBindingNativesGetter PropertyCallback
+ punycode processBindingNativesGetter PropertyCallback
+ querystring processBindingNativesGetter PropertyCallback
+ readline processBindingNativesGetter PropertyCallback
+ readline/promises processBindingNativesGetter PropertyCallback
+ repl processBindingNativesGetter PropertyCallback
+ stream processBindingNativesGetter PropertyCallback
+ stream/consumers processBindingNativesGetter PropertyCallback
+ stream/promises processBindingNativesGetter PropertyCallback
+ stream/web processBindingNativesGetter PropertyCallback
+ string_decoder processBindingNativesGetter PropertyCallback
+ sys processBindingNativesGetter PropertyCallback
+ test processBindingNativesGetter PropertyCallback
+ test/reporters processBindingNativesGetter PropertyCallback
+ timers processBindingNativesGetter PropertyCallback
+ timers/promises processBindingNativesGetter PropertyCallback
+ tls processBindingNativesGetter PropertyCallback
+ trace_events processBindingNativesGetter PropertyCallback
+ tty processBindingNativesGetter PropertyCallback
+ url processBindingNativesGetter PropertyCallback
+ util processBindingNativesGetter PropertyCallback
+ util/types processBindingNativesGetter PropertyCallback
+ v8 processBindingNativesGetter PropertyCallback
+ vm processBindingNativesGetter PropertyCallback
+ wasi processBindingNativesGetter PropertyCallback
+ worker_threads processBindingNativesGetter PropertyCallback
+ zlib processBindingNativesGetter PropertyCallback
+ configs processBindingNativesReturnUndefined PropertyCallback
+@end
+*/
+#include "ProcessBindingNatives.lut.h"
+
+const ClassInfo ProcessBindingNatives::s_info = { "ProcessBindingNatives"_s, Base::info(), &processBindingNativesTable, nullptr, CREATE_METHOD_TABLE(ProcessBindingNatives) };
+
+ProcessBindingNatives* ProcessBindingNatives::create(VM& vm, Structure* structure)
+{
+ ProcessBindingNatives* obj = new (NotNull, allocateCell<ProcessBindingNatives>(vm)) ProcessBindingNatives(vm, structure);
+ obj->finishCreation(vm);
+ return obj;
+}
+
+Structure* ProcessBindingNatives::createStructure(VM& vm, JSGlobalObject* globalObject)
+{
+ return Structure::create(vm, globalObject, jsNull(), TypeInfo(ObjectType, StructureFlags), ProcessBindingNatives::info());
+}
+
+void ProcessBindingNatives::finishCreation(JSC::VM& vm)
+{
+ Base::finishCreation(vm);
+ ASSERT(inherits(vm, info()));
+}
+
+template<typename Visitor>
+void ProcessBindingNatives::visitChildrenImpl(JSCell* cell, Visitor& visitor)
+{
+ ProcessBindingNatives* thisObject = jsCast<ProcessBindingNatives*>(cell);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+ Base::visitChildren(thisObject, visitor);
+}
+
+DEFINE_VISIT_CHILDREN(ProcessBindingNatives);
+
+} // namespace Bun
diff --git a/src/bun.js/bindings/ProcessBindingNatives.h b/src/bun.js/bindings/ProcessBindingNatives.h
new file mode 100644
index 000000000..c8c1f0991
--- /dev/null
+++ b/src/bun.js/bindings/ProcessBindingNatives.h
@@ -0,0 +1,35 @@
+#pragma once
+#include "root.h"
+
+namespace Bun {
+using namespace JSC;
+
+// The object returned from process.binding('natives')
+class ProcessBindingNatives final : public JSC::JSNonFinalObject {
+public:
+ DECLARE_INFO;
+ DECLARE_VISIT_CHILDREN;
+
+ using Base = JSC::JSNonFinalObject;
+
+ static constexpr unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable;
+
+ static ProcessBindingNatives* create(JSC::VM& vm, JSC::Structure* structure);
+ static Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject);
+
+ template<typename CellType, JSC::SubspaceAccess>
+ static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
+ {
+ return &vm.plainObjectSpace();
+ }
+
+private:
+ void finishCreation(JSC::VM& vm);
+
+ ProcessBindingNatives(JSC::VM& vm, JSC::Structure* structure)
+ : Base(vm, structure)
+ {
+ }
+};
+
+} // namespace Bun
diff --git a/src/bun.js/bindings/ProcessBindingNatives.lut.h b/src/bun.js/bindings/ProcessBindingNatives.lut.h
new file mode 100644
index 000000000..2bc7e34f5
--- /dev/null
+++ b/src/bun.js/bindings/ProcessBindingNatives.lut.h
@@ -0,0 +1,339 @@
+// File generated via `make static-hash-table` / `make cpp`
+static const struct CompactHashIndex processBindingNativesTableIndex[259] = {
+ { 11, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 16, -1 },
+ { 40, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 17, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 18, -1 },
+ { -1, -1 },
+ { 59, -1 },
+ { -1, -1 },
+ { 58, -1 },
+ { 29, -1 },
+ { -1, -1 },
+ { 12, -1 },
+ { 56, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 64, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 63, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 61, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 50, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 35, -1 },
+ { 42, -1 },
+ { 55, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 66, -1 },
+ { -1, -1 },
+ { 52, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 60, -1 },
+ { -1, -1 },
+ { 41, -1 },
+ { 21, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 47, -1 },
+ { 30, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 15, -1 },
+ { 70, -1 },
+ { 26, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 54, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 51, -1 },
+ { -1, -1 },
+ { 2, -1 },
+ { 28, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 14, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 27, -1 },
+ { -1, -1 },
+ { 37, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 36, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 1, -1 },
+ { -1, -1 },
+ { 3, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 19, -1 },
+ { -1, -1 },
+ { 10, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 8, 257 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 43, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 5, -1 },
+ { -1, -1 },
+ { 62, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 57, -1 },
+ { 38, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 6, 256 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 22, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 0, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 48, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 4, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 32, -1 },
+ { -1, -1 },
+ { 31, -1 },
+ { 49, -1 },
+ { 34, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 68, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 69, -1 },
+ { 33, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 9, -1 },
+ { 44, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 23, -1 },
+ { -1, -1 },
+ { 7, -1 },
+ { 67, -1 },
+ { -1, -1 },
+ { 24, -1 },
+ { 25, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 20, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 65, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 46, -1 },
+ { -1, -1 },
+ { 45, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 13, -1 },
+ { 39, 258 },
+ { 53, -1 },
+};
+
+static const struct HashTableValue processBindingNativesTableValues[71] = {
+ { "_http_agent"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_http_client"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_http_common"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_http_incoming"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_http_outgoing"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_http_server"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_stream_duplex"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_stream_passthrough"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_stream_readable"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_stream_transform"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_stream_wrap"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_stream_writable"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_tls_common"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "_tls_wrap"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "assert"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "assert/strict"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "async_hooks"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "buffer"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "child_process"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "cluster"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "console"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "constants"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "crypto"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "dgram"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "diagnostics_channel"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "dns"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "dns/promises"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "domain"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "events"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "fs"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "fs/promises"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "http"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "http2"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "https"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "inspector"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "inspector/promises"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "module"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "net"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "os"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "path"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "path/posix"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "path/win32"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "perf_hooks"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "process"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "punycode"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "querystring"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "readline"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "readline/promises"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "repl"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "stream"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "stream/consumers"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "stream/promises"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "stream/web"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "string_decoder"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "sys"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "test"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "test/reporters"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "timers"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "timers/promises"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "tls"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "trace_events"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "tty"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "url"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "util"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "util/types"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "v8"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "vm"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "wasi"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "worker_threads"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "zlib"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesGetter } },
+ { "configs"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, processBindingNativesReturnUndefined } },
+};
+
+static const struct HashTable processBindingNativesTable =
+ { 71, 255, false, nullptr, processBindingNativesTableValues, processBindingNativesTableIndex };
diff --git a/src/bun.js/bindings/ProcessBindingUV.cpp b/src/bun.js/bindings/ProcessBindingUV.cpp
new file mode 100644
index 000000000..8173072a9
--- /dev/null
+++ b/src/bun.js/bindings/ProcessBindingUV.cpp
@@ -0,0 +1,158 @@
+#include "ProcessBindingUV.h"
+#include "ZigGlobalObject.h"
+#include "JavaScriptCore/ObjectConstructor.h"
+#include "JavaScriptCore/JSMap.h"
+#include "JavaScriptCore/JSMapInlines.h"
+
+// clang-format off
+
+#define UV_ERRNO_MAP(macro) \
+ macro(E2BIG, -7, "argument list too long") \
+ macro(EACCES, -13, "permission denied") \
+ macro(EADDRINUSE, -48, "address already in use") \
+ macro(EADDRNOTAVAIL, -49, "address not available") \
+ macro(EAFNOSUPPORT, -47, "address family not supported") \
+ macro(EAGAIN, -35, "resource temporarily unavailable") \
+ macro(EAI_ADDRFAMILY, -3000, "address family not supported") \
+ macro(EAI_AGAIN, -3001, "temporary failure") \
+ macro(EAI_BADFLAGS, -3002, "bad ai_flags value") \
+ macro(EAI_BADHINTS, -3013, "invalid value for hints") \
+ macro(EAI_CANCELED, -3003, "request canceled") \
+ macro(EAI_FAIL, -3004, "permanent failure") \
+ macro(EAI_FAMILY, -3005, "ai_family not supported") \
+ macro(EAI_MEMORY, -3006, "out of memory") \
+ macro(EAI_NODATA, -3007, "no address") \
+ macro(EAI_NONAME, -3008, "unknown node or service") \
+ macro(EAI_OVERFLOW, -3009, "argument buffer overflow") \
+ macro(EAI_PROTOCOL, -3014, "resolved protocol is unknown") \
+ macro(EAI_SERVICE, -3010, "service not available for socket type") \
+ macro(EAI_SOCKTYPE, -3011, "socket type not supported") \
+ macro(EALREADY, -37, "connection already in progress") \
+ macro(EBADF, -9, "bad file descriptor") \
+ macro(EBUSY, -16, "resource busy or locked") \
+ macro(ECANCELED, -89, "operation canceled") \
+ macro(ECHARSET, -4080, "invalid Unicode character") \
+ macro(ECONNABORTED, -53, "software caused connection abort") \
+ macro(ECONNREFUSED, -61, "connection refused") \
+ macro(ECONNRESET, -54, "connection reset by peer") \
+ macro(EDESTADDRREQ, -39, "destination address required") \
+ macro(EEXIST, -17, "file already exists") \
+ macro(EFAULT, -14, "bad address in system call argument") \
+ macro(EFBIG, -27, "file too large") \
+ macro(EHOSTUNREACH, -65, "host is unreachable") \
+ macro(EINTR, -4, "interrupted system call") \
+ macro(EINVAL, -22, "invalid argument") \
+ macro(EIO, -5, "i/o error") \
+ macro(EISCONN, -56, "socket is already connected") \
+ macro(EISDIR, -21, "illegal operation on a directory") \
+ macro(ELOOP, -62, "too many symbolic links encountered") \
+ macro(EMFILE, -24, "too many open files") \
+ macro(EMSGSIZE, -40, "message too long") \
+ macro(ENAMETOOLONG, -63, "name too long") \
+ macro(ENETDOWN, -50, "network is down") \
+ macro(ENETUNREACH, -51, "network is unreachable") \
+ macro(ENFILE, -23, "file table overflow") \
+ macro(ENOBUFS, -55, "no buffer space available") \
+ macro(ENODEV, -19, "no such device") \
+ macro(ENOENT, -2, "no such file or directory") \
+ macro(ENOMEM, -12, "not enough memory") \
+ macro(ENONET, -4056, "machine is not on the network") \
+ macro(ENOPROTOOPT, -42, "protocol not available") \
+ macro(ENOSPC, -28, "no space left on device") \
+ macro(ENOSYS, -78, "function not implemented") \
+ macro(ENOTCONN, -57, "socket is not connected") \
+ macro(ENOTDIR, -20, "not a directory") \
+ macro(ENOTEMPTY, -66, "directory not empty") \
+ macro(ENOTSOCK, -38, "socket operation on non-socket") \
+ macro(ENOTSUP, -45, "operation not supported on socket") \
+ macro(EOVERFLOW, -84, "value too large for defined data type") \
+ macro(EPERM, -1, "operation not permitted") \
+ macro(EPIPE, -32, "broken pipe") \
+ macro(EPROTO, -100, "protocol error") \
+ macro(EPROTONOSUPPORT, -43, "protocol not supported") \
+ macro(EPROTOTYPE, -41, "protocol wrong type for socket") \
+ macro(ERANGE, -34, "result too large") \
+ macro(EROFS, -30, "read-only file system") \
+ macro(ESHUTDOWN, -58, "cannot send after transport endpoint shutdown") \
+ macro(ESPIPE, -29, "invalid seek") \
+ macro(ESRCH, -3, "no such process") \
+ macro(ETIMEDOUT, -60, "connection timed out") \
+ macro(ETXTBSY, -26, "text file is busy") \
+ macro(EXDEV, -18, "cross-device link not permitted") \
+ macro(UNKNOWN, -4094, "unknown error") \
+ macro(EOF, -4095, "end of file") \
+ macro(ENXIO, -6, "no such device or address") \
+ macro(EMLINK, -31, "too many links") \
+ macro(EHOSTDOWN, -64, "host is down") \
+ macro(EREMOTEIO, -4030, "remote I/O error") \
+ macro(ENOTTY, -25, "inappropriate ioctl for device") \
+ macro(EFTYPE, -79, "inappropriate file type or format") \
+ macro(EILSEQ, -92, "illegal byte sequence") \
+ macro(ESOCKTNOSUPPORT, -44, "socket type not supported") \
+ macro(ENODATA, -96, "no data available") \
+ macro(EUNATCH, -4023, "protocol driver not attache")
+
+// clang-format on
+namespace Bun {
+namespace ProcessBindingUV {
+
+JSC_DEFINE_HOST_FUNCTION(jsErrname, (JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
+{
+ auto arg0 = callFrame->argument(0);
+ auto& vm = globalObject->vm();
+
+ // Node.js will actualy crash here, lol.
+ if (!arg0.isInt32())
+ return JSValue::encode(jsString(vm, makeString("Unknown system error "_s, arg0.toWTFString(globalObject))));
+
+ auto err = arg0.asInt32();
+ switch (err) {
+#define CASE(name, value, desc) \
+ case value: \
+ return JSValue::encode(JSC::jsString(vm, String(#name##_s)));
+
+ UV_ERRNO_MAP(CASE)
+#undef CASE
+ }
+
+ return JSValue::encode(jsString(vm, makeString("Unknown system error "_s, String::number(err))));
+}
+
+JSC_DEFINE_HOST_FUNCTION(jsGetErrorMap, (JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
+{
+ auto& vm = globalObject->vm();
+ auto map = JSC::JSMap::create(vm, globalObject->mapStructure());
+
+#define PUT_PROPERTY(name, value, desc) \
+ { \
+ auto arr = JSC::constructEmptyArray(globalObject, nullptr, 2); \
+ arr->putDirectIndex(globalObject, 0, JSC::jsString(vm, String(#name##_s))); \
+ arr->putDirectIndex(globalObject, 1, JSC::jsString(vm, String(desc##_s))); \
+ map->set(globalObject, JSC::jsNumber(value), arr); \
+ }
+
+ UV_ERRNO_MAP(PUT_PROPERTY)
+#undef PUT_PROPERTY
+
+ return JSValue::encode(map);
+}
+
+JSObject* create(VM& vm, JSGlobalObject* globalObject)
+{
+ auto bindingObject = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype(), 0);
+
+ bindingObject->putDirect(vm, JSC::Identifier::fromString(vm, "errname"_s), JSC::JSFunction::create(vm, globalObject, 1, "errname"_s, jsErrname, ImplementationVisibility::Public));
+
+#define PUT_PROPERTY(name, value, desc) \
+ bindingObject->putDirect(vm, JSC::Identifier::fromString(vm, "UV_" #name##_s), JSC::jsNumber(value));
+
+ UV_ERRNO_MAP(PUT_PROPERTY)
+#undef PUT_PROPERTY
+
+ bindingObject->putDirect(vm, JSC::Identifier::fromString(vm, "getErrorMap"_s), JSC::JSFunction::create(vm, globalObject, 0, "getErrorMap"_s, jsGetErrorMap, ImplementationVisibility::Public));
+
+ return bindingObject;
+}
+
+} // namespace ProcessBindingUV
+} // namespace Bun \ No newline at end of file
diff --git a/src/bun.js/bindings/ProcessBindingUV.h b/src/bun.js/bindings/ProcessBindingUV.h
new file mode 100644
index 000000000..4306e21f8
--- /dev/null
+++ b/src/bun.js/bindings/ProcessBindingUV.h
@@ -0,0 +1,13 @@
+#include "root.h"
+
+namespace Bun {
+namespace ProcessBindingUV {
+
+JSC_DECLARE_HOST_FUNCTION(jsErrname);
+
+JSC_DECLARE_HOST_FUNCTION(jsGetErrorMap);
+
+JSC::JSObject* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject);
+
+} // namespace ProcessBindingUV
+} // namespace Bun \ No newline at end of file
diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h
index 2c075a508..386e1ea80 100644
--- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h
+++ b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureHeader.h
@@ -1,300 +1,200 @@
JSC::Structure* JSAttributeIteratorStructure() { return m_JSAttributeIterator.getInitializedOnMainThread(this); }
- JSC::JSObject* JSAttributeIteratorConstructor() { return m_JSAttributeIterator.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSAttributeIteratorPrototype() { return m_JSAttributeIterator.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSAttributeIteratorConstructor() { return m_JSAttributeIterator.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSAttributeIteratorPrototype() { return m_JSAttributeIterator.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSAttributeIterator;
- bool hasJSAttributeIteratorSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSAttributeIteratorSetterValue;
JSC::Structure* JSBigIntStatsStructure() { return m_JSBigIntStats.getInitializedOnMainThread(this); }
- JSC::JSObject* JSBigIntStatsConstructor() { return m_JSBigIntStats.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSBigIntStatsPrototype() { return m_JSBigIntStats.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSBigIntStatsConstructor() { return m_JSBigIntStats.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSBigIntStatsPrototype() { return m_JSBigIntStats.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSBigIntStats;
- bool hasJSBigIntStatsSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSBigIntStatsSetterValue;
JSC::Structure* JSBlobStructure() { return m_JSBlob.getInitializedOnMainThread(this); }
- JSC::JSObject* JSBlobConstructor() { return m_JSBlob.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSBlobPrototype() { return m_JSBlob.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSBlobConstructor() { return m_JSBlob.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSBlobPrototype() { return m_JSBlob.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSBlob;
- bool hasJSBlobSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSBlobSetterValue;
JSC::Structure* JSBuildArtifactStructure() { return m_JSBuildArtifact.getInitializedOnMainThread(this); }
- JSC::JSObject* JSBuildArtifactConstructor() { return m_JSBuildArtifact.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSBuildArtifactPrototype() { return m_JSBuildArtifact.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSBuildArtifactConstructor() { return m_JSBuildArtifact.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSBuildArtifactPrototype() { return m_JSBuildArtifact.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSBuildArtifact;
- bool hasJSBuildArtifactSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSBuildArtifactSetterValue;
JSC::Structure* JSBuildMessageStructure() { return m_JSBuildMessage.getInitializedOnMainThread(this); }
- JSC::JSObject* JSBuildMessageConstructor() { return m_JSBuildMessage.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSBuildMessagePrototype() { return m_JSBuildMessage.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSBuildMessageConstructor() { return m_JSBuildMessage.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSBuildMessagePrototype() { return m_JSBuildMessage.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSBuildMessage;
- bool hasJSBuildMessageSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSBuildMessageSetterValue;
JSC::Structure* JSCommentStructure() { return m_JSComment.getInitializedOnMainThread(this); }
- JSC::JSObject* JSCommentConstructor() { return m_JSComment.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSCommentPrototype() { return m_JSComment.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSCommentConstructor() { return m_JSComment.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSCommentPrototype() { return m_JSComment.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSComment;
- bool hasJSCommentSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSCommentSetterValue;
JSC::Structure* JSCryptoStructure() { return m_JSCrypto.getInitializedOnMainThread(this); }
- JSC::JSObject* JSCryptoConstructor() { return m_JSCrypto.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSCryptoPrototype() { return m_JSCrypto.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSCryptoConstructor() { return m_JSCrypto.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSCryptoPrototype() { return m_JSCrypto.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSCrypto;
- bool hasJSCryptoSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSCryptoSetterValue;
JSC::Structure* JSCryptoHasherStructure() { return m_JSCryptoHasher.getInitializedOnMainThread(this); }
- JSC::JSObject* JSCryptoHasherConstructor() { return m_JSCryptoHasher.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSCryptoHasherPrototype() { return m_JSCryptoHasher.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSCryptoHasherConstructor() { return m_JSCryptoHasher.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSCryptoHasherPrototype() { return m_JSCryptoHasher.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSCryptoHasher;
- bool hasJSCryptoHasherSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSCryptoHasherSetterValue;
JSC::Structure* JSDebugHTTPSServerStructure() { return m_JSDebugHTTPSServer.getInitializedOnMainThread(this); }
- JSC::JSObject* JSDebugHTTPSServerConstructor() { return m_JSDebugHTTPSServer.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSDebugHTTPSServerPrototype() { return m_JSDebugHTTPSServer.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSDebugHTTPSServerConstructor() { return m_JSDebugHTTPSServer.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSDebugHTTPSServerPrototype() { return m_JSDebugHTTPSServer.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSDebugHTTPSServer;
- bool hasJSDebugHTTPSServerSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSDebugHTTPSServerSetterValue;
JSC::Structure* JSDebugHTTPServerStructure() { return m_JSDebugHTTPServer.getInitializedOnMainThread(this); }
- JSC::JSObject* JSDebugHTTPServerConstructor() { return m_JSDebugHTTPServer.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSDebugHTTPServerPrototype() { return m_JSDebugHTTPServer.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSDebugHTTPServerConstructor() { return m_JSDebugHTTPServer.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSDebugHTTPServerPrototype() { return m_JSDebugHTTPServer.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSDebugHTTPServer;
- bool hasJSDebugHTTPServerSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSDebugHTTPServerSetterValue;
JSC::Structure* JSDirentStructure() { return m_JSDirent.getInitializedOnMainThread(this); }
- JSC::JSObject* JSDirentConstructor() { return m_JSDirent.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSDirentPrototype() { return m_JSDirent.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSDirentConstructor() { return m_JSDirent.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSDirentPrototype() { return m_JSDirent.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSDirent;
- bool hasJSDirentSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSDirentSetterValue;
JSC::Structure* JSDocEndStructure() { return m_JSDocEnd.getInitializedOnMainThread(this); }
- JSC::JSObject* JSDocEndConstructor() { return m_JSDocEnd.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSDocEndPrototype() { return m_JSDocEnd.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSDocEndConstructor() { return m_JSDocEnd.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSDocEndPrototype() { return m_JSDocEnd.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSDocEnd;
- bool hasJSDocEndSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSDocEndSetterValue;
JSC::Structure* JSDocTypeStructure() { return m_JSDocType.getInitializedOnMainThread(this); }
- JSC::JSObject* JSDocTypeConstructor() { return m_JSDocType.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSDocTypePrototype() { return m_JSDocType.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSDocTypeConstructor() { return m_JSDocType.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSDocTypePrototype() { return m_JSDocType.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSDocType;
- bool hasJSDocTypeSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSDocTypeSetterValue;
JSC::Structure* JSElementStructure() { return m_JSElement.getInitializedOnMainThread(this); }
- JSC::JSObject* JSElementConstructor() { return m_JSElement.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSElementPrototype() { return m_JSElement.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSElementConstructor() { return m_JSElement.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSElementPrototype() { return m_JSElement.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSElement;
- bool hasJSElementSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSElementSetterValue;
JSC::Structure* JSEndTagStructure() { return m_JSEndTag.getInitializedOnMainThread(this); }
- JSC::JSObject* JSEndTagConstructor() { return m_JSEndTag.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSEndTagPrototype() { return m_JSEndTag.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSEndTagConstructor() { return m_JSEndTag.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSEndTagPrototype() { return m_JSEndTag.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSEndTag;
- bool hasJSEndTagSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSEndTagSetterValue;
JSC::Structure* JSExpectStructure() { return m_JSExpect.getInitializedOnMainThread(this); }
- JSC::JSObject* JSExpectConstructor() { return m_JSExpect.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSExpectPrototype() { return m_JSExpect.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSExpectConstructor() { return m_JSExpect.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSExpectPrototype() { return m_JSExpect.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSExpect;
- bool hasJSExpectSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectSetterValue;
JSC::Structure* JSExpectAnyStructure() { return m_JSExpectAny.getInitializedOnMainThread(this); }
- JSC::JSObject* JSExpectAnyConstructor() { return m_JSExpectAny.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSExpectAnyPrototype() { return m_JSExpectAny.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSExpectAnyConstructor() { return m_JSExpectAny.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSExpectAnyPrototype() { return m_JSExpectAny.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSExpectAny;
- bool hasJSExpectAnySetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectAnySetterValue;
JSC::Structure* JSExpectAnythingStructure() { return m_JSExpectAnything.getInitializedOnMainThread(this); }
- JSC::JSObject* JSExpectAnythingConstructor() { return m_JSExpectAnything.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSExpectAnythingPrototype() { return m_JSExpectAnything.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSExpectAnythingConstructor() { return m_JSExpectAnything.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSExpectAnythingPrototype() { return m_JSExpectAnything.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSExpectAnything;
- bool hasJSExpectAnythingSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectAnythingSetterValue;
JSC::Structure* JSExpectStringContainingStructure() { return m_JSExpectStringContaining.getInitializedOnMainThread(this); }
- JSC::JSObject* JSExpectStringContainingConstructor() { return m_JSExpectStringContaining.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSExpectStringContainingPrototype() { return m_JSExpectStringContaining.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSExpectStringContainingConstructor() { return m_JSExpectStringContaining.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSExpectStringContainingPrototype() { return m_JSExpectStringContaining.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSExpectStringContaining;
- bool hasJSExpectStringContainingSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectStringContainingSetterValue;
JSC::Structure* JSExpectStringMatchingStructure() { return m_JSExpectStringMatching.getInitializedOnMainThread(this); }
- JSC::JSObject* JSExpectStringMatchingConstructor() { return m_JSExpectStringMatching.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSExpectStringMatchingPrototype() { return m_JSExpectStringMatching.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSExpectStringMatchingConstructor() { return m_JSExpectStringMatching.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSExpectStringMatchingPrototype() { return m_JSExpectStringMatching.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSExpectStringMatching;
- bool hasJSExpectStringMatchingSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSExpectStringMatchingSetterValue;
JSC::Structure* JSFFIStructure() { return m_JSFFI.getInitializedOnMainThread(this); }
- JSC::JSObject* JSFFIConstructor() { return m_JSFFI.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSFFIPrototype() { return m_JSFFI.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSFFIConstructor() { return m_JSFFI.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSFFIPrototype() { return m_JSFFI.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSFFI;
- bool hasJSFFISetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSFFISetterValue;
JSC::Structure* JSFSWatcherStructure() { return m_JSFSWatcher.getInitializedOnMainThread(this); }
- JSC::JSObject* JSFSWatcherConstructor() { return m_JSFSWatcher.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSFSWatcherPrototype() { return m_JSFSWatcher.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSFSWatcherConstructor() { return m_JSFSWatcher.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSFSWatcherPrototype() { return m_JSFSWatcher.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSFSWatcher;
- bool hasJSFSWatcherSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSFSWatcherSetterValue;
JSC::Structure* JSFileSystemRouterStructure() { return m_JSFileSystemRouter.getInitializedOnMainThread(this); }
- JSC::JSObject* JSFileSystemRouterConstructor() { return m_JSFileSystemRouter.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSFileSystemRouterPrototype() { return m_JSFileSystemRouter.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSFileSystemRouterConstructor() { return m_JSFileSystemRouter.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSFileSystemRouterPrototype() { return m_JSFileSystemRouter.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSFileSystemRouter;
- bool hasJSFileSystemRouterSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSFileSystemRouterSetterValue;
JSC::Structure* JSHTMLRewriterStructure() { return m_JSHTMLRewriter.getInitializedOnMainThread(this); }
- JSC::JSObject* JSHTMLRewriterConstructor() { return m_JSHTMLRewriter.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSHTMLRewriterPrototype() { return m_JSHTMLRewriter.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSHTMLRewriterConstructor() { return m_JSHTMLRewriter.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSHTMLRewriterPrototype() { return m_JSHTMLRewriter.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSHTMLRewriter;
- bool hasJSHTMLRewriterSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSHTMLRewriterSetterValue;
JSC::Structure* JSHTTPSServerStructure() { return m_JSHTTPSServer.getInitializedOnMainThread(this); }
- JSC::JSObject* JSHTTPSServerConstructor() { return m_JSHTTPSServer.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSHTTPSServerPrototype() { return m_JSHTTPSServer.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSHTTPSServerConstructor() { return m_JSHTTPSServer.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSHTTPSServerPrototype() { return m_JSHTTPSServer.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSHTTPSServer;
- bool hasJSHTTPSServerSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSHTTPSServerSetterValue;
JSC::Structure* JSHTTPServerStructure() { return m_JSHTTPServer.getInitializedOnMainThread(this); }
- JSC::JSObject* JSHTTPServerConstructor() { return m_JSHTTPServer.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSHTTPServerPrototype() { return m_JSHTTPServer.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSHTTPServerConstructor() { return m_JSHTTPServer.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSHTTPServerPrototype() { return m_JSHTTPServer.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSHTTPServer;
- bool hasJSHTTPServerSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSHTTPServerSetterValue;
JSC::Structure* JSListenerStructure() { return m_JSListener.getInitializedOnMainThread(this); }
- JSC::JSObject* JSListenerConstructor() { return m_JSListener.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSListenerPrototype() { return m_JSListener.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSListenerConstructor() { return m_JSListener.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSListenerPrototype() { return m_JSListener.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSListener;
- bool hasJSListenerSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSListenerSetterValue;
JSC::Structure* JSMD4Structure() { return m_JSMD4.getInitializedOnMainThread(this); }
- JSC::JSObject* JSMD4Constructor() { return m_JSMD4.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSMD4Prototype() { return m_JSMD4.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSMD4Constructor() { return m_JSMD4.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSMD4Prototype() { return m_JSMD4.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSMD4;
- bool hasJSMD4SetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSMD4SetterValue;
JSC::Structure* JSMD5Structure() { return m_JSMD5.getInitializedOnMainThread(this); }
- JSC::JSObject* JSMD5Constructor() { return m_JSMD5.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSMD5Prototype() { return m_JSMD5.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSMD5Constructor() { return m_JSMD5.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSMD5Prototype() { return m_JSMD5.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSMD5;
- bool hasJSMD5SetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSMD5SetterValue;
JSC::Structure* JSMatchedRouteStructure() { return m_JSMatchedRoute.getInitializedOnMainThread(this); }
- JSC::JSObject* JSMatchedRouteConstructor() { return m_JSMatchedRoute.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSMatchedRoutePrototype() { return m_JSMatchedRoute.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSMatchedRouteConstructor() { return m_JSMatchedRoute.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSMatchedRoutePrototype() { return m_JSMatchedRoute.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSMatchedRoute;
- bool hasJSMatchedRouteSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSMatchedRouteSetterValue;
JSC::Structure* JSNodeJSFSStructure() { return m_JSNodeJSFS.getInitializedOnMainThread(this); }
- JSC::JSObject* JSNodeJSFSConstructor() { return m_JSNodeJSFS.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSNodeJSFSPrototype() { return m_JSNodeJSFS.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSNodeJSFSConstructor() { return m_JSNodeJSFS.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSNodeJSFSPrototype() { return m_JSNodeJSFS.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSNodeJSFS;
- bool hasJSNodeJSFSSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSNodeJSFSSetterValue;
JSC::Structure* JSRequestStructure() { return m_JSRequest.getInitializedOnMainThread(this); }
- JSC::JSObject* JSRequestConstructor() { return m_JSRequest.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSRequestPrototype() { return m_JSRequest.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSRequestConstructor() { return m_JSRequest.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSRequestPrototype() { return m_JSRequest.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSRequest;
- bool hasJSRequestSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSRequestSetterValue;
JSC::Structure* JSResolveMessageStructure() { return m_JSResolveMessage.getInitializedOnMainThread(this); }
- JSC::JSObject* JSResolveMessageConstructor() { return m_JSResolveMessage.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSResolveMessagePrototype() { return m_JSResolveMessage.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSResolveMessageConstructor() { return m_JSResolveMessage.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSResolveMessagePrototype() { return m_JSResolveMessage.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSResolveMessage;
- bool hasJSResolveMessageSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSResolveMessageSetterValue;
JSC::Structure* JSResponseStructure() { return m_JSResponse.getInitializedOnMainThread(this); }
- JSC::JSObject* JSResponseConstructor() { return m_JSResponse.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSResponsePrototype() { return m_JSResponse.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSResponseConstructor() { return m_JSResponse.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSResponsePrototype() { return m_JSResponse.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSResponse;
- bool hasJSResponseSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSResponseSetterValue;
JSC::Structure* JSSHA1Structure() { return m_JSSHA1.getInitializedOnMainThread(this); }
- JSC::JSObject* JSSHA1Constructor() { return m_JSSHA1.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSSHA1Prototype() { return m_JSSHA1.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSSHA1Constructor() { return m_JSSHA1.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSSHA1Prototype() { return m_JSSHA1.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSSHA1;
- bool hasJSSHA1SetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA1SetterValue;
JSC::Structure* JSSHA224Structure() { return m_JSSHA224.getInitializedOnMainThread(this); }
- JSC::JSObject* JSSHA224Constructor() { return m_JSSHA224.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSSHA224Prototype() { return m_JSSHA224.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSSHA224Constructor() { return m_JSSHA224.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSSHA224Prototype() { return m_JSSHA224.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSSHA224;
- bool hasJSSHA224SetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA224SetterValue;
JSC::Structure* JSSHA256Structure() { return m_JSSHA256.getInitializedOnMainThread(this); }
- JSC::JSObject* JSSHA256Constructor() { return m_JSSHA256.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSSHA256Prototype() { return m_JSSHA256.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSSHA256Constructor() { return m_JSSHA256.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSSHA256Prototype() { return m_JSSHA256.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSSHA256;
- bool hasJSSHA256SetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA256SetterValue;
JSC::Structure* JSSHA384Structure() { return m_JSSHA384.getInitializedOnMainThread(this); }
- JSC::JSObject* JSSHA384Constructor() { return m_JSSHA384.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSSHA384Prototype() { return m_JSSHA384.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSSHA384Constructor() { return m_JSSHA384.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSSHA384Prototype() { return m_JSSHA384.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSSHA384;
- bool hasJSSHA384SetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA384SetterValue;
JSC::Structure* JSSHA512Structure() { return m_JSSHA512.getInitializedOnMainThread(this); }
- JSC::JSObject* JSSHA512Constructor() { return m_JSSHA512.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSSHA512Prototype() { return m_JSSHA512.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSSHA512Constructor() { return m_JSSHA512.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSSHA512Prototype() { return m_JSSHA512.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSSHA512;
- bool hasJSSHA512SetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA512SetterValue;
JSC::Structure* JSSHA512_256Structure() { return m_JSSHA512_256.getInitializedOnMainThread(this); }
- JSC::JSObject* JSSHA512_256Constructor() { return m_JSSHA512_256.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSSHA512_256Prototype() { return m_JSSHA512_256.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSSHA512_256Constructor() { return m_JSSHA512_256.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSSHA512_256Prototype() { return m_JSSHA512_256.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSSHA512_256;
- bool hasJSSHA512_256SetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSSHA512_256SetterValue;
JSC::Structure* JSServerWebSocketStructure() { return m_JSServerWebSocket.getInitializedOnMainThread(this); }
- JSC::JSObject* JSServerWebSocketConstructor() { return m_JSServerWebSocket.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSServerWebSocketPrototype() { return m_JSServerWebSocket.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSServerWebSocketConstructor() { return m_JSServerWebSocket.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSServerWebSocketPrototype() { return m_JSServerWebSocket.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSServerWebSocket;
- bool hasJSServerWebSocketSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSServerWebSocketSetterValue;
JSC::Structure* JSStatWatcherStructure() { return m_JSStatWatcher.getInitializedOnMainThread(this); }
- JSC::JSObject* JSStatWatcherConstructor() { return m_JSStatWatcher.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSStatWatcherPrototype() { return m_JSStatWatcher.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSStatWatcherConstructor() { return m_JSStatWatcher.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSStatWatcherPrototype() { return m_JSStatWatcher.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSStatWatcher;
- bool hasJSStatWatcherSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSStatWatcherSetterValue;
JSC::Structure* JSStatsStructure() { return m_JSStats.getInitializedOnMainThread(this); }
- JSC::JSObject* JSStatsConstructor() { return m_JSStats.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSStatsPrototype() { return m_JSStats.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSStatsConstructor() { return m_JSStats.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSStatsPrototype() { return m_JSStats.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSStats;
- bool hasJSStatsSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSStatsSetterValue;
JSC::Structure* JSSubprocessStructure() { return m_JSSubprocess.getInitializedOnMainThread(this); }
- JSC::JSObject* JSSubprocessConstructor() { return m_JSSubprocess.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSSubprocessPrototype() { return m_JSSubprocess.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSSubprocessConstructor() { return m_JSSubprocess.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSSubprocessPrototype() { return m_JSSubprocess.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSSubprocess;
- bool hasJSSubprocessSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSSubprocessSetterValue;
JSC::Structure* JSTCPSocketStructure() { return m_JSTCPSocket.getInitializedOnMainThread(this); }
- JSC::JSObject* JSTCPSocketConstructor() { return m_JSTCPSocket.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSTCPSocketPrototype() { return m_JSTCPSocket.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSTCPSocketConstructor() { return m_JSTCPSocket.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSTCPSocketPrototype() { return m_JSTCPSocket.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSTCPSocket;
- bool hasJSTCPSocketSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSTCPSocketSetterValue;
JSC::Structure* JSTLSSocketStructure() { return m_JSTLSSocket.getInitializedOnMainThread(this); }
- JSC::JSObject* JSTLSSocketConstructor() { return m_JSTLSSocket.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSTLSSocketPrototype() { return m_JSTLSSocket.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSTLSSocketConstructor() { return m_JSTLSSocket.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSTLSSocketPrototype() { return m_JSTLSSocket.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSTLSSocket;
- bool hasJSTLSSocketSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSTLSSocketSetterValue;
JSC::Structure* JSTextChunkStructure() { return m_JSTextChunk.getInitializedOnMainThread(this); }
- JSC::JSObject* JSTextChunkConstructor() { return m_JSTextChunk.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSTextChunkPrototype() { return m_JSTextChunk.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSTextChunkConstructor() { return m_JSTextChunk.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSTextChunkPrototype() { return m_JSTextChunk.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSTextChunk;
- bool hasJSTextChunkSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSTextChunkSetterValue;
JSC::Structure* JSTextDecoderStructure() { return m_JSTextDecoder.getInitializedOnMainThread(this); }
- JSC::JSObject* JSTextDecoderConstructor() { return m_JSTextDecoder.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSTextDecoderPrototype() { return m_JSTextDecoder.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSTextDecoderConstructor() { return m_JSTextDecoder.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSTextDecoderPrototype() { return m_JSTextDecoder.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSTextDecoder;
- bool hasJSTextDecoderSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSTextDecoderSetterValue;
JSC::Structure* JSTimeoutStructure() { return m_JSTimeout.getInitializedOnMainThread(this); }
- JSC::JSObject* JSTimeoutConstructor() { return m_JSTimeout.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSTimeoutPrototype() { return m_JSTimeout.prototypeInitializedOnMainThread(this); }
+ JSC::JSObject* JSTimeoutConstructor() { return m_JSTimeout.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSTimeoutPrototype() { return m_JSTimeout.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_JSTimeout;
- bool hasJSTimeoutSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSTimeoutSetterValue;
JSC::Structure* JSTranspilerStructure() { return m_JSTranspiler.getInitializedOnMainThread(this); }
- JSC::JSObject* JSTranspilerConstructor() { return m_JSTranspiler.constructorInitializedOnMainThread(this); }
- JSC::JSValue JSTranspilerPrototype() { return m_JSTranspiler.prototypeInitializedOnMainThread(this); }
- JSC::LazyClassStructure m_JSTranspiler;
- bool hasJSTranspilerSetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_JSTranspilerSetterValue; \ No newline at end of file
+ JSC::JSObject* JSTranspilerConstructor() { return m_JSTranspiler.constructorInitializedOnMainThread(this); }
+ JSC::JSValue JSTranspilerPrototype() { return m_JSTranspiler.prototypeInitializedOnMainThread(this); }
+ JSC::LazyClassStructure m_JSTranspiler; \ No newline at end of file
diff --git a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h
index cb4c47ccb..b51752180 100644
--- a/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h
+++ b/src/bun.js/bindings/ZigGeneratedClasses+lazyStructureImpl.h
@@ -303,54 +303,54 @@ void GlobalObject::initGeneratedLazyClasses() {
template<typename Visitor>
void GlobalObject::visitGeneratedLazyClasses(GlobalObject *thisObject, Visitor& visitor)
{
- thisObject->m_JSAttributeIterator.visit(visitor); visitor.append(thisObject->m_JSAttributeIteratorSetterValue);
- thisObject->m_JSBigIntStats.visit(visitor); visitor.append(thisObject->m_JSBigIntStatsSetterValue);
- thisObject->m_JSBlob.visit(visitor); visitor.append(thisObject->m_JSBlobSetterValue);
- thisObject->m_JSBuildArtifact.visit(visitor); visitor.append(thisObject->m_JSBuildArtifactSetterValue);
- thisObject->m_JSBuildMessage.visit(visitor); visitor.append(thisObject->m_JSBuildMessageSetterValue);
- thisObject->m_JSComment.visit(visitor); visitor.append(thisObject->m_JSCommentSetterValue);
- thisObject->m_JSCrypto.visit(visitor); visitor.append(thisObject->m_JSCryptoSetterValue);
- thisObject->m_JSCryptoHasher.visit(visitor); visitor.append(thisObject->m_JSCryptoHasherSetterValue);
- thisObject->m_JSDebugHTTPSServer.visit(visitor); visitor.append(thisObject->m_JSDebugHTTPSServerSetterValue);
- thisObject->m_JSDebugHTTPServer.visit(visitor); visitor.append(thisObject->m_JSDebugHTTPServerSetterValue);
- thisObject->m_JSDirent.visit(visitor); visitor.append(thisObject->m_JSDirentSetterValue);
- thisObject->m_JSDocEnd.visit(visitor); visitor.append(thisObject->m_JSDocEndSetterValue);
- thisObject->m_JSDocType.visit(visitor); visitor.append(thisObject->m_JSDocTypeSetterValue);
- thisObject->m_JSElement.visit(visitor); visitor.append(thisObject->m_JSElementSetterValue);
- thisObject->m_JSEndTag.visit(visitor); visitor.append(thisObject->m_JSEndTagSetterValue);
- thisObject->m_JSExpect.visit(visitor); visitor.append(thisObject->m_JSExpectSetterValue);
- thisObject->m_JSExpectAny.visit(visitor); visitor.append(thisObject->m_JSExpectAnySetterValue);
- thisObject->m_JSExpectAnything.visit(visitor); visitor.append(thisObject->m_JSExpectAnythingSetterValue);
- thisObject->m_JSExpectStringContaining.visit(visitor); visitor.append(thisObject->m_JSExpectStringContainingSetterValue);
- thisObject->m_JSExpectStringMatching.visit(visitor); visitor.append(thisObject->m_JSExpectStringMatchingSetterValue);
- thisObject->m_JSFFI.visit(visitor); visitor.append(thisObject->m_JSFFISetterValue);
- thisObject->m_JSFSWatcher.visit(visitor); visitor.append(thisObject->m_JSFSWatcherSetterValue);
- thisObject->m_JSFileSystemRouter.visit(visitor); visitor.append(thisObject->m_JSFileSystemRouterSetterValue);
- thisObject->m_JSHTMLRewriter.visit(visitor); visitor.append(thisObject->m_JSHTMLRewriterSetterValue);
- thisObject->m_JSHTTPSServer.visit(visitor); visitor.append(thisObject->m_JSHTTPSServerSetterValue);
- thisObject->m_JSHTTPServer.visit(visitor); visitor.append(thisObject->m_JSHTTPServerSetterValue);
- thisObject->m_JSListener.visit(visitor); visitor.append(thisObject->m_JSListenerSetterValue);
- thisObject->m_JSMD4.visit(visitor); visitor.append(thisObject->m_JSMD4SetterValue);
- thisObject->m_JSMD5.visit(visitor); visitor.append(thisObject->m_JSMD5SetterValue);
- thisObject->m_JSMatchedRoute.visit(visitor); visitor.append(thisObject->m_JSMatchedRouteSetterValue);
- thisObject->m_JSNodeJSFS.visit(visitor); visitor.append(thisObject->m_JSNodeJSFSSetterValue);
- thisObject->m_JSRequest.visit(visitor); visitor.append(thisObject->m_JSRequestSetterValue);
- thisObject->m_JSResolveMessage.visit(visitor); visitor.append(thisObject->m_JSResolveMessageSetterValue);
- thisObject->m_JSResponse.visit(visitor); visitor.append(thisObject->m_JSResponseSetterValue);
- thisObject->m_JSSHA1.visit(visitor); visitor.append(thisObject->m_JSSHA1SetterValue);
- thisObject->m_JSSHA224.visit(visitor); visitor.append(thisObject->m_JSSHA224SetterValue);
- thisObject->m_JSSHA256.visit(visitor); visitor.append(thisObject->m_JSSHA256SetterValue);
- thisObject->m_JSSHA384.visit(visitor); visitor.append(thisObject->m_JSSHA384SetterValue);
- thisObject->m_JSSHA512.visit(visitor); visitor.append(thisObject->m_JSSHA512SetterValue);
- thisObject->m_JSSHA512_256.visit(visitor); visitor.append(thisObject->m_JSSHA512_256SetterValue);
- thisObject->m_JSServerWebSocket.visit(visitor); visitor.append(thisObject->m_JSServerWebSocketSetterValue);
- thisObject->m_JSStatWatcher.visit(visitor); visitor.append(thisObject->m_JSStatWatcherSetterValue);
- thisObject->m_JSStats.visit(visitor); visitor.append(thisObject->m_JSStatsSetterValue);
- thisObject->m_JSSubprocess.visit(visitor); visitor.append(thisObject->m_JSSubprocessSetterValue);
- thisObject->m_JSTCPSocket.visit(visitor); visitor.append(thisObject->m_JSTCPSocketSetterValue);
- thisObject->m_JSTLSSocket.visit(visitor); visitor.append(thisObject->m_JSTLSSocketSetterValue);
- thisObject->m_JSTextChunk.visit(visitor); visitor.append(thisObject->m_JSTextChunkSetterValue);
- thisObject->m_JSTextDecoder.visit(visitor); visitor.append(thisObject->m_JSTextDecoderSetterValue);
- thisObject->m_JSTimeout.visit(visitor); visitor.append(thisObject->m_JSTimeoutSetterValue);
- thisObject->m_JSTranspiler.visit(visitor); visitor.append(thisObject->m_JSTranspilerSetterValue);
+ thisObject->m_JSAttributeIterator.visit(visitor);
+ thisObject->m_JSBigIntStats.visit(visitor);
+ thisObject->m_JSBlob.visit(visitor);
+ thisObject->m_JSBuildArtifact.visit(visitor);
+ thisObject->m_JSBuildMessage.visit(visitor);
+ thisObject->m_JSComment.visit(visitor);
+ thisObject->m_JSCrypto.visit(visitor);
+ thisObject->m_JSCryptoHasher.visit(visitor);
+ thisObject->m_JSDebugHTTPSServer.visit(visitor);
+ thisObject->m_JSDebugHTTPServer.visit(visitor);
+ thisObject->m_JSDirent.visit(visitor);
+ thisObject->m_JSDocEnd.visit(visitor);
+ thisObject->m_JSDocType.visit(visitor);
+ thisObject->m_JSElement.visit(visitor);
+ thisObject->m_JSEndTag.visit(visitor);
+ thisObject->m_JSExpect.visit(visitor);
+ thisObject->m_JSExpectAny.visit(visitor);
+ thisObject->m_JSExpectAnything.visit(visitor);
+ thisObject->m_JSExpectStringContaining.visit(visitor);
+ thisObject->m_JSExpectStringMatching.visit(visitor);
+ thisObject->m_JSFFI.visit(visitor);
+ thisObject->m_JSFSWatcher.visit(visitor);
+ thisObject->m_JSFileSystemRouter.visit(visitor);
+ thisObject->m_JSHTMLRewriter.visit(visitor);
+ thisObject->m_JSHTTPSServer.visit(visitor);
+ thisObject->m_JSHTTPServer.visit(visitor);
+ thisObject->m_JSListener.visit(visitor);
+ thisObject->m_JSMD4.visit(visitor);
+ thisObject->m_JSMD5.visit(visitor);
+ thisObject->m_JSMatchedRoute.visit(visitor);
+ thisObject->m_JSNodeJSFS.visit(visitor);
+ thisObject->m_JSRequest.visit(visitor);
+ thisObject->m_JSResolveMessage.visit(visitor);
+ thisObject->m_JSResponse.visit(visitor);
+ thisObject->m_JSSHA1.visit(visitor);
+ thisObject->m_JSSHA224.visit(visitor);
+ thisObject->m_JSSHA256.visit(visitor);
+ thisObject->m_JSSHA384.visit(visitor);
+ thisObject->m_JSSHA512.visit(visitor);
+ thisObject->m_JSSHA512_256.visit(visitor);
+ thisObject->m_JSServerWebSocket.visit(visitor);
+ thisObject->m_JSStatWatcher.visit(visitor);
+ thisObject->m_JSStats.visit(visitor);
+ thisObject->m_JSSubprocess.visit(visitor);
+ thisObject->m_JSTCPSocket.visit(visitor);
+ thisObject->m_JSTLSSocket.visit(visitor);
+ thisObject->m_JSTextChunk.visit(visitor);
+ thisObject->m_JSTextDecoder.visit(visitor);
+ thisObject->m_JSTimeout.visit(visitor);
+ thisObject->m_JSTranspiler.visit(visitor);
} \ No newline at end of file
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp
index c10282f3c..2f75a7f55 100644
--- a/src/bun.js/bindings/ZigGlobalObject.cpp
+++ b/src/bun.js/bindings/ZigGlobalObject.cpp
@@ -126,6 +126,8 @@
#include "JSDOMFile.h"
+#include "ProcessBindingConstants.h"
+
#if ENABLE(REMOTE_INSPECTOR)
#include "JavaScriptCore/RemoteInspectorServer.h"
#endif
@@ -227,6 +229,10 @@ static bool has_loaded_jsc = false;
Structure* createMemoryFootprintStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject);
+namespace Bun {
+extern JSC::EncodedJSValue Process_functionInternalGetWindowSize(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame);
+}
+
namespace WebCore {
class Base64Utilities {
public:
@@ -629,69 +635,17 @@ extern "C" bool Zig__GlobalObject__resetModuleRegistryMap(JSC__JSGlobalObject* g
return true;
}
-#define BUN_LAZY_GETTER_FN_NAME(GetterName) BunLazyGetter##GetterName##_getter
-
-#define DEFINE_BUN_LAZY_GETTER(GetterName, __propertyName) \
- JSC_DEFINE_CUSTOM_GETTER(GetterName, \
- (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, \
- JSC::PropertyName)) \
- { \
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject); \
- return JSC::JSValue::encode(thisObject->__propertyName()); \
- }
-
-#define GENERATED_CONSTRUCTOR_GETTER(ConstructorName) \
- JSC_DECLARE_CUSTOM_GETTER(ConstructorName##_getter); \
- JSC_DEFINE_CUSTOM_GETTER(ConstructorName##_getter, \
- (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, \
- JSC::PropertyName)) \
- { \
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject); \
- if (JSValue override = thisObject->m_##ConstructorName##SetterValue.get()) { \
- return JSC::JSValue::encode(override); \
- } \
- return JSC::JSValue::encode( \
- thisObject->ConstructorName##Constructor()); \
- }
-
-#define GENERATED_CONSTRUCTOR_SETTER(ConstructorName) \
- JSC_DECLARE_CUSTOM_SETTER(ConstructorName##_setter); \
- JSC_DEFINE_CUSTOM_SETTER(ConstructorName##_setter, \
- (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, \
- EncodedJSValue value, JSC::PropertyName)) \
- { \
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject); \
- thisObject->m_##ConstructorName##SetterValue.set(thisObject->vm(), thisObject, JSValue::decode(value)); \
- return true; \
- }
-
-#define WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ConstructorName) \
- JSC_DECLARE_CUSTOM_GETTER(ConstructorName##_getter); \
- JSC_DEFINE_CUSTOM_GETTER(ConstructorName##_getter, \
- (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, \
- JSC::PropertyName)) \
- { \
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject); \
- if (JSValue override = thisObject->m_##ConstructorName##SetterValue.get()) { \
- return JSC::JSValue::encode(override); \
- } \
- return JSC::JSValue::encode( \
- WebCore::ConstructorName::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject)); \
- }
-
-#define WEBCORE_GENERATED_CONSTRUCTOR_SETTER(ConstructorName) \
- JSC_DECLARE_CUSTOM_SETTER(ConstructorName##_setter); \
- JSC_DEFINE_CUSTOM_SETTER(ConstructorName##_setter, \
- (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, \
- EncodedJSValue value, JSC::PropertyName)) \
- { \
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject); \
- thisObject->m_##ConstructorName##SetterValue.set(thisObject->vm(), thisObject, JSValue::decode(value)); \
- return true; \
- }
-
-#define PUT_WEBCORE_GENERATED_CONSTRUCTOR(name, ConstructorName) \
- putDirectCustomAccessor(vm, JSC::PropertyName(JSC::Identifier::fromString(vm, name)), JSC::CustomGetterSetter::create(vm, ConstructorName##_getter, ConstructorName##_setter), 0)
+#define WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ConstructorName) \
+ JSValue ConstructorName##ConstructorCallback(VM& vm, JSObject* lexicalGlobalObject) \
+ { \
+ return WebCore::JS##ConstructorName::getConstructor(vm, JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject)); \
+ } \
+ JSC_DEFINE_CUSTOM_GETTER(ConstructorName##_getter, \
+ (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, \
+ JSC::PropertyName)) \
+ { \
+ return JSC::JSValue::encode(WebCore::JS##ConstructorName::getConstructor(lexicalGlobalObject->vm(), JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject))); \
+ }
String GlobalObject::defaultAgentClusterID()
{
@@ -710,9 +664,6 @@ namespace Zig {
using namespace WebCore;
-const JSC::ClassInfo GlobalObject::s_info = { "GlobalObject"_s, &Base::s_info, nullptr, nullptr,
- CREATE_METHOD_TABLE(GlobalObject) };
-
static JSGlobalObject* deriveShadowRealmGlobalObject(JSGlobalObject* globalObject)
{
auto& vm = globalObject->vm();
@@ -855,7 +806,7 @@ void GlobalObject::setConsole(void* console)
#pragma mark - Globals
-JSC_DEFINE_CUSTOM_GETTER(globalGetterOnMessage,
+JSC_DEFINE_CUSTOM_GETTER(globalOnMessage,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::PropertyName))
{
@@ -863,7 +814,7 @@ JSC_DEFINE_CUSTOM_GETTER(globalGetterOnMessage,
return JSValue::encode(eventHandlerAttribute(thisObject->eventTarget(), eventNames().messageEvent, thisObject->world()));
}
-JSC_DEFINE_CUSTOM_GETTER(globalGetterOnError,
+JSC_DEFINE_CUSTOM_GETTER(globalOnError,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::PropertyName))
{
@@ -871,7 +822,7 @@ JSC_DEFINE_CUSTOM_GETTER(globalGetterOnError,
return JSValue::encode(eventHandlerAttribute(thisObject->eventTarget(), eventNames().errorEvent, thisObject->world()));
}
-JSC_DEFINE_CUSTOM_SETTER(globalSetterOnMessage,
+JSC_DEFINE_CUSTOM_SETTER(setGlobalOnMessage,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue encodedValue, JSC::PropertyName property))
{
@@ -884,7 +835,7 @@ JSC_DEFINE_CUSTOM_SETTER(globalSetterOnMessage,
return true;
}
-JSC_DEFINE_CUSTOM_SETTER(globalSetterOnError,
+JSC_DEFINE_CUSTOM_SETTER(setGlobalOnError,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::EncodedJSValue encodedValue, JSC::PropertyName property))
{
@@ -902,8 +853,6 @@ WebCore::EventTarget& GlobalObject::eventTarget()
return globalEventScope;
}
-JSC_DECLARE_CUSTOM_GETTER(functionLazyLoadStreamPrototypeMap_getter);
-
JSC_DEFINE_CUSTOM_GETTER(functionLazyLoadStreamPrototypeMap_getter,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::PropertyName))
@@ -913,157 +862,50 @@ JSC_DEFINE_CUSTOM_GETTER(functionLazyLoadStreamPrototypeMap_getter,
thisObject->readableStreamNativeMap());
}
-JSC_DECLARE_CUSTOM_GETTER(JSDOMURL_getter);
-
-JSC_DEFINE_CUSTOM_GETTER(JSDOMURL_getter,
- (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
- JSC::PropertyName))
-{
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
- return JSC::JSValue::encode(
- WebCore::JSDOMURL::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject));
-}
-
-JSC_DEFINE_CUSTOM_GETTER(JSBuffer_privateGetter,
- (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
- JSC::PropertyName))
-{
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
- return JSC::JSValue::encode(
- thisObject->JSBufferConstructor());
-}
-
-GENERATED_CONSTRUCTOR_GETTER(JSBuffer);
-GENERATED_CONSTRUCTOR_SETTER(JSBuffer);
-
-GENERATED_CONSTRUCTOR_GETTER(JSTextDecoder);
-GENERATED_CONSTRUCTOR_SETTER(JSTextDecoder);
-
-GENERATED_CONSTRUCTOR_GETTER(JSResponse);
-GENERATED_CONSTRUCTOR_SETTER(JSResponse);
-
-GENERATED_CONSTRUCTOR_GETTER(JSRequest);
-GENERATED_CONSTRUCTOR_SETTER(JSRequest);
-
-GENERATED_CONSTRUCTOR_GETTER(JSBlob);
-GENERATED_CONSTRUCTOR_SETTER(JSBlob);
-
-GENERATED_CONSTRUCTOR_GETTER(JSHTMLRewriter);
-GENERATED_CONSTRUCTOR_SETTER(JSHTMLRewriter);
-
-GENERATED_CONSTRUCTOR_GETTER(JSCrypto);
-GENERATED_CONSTRUCTOR_SETTER(JSCrypto);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSMessageEvent);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSMessageEvent);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSWebSocket);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSWebSocket);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSFetchHeaders);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSFetchHeaders);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSTextEncoder);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSTextEncoder);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSURLSearchParams);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSURLSearchParams);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSDOMFormData);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSDOMFormData);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSWorker);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSWorker);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSMessageChannel);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSMessageChannel);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSMessagePort);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSMessagePort);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSBroadcastChannel);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSBroadcastChannel);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSEvent);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSEvent);
-
-JSC_DECLARE_CUSTOM_GETTER(JSEvent_getter);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSDOMException);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSDOMException);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSEventTarget);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSEventTarget);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSCustomEvent);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSCustomEvent);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSErrorEvent);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSErrorEvent);
-
-WEBCORE_GENERATED_CONSTRUCTOR_GETTER(JSCloseEvent);
-WEBCORE_GENERATED_CONSTRUCTOR_SETTER(JSCloseEvent);
-
-JSC_DECLARE_CUSTOM_GETTER(JSDOMAbortController_getter);
-
-JSC_DEFINE_CUSTOM_GETTER(JSDOMAbortController_getter,
- (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
- JSC::PropertyName))
-{
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
- return JSC::JSValue::encode(
- WebCore::JSAbortController::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject));
-}
-
-JSC_DECLARE_CUSTOM_GETTER(JSDOMAbortSignal_getter);
-
-JSC_DEFINE_CUSTOM_GETTER(JSDOMAbortSignal_getter,
+JSC_DEFINE_CUSTOM_GETTER(JSBuffer_getter,
(JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
JSC::PropertyName))
{
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
- return JSC::JSValue::encode(
- WebCore::JSAbortSignal::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject));
-}
-
-static JSC_DECLARE_CUSTOM_SETTER(property_lazyProcessSetter);
-static JSC_DECLARE_CUSTOM_GETTER(property_lazyProcessGetter);
-
-JSC_DEFINE_CUSTOM_SETTER(property_lazyProcessSetter,
- (JSC::JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue,
- JSC::EncodedJSValue value, JSC::PropertyName))
-{
- return false;
-}
-
-JSC_DEFINE_CUSTOM_GETTER(property_lazyProcessGetter,
- (JSC::JSGlobalObject * _globalObject, JSC::EncodedJSValue thisValue,
- JSC::PropertyName))
-{
- Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(_globalObject);
-
- JSC::VM& vm = globalObject->vm();
- auto clientData = WebCore::clientData(vm);
- return JSC::JSValue::encode(
- globalObject->processObject());
-}
-
-JSC_DEFINE_CUSTOM_GETTER(property_lazyCryptoGetter,
- (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue,
- JSC::PropertyName property))
-{
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(JSValue::decode(thisValue));
- JSValue cryptoObject = thisObject->cryptoObject();
- thisObject->putDirect(thisObject->vm(), property, cryptoObject, 0);
- return JSValue::encode(cryptoObject);
-}
-
-JSC_DEFINE_CUSTOM_SETTER(lazyProcessEnvSetter,
- (JSC::JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue,
- JSC::EncodedJSValue value, JSC::PropertyName))
-{
- return false;
-}
+ return JSC::JSValue::encode(JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject)->JSBufferConstructor());
+}
+
+// This macro defines the getter needed for ZigGlobalObject.lut.h
+// "<ClassName>ConstructorCallback" is a PropertyCallback
+// it also defines "<ClassName>_getter" which is the getter for a JSC::CustomGetterSetter
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(AbortController);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(AbortSignal);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(BroadcastChannel);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ByteLengthQueuingStrategy)
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(CloseEvent);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(CountQueuingStrategy)
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(CryptoKey);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(CustomEvent);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(DOMException);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(DOMFormData);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(DOMURL);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ErrorEvent);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(Event);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(EventTarget);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(FetchHeaders);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(MessageChannel);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(MessageEvent);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(MessagePort);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ReadableByteStreamController)
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ReadableStream)
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ReadableStreamBYOBReader)
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ReadableStreamBYOBRequest)
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ReadableStreamDefaultController)
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(ReadableStreamDefaultReader)
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(SubtleCrypto);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(TextEncoder);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(TransformStream)
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(TransformStreamDefaultController)
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(URLSearchParams);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(WebSocket);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(Worker);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(WritableStream);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(WritableStreamDefaultController);
+WEBCORE_GENERATED_CONSTRUCTOR_GETTER(WritableStreamDefaultWriter);
JSC_DEFINE_HOST_FUNCTION(functionGetSelf,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
@@ -1077,15 +919,6 @@ JSC_DEFINE_HOST_FUNCTION(functionSetSelf,
return JSC::JSValue::encode(jsUndefined());
}
-JSC_DEFINE_CUSTOM_GETTER(lazyProcessEnvGetter,
- (JSC::JSGlobalObject * _globalObject, JSC::EncodedJSValue thisValue,
- JSC::PropertyName))
-{
- Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(_globalObject);
- return JSC::JSValue::encode(
- globalObject->processEnvObject());
-}
-
JSC_DEFINE_HOST_FUNCTION(functionQueueMicrotask,
(JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
{
@@ -1674,15 +1507,6 @@ enum ReadableStreamTag : int32_t {
Bytes = 4,
};
-JSC_DEFINE_HOST_FUNCTION(functionCallNotImplemented,
- (JSC::JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
-{
- auto& vm = globalObject->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
- throwTypeError(globalObject, scope, "Not implemented yet in Bun :("_s);
- return JSC::JSValue::encode(JSC::JSValue {});
-}
-
JSC_DEFINE_HOST_FUNCTION(jsReceiveMessageOnPort, (JSGlobalObject * lexicalGlobalObject, CallFrame* callFrame))
{
auto& vm = lexicalGlobalObject->vm();
@@ -1711,8 +1535,6 @@ JSC_DEFINE_HOST_FUNCTION(jsReceiveMessageOnPort, (JSGlobalObject * lexicalGlobal
return JSC::JSValue::encode(jsUndefined());
}
-extern JSC::EncodedJSValue Process_functionInternalGetWindowSize(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame);
-
// we're trying out a new way to do this lazy loading
// this is $lazy() in js code
static JSC_DEFINE_HOST_FUNCTION(functionLazyLoad,
@@ -1867,10 +1689,6 @@ static JSC_DEFINE_HOST_FUNCTION(functionLazyLoad,
return JSValue::encode(obj);
}
- if (string == "masqueradesAsUndefined"_s) {
- return JSValue::encode(InternalFunction::createFunctionThatMasqueradesAsUndefined(vm, globalObject, 0, String(), functionCallNotImplemented));
- }
-
if (string == "vm"_s) {
auto* obj = constructEmptyObject(globalObject);
obj->putDirect(
@@ -1911,7 +1729,7 @@ static JSC_DEFINE_HOST_FUNCTION(functionLazyLoad,
obj->putDirect(vm, PropertyName(Identifier::fromString(vm, "isatty"_s)), JSFunction::create(vm, globalObject, 0, "isatty"_s, jsFunctionTty_isatty, ImplementationVisibility::Public), 1);
- obj->putDirect(vm, PropertyName(Identifier::fromString(vm, "getWindowSize"_s)), JSFunction::create(vm, globalObject, 0, "getWindowSize"_s, Process_functionInternalGetWindowSize, ImplementationVisibility::Public), 2);
+ obj->putDirect(vm, PropertyName(Identifier::fromString(vm, "getWindowSize"_s)), JSFunction::create(vm, globalObject, 0, "getWindowSize"_s, Bun::Process_functionInternalGetWindowSize, ImplementationVisibility::Public), 2);
return JSValue::encode(obj);
}
@@ -2011,163 +1829,6 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionDispatchEvent, (JSGlobalObject * lexicalGloba
return jsFunctionDispatchEventBody(lexicalGlobalObject, callFrame, jsDynamicCast<Zig::GlobalObject*>(lexicalGlobalObject));
}
-static inline JSValue jsServiceWorkerGlobalScope_ByteLengthQueuingStrategyConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSByteLengthQueuingStrategy::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_ByteLengthQueuingStrategyConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_ByteLengthQueuingStrategyConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_CountQueuingStrategyConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSCountQueuingStrategy::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_CountQueuingStrategyConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_CountQueuingStrategyConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_ReadableByteStreamControllerConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSReadableByteStreamController::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_ReadableByteStreamControllerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_ReadableByteStreamControllerConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_ReadableStreamConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSReadableStream::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_ReadableStreamConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_ReadableStreamConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_ReadableStreamBYOBReaderConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSReadableStreamBYOBReader::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_ReadableStreamBYOBReaderConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_ReadableStreamBYOBReaderConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_ReadableStreamBYOBRequestConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSReadableStreamBYOBRequest::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_ReadableStreamBYOBRequestConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_ReadableStreamBYOBRequestConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_ReadableStreamDefaultControllerConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSReadableStreamDefaultController::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_ReadableStreamDefaultControllerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_ReadableStreamDefaultControllerConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_ReadableStreamDefaultReaderConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSReadableStreamDefaultReader::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_ReadableStreamDefaultReaderConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_ReadableStreamDefaultReaderConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_TransformStreamConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSTransformStream::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_TransformStreamConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_TransformStreamConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_TransformStreamDefaultControllerConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSTransformStreamDefaultController::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_TransformStreamDefaultControllerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_TransformStreamDefaultControllerConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_WritableStreamConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSWritableStream::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_WritableStreamConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_WritableStreamConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_WritableStreamDefaultControllerConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSWritableStreamDefaultController::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_WritableStreamDefaultControllerConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_WritableStreamDefaultControllerConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-static inline JSValue jsServiceWorkerGlobalScope_WritableStreamDefaultWriterConstructorGetter(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- return JSWritableStreamDefaultWriter::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(jsServiceWorkerGlobalScope_WritableStreamDefaultWriterConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- return IDLAttribute<Zig::GlobalObject>::get<jsServiceWorkerGlobalScope_WritableStreamDefaultWriterConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
-}
-
-JSC_DEFINE_CUSTOM_GETTER(getterSubtleCryptoConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
- return JSValue::encode(
- JSSubtleCrypto::getConstructor(thisObject->vm(), thisObject));
-}
-
-JSC_DEFINE_CUSTOM_GETTER(getterCryptoKeyConstructor, (JSGlobalObject * lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
-{
- Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject);
- return JSValue::encode(
- JSCryptoKey::getConstructor(thisObject->vm(), thisObject));
-}
-
static inline JSValue getterSubtleCryptoBody(JSGlobalObject& lexicalGlobalObject, Zig::GlobalObject& thisObject)
{
UNUSED_PARAM(lexicalGlobalObject);
@@ -2187,6 +1848,7 @@ JSC_DECLARE_HOST_FUNCTION(createWritableStreamFromInternal);
JSC_DECLARE_HOST_FUNCTION(getInternalWritableStream);
JSC_DECLARE_HOST_FUNCTION(whenSignalAborted);
JSC_DECLARE_HOST_FUNCTION(isAbortSignal);
+
JSC_DEFINE_HOST_FUNCTION(makeThisTypeErrorForBuiltins, (JSGlobalObject * globalObject, CallFrame* callFrame))
{
ASSERT(callFrame);
@@ -2915,7 +2577,7 @@ JSC_DEFINE_HOST_FUNCTION(errorConstructorFuncCaptureStackTrace, (JSC::JSGlobalOb
// Create the call sites (one per frame)
GlobalObject::createCallSitesFromFrames(lexicalGlobalObject, stackTrace, callSites);
- /* Foramt the stack trace.
+ /* Format the stack trace.
* Note that v8 won't actually format the stack trace here, but will create a "stack" accessor
* on the error object, which will format the stack trace on the first access. For now, since
* we're not being used internally by JSC, we can assume callers of Error.captureStackTrace in
@@ -3199,8 +2861,7 @@ void GlobalObject::finishCreation(VM& vm)
#endif
obj->putDirect(init.vm, hardwareConcurrencyIdentifier, JSC::jsNumber(cpuCount));
- init.set(
- obj);
+ init.set(obj);
});
this->m_pendingVirtualModuleResultStructure.initLater(
@@ -3208,6 +2869,11 @@ void GlobalObject::finishCreation(VM& vm)
init.set(Bun::PendingVirtualModuleResult::createStructure(init.vm, init.owner, init.owner->objectPrototype()));
});
+ m_bunObject.initLater(
+ [](const JSC::LazyProperty<JSC::JSGlobalObject, JSObject>::Initializer& init) {
+ init.set(Bun::createBunObject(init.vm, init.owner));
+ });
+
this->initGeneratedLazyClasses();
m_cachedGlobalObjectStructure.initLater(
@@ -3281,8 +2947,8 @@ void GlobalObject::finishCreation(VM& vm)
m_processObject.initLater(
[](const JSC::LazyProperty<JSC::JSGlobalObject, JSC::JSObject>::Initializer& init) {
Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(init.owner);
- auto* process = Zig::Process::create(
- *globalObject, Zig::Process::createStructure(init.vm, init.owner, WebCore::JSEventEmitter::prototype(init.vm, *globalObject)));
+ auto* process = Bun::Process::create(
+ *globalObject, Bun::Process::createStructure(init.vm, init.owner, WebCore::JSEventEmitter::prototype(init.vm, *globalObject)));
init.set(process);
});
@@ -3342,7 +3008,7 @@ void GlobalObject::finishCreation(VM& vm)
});
m_processBindingConstants.initLater(
- [](const JSC::LazyProperty<JSC::JSGlobalObject, Bun::ProcessBindingConstants>::Initializer& init) {
+ [](const JSC::LazyProperty<JSC::JSGlobalObject, JSC::JSObject>::Initializer& init) {
init.set(
ProcessBindingConstants::create(
init.vm,
@@ -3624,31 +3290,11 @@ static JSC_DEFINE_HOST_FUNCTION(functionSetImmediate,
return Bun__Timer__setTimeout(globalObject, JSC::JSValue::encode(job), JSC::JSValue::encode(jsNumber(0)), JSValue::encode(arguments));
}
-JSC_DEFINE_CUSTOM_GETTER(JSModuleLoader_getter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName))
-{
- return JSValue::encode(globalObject->moduleLoader());
-}
-
-JSC_DEFINE_CUSTOM_GETTER(functionResolveMessageGetter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName))
-{
- return JSValue::encode(reinterpret_cast<Zig::GlobalObject*>(globalObject)->JSResolveMessageConstructor());
-}
-JSC_DEFINE_CUSTOM_GETTER(functionBuildMessageGetter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName))
-{
- return JSValue::encode(reinterpret_cast<Zig::GlobalObject*>(globalObject)->JSBuildMessageConstructor());
-}
-
-JSC_DEFINE_CUSTOM_GETTER(
- EventSource_getter, (JSGlobalObject * globalObject, EncodedJSValue thisValue, PropertyName property))
+JSValue getEventSourceConstructor(VM& vm, JSObject* thisObject)
{
- auto& vm = globalObject->vm();
+ auto globalObject = jsCast<Zig::GlobalObject*>(thisObject);
auto scope = DECLARE_THROW_SCOPE(vm);
- // If "this" is not the Global object, just return undefined
- // you should not be able to reset the global object's EventSource if you muck around with prototypes
- if (JSValue::decode(thisValue) != globalObject)
- return JSValue::encode(JSC::jsUndefined());
-
JSC::JSFunction* getSourceEvent = JSC::JSFunction::create(vm, eventSourceGetEventSourceCodeGenerator(vm), globalObject);
RETURN_IF_EXCEPTION(scope, {});
@@ -3665,26 +3311,7 @@ JSC_DEFINE_CUSTOM_GETTER(
throwException(globalObject, scope, returnedException.get());
}
- RETURN_IF_EXCEPTION(scope, {});
-
- if (LIKELY(result)) {
- globalObject->putDirect(vm, property, result, 0);
- }
-
- RELEASE_AND_RETURN(scope, JSValue::encode(result));
-}
-
-JSC_DEFINE_CUSTOM_SETTER(EventSource_setter,
- (JSC::JSGlobalObject * globalObject, JSC::EncodedJSValue thisValue,
- JSC::EncodedJSValue value, JSC::PropertyName property))
-{
- if (JSValue::decode(thisValue) != globalObject) {
- return false;
- }
-
- auto& vm = globalObject->vm();
- globalObject->putDirect(vm, property, JSValue::decode(value), 0);
- return true;
+ RELEASE_AND_RETURN(scope, result);
}
EncodedJSValue GlobalObject::assignToStream(JSValue stream, JSValue controller)
@@ -3779,6 +3406,19 @@ extern "C" EncodedJSValue WebCore__alert(JSC::JSGlobalObject*, JSC::CallFrame*);
extern "C" EncodedJSValue WebCore__prompt(JSC::JSGlobalObject*, JSC::CallFrame*);
extern "C" EncodedJSValue WebCore__confirm(JSC::JSGlobalObject*, JSC::CallFrame*);
+JSValue GlobalObject_getPerformanceObject(VM& vm, JSObject* globalObject)
+{
+ return static_cast<Zig::GlobalObject*>(globalObject)->performanceObject();
+}
+
+JSValue GlobalObject_getGlobalThis(VM& vm, JSObject* globalObject)
+{
+ return static_cast<Zig::GlobalObject*>(globalObject)->globalThis();
+}
+
+// This is like `putDirectBuiltinFunction` but for the global static list.
+#define globalBuiltinFunction(vm, globalObject, identifier, function, attributes) JSC::JSGlobalObject::GlobalPropertyInfo(identifier, JSFunction::create(vm, function, globalObject), attributes)
+
void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
{
m_builtinInternalFunctions.initialize(*this);
@@ -3788,12 +3428,9 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
// ----- Private/Static Properties -----
- JSValue bunObject = Bun::createBunObject(this);
auto $lazy = JSC::JSFunction::create(vm, this, 0, "$lazy"_s, functionLazyLoad, ImplementationVisibility::Public);
GlobalPropertyInfo staticGlobals[] = {
- GlobalPropertyInfo { builtinNames.BunPublicName(), bunObject, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontDelete | 0 },
-
GlobalPropertyInfo { builtinNames.startDirectStreamPrivateName(),
JSC::JSFunction::create(vm, this, 1,
String(), functionStartDirectStream, ImplementationVisibility::Public),
@@ -3829,6 +3466,7 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
addStaticGlobals(staticGlobals, std::size(staticGlobals));
// TODO: most/all of these private properties can be made as static globals.
+ // i've noticed doing it as is will work somewhat but getDirect() wont be able to find them
putDirectBuiltinFunction(vm, this, builtinNames.createFIFOPrivateName(), streamInternalsCreateFIFOCodeGenerator(vm), PropertyAttribute::Builtin | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);
putDirectBuiltinFunction(vm, this, builtinNames.createEmptyReadableStreamPrivateName(), readableStreamCreateEmptyReadableStreamCodeGenerator(vm), PropertyAttribute::Builtin | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);
@@ -3857,25 +3495,25 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
NoIntrinsic,
JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::Function | JSC::PropertyAttribute::DontDelete | 0);
- putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().BufferPrivateName(), JSC::CustomGetterSetter::create(vm, JSBuffer_privateGetter, nullptr), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
-
+ putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().BufferPrivateName(), JSC::CustomGetterSetter::create(vm, JSBuffer_getter, nullptr), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
putDirectCustomAccessor(vm, builtinNames.lazyStreamPrototypeMapPrivateName(), JSC::CustomGetterSetter::create(vm, functionLazyLoadStreamPrototypeMap_getter, nullptr), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | 0);
- putDirectCustomAccessor(vm, builtinNames.TransformStreamPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_TransformStreamConstructor, nullptr), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum)));
- putDirectCustomAccessor(vm, builtinNames.TransformStreamDefaultControllerPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_TransformStreamDefaultControllerConstructor, nullptr), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum)));
- putDirectCustomAccessor(vm, builtinNames.TransformStreamDefaultControllerPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_TransformStreamDefaultControllerConstructor, nullptr), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum)));
- putDirectCustomAccessor(vm, builtinNames.ReadableByteStreamControllerPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableByteStreamControllerConstructor, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
- putDirectCustomAccessor(vm, builtinNames.ReadableStreamPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableStreamConstructor, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
- putDirectCustomAccessor(vm, builtinNames.ReadableStreamBYOBReaderPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableStreamBYOBReaderConstructor, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
- putDirectCustomAccessor(vm, builtinNames.ReadableStreamBYOBRequestPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableStreamBYOBRequestConstructor, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
- putDirectCustomAccessor(vm, builtinNames.ReadableStreamDefaultControllerPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableStreamDefaultControllerConstructor, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
- putDirectCustomAccessor(vm, builtinNames.ReadableStreamDefaultReaderPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableStreamDefaultReaderConstructor, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
- putDirectCustomAccessor(vm, builtinNames.WritableStreamPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_WritableStreamConstructor, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
- putDirectCustomAccessor(vm, builtinNames.WritableStreamDefaultControllerPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_WritableStreamDefaultControllerConstructor, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
- putDirectCustomAccessor(vm, builtinNames.WritableStreamDefaultWriterPrivateName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_WritableStreamDefaultWriterConstructor, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
- putDirectCustomAccessor(vm, builtinNames.AbortSignalPrivateName(), CustomGetterSetter::create(vm, JSDOMAbortSignal_getter, nullptr), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
+
+ putDirectCustomAccessor(vm, builtinNames.TransformStreamPrivateName(), CustomGetterSetter::create(vm, TransformStream_getter, nullptr), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum)));
+ putDirectCustomAccessor(vm, builtinNames.TransformStreamDefaultControllerPrivateName(), CustomGetterSetter::create(vm, TransformStreamDefaultController_getter, nullptr), attributesForStructure(static_cast<unsigned>(JSC::PropertyAttribute::DontEnum)));
+ putDirectCustomAccessor(vm, builtinNames.ReadableByteStreamControllerPrivateName(), CustomGetterSetter::create(vm, ReadableByteStreamController_getter, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
+ putDirectCustomAccessor(vm, builtinNames.ReadableStreamPrivateName(), CustomGetterSetter::create(vm, ReadableStream_getter, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
+ putDirectCustomAccessor(vm, builtinNames.ReadableStreamBYOBReaderPrivateName(), CustomGetterSetter::create(vm, ReadableStreamBYOBReader_getter, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
+ putDirectCustomAccessor(vm, builtinNames.ReadableStreamBYOBRequestPrivateName(), CustomGetterSetter::create(vm, ReadableStreamBYOBRequest_getter, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
+ putDirectCustomAccessor(vm, builtinNames.ReadableStreamDefaultControllerPrivateName(), CustomGetterSetter::create(vm, ReadableStreamDefaultController_getter, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
+ putDirectCustomAccessor(vm, builtinNames.ReadableStreamDefaultReaderPrivateName(), CustomGetterSetter::create(vm, ReadableStreamDefaultReader_getter, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
+ putDirectCustomAccessor(vm, builtinNames.WritableStreamPrivateName(), CustomGetterSetter::create(vm, WritableStream_getter, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
+ putDirectCustomAccessor(vm, builtinNames.WritableStreamDefaultControllerPrivateName(), CustomGetterSetter::create(vm, WritableStreamDefaultController_getter, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
+ putDirectCustomAccessor(vm, builtinNames.WritableStreamDefaultWriterPrivateName(), CustomGetterSetter::create(vm, WritableStreamDefaultWriter_getter, nullptr), attributesForStructure(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly));
+ putDirectCustomAccessor(vm, builtinNames.AbortSignalPrivateName(), CustomGetterSetter::create(vm, AbortSignal_getter, nullptr), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly);
// ----- Public Properties -----
+ // a direct accessor (uses js functions for get and set) cannot be on the lookup table. i think.
putDirectAccessor(
this,
builtinNames.selfPublicName(),
@@ -3886,183 +3524,9 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
JSFunction::create(vm, this, 0, "set"_s, functionSetSelf, ImplementationVisibility::Public)),
0);
- putDirect(vm, JSC::Identifier::fromString(vm, "global"_s), this->globalThis(), JSC::PropertyAttribute::DontEnum | 0);
-
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "fetch"_s),
- JSC::JSFunction::create(vm, this, 2, "fetch"_s, Bun__fetch, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "queueMicrotask"_s),
- JSC::JSFunction::create(vm, this, 2, "queueMicrotask"_s, functionQueueMicrotask, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "setImmediate"_s),
- JSC::JSFunction::create(vm, this, 1, "setImmediate"_s, functionSetImmediate, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "clearImmediate"_s),
- JSC::JSFunction::create(vm, this, 1, "clearImmediate"_s, functionClearTimeout, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "structuredClone"_s),
- JSC::JSFunction::create(vm, this, 2, "structuredClone"_s, functionStructuredClone, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "setTimeout"_s),
- JSC::JSFunction::create(vm, this, 1, "setTimeout"_s, functionSetTimeout, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "clearTimeout"_s),
- JSC::JSFunction::create(vm, this, 1, "clearTimeout"_s, functionClearTimeout, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "setInterval"_s),
- JSC::JSFunction::create(vm, this, 1, "setInterval"_s, functionSetInterval, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "clearInterval"_s),
- JSC::JSFunction::create(vm, this, 1, "clearInterval"_s, functionClearInterval, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "atob"_s),
- JSC::JSFunction::create(vm, this, 1, "atob"_s, functionATOB, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "btoa"_s),
- JSC::JSFunction::create(vm, this, 1, "btoa"_s, functionBTOA, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "reportError"_s),
- JSC::JSFunction::create(vm, this, 1, "reportError"_s, functionReportError, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "postMessage"_s),
- JSC::JSFunction::create(vm, this, 1, "postMessage"_s, jsFunctionPostMessage, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "alert"_s),
- JSC::JSFunction::create(vm, this, 1, "alert"_s, WebCore__alert, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
-
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "confirm"_s),
- JSC::JSFunction::create(vm, this, 1,
- "confirm"_s, WebCore__confirm, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
-
- putDirect(
- vm,
- JSC::Identifier::fromString(vm, "prompt"_s),
- JSC::JSFunction::create(vm, this, 1,
- "prompt"_s, WebCore__prompt, ImplementationVisibility::Public),
- JSC::PropertyAttribute::Function | 0);
-
- // This is not meant to be used publicly, but it has to be a public symbol or else commonjs modules will not load
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "$_BunCommonJSModule_$"_s), JSC::CustomGetterSetter::create(vm, BunCommonJSModule_getter, nullptr),
- JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::ReadOnly);
-
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "process"_s), JSC::CustomGetterSetter::create(vm, property_lazyProcessGetter, property_lazyProcessSetter),
- JSC::PropertyAttribute::CustomAccessor | 0);
-
- putDirect(vm, JSC::Identifier::fromString(vm, "performance"_s), this->performanceObject(), 0);
-
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "URL"_s), JSC::CustomGetterSetter::create(vm, JSDOMURL_getter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "navigator"_s), JSC::CustomGetterSetter::create(vm, functionLazyNavigatorGetter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "ResolveError"_s), JSC::CustomGetterSetter::create(vm, functionResolveMessageGetter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "ResolveMessage"_s), JSC::CustomGetterSetter::create(vm, functionResolveMessageGetter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "BuildError"_s), JSC::CustomGetterSetter::create(vm, functionBuildMessageGetter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "BuildMessage"_s), JSC::CustomGetterSetter::create(vm, functionBuildMessageGetter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "Request"_s), JSC::CustomGetterSetter::create(vm, JSRequest_getter, JSRequest_setter), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "Response"_s), JSC::CustomGetterSetter::create(vm, JSResponse_getter, JSResponse_setter), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "TextDecoder"_s), JSC::CustomGetterSetter::create(vm, JSTextDecoder_getter, JSTextDecoder_setter), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "Blob"_s), JSC::CustomGetterSetter::create(vm, JSBlob_getter, JSBlob_setter), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "HTMLRewriter"_s), JSC::CustomGetterSetter::create(vm, JSHTMLRewriter_getter, JSHTMLRewriter_setter), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "Crypto"_s), JSC::CustomGetterSetter::create(vm, JSCrypto_getter, JSCrypto_setter), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "File"_s), JSC::CustomGetterSetter::create(vm, JSDOMFileConstructor_getter, JSDOMFileConstructor_setter), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "DOMException"_s), JSC::CustomGetterSetter::create(vm, JSDOMException_getter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "Event"_s), JSC::CustomGetterSetter::create(vm, JSEvent_getter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "EventTarget"_s), JSC::CustomGetterSetter::create(vm, JSEventTarget_getter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "AbortController"_s), JSC::CustomGetterSetter::create(vm, JSDOMAbortController_getter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "AbortSignal"_s), JSC::CustomGetterSetter::create(vm, JSDOMAbortSignal_getter, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "EventSource"_s), JSC::CustomGetterSetter::create(vm, EventSource_getter, EventSource_setter), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "onmessage"_s), JSC::CustomGetterSetter::create(vm, globalGetterOnMessage, globalSetterOnMessage), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "onerror"_s), JSC::CustomGetterSetter::create(vm, globalGetterOnError, globalSetterOnError), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "crypto"_s), JSC::CustomGetterSetter::create(vm, property_lazyCryptoGetter, JSDOMFileConstructor_setter), 0);
-
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "ByteLengthQueuingStrategy"_s), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ByteLengthQueuingStrategyConstructor, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "CountQueuingStrategy"_s), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_CountQueuingStrategyConstructor, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "SubtleCrypto"_s), JSC::CustomGetterSetter::create(vm, getterSubtleCryptoConstructor, nullptr), 0);
- putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "CryptoKey"_s), JSC::CustomGetterSetter::create(vm, getterCryptoKeyConstructor, nullptr), 0);
-
- putDirectCustomAccessor(vm, static_cast<JSVMClientData*>(vm.clientData)->builtinNames().BufferPublicName(), JSC::CustomGetterSetter::create(vm, JSBuffer_getter, JSBuffer_setter), 0);
-
- putDirectCustomAccessor(vm, builtinNames.TransformStreamPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_TransformStreamConstructor, nullptr), attributesForStructure(0));
- putDirectCustomAccessor(vm, builtinNames.ReadableByteStreamControllerPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableByteStreamControllerConstructor, nullptr), JSC::PropertyAttribute::CustomAccessor | 0);
- putDirectCustomAccessor(vm, builtinNames.ReadableStreamPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableStreamConstructor, nullptr), JSC::PropertyAttribute::CustomAccessor | 0);
- putDirectCustomAccessor(vm, builtinNames.ReadableStreamBYOBReaderPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableStreamBYOBReaderConstructor, nullptr), JSC::PropertyAttribute::CustomAccessor | 0);
- putDirectCustomAccessor(vm, builtinNames.ReadableStreamBYOBRequestPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableStreamBYOBRequestConstructor, nullptr), JSC::PropertyAttribute::CustomAccessor | 0);
- putDirectCustomAccessor(vm, builtinNames.ReadableStreamDefaultControllerPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableStreamDefaultControllerConstructor, nullptr), JSC::PropertyAttribute::CustomAccessor | 0);
- putDirectCustomAccessor(vm, builtinNames.ReadableStreamDefaultReaderPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_ReadableStreamDefaultReaderConstructor, nullptr), JSC::PropertyAttribute::CustomAccessor | 0);
- putDirectCustomAccessor(vm, builtinNames.WritableStreamPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_WritableStreamConstructor, nullptr), JSC::PropertyAttribute::CustomAccessor | 0);
- putDirectCustomAccessor(vm, builtinNames.WritableStreamDefaultControllerPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_WritableStreamDefaultControllerConstructor, nullptr), JSC::PropertyAttribute::CustomAccessor | 0);
- putDirectCustomAccessor(vm, builtinNames.WritableStreamDefaultWriterPublicName(), CustomGetterSetter::create(vm, jsServiceWorkerGlobalScope_WritableStreamDefaultWriterConstructor, nullptr), JSC::PropertyAttribute::CustomAccessor | 0);
-
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("BroadcastChannel"_s, JSBroadcastChannel);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("CloseEvent"_s, JSCloseEvent);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("CustomEvent"_s, JSCustomEvent);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("DOMException"_s, JSDOMException);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("ErrorEvent"_s, JSErrorEvent);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("Event"_s, JSEvent);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("EventTarget"_s, JSEventTarget);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("FormData"_s, JSDOMFormData);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("Headers"_s, JSFetchHeaders);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("MessageChannel"_s, JSMessageChannel);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("MessageEvent"_s, JSMessageEvent);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("MessagePort"_s, JSMessagePort);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("TextEncoder"_s, JSTextEncoder);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("URLSearchParams"_s, JSURLSearchParams);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("WebSocket"_s, JSWebSocket);
- PUT_WEBCORE_GENERATED_CONSTRUCTOR("Worker"_s, JSWorker);
-
- putDirectNativeFunction(vm, this,
- Identifier::fromString(vm, "addEventListener"_s),
- 2,
- jsFunctionAddEventListener,
- ImplementationVisibility::Public,
- NoIntrinsic,
- JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::Function | 0);
-
- putDirectNativeFunction(vm, this,
- Identifier::fromString(vm, "dispatchEvent"_s),
- 1,
- jsFunctionDispatchEvent,
- ImplementationVisibility::Public,
- NoIntrinsic,
- JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::Function | 0);
-
- putDirectNativeFunction(vm, this,
- Identifier::fromString(vm, "removeEventListener"_s),
- 2,
- jsFunctionRemoveEventListener,
- ImplementationVisibility::Public,
- NoIntrinsic,
- JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::Function | 0);
+ // TODO: this should be usable on the lookup table. it crashed las time i tried it
+ putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "onmessage"_s), JSC::CustomGetterSetter::create(vm, globalOnMessage, setGlobalOnMessage), 0);
+ putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "onerror"_s), JSC::CustomGetterSetter::create(vm, globalOnError, setGlobalOnError), 0);
// ----- Extensions to Built-in objects -----
@@ -4135,28 +3599,6 @@ void GlobalObject::visitChildrenImpl(JSCell* cell, Visitor& visitor)
visitor.append(thisObject->m_readableStreamToFormData);
visitor.append(thisObject->m_nodeModuleOverriddenResolveFilename);
- visitor.append(thisObject->m_JSBlobSetterValue);
- visitor.append(thisObject->m_JSBroadcastChannelSetterValue);
- visitor.append(thisObject->m_JSBufferSetterValue);
- visitor.append(thisObject->m_JSCloseEventSetterValue);
- visitor.append(thisObject->m_JSCustomEventSetterValue);
- visitor.append(thisObject->m_JSDOMExceptionSetterValue);
- visitor.append(thisObject->m_JSDOMFormDataSetterValue);
- visitor.append(thisObject->m_JSErrorEventSetterValue);
- visitor.append(thisObject->m_JSEventSetterValue);
- visitor.append(thisObject->m_JSEventTargetSetterValue);
- visitor.append(thisObject->m_JSFetchHeadersSetterValue);
- visitor.append(thisObject->m_JSMessageChannelSetterValue);
- visitor.append(thisObject->m_JSMessageEventSetterValue);
- visitor.append(thisObject->m_JSMessagePortSetterValue);
- visitor.append(thisObject->m_JSRequestSetterValue);
- visitor.append(thisObject->m_JSResponseSetterValue);
- visitor.append(thisObject->m_JSTextDecoderSetterValue);
- visitor.append(thisObject->m_JSTextEncoderSetterValue);
- visitor.append(thisObject->m_JSURLSearchParamsSetterValue);
- visitor.append(thisObject->m_JSWebSocketSetterValue);
- visitor.append(thisObject->m_JSWorkerSetterValue);
-
visitor.append(thisObject->m_nextTickQueue);
thisObject->m_JSArrayBufferSinkClassStructure.visit(visitor);
@@ -4188,6 +3630,7 @@ void GlobalObject::visitChildrenImpl(JSCell* cell, Visitor& visitor)
thisObject->m_performanceObject.visit(visitor);
thisObject->m_processEnvObject.visit(visitor);
thisObject->m_processObject.visit(visitor);
+ thisObject->m_bunObject.visit(visitor);
thisObject->m_subtleCryptoObject.visit(visitor);
thisObject->m_JSHTTPResponseController.visit(visitor);
thisObject->m_callSiteStructure.visit(visitor);
@@ -4198,7 +3641,6 @@ void GlobalObject::visitChildrenImpl(JSCell* cell, Visitor& visitor)
thisObject->m_requireFunctionUnbound.visit(visitor);
thisObject->m_requireResolveFunctionUnbound.visit(visitor);
- thisObject->m_processBindingConstants.visit(visitor);
thisObject->m_importMetaObjectStructure.visit(visitor);
thisObject->m_asyncBoundFunctionStructure.visit(visitor);
thisObject->m_internalModuleRegistry.visit(visitor);
@@ -4580,5 +4022,9 @@ GlobalObject::PromiseFunctions GlobalObject::promiseHandlerID(EncodedJSValue (*h
}
#include "ZigGeneratedClasses+lazyStructureImpl.h"
+#include "ZigGlobalObject.lut.h"
+
+const JSC::ClassInfo GlobalObject::s_info = { "GlobalObject"_s, &Base::s_info, &bunGlobalObjectTable, nullptr,
+ CREATE_METHOD_TABLE(GlobalObject) };
} // namespace Zig
diff --git a/src/bun.js/bindings/ZigGlobalObject.h b/src/bun.js/bindings/ZigGlobalObject.h
index 29c1cd09c..ad5138527 100644
--- a/src/bun.js/bindings/ZigGlobalObject.h
+++ b/src/bun.js/bindings/ZigGlobalObject.h
@@ -13,21 +13,22 @@ namespace JSC {
class Structure;
class Identifier;
class LazyClassStructure;
-
-} // namespace JSC
-
-namespace JSC {
-
enum class JSPromiseRejectionOperation : unsigned;
-
-}
+} // namespace JSC
namespace WebCore {
class ScriptExecutionContext;
class DOMGuardedObject;
class EventLoopTask;
class DOMWrapperWorld;
-}
+class GlobalScope;
+class SubtleCrypto;
+class EventTarget;
+} // namespace WebCore
+
+namespace Bun {
+class InternalModuleRegistry;
+} // namespace Bun
#include "root.h"
@@ -43,37 +44,9 @@ class DOMWrapperWorld;
#include "BunPlugin.h"
#include "JSMockFunction.h"
#include "InternalModuleRegistry.h"
-#include "ProcessBindingConstants.h"
-
-namespace WebCore {
-class GlobalScope;
-class SubtleCrypto;
-class EventTarget;
-}
extern "C" void Bun__reportError(JSC__JSGlobalObject*, JSC__JSValue);
extern "C" void Bun__reportUnhandledError(JSC__JSGlobalObject*, JSC::EncodedJSValue);
-// defined in ModuleLoader.cpp
-extern "C" JSC::EncodedJSValue jsFunctionOnLoadObjectResultResolve(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame);
-extern "C" JSC::EncodedJSValue jsFunctionOnLoadObjectResultReject(JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame);
-
-// #include "EventTarget.h"
-
-// namespace WebCore {
-// class GlobalEventTarget : public EventTargetWithInlineData, public ContextDestructionObserver {
-// WTF_MAKE_ISO_ALLOCATED(GlobalEventTarget);
-
-// public:
-// static Ref<GlobalEventTarget> create(ScriptExecutionContext&);
-
-// EventTargetInterface eventTargetInterface() const final { return DOMWindowEventTargetInterfaceType; }
-// ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); }
-// void refEventTarget() final {}
-// void derefEventTarget() final {}
-// void eventListenersDidChange() final;
-// };
-
-// }
namespace Zig {
@@ -184,22 +157,12 @@ public:
static void reportUncaughtExceptionAtEventLoop(JSGlobalObject*, JSC::Exception*);
static JSGlobalObject* deriveShadowRealmGlobalObject(JSGlobalObject* globalObject);
- static JSC::JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, JSC::JSModuleLoader*,
- JSC::JSString* moduleNameValue,
- JSC::JSValue parameters,
- const JSC::SourceOrigin&);
- static JSC::Identifier moduleLoaderResolve(JSGlobalObject*, JSC::JSModuleLoader*,
- JSC::JSValue keyValue, JSC::JSValue referrerValue,
- JSC::JSValue);
- static JSC::JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, JSC::JSModuleLoader*,
- JSC::JSValue, JSC::JSValue, JSC::JSValue);
- static JSC::JSObject* moduleLoaderCreateImportMetaProperties(JSGlobalObject*,
- JSC::JSModuleLoader*, JSC::JSValue,
- JSC::JSModuleRecord*, JSC::JSValue);
- static JSC::JSValue moduleLoaderEvaluate(JSGlobalObject*, JSC::JSModuleLoader*, JSC::JSValue,
- JSC::JSValue, JSC::JSValue, JSC::JSValue, JSC::JSValue);
- static void promiseRejectionTracker(JSGlobalObject*, JSC::JSPromise*,
- JSC::JSPromiseRejectionOperation);
+ static JSC::JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, JSC::JSModuleLoader*, JSC::JSString* moduleNameValue, JSC::JSValue parameters, const JSC::SourceOrigin&);
+ static JSC::Identifier moduleLoaderResolve(JSGlobalObject*, JSC::JSModuleLoader*, JSC::JSValue keyValue, JSC::JSValue referrerValue, JSC::JSValue);
+ static JSC::JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue, JSC::JSValue);
+ static JSC::JSObject* moduleLoaderCreateImportMetaProperties(JSGlobalObject*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSModuleRecord*, JSC::JSValue);
+ static JSC::JSValue moduleLoaderEvaluate(JSGlobalObject*, JSC::JSModuleLoader*, JSC::JSValue, JSC::JSValue, JSC::JSValue, JSC::JSValue, JSC::JSValue);
+ static void promiseRejectionTracker(JSGlobalObject*, JSC::JSPromise*, JSC::JSPromiseRejectionOperation);
void setConsole(void* console);
WebCore::JSBuiltinInternalFunctions& builtinInternalFunctions() { return m_builtinInternalFunctions; }
JSC::Structure* FFIFunctionStructure() { return m_JSFFIFunctionStructure.getInitializedOnMainThread(this); }
@@ -266,7 +229,8 @@ public:
JSObject* requireFunctionUnbound() { return m_requireFunctionUnbound.getInitializedOnMainThread(this); }
JSObject* requireResolveFunctionUnbound() { return m_requireResolveFunctionUnbound.getInitializedOnMainThread(this); }
Bun::InternalModuleRegistry* internalModuleRegistry() { return m_internalModuleRegistry.getInitializedOnMainThread(this); }
- Bun::ProcessBindingConstants* processBindingConstants() { return m_processBindingConstants.getInitializedOnMainThread(this); }
+
+ JSObject* processBindingConstants() { return m_processBindingConstants.getInitializedOnMainThread(this); }
JSObject* lazyRequireCacheObject() { return m_lazyRequireCacheObject.getInitializedOnMainThread(this); }
@@ -286,31 +250,22 @@ public:
bool hasProcessObject() const { return m_processObject.isInitialized(); }
- JSC::JSObject* processObject()
- {
- return m_processObject.getInitializedOnMainThread(this);
- }
-
- JSC::JSObject* processEnvObject()
- {
- return m_processEnvObject.getInitializedOnMainThread(this);
- }
+ JSC::JSObject* processObject() { return m_processObject.getInitializedOnMainThread(this); }
+ JSC::JSObject* processEnvObject() { return m_processEnvObject.getInitializedOnMainThread(this); }
+ JSC::JSObject* bunObject() { return m_bunObject.getInitializedOnMainThread(this); }
void drainMicrotasks();
void handleRejectedPromises();
- void initGeneratedLazyClasses();
+ ALWAYS_INLINE void initGeneratedLazyClasses();
template<typename Visitor>
void visitGeneratedLazyClasses(GlobalObject*, Visitor&);
- void* bunVM() { return m_bunVM; }
+ ALWAYS_INLINE void* bunVM() { return m_bunVM; }
bool isThreadLocalDefaultGlobalObject = false;
- JSObject* subtleCrypto()
- {
- return m_subtleCryptoObject.getInitializedOnMainThread(this);
- }
+ JSObject* subtleCrypto() { return m_subtleCryptoObject.getInitializedOnMainThread(this); }
EncodedJSValue assignToStream(JSValue stream, JSValue controller);
@@ -377,6 +332,7 @@ public:
* For example, if you don't add the queueMicrotask functions to visitChildrenImpl(),
* those callbacks will eventually never be called anymore. But it'll work the first time!
*/
+ // TODO: these should use LazyProperty
mutable WriteBarrier<JSFunction> m_assignToStream;
mutable WriteBarrier<JSFunction> m_readableStreamToArrayBuffer;
mutable WriteBarrier<JSFunction> m_readableStreamToArrayBufferResolve;
@@ -391,25 +347,8 @@ public:
mutable WriteBarrier<Unknown> m_nextTickQueue;
mutable WriteBarrier<Unknown> m_BunCommonJSModuleValue;
- mutable WriteBarrier<Unknown> m_JSBroadcastChannelSetterValue;
- mutable WriteBarrier<Unknown> m_JSBufferSetterValue;
- mutable WriteBarrier<Unknown> m_JSCloseEventSetterValue;
- mutable WriteBarrier<Unknown> m_JSCustomEventSetterValue;
- mutable WriteBarrier<Unknown> m_JSDOMExceptionSetterValue;
- mutable WriteBarrier<Unknown> m_JSDOMFormDataSetterValue;
- mutable WriteBarrier<Unknown> m_JSErrorEventSetterValue;
- mutable WriteBarrier<Unknown> m_JSEventSetterValue;
- mutable WriteBarrier<Unknown> m_JSEventTargetSetterValue;
- mutable WriteBarrier<Unknown> m_JSFetchHeadersSetterValue;
- mutable WriteBarrier<Unknown> m_JSMessageChannelSetterValue;
- mutable WriteBarrier<Unknown> m_JSMessageEventSetterValue;
- mutable WriteBarrier<Unknown> m_JSMessagePortSetterValue;
- mutable WriteBarrier<Unknown> m_JSTextEncoderSetterValue;
- mutable WriteBarrier<Unknown> m_JSURLSearchParamsSetterValue;
- mutable WriteBarrier<Unknown> m_JSWebSocketSetterValue;
- mutable WriteBarrier<Unknown> m_JSWorkerSetterValue;
-
- mutable WriteBarrier<Unknown> m_JSBunDebuggerValue;
+
+ // mutable WriteBarrier<Unknown> m_JSBunDebuggerValue;
mutable WriteBarrier<JSFunction> m_thenables[promiseFunctionsSize + 1];
Structure* memoryFootprintStructure()
@@ -490,6 +429,9 @@ private:
WebCore::ScriptExecutionContext* m_scriptExecutionContext;
Ref<WebCore::DOMWrapperWorld> m_world;
+ // JSC's hashtable code-generator tries to access these properties, so we make them public.
+ // However, we'd like it better if they could be protected.
+public:
/**
* WARNING: You must update visitChildrenImpl() if you add a new field.
*
@@ -523,7 +465,7 @@ private:
* For example, if you don't add the queueMicrotask functions to visitChildrenImpl(),
* those callbacks will eventually never be called anymore. But it'll work the first time!
*/
- LazyProperty<JSGlobalObject, JSC::Structure> m_pendingVirtualModuleResultStructure;
+ LazyProperty<JSGlobalObject, Structure> m_pendingVirtualModuleResultStructure;
LazyProperty<JSGlobalObject, JSFunction> m_performMicrotaskFunction;
LazyProperty<JSGlobalObject, JSFunction> m_nativeMicrotaskTrampoline;
LazyProperty<JSGlobalObject, JSFunction> m_performMicrotaskVariadicFunction;
@@ -537,34 +479,34 @@ private:
LazyProperty<JSGlobalObject, JSObject> m_JSArrayBufferControllerPrototype;
LazyProperty<JSGlobalObject, JSObject> m_JSFileSinkControllerPrototype;
LazyProperty<JSGlobalObject, JSObject> m_JSHTTPSResponseControllerPrototype;
- LazyProperty<JSGlobalObject, JSObject> m_navigatorObject;
- LazyProperty<JSGlobalObject, JSObject> m_performanceObject;
- LazyProperty<JSGlobalObject, JSObject> m_processObject;
LazyProperty<JSGlobalObject, JSObject> m_subtleCryptoObject;
LazyProperty<JSGlobalObject, Structure> m_JSHTTPResponseController;
- LazyProperty<JSGlobalObject, JSC::Structure> m_JSBufferSubclassStructure;
+ LazyProperty<JSGlobalObject, Structure> m_JSBufferSubclassStructure;
LazyProperty<JSGlobalObject, JSWeakMap> m_vmModuleContextMap;
LazyProperty<JSGlobalObject, JSObject> m_lazyRequireCacheObject;
LazyProperty<JSGlobalObject, JSObject> m_lazyTestModuleObject;
LazyProperty<JSGlobalObject, JSObject> m_lazyPreloadTestModuleObject;
-
LazyProperty<JSGlobalObject, JSFunction> m_bunSleepThenCallback;
LazyProperty<JSGlobalObject, Structure> m_cachedGlobalObjectStructure;
LazyProperty<JSGlobalObject, Structure> m_cachedGlobalProxyStructure;
LazyProperty<JSGlobalObject, Structure> m_commonJSModuleObjectStructure;
LazyProperty<JSGlobalObject, Structure> m_commonJSFunctionArgumentsStructure;
LazyProperty<JSGlobalObject, Structure> m_memoryFootprintStructure;
- LazyProperty<JSGlobalObject, JSObject> m_cryptoObject;
-
- LazyProperty<JSGlobalObject, JSC::JSObject> m_requireFunctionUnbound;
- LazyProperty<JSGlobalObject, JSC::JSObject> m_requireResolveFunctionUnbound;
+ LazyProperty<JSGlobalObject, JSObject> m_requireFunctionUnbound;
+ LazyProperty<JSGlobalObject, JSObject> m_requireResolveFunctionUnbound;
LazyProperty<JSGlobalObject, Bun::InternalModuleRegistry> m_internalModuleRegistry;
- LazyProperty<JSGlobalObject, Bun::ProcessBindingConstants> m_processBindingConstants;
- LazyProperty<JSGlobalObject, JSC::Structure> m_importMetaObjectStructure;
- LazyProperty<JSGlobalObject, JSC::Structure> m_asyncBoundFunctionStructure;
-
+ LazyProperty<JSGlobalObject, JSObject> m_processBindingConstants;
+ LazyProperty<JSGlobalObject, Structure> m_importMetaObjectStructure;
+ LazyProperty<JSGlobalObject, Structure> m_asyncBoundFunctionStructure;
LazyProperty<JSGlobalObject, JSC::JSObject> m_JSDOMFileConstructor;
+ LazyProperty<JSGlobalObject, JSObject> m_bunObject;
+ LazyProperty<JSGlobalObject, JSObject> m_cryptoObject;
+ LazyProperty<JSGlobalObject, JSObject> m_navigatorObject;
+ LazyProperty<JSGlobalObject, JSObject> m_performanceObject;
+ LazyProperty<JSGlobalObject, JSObject> m_processObject;
+
+private:
DOMGuardedObjectSet m_guardedObjects WTF_GUARDED_BY_LOCK(m_gcLock);
void* m_bunVM;
diff --git a/src/bun.js/bindings/ZigGlobalObject.lut.h b/src/bun.js/bindings/ZigGlobalObject.lut.h
new file mode 100644
index 000000000..8363a994d
--- /dev/null
+++ b/src/bun.js/bindings/ZigGlobalObject.lut.h
@@ -0,0 +1,342 @@
+// File generated via `make static-hash-table` / `make cpp`
+static const struct CompactHashIndex bunGlobalObjectTableIndex[260] = {
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 43, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 6, -1 },
+ { 3, -1 },
+ { -1, -1 },
+ { 35, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 30, 258 },
+ { -1, -1 },
+ { -1, -1 },
+ { 55, 257 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 52, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 2, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 18, -1 },
+ { 57, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 14, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 42, -1 },
+ { 48, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 70, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 40, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 39, -1 },
+ { 64, -1 },
+ { -1, -1 },
+ { 58, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 50, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 59, -1 },
+ { 11, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 0, -1 },
+ { -1, -1 },
+ { 38, -1 },
+ { 22, -1 },
+ { 67, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 71, -1 },
+ { -1, -1 },
+ { 46, -1 },
+ { -1, -1 },
+ { 49, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 25, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 34, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 51, -1 },
+ { 47, -1 },
+ { -1, -1 },
+ { 13, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 44, -1 },
+ { -1, -1 },
+ { 1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 21, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 33, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 29, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 27, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 17, -1 },
+ { -1, -1 },
+ { 32, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 36, -1 },
+ { 72, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 23, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 4, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 24, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 56, -1 },
+ { -1, -1 },
+ { 54, -1 },
+ { -1, -1 },
+ { 12, -1 },
+ { 26, -1 },
+ { 7, -1 },
+ { -1, -1 },
+ { 9, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 62, -1 },
+ { 61, -1 },
+ { -1, -1 },
+ { 5, 256 },
+ { -1, -1 },
+ { 65, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 37, -1 },
+ { -1, -1 },
+ { 15, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 41, 259 },
+ { -1, -1 },
+ { -1, -1 },
+ { 69, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 53, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 31, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 28, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 45, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 66, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 20, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 10, -1 },
+ { 16, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { -1, -1 },
+ { 19, -1 },
+ { -1, -1 },
+ { 8, -1 },
+ { 60, -1 },
+ { 63, -1 },
+ { 68, -1 },
+};
+
+static const struct HashTableValue bunGlobalObjectTableValues[73] = {
+ { "addEventListener"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsFunctionAddEventListener, 2 } },
+ { "alert"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, WebCore__alert, 1 } },
+ { "atob"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionATOB, 1 } },
+ { "btoa"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionBTOA, 1 } },
+ { "clearImmediate"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionClearTimeout, 1 } },
+ { "clearInterval"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionClearInterval, 1 } },
+ { "clearTimeout"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionClearTimeout, 1 } },
+ { "confirm"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, WebCore__confirm, 1 } },
+ { "dispatchEvent"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsFunctionDispatchEvent, 1 } },
+ { "fetch"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, Bun__fetch, 2 } },
+ { "postMessage"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsFunctionPostMessage, 1 } },
+ { "prompt"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, WebCore__prompt, 1 } },
+ { "queueMicrotask"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionQueueMicrotask, 2 } },
+ { "removeEventListener"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsFunctionRemoveEventListener, 2 } },
+ { "reportError"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionReportError, 1 } },
+ { "setImmediate"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionSetImmediate, 1 } },
+ { "setInterval"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionSetInterval, 1 } },
+ { "setTimeout"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionSetTimeout, 1 } },
+ { "structuredClone"_s, static_cast<unsigned>(PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, functionStructuredClone, 2 } },
+ { "global"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, GlobalObject_getGlobalThis } },
+ { "EventSource"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, getEventSourceConstructor } },
+ { "$_BunCommonJSModule_$"_s, static_cast<unsigned>(PropertyAttribute::CustomAccessor|PropertyAttribute::DontDelete|PropertyAttribute::ReadOnly), NoIntrinsic, { HashTableValue::GetterSetterType, BunCommonJSModule_getter, 0 } },
+ { "Bun"_s, static_cast<unsigned>(PropertyAttribute::CellProperty|PropertyAttribute::DontDelete|PropertyAttribute::ReadOnly), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_bunObject) } },
+ { "File"_s, static_cast<unsigned>(PropertyAttribute::CellProperty), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_JSDOMFileConstructor) } },
+ { "crypto"_s, static_cast<unsigned>(PropertyAttribute::CellProperty), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_cryptoObject) } },
+ { "navigator"_s, static_cast<unsigned>(PropertyAttribute::CellProperty), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_navigatorObject) } },
+ { "performance"_s, static_cast<unsigned>(PropertyAttribute::CellProperty), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_performanceObject) } },
+ { "process"_s, static_cast<unsigned>(PropertyAttribute::CellProperty), NoIntrinsic, { HashTableValue::LazyCellPropertyType, OBJECT_OFFSETOF(GlobalObject, m_processObject) } },
+ { "Blob"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSBlob) } },
+ { "Buffer"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSBufferClassStructure) } },
+ { "BuildError"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSBuildMessage) } },
+ { "BuildMessage"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSBuildMessage) } },
+ { "Crypto"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSCrypto) } },
+ { "HTMLRewriter"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSHTMLRewriter) } },
+ { "Request"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSRequest) } },
+ { "ResolveError"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSResolveMessage) } },
+ { "ResolveMessage"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSResolveMessage) } },
+ { "Response"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSResponse) } },
+ { "TextDecoder"_s, static_cast<unsigned>(PropertyAttribute::ClassStructure), NoIntrinsic, { HashTableValue::LazyClassStructureType, OBJECT_OFFSETOF(GlobalObject, m_JSTextDecoder) } },
+ { "AbortController"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, AbortControllerConstructorCallback } },
+ { "AbortSignal"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, AbortSignalConstructorCallback } },
+ { "BroadcastChannel"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, BroadcastChannelConstructorCallback } },
+ { "ByteLengthQueuingStrategy"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ByteLengthQueuingStrategyConstructorCallback } },
+ { "CloseEvent"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, CloseEventConstructorCallback } },
+ { "CountQueuingStrategy"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, CountQueuingStrategyConstructorCallback } },
+ { "CryptoKey"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, CryptoKeyConstructorCallback } },
+ { "CustomEvent"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, CustomEventConstructorCallback } },
+ { "DOMException"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, DOMExceptionConstructorCallback } },
+ { "ErrorEvent"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ErrorEventConstructorCallback } },
+ { "Event"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, EventConstructorCallback } },
+ { "EventTarget"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, EventTargetConstructorCallback } },
+ { "FormData"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, DOMFormDataConstructorCallback } },
+ { "Headers"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, FetchHeadersConstructorCallback } },
+ { "MessageChannel"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, MessageChannelConstructorCallback } },
+ { "MessageEvent"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, MessageEventConstructorCallback } },
+ { "MessagePort"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, MessagePortConstructorCallback } },
+ { "ReadableByteStreamController"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableByteStreamControllerConstructorCallback } },
+ { "ReadableStream"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableStreamConstructorCallback } },
+ { "ReadableStreamBYOBReader"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableStreamBYOBReaderConstructorCallback } },
+ { "ReadableStreamBYOBRequest"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableStreamBYOBRequestConstructorCallback } },
+ { "ReadableStreamDefaultController"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableStreamDefaultControllerConstructorCallback } },
+ { "ReadableStreamDefaultReader"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, ReadableStreamDefaultReaderConstructorCallback } },
+ { "SubtleCrypto"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, SubtleCryptoConstructorCallback } },
+ { "TextEncoder"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, TextEncoderConstructorCallback } },
+ { "TransformStream"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, TransformStreamConstructorCallback } },
+ { "URL"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, DOMURLConstructorCallback } },
+ { "URLSearchParams"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, URLSearchParamsConstructorCallback } },
+ { "WebSocket"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, WebSocketConstructorCallback } },
+ { "Worker"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, WorkerConstructorCallback } },
+ { "WritableStream"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, WritableStreamConstructorCallback } },
+ { "WritableStreamDefaultController"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, WritableStreamDefaultControllerConstructorCallback } },
+ { "WritableStreamDefaultWriter"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, WritableStreamDefaultWriterConstructorCallback } },
+ { "TransformStreamDefaultController"_s, static_cast<unsigned>(PropertyAttribute::PropertyCallback), NoIntrinsic, { HashTableValue::LazyPropertyType, TransformStreamDefaultControllerConstructorCallback } },
+};
+
+static const struct HashTable bunGlobalObjectTable =
+ { 73, 255, true, nullptr, bunGlobalObjectTableValues, bunGlobalObjectTableIndex };
diff --git a/src/bun.js/bindings/ZigGlobalObject.lut.txt b/src/bun.js/bindings/ZigGlobalObject.lut.txt
new file mode 100644
index 000000000..7700dcc8d
--- /dev/null
+++ b/src/bun.js/bindings/ZigGlobalObject.lut.txt
@@ -0,0 +1,84 @@
+// In a separate file because processing ZigGlobalObject.cpp takes 15+ seconds
+
+/* Source for ZigGlobalObject.lut.h
+@begin bunGlobalObjectTable
+ addEventListener jsFunctionAddEventListener Function 2
+ alert WebCore__alert Function 1
+ atob functionATOB Function 1
+ btoa functionBTOA Function 1
+ clearImmediate functionClearTimeout Function 1
+ clearInterval functionClearInterval Function 1
+ clearTimeout functionClearTimeout Function 1
+ confirm WebCore__confirm Function 1
+ dispatchEvent jsFunctionDispatchEvent Function 1
+ fetch Bun__fetch Function 2
+ postMessage jsFunctionPostMessage Function 1
+ prompt WebCore__prompt Function 1
+ queueMicrotask functionQueueMicrotask Function 2
+ removeEventListener jsFunctionRemoveEventListener Function 2
+ reportError functionReportError Function 1
+ setImmediate functionSetImmediate Function 1
+ setInterval functionSetInterval Function 1
+ setTimeout functionSetTimeout Function 1
+ structuredClone functionStructuredClone Function 2
+
+ global GlobalObject_getGlobalThis PropertyCallback
+ EventSource getEventSourceConstructor PropertyCallback
+
+ $_BunCommonJSModule_$ BunCommonJSModule_getter CustomAccessor|DontDelete|ReadOnly
+
+ Bun GlobalObject::m_bunObject CellProperty|DontDelete|ReadOnly
+ File GlobalObject::m_JSDOMFileConstructor CellProperty
+ crypto GlobalObject::m_cryptoObject CellProperty
+ navigator GlobalObject::m_navigatorObject CellProperty
+ performance GlobalObject::m_performanceObject CellProperty
+ process GlobalObject::m_processObject CellProperty
+
+ Blob GlobalObject::m_JSBlob ClassStructure
+ Buffer GlobalObject::m_JSBufferClassStructure ClassStructure
+ BuildError GlobalObject::m_JSBuildMessage ClassStructure
+ BuildMessage GlobalObject::m_JSBuildMessage ClassStructure
+ Crypto GlobalObject::m_JSCrypto ClassStructure
+ HTMLRewriter GlobalObject::m_JSHTMLRewriter ClassStructure
+ Request GlobalObject::m_JSRequest ClassStructure
+ ResolveError GlobalObject::m_JSResolveMessage ClassStructure
+ ResolveMessage GlobalObject::m_JSResolveMessage ClassStructure
+ Response GlobalObject::m_JSResponse ClassStructure
+ TextDecoder GlobalObject::m_JSTextDecoder ClassStructure
+
+ AbortController AbortControllerConstructorCallback PropertyCallback
+ AbortSignal AbortSignalConstructorCallback PropertyCallback
+ BroadcastChannel BroadcastChannelConstructorCallback PropertyCallback
+ ByteLengthQueuingStrategy ByteLengthQueuingStrategyConstructorCallback PropertyCallback
+ CloseEvent CloseEventConstructorCallback PropertyCallback
+ CountQueuingStrategy CountQueuingStrategyConstructorCallback PropertyCallback
+ CryptoKey CryptoKeyConstructorCallback PropertyCallback
+ CustomEvent CustomEventConstructorCallback PropertyCallback
+ DOMException DOMExceptionConstructorCallback PropertyCallback
+ ErrorEvent ErrorEventConstructorCallback PropertyCallback
+ Event EventConstructorCallback PropertyCallback
+ EventTarget EventTargetConstructorCallback PropertyCallback
+ FormData DOMFormDataConstructorCallback PropertyCallback
+ Headers FetchHeadersConstructorCallback PropertyCallback
+ MessageChannel MessageChannelConstructorCallback PropertyCallback
+ MessageEvent MessageEventConstructorCallback PropertyCallback
+ MessagePort MessagePortConstructorCallback PropertyCallback
+ ReadableByteStreamController ReadableByteStreamControllerConstructorCallback PropertyCallback
+ ReadableStream ReadableStreamConstructorCallback PropertyCallback
+ ReadableStreamBYOBReader ReadableStreamBYOBReaderConstructorCallback PropertyCallback
+ ReadableStreamBYOBRequest ReadableStreamBYOBRequestConstructorCallback PropertyCallback
+ ReadableStreamDefaultController ReadableStreamDefaultControllerConstructorCallback PropertyCallback
+ ReadableStreamDefaultReader ReadableStreamDefaultReaderConstructorCallback PropertyCallback
+ SubtleCrypto SubtleCryptoConstructorCallback PropertyCallback
+ TextEncoder TextEncoderConstructorCallback PropertyCallback
+ TransformStream TransformStreamConstructorCallback PropertyCallback
+ URL DOMURLConstructorCallback PropertyCallback
+ URLSearchParams URLSearchParamsConstructorCallback PropertyCallback
+ WebSocket WebSocketConstructorCallback PropertyCallback
+ Worker WorkerConstructorCallback PropertyCallback
+ WritableStream WritableStreamConstructorCallback PropertyCallback
+ WritableStreamDefaultController WritableStreamDefaultControllerConstructorCallback PropertyCallback
+ WritableStreamDefaultWriter WritableStreamDefaultWriterConstructorCallback PropertyCallback
+ TransformStreamDefaultController TransformStreamDefaultControllerConstructorCallback PropertyCallback
+@end
+*/
diff --git a/src/bun.js/bindings/process.d.ts b/src/bun.js/bindings/process.d.ts
deleted file mode 100644
index 194ea2b6a..000000000
--- a/src/bun.js/bindings/process.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- * The process object provides information about, and control over, the
- * current Bun.js process. While it is available as a global, it is
- * recommended to explicitly access it via require or import
- */
-export interface Process {
- //
-}
diff --git a/src/bun.js/modules/BunJSCModule.h b/src/bun.js/modules/BunJSCModule.h
index 73823e16e..1e64e7a02 100644
--- a/src/bun.js/modules/BunJSCModule.h
+++ b/src/bun.js/modules/BunJSCModule.h
@@ -238,7 +238,7 @@ JSC_DEFINE_HOST_FUNCTION(functionCreateMemoryFootprint,
&peak_rss, &current_commit, &peak_commit, &page_faults);
// mi_process_info produces incorrect rss size on linux.
- Zig::getRSS(&current_rss);
+ Bun::getRSS(&current_rss);
VM &vm = globalObject->vm();
JSC::JSObject *object = JSC::constructEmptyObject(
diff --git a/src/bun.js/scripts/generate-classes.ts b/src/bun.js/scripts/generate-classes.ts
index b6fbe0915..ddb01cccd 100644
--- a/src/bun.js/scripts/generate-classes.ts
+++ b/src/bun.js/scripts/generate-classes.ts
@@ -1556,43 +1556,19 @@ ${[...exports]
function generateLazyClassStructureHeader(typeName, { klass = {}, proto = {} }) {
return `
- JSC::Structure* ${className(typeName)}Structure() { return m_${className(
+ JSC::Structure* ${className(typeName)}Structure() { return m_${className(
typeName,
)}.getInitializedOnMainThread(this); }
- JSC::JSObject* ${className(typeName)}Constructor() { return m_${className(
+ JSC::JSObject* ${className(typeName)}Constructor() { return m_${className(
typeName,
)}.constructorInitializedOnMainThread(this); }
- JSC::JSValue ${className(typeName)}Prototype() { return m_${className(
+ JSC::JSValue ${className(typeName)}Prototype() { return m_${className(
typeName,
)}.prototypeInitializedOnMainThread(this); }
JSC::LazyClassStructure m_${className(typeName)};
- bool has${className(typeName)}SetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_${className(typeName)}SetterValue;
`.trim();
}
-function generateLazyStructureHeader(typeName, { klass = {}, proto = {} }) {
- return `
- JSC::Structure* ${className(typeName)}Structure() { return m_${className(typeName)}.get(this); }
- JSC::LazyProperty<Zig::GlobalObject, Structure> m_${className(typeName)};
- bool has${className(typeName)}SetterValue { false };
- mutable JSC::WriteBarrier<JSC::Unknown> m_${className(typeName)}SetterValue;
- `.trim();
-}
-
-function generateLazyStructureImpl(typeName, { klass = {}, proto = {} }) {
- return `
- m_${className(typeName)}.initLater(
- [](const JSC::LazyProperty<JSC::JSGlobalObject, JSC::JSObject>::Initializer& init) {
- auto *prototype = WebCore::${className(
- typeName,
- )}::createPrototype(init.vm, reinterpret_cast<Zig::GlobalObject*>(init.owner));
- init.set(WebCore::${className(typeName)}::createStructure(init.vm, init.owner, prototype));
- });
-
- `.trim();
-}
-
function generateLazyClassStructureImpl(typeName, { klass = {}, proto = {}, noConstructor = false }) {
return `
m_${className(typeName)}.initLater(
@@ -1685,7 +1661,7 @@ const GENERATED_CLASSES_IMPL_FOOTER = `
function initLazyClasses(initLaterFunctions) {
return `
-void GlobalObject::initGeneratedLazyClasses() {
+ALWAYS_INLINE void GlobalObject::initGeneratedLazyClasses() {
${initLaterFunctions.map(a => a.trim()).join("\n ")}
}
@@ -1698,14 +1674,7 @@ function visitLazyClasses(classes) {
template<typename Visitor>
void GlobalObject::visitGeneratedLazyClasses(GlobalObject *thisObject, Visitor& visitor)
{
- ${classes
- .map(
- a =>
- `thisObject->m_${className(a.name)}.visit(visitor); visitor.append(thisObject->m_${className(
- a.name,
- )}SetterValue);`,
- )
- .join("\n ")}
+ ${classes.map(a => `thisObject->m_${className(a.name)}.visit(visitor);`).join("\n ")}
}
`.trim();
diff --git a/src/js/_codegen/build-functions.ts b/src/js/_codegen/build-functions.ts
index fcce0263a..0f752e8a1 100644
--- a/src/js/_codegen/build-functions.ts
+++ b/src/js/_codegen/build-functions.ts
@@ -3,38 +3,7 @@ import path from "path";
import { sliceSourceCode } from "./builtin-parser";
import { applyGlobalReplacements, define } from "./replacements";
import { cap, fmtCPPString, low } from "./helpers";
-import { spawn } from "bun";
-
-async function createStaticHashtables() {
- const STATIC_HASH_TABLES = ["src/bun.js/bindings/Process.cpp", "src/bun.js/bindings/BunObject.cpp"];
- console.time("Creating static hash tables...");
- const create_hash_table = path.join(import.meta.dir, "../../../src/bun.js/scripts/create_hash_table");
- if (!create_hash_table) {
- console.warn(
- "Could not find create_hash_table executable. Run `bun i` or clone webkit to build static hash tables",
- );
- return;
- }
- for (let cpp of STATIC_HASH_TABLES) {
- cpp = path.join(import.meta.dir, "../../../", cpp);
- const { stdout, exited } = spawn({
- cmd: [create_hash_table, cpp],
- stdout: "pipe",
- stderr: "inherit",
- });
- await exited;
- let str = await new Response(stdout).text();
- str = str.replaceAll(/^\/\/.*$/gm, "");
- str = str.replaceAll(/^#include.*$/gm, "");
- str = str.replaceAll(`namespace JSC {`, "");
- str = str.replaceAll(`} // namespace JSC`, "");
- str = "// File generated via `make generate-builtins`\n" + str.trim() + "\n";
- await Bun.write(cpp.replace(/\.cpp$/, ".lut.h"), str);
- }
- console.timeEnd("Creating static hash tables...");
-}
-const staticHashTablePromise = createStaticHashtables();
console.log("Bundling Bun builtin functions...");
const MINIFY = process.argv.includes("--minify") || process.argv.includes("-m");
@@ -634,8 +603,6 @@ if (!KEEP_TMP) {
await rmSync(TMP_DIR, { recursive: true });
}
-await staticHashTablePromise;
-
console.log(
`Embedded JS size: %s bytes (across %s functions, %s files)`,
totalJSSize,
diff --git a/src/js/_codegen/static-hash-tables.ts b/src/js/_codegen/static-hash-tables.ts
new file mode 100644
index 000000000..be2aa908d
--- /dev/null
+++ b/src/js/_codegen/static-hash-tables.ts
@@ -0,0 +1,42 @@
+// TODO: move this file somewhere else. it doesnt make sense in src/js/
+// it generates C++ code not related to javascript at all
+import { spawn } from "bun";
+import path from "../node/path";
+
+const STATIC_HASH_TABLES = [
+ //
+ "src/bun.js/bindings/BunObject.cpp",
+ "src/bun.js/bindings/ZigGlobalObject.lut.txt",
+ "src/bun.js/bindings/Process.cpp",
+ "src/bun.js/bindings/ProcessBindingConstants.cpp",
+ "src/bun.js/bindings/ProcessBindingNatives.cpp",
+];
+
+console.time("Creating static hash tables...");
+const create_hash_table = path.join(import.meta.dir, "../../../src/bun.js/scripts/create_hash_table");
+if (!create_hash_table) {
+ console.warn("Could not find create_hash_table executable. Run `bun i` or clone webkit to build static hash tables");
+ process.exit(1);
+}
+
+await Promise.all(
+ STATIC_HASH_TABLES.map(async cpp => {
+ cpp = path.join(import.meta.dir, "../../../", cpp);
+ const { stdout, exited } = spawn({
+ cmd: [create_hash_table, cpp],
+ stdout: "pipe",
+ stderr: "inherit",
+ });
+ await exited;
+ let str = await new Response(stdout).text();
+ str = str.replaceAll(/^\/\/.*$/gm, "");
+ str = str.replaceAll(/^#include.*$/gm, "");
+ str = str.replaceAll(`namespace JSC {`, "");
+ str = str.replaceAll(`} // namespace JSC`, "");
+ str = "// File generated via `make static-hash-table` / `make cpp`\n" + str.trim() + "\n";
+ await Bun.write(cpp.replace(/\.cpp$/, ".lut.h").replace(/(\.lut)?\.txt$/, ".lut.h"), str);
+ console.log("Wrote", path.relative(process.cwd(), cpp.replace(/\.cpp$/, ".lut.h")));
+ }),
+);
+
+console.timeEnd("Creating static hash tables...");
diff --git a/src/js/builtins/ProcessObjectInternals.ts b/src/js/builtins/ProcessObjectInternals.ts
index 2bb8648df..ef8f1f9ce 100644
--- a/src/js/builtins/ProcessObjectInternals.ts
+++ b/src/js/builtins/ProcessObjectInternals.ts
@@ -24,27 +24,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// TODO: move this to native code?
-export function binding(bindingName) {
- if (bindingName === "constants") {
- return $processBindingConstants;
- }
- const issue = {
- fs: 3546,
- buffer: 2020,
- natives: 2254,
- uv: 2891,
- }[bindingName];
- if (issue) {
- throw new Error(
- `process.binding("${bindingName}") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/${issue}`,
- );
- }
- throw new TypeError(
- `process.binding("${bindingName}") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample.`,
- );
-}
-
export function getStdioWriteStream(fd) {
const tty = require("node:tty");
diff --git a/src/js/out/WebCoreJSBuiltins.cpp b/src/js/out/WebCoreJSBuiltins.cpp
index 94e249711..cc537687a 100644
--- a/src/js/out/WebCoreJSBuiltins.cpp
+++ b/src/js/out/WebCoreJSBuiltins.cpp
@@ -634,14 +634,6 @@ WEBCORE_FOREACH_TRANSFORMSTREAMINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
#undef DEFINE_BUILTIN_GENERATOR
/* ProcessObjectInternals.ts */
-// binding
-const JSC::ConstructAbility s_processObjectInternalsBindingCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
-const JSC::ConstructorKind s_processObjectInternalsBindingCodeConstructorKind = JSC::ConstructorKind::None;
-const JSC::ImplementationVisibility s_processObjectInternalsBindingCodeImplementationVisibility = JSC::ImplementationVisibility::Public;
-const int s_processObjectInternalsBindingCodeLength = 569;
-static const JSC::Intrinsic s_processObjectInternalsBindingCodeIntrinsic = JSC::NoIntrinsic;
-const char* const s_processObjectInternalsBindingCode = "(function (bindingName) {\"use strict\";\n if (bindingName === \"constants\")\n return @processBindingConstants;\n const issue = {\n fs: 3546,\n buffer: 2020,\n natives: 2254,\n uv: 2891\n }[bindingName];\n if (issue)\n throw new Error(`process.binding(\"${bindingName}\") is not implemented in Bun. Track the status & thumbs up the issue: https://github.com/oven-sh/bun/issues/${issue}`);\n @throwTypeError(`process.binding(\"${bindingName}\") is not implemented in Bun. If that breaks something, please file an issue and include a reproducible code sample.`);\n})\n";
-
// getStdioWriteStream
const JSC::ConstructAbility s_processObjectInternalsGetStdioWriteStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_processObjectInternalsGetStdioWriteStreamCodeConstructorKind = JSC::ConstructorKind::None;
diff --git a/src/js/out/WebCoreJSBuiltins.h b/src/js/out/WebCoreJSBuiltins.h
index 4fc91dbd9..6e97db4d7 100644
--- a/src/js/out/WebCoreJSBuiltins.h
+++ b/src/js/out/WebCoreJSBuiltins.h
@@ -1155,14 +1155,6 @@ inline void TransformStreamInternalsBuiltinFunctions::visit(Visitor& visitor)
template void TransformStreamInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&);
template void TransformStreamInternalsBuiltinFunctions::visit(JSC::SlotVisitor&);
/* ProcessObjectInternals.ts */
-// binding
-#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_BINDING 1
-extern const char* const s_processObjectInternalsBindingCode;
-extern const int s_processObjectInternalsBindingCodeLength;
-extern const JSC::ConstructAbility s_processObjectInternalsBindingCodeConstructAbility;
-extern const JSC::ConstructorKind s_processObjectInternalsBindingCodeConstructorKind;
-extern const JSC::ImplementationVisibility s_processObjectInternalsBindingCodeImplementationVisibility;
-
// getStdioWriteStream
#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_GETSTDIOWRITESTREAM 1
extern const char* const s_processObjectInternalsGetStdioWriteStreamCode;
@@ -1188,19 +1180,16 @@ extern const JSC::ConstructorKind s_processObjectInternalsInitializeNextTickQueu
extern const JSC::ImplementationVisibility s_processObjectInternalsInitializeNextTickQueueCodeImplementationVisibility;
#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_DATA(macro) \
- macro(binding, processObjectInternalsBinding, 1) \
macro(getStdioWriteStream, processObjectInternalsGetStdioWriteStream, 1) \
macro(getStdinStream, processObjectInternalsGetStdinStream, 1) \
macro(initializeNextTickQueue, processObjectInternalsInitializeNextTickQueue, 4) \
#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(macro) \
- macro(processObjectInternalsBindingCode, binding, ASCIILiteral(), s_processObjectInternalsBindingCodeLength) \
macro(processObjectInternalsGetStdioWriteStreamCode, getStdioWriteStream, ASCIILiteral(), s_processObjectInternalsGetStdioWriteStreamCodeLength) \
macro(processObjectInternalsGetStdinStreamCode, getStdinStream, ASCIILiteral(), s_processObjectInternalsGetStdinStreamCodeLength) \
macro(processObjectInternalsInitializeNextTickQueueCode, initializeNextTickQueue, ASCIILiteral(), s_processObjectInternalsInitializeNextTickQueueCodeLength) \
#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(macro) \
- macro(binding) \
macro(getStdioWriteStream) \
macro(getStdinStream) \
macro(initializeNextTickQueue) \