diff options
Diffstat (limited to 'src/javascript/jsc/bindings/DefaultGlobal.h')
| -rw-r--r-- | src/javascript/jsc/bindings/DefaultGlobal.h | 101 |
1 files changed, 50 insertions, 51 deletions
diff --git a/src/javascript/jsc/bindings/DefaultGlobal.h b/src/javascript/jsc/bindings/DefaultGlobal.h index 6bc5eb0c9..ae174e049 100644 --- a/src/javascript/jsc/bindings/DefaultGlobal.h +++ b/src/javascript/jsc/bindings/DefaultGlobal.h @@ -1,65 +1,64 @@ -#pragma once +#pragma once namespace JSC { - class Structure; - class Identifier; - -} +class Structure; +class Identifier; +} // namespace JSC + +#include "JSCInlines.h" #include "root.h" #include <JavaScriptCore/JSGlobalObject.h> -#include "JSCInlines.h" using namespace JSC; - -namespace Wundle { +namespace Bun { class Script; class DefaultGlobal final : public JSC::JSGlobalObject { -public: - using Base = JSC::JSGlobalObject; - - DECLARE_EXPORT_INFO; - static const JSC::GlobalObjectMethodTable s_globalObjectMethodTable; - - static constexpr bool needsDestruction = true; - template<typename CellType, SubspaceAccess mode> - static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) - { - return vm.apiGlobalObjectSpace<mode>(); - } - - static DefaultGlobal* create(JSC::VM& vm, JSC::Structure* structure) - { - auto* object = new (NotNull, allocateCell<DefaultGlobal>(vm.heap)) DefaultGlobal(vm, structure); - object->finishCreation(vm); - return object; - } - - static Structure* createStructure(JSC::VM& vm, JSC::JSValue prototype) - { - auto* result = Structure::create(vm, nullptr, prototype, TypeInfo(GlobalObjectType, StructureFlags), info()); - result->setTransitionWatchpointIsLikelyToBeFired(true); - return result; - } - - static void reportUncaughtExceptionAtEventLoop(JSGlobalObject*, Exception*); - - static JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, JSModuleLoader*, JSC::JSString* moduleNameValue, JSValue parameters, const SourceOrigin&); - static JSC::Identifier moduleLoaderResolve(JSGlobalObject*, JSModuleLoader*, JSValue keyValue, JSValue referrerValue, JSValue); - static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, JSModuleLoader*, JSValue, JSValue, JSValue); - static JSC::JSObject* moduleLoaderCreateImportMetaProperties(JSGlobalObject*, JSModuleLoader*, JSValue, JSModuleRecord*, JSValue); - static JSValue moduleLoaderEvaluate(JSGlobalObject*, JSModuleLoader*, JSValue, JSValue, JSValue, JSValue, JSValue); - - -private: - DefaultGlobal(JSC::VM& vm, JSC::Structure* structure) - : Base(vm, structure, &s_globalObjectMethodTable) - { } + public: + using Base = JSC::JSGlobalObject; + + DECLARE_EXPORT_INFO; + static const JSC::GlobalObjectMethodTable s_globalObjectMethodTable; + + static constexpr bool needsDestruction = true; + template <typename CellType, SubspaceAccess mode> + static JSC::IsoSubspace *subspaceFor(JSC::VM &vm) { + return vm.apiGlobalObjectSpace<mode>(); + } + + static DefaultGlobal *create(JSC::VM &vm, JSC::Structure *structure) { + auto *object = new (NotNull, allocateCell<DefaultGlobal>(vm.heap)) DefaultGlobal(vm, structure); + object->finishCreation(vm); + return object; + } + + static Structure *createStructure(JSC::VM &vm, JSC::JSValue prototype) { + auto *result = + Structure::create(vm, nullptr, prototype, TypeInfo(GlobalObjectType, StructureFlags), info()); + result->setTransitionWatchpointIsLikelyToBeFired(true); + return result; + } + + static void reportUncaughtExceptionAtEventLoop(JSGlobalObject *, Exception *); + + static JSInternalPromise *moduleLoaderImportModule(JSGlobalObject *, JSModuleLoader *, + JSC::JSString *moduleNameValue, + JSValue parameters, const SourceOrigin &); + static JSC::Identifier moduleLoaderResolve(JSGlobalObject *, JSModuleLoader *, JSValue keyValue, + JSValue referrerValue, JSValue); + static JSInternalPromise *moduleLoaderFetch(JSGlobalObject *, JSModuleLoader *, JSValue, JSValue, + JSValue); + static JSC::JSObject *moduleLoaderCreateImportMetaProperties(JSGlobalObject *, JSModuleLoader *, + JSValue, JSModuleRecord *, JSValue); + static JSValue moduleLoaderEvaluate(JSGlobalObject *, JSModuleLoader *, JSValue, JSValue, JSValue, + JSValue, JSValue); + + private: + DefaultGlobal(JSC::VM &vm, JSC::Structure *structure) + : Base(vm, structure, &s_globalObjectMethodTable) {} }; - -} - +} // namespace Bun |
