diff options
author | 2022-12-03 08:25:15 -0800 | |
---|---|---|
committer | 2022-12-03 08:26:53 -0800 | |
commit | bdc43c1696f0d759d28cfb63a2eb1aed5273d55f (patch) | |
tree | 604b87032f77ae1902c76a149b98ad7d40b1a2b1 /src/bun.js/builtins/cpp | |
parent | bc028168a815977830460983f28aefa4f7605c5e (diff) | |
download | bun-bdc43c1696f0d759d28cfb63a2eb1aed5273d55f.tar.gz bun-bdc43c1696f0d759d28cfb63a2eb1aed5273d55f.tar.zst bun-bdc43c1696f0d759d28cfb63a2eb1aed5273d55f.zip |
`process.stdout` and `process.stderr`
Diffstat (limited to 'src/bun.js/builtins/cpp')
-rw-r--r-- | src/bun.js/builtins/cpp/ProcessObjectBuiltins.cpp | 63 | ||||
-rw-r--r-- | src/bun.js/builtins/cpp/ProcessObjectBuiltins.h | 120 | ||||
-rw-r--r-- | src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp | 655 | ||||
-rw-r--r-- | src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h | 175 | ||||
-rw-r--r-- | src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h | 3 | ||||
-rw-r--r-- | src/bun.js/builtins/cpp/WebCoreJSBuiltins.h | 9 |
6 files changed, 838 insertions, 187 deletions
diff --git a/src/bun.js/builtins/cpp/ProcessObjectBuiltins.cpp b/src/bun.js/builtins/cpp/ProcessObjectBuiltins.cpp deleted file mode 100644 index 0a0389ca3..000000000 --- a/src/bun.js/builtins/cpp/ProcessObjectBuiltins.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2018 -2018 Apple Inc. All rights reserved. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#include "config.h" -#include "ProcessObjectBuiltins.h" - -#include "WebCoreJSClientData.h" -#include <JavaScriptCore/HeapInlines.h> -#include <JavaScriptCore/IdentifierInlines.h> -#include <JavaScriptCore/ImplementationVisibility.h> -#include <JavaScriptCore/Intrinsic.h> -#include <JavaScriptCore/JSCJSValueInlines.h> -#include <JavaScriptCore/JSCellInlines.h> -#include <JavaScriptCore/StructureInlines.h> -#include <JavaScriptCore/VM.h> - -namespace WebCore { - - -#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ -JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ -{\ - JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ - return clientData->builtinFunctions().processObjectBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().processObjectBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ -} -WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) -#undef DEFINE_BUILTIN_GENERATOR - - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ProcessObjectBuiltins.h b/src/bun.js/builtins/cpp/ProcessObjectBuiltins.h deleted file mode 100644 index b48359479..000000000 --- a/src/bun.js/builtins/cpp/ProcessObjectBuiltins.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2015 Igalia - * Copyright (c) 2015 Igalia S.L. - * Copyright (c) 2015 Igalia. - * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. - * Copyright (c) 2015, 2016, 2017 Canon Inc. - * Copyright (c) 2016, 2018 -2018 Apple Inc. All rights reserved. - * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. - * Copyright (c) 2022 Codeblog Corp. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for -// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py - -#pragma once - -#include <JavaScriptCore/BuiltinUtils.h> -#include <JavaScriptCore/Identifier.h> -#include <JavaScriptCore/JSFunction.h> -#include <JavaScriptCore/UnlinkedFunctionExecutable.h> - -namespace JSC { -class FunctionExecutable; -} - -namespace WebCore { - -/* ProcessObject */ - -#define WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_DATA(macro) \ - - -#define WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_CODE(macro) \ - -#define WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_FUNCTION_NAME(macro) \ - -#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ - JSC::FunctionExecutable* codeName##Generator(JSC::VM&); - -WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) -#undef DECLARE_BUILTIN_GENERATOR - -class ProcessObjectBuiltinsWrapper : private JSC::WeakHandleOwner { -public: - explicit ProcessObjectBuiltinsWrapper(JSC::VM& vm) - : m_vm(vm) - WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) -#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) - WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) -#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS - { - } - -#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ - JSC::UnlinkedFunctionExecutable* name##Executable(); \ - const JSC::SourceCode& name##Source() const { return m_##name##Source; } - WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) -#undef EXPOSE_BUILTIN_EXECUTABLES - - WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) - - void exportNames(); - -private: - JSC::VM& m_vm; - - WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) - -#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ - JSC::SourceCode m_##name##Source;\ - JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; - WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) -#undef DECLARE_BUILTIN_SOURCE_MEMBERS - -}; - -#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ -inline JSC::UnlinkedFunctionExecutable* ProcessObjectBuiltinsWrapper::name##Executable() \ -{\ - if (!m_##name##Executable) {\ - JSC::Identifier executableName = functionName##PublicName();\ - if (overriddenName)\ - executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ - m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ - }\ - return m_##name##Executable.get();\ -} -WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) -#undef DEFINE_BUILTIN_EXECUTABLES - -inline void ProcessObjectBuiltinsWrapper::exportNames() -{ -#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); - WEBCORE_FOREACH_PROCESSOBJECT_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) -#undef EXPORT_FUNCTION_NAME -} - -} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp new file mode 100644 index 000000000..ed5ea553e --- /dev/null +++ b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.cpp @@ -0,0 +1,655 @@ +/* + * Copyright (c) 2015 Igalia + * Copyright (c) 2015 Igalia S.L. + * Copyright (c) 2015 Igalia. + * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. + * Copyright (c) 2015, 2016, 2017 Canon Inc. + * Copyright (c) 2016, 2018 -2018 Apple Inc. All rights reserved. + * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. + * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#include "config.h" +#include "ProcessObjectInternalsBuiltins.h" + +#include "WebCoreJSClientData.h" +#include <JavaScriptCore/HeapInlines.h> +#include <JavaScriptCore/IdentifierInlines.h> +#include <JavaScriptCore/ImplementationVisibility.h> +#include <JavaScriptCore/Intrinsic.h> +#include <JavaScriptCore/JSCJSValueInlines.h> +#include <JavaScriptCore/JSCellInlines.h> +#include <JavaScriptCore/StructureInlines.h> +#include <JavaScriptCore/VM.h> + +namespace WebCore { + +const JSC::ConstructAbility s_processObjectInternalsGetStdioWriteStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const JSC::ConstructorKind s_processObjectInternalsGetStdioWriteStreamCodeConstructorKind = JSC::ConstructorKind::None; +const JSC::ImplementationVisibility s_processObjectInternalsGetStdioWriteStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; +const int s_processObjectInternalsGetStdioWriteStreamCodeLength = 9885; +static const JSC::Intrinsic s_processObjectInternalsGetStdioWriteStreamCodeIntrinsic = JSC::NoIntrinsic; +const char* const s_processObjectInternalsGetStdioWriteStreamCode = + "(function (fd_, rawRequire) {\n" \ + " var module = { path: \"node:process\", require: rawRequire };\n" \ + " var require = (path) => module.require(path);\n" \ + "\n" \ + " function createStdioWriteStream(fd_) {\n" \ + " var { Duplex, eos, destroy } = require(\"node:stream\");\n" \ + " var StdioWriteStream = class StdioWriteStream extends Duplex {\n" \ + " #writeStream;\n" \ + " #readStream;\n" \ + "\n" \ + " #readable = true;\n" \ + " #writable = true;\n" \ + " #fdPath;\n" \ + "\n" \ + " #onClose;\n" \ + " #onDrain;\n" \ + " #onFinish;\n" \ + " #onReadable;\n" \ + " #isTTY;\n" \ + "\n" \ + " get isTTY() {\n" \ + " return (this.#isTTY ??= require(\"node:tty\").isatty(fd_));\n" \ + " }\n" \ + "\n" \ + " get fd() {\n" \ + " return fd_;\n" \ + " }\n" \ + "\n" \ + " constructor(fd) {\n" \ + " super({ readable: true, writable: true });\n" \ + " this.#fdPath = `/dev/fd/${fd}`;\n" \ + " }\n" \ + "\n" \ + " #onFinished(err) {\n" \ + " const cb = this.#onClose;\n" \ + " this.#onClose = null;\n" \ + "\n" \ + " if (cb) {\n" \ + " cb(err);\n" \ + " } else if (err) {\n" \ + " this.destroy(err);\n" \ + " } else if (!this.#readable && !this.#writable) {\n" \ + " this.destroy();\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " _destroy(err, callback) {\n" \ + " if (!err && this.#onClose !== null) {\n" \ + " var AbortError = class AbortError extends Error {\n" \ + " constructor(\n" \ + " message = \"The operation was aborted\",\n" \ + " options = void 0,\n" \ + " ) {\n" \ + " if (options !== void 0 && typeof options !== \"object\") {\n" \ + " throw new Error(\n" \ + " `Invalid AbortError options:\\n" \ + "\\n" \ + "${JSON.stringify(\n" \ + " options,\n" \ + " null,\n" \ + " 2,\n" \ + " )}`,\n" \ + " );\n" \ + " }\n" \ + " super(message, options);\n" \ + " this.code = \"ABORT_ERR\";\n" \ + " this.name = \"AbortError\";\n" \ + " }\n" \ + " };\n" \ + " err = new AbortError();\n" \ + " }\n" \ + "\n" \ + " this.#onDrain = null;\n" \ + " this.#onFinish = null;\n" \ + " if (this.#onClose === null) {\n" \ + " callback(err);\n" \ + " } else {\n" \ + " this.#onClose = callback;\n" \ + " if (this.#writeStream) destroy(this.#writeStream, err);\n" \ + " if (this.#readStream) destroy(this.#readStream, err);\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " _write(chunk, encoding, callback) {\n" \ + " if (!this.#writeStream) {\n" \ + " var { createWriteStream } = require(\"node:fs\");\n" \ + " var stream = (this.#writeStream = createWriteStream(this.#fdPath));\n" \ + "\n" \ + " stream.on(\"finish\", () => {\n" \ + " if (this.#onFinish) {\n" \ + " const cb = this.#onFinish;\n" \ + " this.#onFinish = null;\n" \ + " cb();\n" \ + " }\n" \ + " });\n" \ + "\n" \ + " stream.on(\"drain\", () => {\n" \ + " if (this.#onDrain) {\n" \ + " const cb = this.#onDrain;\n" \ + " this.#onDrain = null;\n" \ + " cb();\n" \ + " }\n" \ + " });\n" \ + "\n" \ + " eos(stream, (err) => {\n" \ + " this.#writable = false;\n" \ + " if (err) {\n" \ + " destroy(stream, err);\n" \ + " }\n" \ + " this.#onFinished(err);\n" \ + " });\n" \ + " }\n" \ + " if (stream.write(chunk, encoding)) {\n" \ + " callback();\n" \ + " } else {\n" \ + " this.#onDrain = callback;\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " _final(callback) {\n" \ + " this.#writeStream && this.#writeStream.end();\n" \ + " this.#onFinish = callback;\n" \ + " }\n" \ + "\n" \ + " #loadReadStream() {\n" \ + " var { createReadStream } = require(\"node:fs\");\n" \ + "\n" \ + " var readStream = (this.#readStream = createReadStream(this.#fdPath));\n" \ + "\n" \ + " readStream.on(\"readable\", () => {\n" \ + " if (this.#onReadable) {\n" \ + " const cb = this.#onReadable;\n" \ + " this.#onReadable = null;\n" \ + " cb();\n" \ + " } else {\n" \ + " this.read();\n" \ + " }\n" \ + " });\n" \ + "\n" \ + " readStream.on(\"end\", () => {\n" \ + " this.push(null);\n" \ + " });\n" \ + "\n" \ + " eos(readStream, (err) => {\n" \ + " this.#readable = false;\n" \ + " if (err) {\n" \ + " destroy(readStream, err);\n" \ + " }\n" \ + " this.#onFinished(err);\n" \ + " });\n" \ + " return readStream;\n" \ + " }\n" \ + "\n" \ + " _read() {\n" \ + " var stream = this.#readStream;\n" \ + " if (!stream) {\n" \ + " stream = this.#loadReadStream();\n" \ + " }\n" \ + "\n" \ + " while (true) {\n" \ + " const buf = stream.read();\n" \ + " if (buf === null || !this.push(buf)) {\n" \ + " return;\n" \ + " }\n" \ + " }\n" \ + " }\n" \ + " };\n" \ + " return new StdioWriteStream(fd_);\n" \ + " }\n" \ + "\n" \ + " var { EventEmitter } = require(\"node:events\");\n" \ + "\n" \ + " function isFastEncoding(encoding) {\n" \ + " if (!encoding) return true;\n" \ + "\n" \ + " var normalied = encoding.toLowerCase();\n" \ + " return (\n" \ + " normalied === \"utf8\" ||\n" \ + " normalied === \"utf-8\" ||\n" \ + " normalied === \"buffer\" ||\n" \ + " normalied === \"binary\" ||\n" \ + " normalized === \"\"\n" \ + " );\n" \ + " }\n" \ + " var FastStdioWriteStream = class StdioWriteStream extends EventEmitter {\n" \ + " #fd;\n" \ + " #innerStream;\n" \ + " #writer;\n" \ + " #isTTY;\n" \ + "\n" \ + " bytesWritten = 0;\n" \ + "\n" \ + " setDefaultEncoding(encoding) {\n" \ + " if (this.#innerStream || !isFastEncoding(encoding)) {\n" \ + " this.#ensureInnerStream();\n" \ + " return this.#innerStream.setDefaultEncoding(encoding);\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " #createWriter() {\n" \ + " switch (this.#fd) {\n" \ + " case 1: {\n" \ + " var writer = Bun.stdout.writer({ highWaterMark: 0 });\n" \ + " writer.unref();\n" \ + " return writer;\n" \ + " }\n" \ + "\n" \ + " case 2: {\n" \ + " var writer = Bun.stderr.writer({ highWaterMark: 0 });\n" \ + " writer.unref();\n" \ + " return writer;\n" \ + " }\n" \ + " default: {\n" \ + " throw new Error(\"Unsupported writer\");\n" \ + " }\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " #getWriter() {\n" \ + " return (this.#writer ??= this.#createWriter());\n" \ + " }\n" \ + "\n" \ + " constructor(fd_) {\n" \ + " super();\n" \ + " this.#fd = fd_;\n" \ + " }\n" \ + "\n" \ + " get fd() {\n" \ + " return this.#fd;\n" \ + " }\n" \ + "\n" \ + " get isTTY() {\n" \ + " return (this.#isTTY ??= require(\"node:tty\").isatty(this.#fd));\n" \ + " }\n" \ + "\n" \ + " on(event, listener) {\n" \ + " if (event === \"close\" || event === \"finish\") {\n" \ + " this.#ensureInnerStream();\n" \ + " return this.#innerStream.on(event, listener);\n" \ + " }\n" \ + "\n" \ + " if (event === \"drain\") {\n" \ + " return super.on(\"drain\", listener);\n" \ + " }\n" \ + "\n" \ + " if (event === \"error\") {\n" \ + " return super.on(\"error\", listener);\n" \ + " }\n" \ + "\n" \ + " return super.on(event, listener);\n" \ + " }\n" \ + "\n" \ + " get _writableState() {\n" \ + " this.#ensureInnerStream();\n" \ + " return this.#innerStream._writableState;\n" \ + " }\n" \ + "\n" \ + " get _readableState() {\n" \ + " this.#ensureInnerStream();\n" \ + " return this.#innerStream._readableState;\n" \ + " }\n" \ + "\n" \ + " pipe(destination) {\n" \ + " this.#ensureInnerStream();\n" \ + " return this.#innerStream.pipe(destination);\n" \ + " }\n" \ + "\n" \ + " unpipe(destination) {\n" \ + " this.#ensureInnerStream();\n" \ + " return this.#innerStream.unpipe(destination);\n" \ + " }\n" \ + "\n" \ + " #ensureInnerStream() {\n" \ + " if (this.#innerStream) return;\n" \ + " this.#innerStream = createStdioWriteStream(this.#fd);\n" \ + " const events = this.eventNames();\n" \ + " for (const event of events) {\n" \ + " this.#innerStream.on(event, (...args) => {\n" \ + " this.emit(event, ...args);\n" \ + " });\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " #write1(chunk) {\n" \ + " var writer = this.#getWriter();\n" \ + " const writeResult = writer.write(chunk);\n" \ + " this.bytesWritten += writeResult;\n" \ + " const flushResult = writer.flush();\n" \ + " return !!(writeResult || flushResult);\n" \ + " }\n" \ + "\n" \ + " #writeWithEncoding(chunk, encoding) {\n" \ + " if (!isFastEncoding(encoding)) {\n" \ + " this.#ensureInnerStream();\n" \ + " return this.#innerStream.write(chunk, encoding);\n" \ + " }\n" \ + "\n" \ + " return this.#write1(chunk);\n" \ + " }\n" \ + "\n" \ + " #performCallback(cb, err) {\n" \ + " if (err) {\n" \ + " this.emit(\"error\", err);\n" \ + " }\n" \ + "\n" \ + " try {\n" \ + " cb(err ? err : null);\n" \ + " } catch (err2) {\n" \ + " this.emit(\"error\", err2);\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " #writeWithCallbackAndEncoding(chunk, encoding, callback) {\n" \ + " if (!isFastEncoding(encoding)) {\n" \ + " this.#ensureInnerStream();\n" \ + " return this.#innerStream.write(chunk, encoding, callback);\n" \ + " }\n" \ + "\n" \ + " var writer = this.#getWriter();\n" \ + " const writeResult = writer.write(chunk);\n" \ + " const flushResult = writer.flush(true);\n" \ + " if (flushResult?.then) {\n" \ + " flushResult.then(\n" \ + " () => {\n" \ + " this.#performCallback(callback);\n" \ + " this.emit(\"drain\");\n" \ + " },\n" \ + " (err) => this.#performCallback(callback, err),\n" \ + " );\n" \ + " return false;\n" \ + " }\n" \ + "\n" \ + " queueMicrotask(() => {\n" \ + " this.#performCallback(callback);\n" \ + " });\n" \ + "\n" \ + " return !!(writeResult || flushResult);\n" \ + " }\n" \ + "\n" \ + " write(chunk, encoding, callback) {\n" \ + " const result = this._write(chunk, encoding, callback);\n" \ + "\n" \ + " if (result) {\n" \ + " this.emit(\"drain\");\n" \ + " }\n" \ + "\n" \ + " return result;\n" \ + " }\n" \ + "\n" \ + " get hasColors() {\n" \ + " return Bun.tty[this.#fd].hasColors;\n" \ + " }\n" \ + "\n" \ + " _write(chunk, encoding, callback) {\n" \ + " var inner = this.#innerStream;\n" \ + " if (inner) {\n" \ + " return inner.write(chunk, encoding, callback);\n" \ + " }\n" \ + "\n" \ + " switch (arguments.length) {\n" \ + " case 0: {\n" \ + " var error = new Error(\"Invalid arguments\");\n" \ + " error.code = \"ERR_INVALID_ARG_TYPE\";\n" \ + " throw error;\n" \ + " }\n" \ + " case 1: {\n" \ + " return this.#write1(chunk);\n" \ + " }\n" \ + " case 2: {\n" \ + " if (typeof encoding === \"function\") {\n" \ + " return this.#writeWithCallbackAndEncoding(chunk, \"\", encoding);\n" \ + " } else if (typeof encoding === \"string\") {\n" \ + " return this.#writeWithEncoding(chunk, encoding);\n" \ + " }\n" \ + " }\n" \ + " default: {\n" \ + " if (\n" \ + " (typeof encoding !== \"undefined\" && typeof encoding !== \"string\") ||\n" \ + " (typeof callback !== \"undefined\" && typeof callback !== \"function\")\n" \ + " ) {\n" \ + " var error = new Error(\"Invalid arguments\");\n" \ + " error.code = \"ERR_INVALID_ARG_TYPE\";\n" \ + " throw error;\n" \ + " }\n" \ + "\n" \ + " if (typeof callback === \"undefined\") {\n" \ + " return this.#writeWithEncoding(chunk, encoding);\n" \ + " }\n" \ + "\n" \ + " return this.#writeWithCallbackAndEncoding(chunk, encoding, callback);\n" \ + " }\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " destroy() {\n" \ + " return this;\n" \ + " }\n" \ + "\n" \ + " end() {\n" \ + " return this;\n" \ + " }\n" \ + " };\n" \ + "\n" \ + " return new FastStdioWriteStream(fd_);\n" \ + "})\n" \ +; + +const JSC::ConstructAbility s_processObjectInternalsGetStdinStreamCodeConstructAbility = JSC::ConstructAbility::CannotConstruct; +const JSC::ConstructorKind s_processObjectInternalsGetStdinStreamCodeConstructorKind = JSC::ConstructorKind::None; +const JSC::ImplementationVisibility s_processObjectInternalsGetStdinStreamCodeImplementationVisibility = JSC::ImplementationVisibility::Public; +const int s_processObjectInternalsGetStdinStreamCodeLength = 3915; +static const JSC::Intrinsic s_processObjectInternalsGetStdinStreamCodeIntrinsic = JSC::NoIntrinsic; +const char* const s_processObjectInternalsGetStdinStreamCode = + "(function (fd, rawRequire, Bun) {\n" \ + " var module = { path: \"node:process\", require: rawRequire };\n" \ + " var require = (path) => module.require(path);\n" \ + "\n" \ + " var { Readable, Duplex, eos, destroy } = require(\"node:stream\");\n" \ + "\n" \ + " var StdinStream = class StdinStream extends Duplex {\n" \ + " #readStream;\n" \ + " #writeStream;\n" \ + "\n" \ + " #readable = true;\n" \ + " #writable = true;\n" \ + "\n" \ + " #onFinish;\n" \ + " #onClose;\n" \ + " #onDrain;\n" \ + " #onReadable;\n" \ + "\n" \ + " get isTTY() {\n" \ + " return require(\"tty\").isatty(fd);\n" \ + " }\n" \ + "\n" \ + " get fd() {\n" \ + " return fd_;\n" \ + " }\n" \ + "\n" \ + " constructor() {\n" \ + " super({ readable: true, writable: true });\n" \ + "\n" \ + " this.#onReadable = this._read.bind(this);\n" \ + " }\n" \ + "\n" \ + " #onFinished(err) {\n" \ + " const cb = this.#onClose;\n" \ + " this.#onClose = null;\n" \ + "\n" \ + " if (cb) {\n" \ + " cb(err);\n" \ + " } else if (err) {\n" \ + " this.destroy(err);\n" \ + " } else if (!this.#readable && !this.#writable) {\n" \ + " this.destroy();\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " _destroy(err, callback) {\n" \ + " if (!err && this.#onClose !== null) {\n" \ + " var AbortError = class AbortError extends Error {\n" \ + " constructor(message = \"The operation was aborted\", options = void 0) {\n" \ + " if (options !== void 0 && typeof options !== \"object\") {\n" \ + " throw new Error(\n" \ + " `Invalid AbortError options:\\n" \ + "\\n" \ + "${JSON.stringify(\n" \ + " options,\n" \ + " null,\n" \ + " 2,\n" \ + " )}`,\n" \ + " );\n" \ + " }\n" \ + " super(message, options);\n" \ + " this.code = \"ABORT_ERR\";\n" \ + " this.name = \"AbortError\";\n" \ + " }\n" \ + " };\n" \ + " err = new AbortError();\n" \ + " }\n" \ + "\n" \ + " if (this.#onClose === null) {\n" \ + " callback(err);\n" \ + " } else {\n" \ + " this.#onClose = callback;\n" \ + " if (this.#readStream) destroy(this.#readStream, err);\n" \ + " if (this.#writeStream) destroy(this.#writeStream, err);\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " on(ev, cb) {\n" \ + " super.on(ev, cb);\n" \ + " if (!this.#readStream && (ev === \"readable\" || ev === \"data\")) {\n" \ + " this.#loadReadStream();\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " #loadReadStream() {\n" \ + " var readStream = (this.#readStream = Readable.fromWeb(\n" \ + " Bun.stdin.stream(),\n" \ + " ));\n" \ + "\n" \ + " readStream.on(\"readable\", () => {\n" \ + " const cb = this.#onReadable;\n" \ + " this.#onReadable = null;\n" \ + " cb();\n" \ + " });\n" \ + "\n" \ + " readStream.on(\"end\", () => {\n" \ + " this.push(null);\n" \ + " });\n" \ + "\n" \ + " eos(readStream, (err) => {\n" \ + " this.#readable = false;\n" \ + " if (err) {\n" \ + " destroy(readStream, err);\n" \ + " }\n" \ + " this.#onFinished(err);\n" \ + " });\n" \ + " }\n" \ + "\n" \ + " _read() {\n" \ + " var readStream = this.#readStream;\n" \ + " while (true) {\n" \ + " const buf = readStream.read();\n" \ + " if (buf === null || !this.push(buf)) {\n" \ + " this.#onReadable = this._read.bind(this);\n" \ + " return;\n" \ + " }\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " #constructWriteStream() {\n" \ + " var { createWriteStream } = require(\"node:fs\");\n" \ + " var writeStream = (this.#writeStream = createWriteStream(\"/dev/fd/0\"));\n" \ + "\n" \ + " writeStream.on(\"finish\", () => {\n" \ + " if (this.#onFinish) {\n" \ + " const cb = this.#onFinish;\n" \ + " this.#onFinish = null;\n" \ + " cb();\n" \ + " }\n" \ + " });\n" \ + "\n" \ + " writeStream.on(\"drain\", () => {\n" \ + " if (this.#onDrain) {\n" \ + " const cb = this.#onDrain;\n" \ + " this.#onDrain = null;\n" \ + " cb();\n" \ + " }\n" \ + " });\n" \ + "\n" \ + " eos(writeStream, (err) => {\n" \ + " this.#writable = false;\n" \ + " if (err) {\n" \ + " destroy(writeStream, err);\n" \ + " }\n" \ + " this.#onFinished(err);\n" \ + " });\n" \ + "\n" \ + " return writeStream;\n" \ + " }\n" \ + "\n" \ + " _write(chunk, encoding, callback) {\n" \ + " var writeStream = this.#writeStream;\n" \ + " if (!writeStream) {\n" \ + " writeStream = this.#constructWriteStream();\n" \ + " }\n" \ + "\n" \ + " if (writeStream.write(chunk, encoding)) {\n" \ + " callback();\n" \ + " } else {\n" \ + " this.#onDrain = callback;\n" \ + " }\n" \ + " }\n" \ + "\n" \ + " _final(callback) {\n" \ + " this.#writeStream.end();\n" \ + " this.#onFinish = callback.bind(this);\n" \ + " }\n" \ + " };\n" \ + "\n" \ + " return new StdinStream();\n" \ + "})\n" \ +; + + +#define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ +JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \ +{\ + JSVMClientData* clientData = static_cast<JSVMClientData*>(vm.clientData); \ + return clientData->builtinFunctions().processObjectInternalsBuiltins().codeName##Executable()->link(vm, nullptr, clientData->builtinFunctions().processObjectInternalsBuiltins().codeName##Source(), std::nullopt, s_##codeName##Intrinsic); \ +} +WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR) +#undef DEFINE_BUILTIN_GENERATOR + + +} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h new file mode 100644 index 000000000..cce9c1564 --- /dev/null +++ b/src/bun.js/builtins/cpp/ProcessObjectInternalsBuiltins.h @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2015 Igalia + * Copyright (c) 2015 Igalia S.L. + * Copyright (c) 2015 Igalia. + * Copyright (c) 2015, 2016 Canon Inc. All rights reserved. + * Copyright (c) 2015, 2016, 2017 Canon Inc. + * Copyright (c) 2016, 2018 -2018 Apple Inc. All rights reserved. + * Copyright (c) 2016, 2020 Apple Inc. All rights reserved. + * Copyright (c) 2022 Codeblog Corp. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +// DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for +// builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py + +#pragma once + +#include <JavaScriptCore/BuiltinUtils.h> +#include <JavaScriptCore/Identifier.h> +#include <JavaScriptCore/JSFunction.h> +#include <JavaScriptCore/UnlinkedFunctionExecutable.h> + +namespace JSC { +class FunctionExecutable; +} + +namespace WebCore { + +/* ProcessObjectInternals */ +extern const char* const s_processObjectInternalsGetStdioWriteStreamCode; +extern const int s_processObjectInternalsGetStdioWriteStreamCodeLength; +extern const JSC::ConstructAbility s_processObjectInternalsGetStdioWriteStreamCodeConstructAbility; +extern const JSC::ConstructorKind s_processObjectInternalsGetStdioWriteStreamCodeConstructorKind; +extern const JSC::ImplementationVisibility s_processObjectInternalsGetStdioWriteStreamCodeImplementationVisibility; +extern const char* const s_processObjectInternalsGetStdinStreamCode; +extern const int s_processObjectInternalsGetStdinStreamCodeLength; +extern const JSC::ConstructAbility s_processObjectInternalsGetStdinStreamCodeConstructAbility; +extern const JSC::ConstructorKind s_processObjectInternalsGetStdinStreamCodeConstructorKind; +extern const JSC::ImplementationVisibility s_processObjectInternalsGetStdinStreamCodeImplementationVisibility; + +#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_DATA(macro) \ + macro(getStdioWriteStream, processObjectInternalsGetStdioWriteStream, 2) \ + macro(getStdinStream, processObjectInternalsGetStdinStream, 3) \ + +#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_GETSTDIOWRITESTREAM 1 +#define WEBCORE_BUILTIN_PROCESSOBJECTINTERNALS_GETSTDINSTREAM 1 + +#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(macro) \ + macro(processObjectInternalsGetStdioWriteStreamCode, getStdioWriteStream, ASCIILiteral(), s_processObjectInternalsGetStdioWriteStreamCodeLength) \ + macro(processObjectInternalsGetStdinStreamCode, getStdinStream, ASCIILiteral(), s_processObjectInternalsGetStdinStreamCodeLength) \ + +#define WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(macro) \ + macro(getStdinStream) \ + macro(getStdioWriteStream) \ + +#define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \ + JSC::FunctionExecutable* codeName##Generator(JSC::VM&); + +WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR) +#undef DECLARE_BUILTIN_GENERATOR + +class ProcessObjectInternalsBuiltinsWrapper : private JSC::WeakHandleOwner { +public: + explicit ProcessObjectInternalsBuiltinsWrapper(JSC::VM& vm) + : m_vm(vm) + WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES) +#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(s_##name, length), { })) + WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS) +#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS + { + } + +#define EXPOSE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ + JSC::UnlinkedFunctionExecutable* name##Executable(); \ + const JSC::SourceCode& name##Source() const { return m_##name##Source; } + WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(EXPOSE_BUILTIN_EXECUTABLES) +#undef EXPOSE_BUILTIN_EXECUTABLES + + WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR) + + void exportNames(); + +private: + JSC::VM& m_vm; + + WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES) + +#define DECLARE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) \ + JSC::SourceCode m_##name##Source;\ + JSC::Weak<JSC::UnlinkedFunctionExecutable> m_##name##Executable; + WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS + +}; + +#define DEFINE_BUILTIN_EXECUTABLES(name, functionName, overriddenName, length) \ +inline JSC::UnlinkedFunctionExecutable* ProcessObjectInternalsBuiltinsWrapper::name##Executable() \ +{\ + if (!m_##name##Executable) {\ + JSC::Identifier executableName = functionName##PublicName();\ + if (overriddenName)\ + executableName = JSC::Identifier::fromString(m_vm, overriddenName);\ + m_##name##Executable = JSC::Weak<JSC::UnlinkedFunctionExecutable>(JSC::createBuiltinExecutable(m_vm, m_##name##Source, executableName, s_##name##ImplementationVisibility, s_##name##ConstructorKind, s_##name##ConstructAbility), this, &m_##name##Executable);\ + }\ + return m_##name##Executable.get();\ +} +WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(DEFINE_BUILTIN_EXECUTABLES) +#undef DEFINE_BUILTIN_EXECUTABLES + +inline void ProcessObjectInternalsBuiltinsWrapper::exportNames() +{ +#define EXPORT_FUNCTION_NAME(name) m_vm.propertyNames->appendExternalName(name##PublicName(), name##PrivateName()); + WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(EXPORT_FUNCTION_NAME) +#undef EXPORT_FUNCTION_NAME +} + +class ProcessObjectInternalsBuiltinFunctions { +public: + explicit ProcessObjectInternalsBuiltinFunctions(JSC::VM& vm) : m_vm(vm) { } + + void init(JSC::JSGlobalObject&); + template<typename Visitor> void visit(Visitor&); + +public: + JSC::VM& m_vm; + +#define DECLARE_BUILTIN_SOURCE_MEMBERS(functionName) \ + JSC::WriteBarrier<JSC::JSFunction> m_##functionName##Function; + WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_SOURCE_MEMBERS) +#undef DECLARE_BUILTIN_SOURCE_MEMBERS +}; + +inline void ProcessObjectInternalsBuiltinFunctions::init(JSC::JSGlobalObject& globalObject) +{ +#define EXPORT_FUNCTION(codeName, functionName, overriddenName, length)\ + m_##functionName##Function.set(m_vm, &globalObject, JSC::JSFunction::create(m_vm, codeName##Generator(m_vm), &globalObject)); + WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_CODE(EXPORT_FUNCTION) +#undef EXPORT_FUNCTION +} + +template<typename Visitor> +inline void ProcessObjectInternalsBuiltinFunctions::visit(Visitor& visitor) +{ +#define VISIT_FUNCTION(name) visitor.append(m_##name##Function); + WEBCORE_FOREACH_PROCESSOBJECTINTERNALS_BUILTIN_FUNCTION_NAME(VISIT_FUNCTION) +#undef VISIT_FUNCTION +} + +template void ProcessObjectInternalsBuiltinFunctions::visit(JSC::AbstractSlotVisitor&); +template void ProcessObjectInternalsBuiltinFunctions::visit(JSC::SlotVisitor&); + + + +} // namespace WebCore diff --git a/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h b/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h index e843b7136..ef76cb146 100644 --- a/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h +++ b/src/bun.js/builtins/cpp/WebCoreJSBuiltinInternals.h @@ -40,6 +40,7 @@ namespace Zig { class GlobalObject; } #pragma once +#include "ProcessObjectInternalsBuiltins.h" #include "ReadableByteStreamInternalsBuiltins.h" #include "ReadableStreamInternalsBuiltins.h" #include "StreamInternalsBuiltins.h" @@ -59,6 +60,7 @@ public: template<typename Visitor> void visit(Visitor&); void initialize(JSDOMGlobalObject&); + ProcessObjectInternalsBuiltinFunctions& processObjectInternals() { return m_processObjectInternals; } ReadableByteStreamInternalsBuiltinFunctions& readableByteStreamInternals() { return m_readableByteStreamInternals; } ReadableStreamInternalsBuiltinFunctions& readableStreamInternals() { return m_readableStreamInternals; } StreamInternalsBuiltinFunctions& streamInternals() { return m_streamInternals; } @@ -67,6 +69,7 @@ public: private: JSC::VM& m_vm; + ProcessObjectInternalsBuiltinFunctions m_processObjectInternals; ReadableByteStreamInternalsBuiltinFunctions m_readableByteStreamInternals; ReadableStreamInternalsBuiltinFunctions m_readableStreamInternals; StreamInternalsBuiltinFunctions m_streamInternals; diff --git a/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h b/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h index 714be8e4f..22aa58ced 100644 --- a/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h +++ b/src/bun.js/builtins/cpp/WebCoreJSBuiltins.h @@ -42,7 +42,7 @@ #include "JSBufferConstructorBuiltins.h" #include "JSBufferPrototypeBuiltins.h" #include "OnigurumaRegExpPrototypeBuiltins.h" -#include "ProcessObjectBuiltins.h" +#include "ProcessObjectInternalsBuiltins.h" #include "ReadableByteStreamControllerBuiltins.h" #include "ReadableByteStreamInternalsBuiltins.h" #include "ReadableStreamBYOBReaderBuiltins.h" @@ -72,7 +72,7 @@ public: , m_jsBufferConstructorBuiltins(m_vm) , m_jsBufferPrototypeBuiltins(m_vm) , m_onigurumaRegExpPrototypeBuiltins(m_vm) - , m_processObjectBuiltins(m_vm) + , m_processObjectInternalsBuiltins(m_vm) , m_readableByteStreamControllerBuiltins(m_vm) , m_readableByteStreamInternalsBuiltins(m_vm) , m_readableStreamBuiltins(m_vm) @@ -89,6 +89,7 @@ public: , m_writableStreamDefaultWriterBuiltins(m_vm) , m_writableStreamInternalsBuiltins(m_vm) { + m_processObjectInternalsBuiltins.exportNames(); m_readableByteStreamInternalsBuiltins.exportNames(); m_readableStreamInternalsBuiltins.exportNames(); m_streamInternalsBuiltins.exportNames(); @@ -102,7 +103,7 @@ public: JSBufferConstructorBuiltinsWrapper& jsBufferConstructorBuiltins() { return m_jsBufferConstructorBuiltins; } JSBufferPrototypeBuiltinsWrapper& jsBufferPrototypeBuiltins() { return m_jsBufferPrototypeBuiltins; } OnigurumaRegExpPrototypeBuiltinsWrapper& onigurumaRegExpPrototypeBuiltins() { return m_onigurumaRegExpPrototypeBuiltins; } - ProcessObjectBuiltinsWrapper& processObjectBuiltins() { return m_processObjectBuiltins; } + ProcessObjectInternalsBuiltinsWrapper& processObjectInternalsBuiltins() { return m_processObjectInternalsBuiltins; } ReadableByteStreamControllerBuiltinsWrapper& readableByteStreamControllerBuiltins() { return m_readableByteStreamControllerBuiltins; } ReadableByteStreamInternalsBuiltinsWrapper& readableByteStreamInternalsBuiltins() { return m_readableByteStreamInternalsBuiltins; } ReadableStreamBuiltinsWrapper& readableStreamBuiltins() { return m_readableStreamBuiltins; } @@ -127,7 +128,7 @@ private: JSBufferConstructorBuiltinsWrapper m_jsBufferConstructorBuiltins; JSBufferPrototypeBuiltinsWrapper m_jsBufferPrototypeBuiltins; OnigurumaRegExpPrototypeBuiltinsWrapper m_onigurumaRegExpPrototypeBuiltins; - ProcessObjectBuiltinsWrapper m_processObjectBuiltins; + ProcessObjectInternalsBuiltinsWrapper m_processObjectInternalsBuiltins; ReadableByteStreamControllerBuiltinsWrapper m_readableByteStreamControllerBuiltins; ReadableByteStreamInternalsBuiltinsWrapper m_readableByteStreamInternalsBuiltins; ReadableStreamBuiltinsWrapper m_readableStreamBuiltins; |