From 796a9854b4a698b309a6e7a4c040047558858da6 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Sat, 24 Jul 2021 15:00:08 -0700 Subject: wip --- src/javascript/jsc/bindings/ZigGlobalObject.h | 50 ++++++++++++++------------- 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'src/javascript/jsc/bindings/ZigGlobalObject.h') diff --git a/src/javascript/jsc/bindings/ZigGlobalObject.h b/src/javascript/jsc/bindings/ZigGlobalObject.h index 7436bc531..b7bf7e00b 100644 --- a/src/javascript/jsc/bindings/ZigGlobalObject.h +++ b/src/javascript/jsc/bindings/ZigGlobalObject.h @@ -1,3 +1,5 @@ +#include "root.h" + #pragma once namespace JSC { @@ -7,56 +9,56 @@ namespace JSC { } - +#include #include +#include +namespace Zig { +class GlobalObject final : public JSC::JSGlobalObject { + using Base = JSC::JSGlobalObject; -namespace Zig { - using namespace JSC; - -class GlobalObject final : public JSGlobalObject { public: - using Base = JSGlobalObject; DECLARE_EXPORT_INFO; - static const GlobalObjectMethodTable s_globalObjectMethodTable; + static const JSC::GlobalObjectMethodTable s_globalObjectMethodTable; static constexpr bool needsDestruction = true; - template - static IsoSubspace* subspaceFor(VM& vm) + template + static JSC::IsoSubspace* subspaceFor(JSC::VM& vm) { return vm.apiGlobalObjectSpace(); } - static GlobalObject* create(VM& vm, Structure* structure) + static GlobalObject* create(JSC::VM& vm, JSC::Structure* structure) { - auto* object = new (NotNull, allocateCell(vm.heap)) GlobalObject(vm, structure); + auto* object = new (NotNull, JSC::allocateCell(vm.heap)) GlobalObject(vm, structure); object->finishCreation(vm); return object; } - static Structure* createStructure(VM& vm, JSValue prototype) + static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSValue prototype) { - auto* result = Structure::create(vm, nullptr, prototype, TypeInfo(GlobalObjectType, StructureFlags), info()); + auto* result = JSC::Structure::create(vm, nullptr, prototype, JSC::TypeInfo(JSC::GlobalObjectType, Base::StructureFlags), info()); result->setTransitionWatchpointIsLikelyToBeFired(true); return result; } - static void reportUncaughtExceptionAtEventLoop(JSGlobalObject*, Exception*); - - static JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, JSModuleLoader*, JSString* moduleNameValue, JSValue parameters, const SourceOrigin&); - static Identifier moduleLoaderResolve(JSGlobalObject*, JSModuleLoader*, JSValue keyValue, JSValue referrerValue, JSValue); - static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, JSModuleLoader*, JSValue, JSValue, JSValue); - static JSObject* moduleLoaderCreateImportMetaProperties(JSGlobalObject*, JSModuleLoader*, JSValue, JSModuleRecord*, JSValue); - static JSValue moduleLoaderEvaluate(JSGlobalObject*, JSModuleLoader*, JSValue, JSValue, JSValue, JSValue, JSValue); - + static void reportUncaughtExceptionAtEventLoop(JSGlobalObject*, JSC::Exception*); + 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); private: - GlobalObject(VM& vm, Structure* structure) - : Base(vm, structure, &s_globalObjectMethodTable) - { } + + GlobalObject(JSC::VM& vm, JSC::Structure* structure) + : JSC::JSGlobalObject(vm, structure, &s_globalObjectMethodTable) + { + } }; } -- cgit v1.2.3