From 98d19fa6244384f7e17998b5420d724481ed3835 Mon Sep 17 00:00:00 2001 From: dave caruso Date: Mon, 16 Oct 2023 21:22:43 -0700 Subject: fix(runtime): make some things more stable (partial jsc debug build) (#5881) * make our debug assertions work * install bun-webkit-debug * more progress * ok * progress... * more debug build stuff * ok * a * asdfghjkl * fix(runtime): fix bad assertion failure in JSBufferList * ok * stuff * upgrade webkit * Update src/bun.js/bindings/JSDOMWrapperCache.h Co-authored-by: Jarred Sumner * fix message for colin's changes * okay * fix cjs prototype * implement mainModule * i think this fixes it all --------- Co-authored-by: Jarred Sumner --- src/bun.js/bindings/InternalModuleRegistry.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/bun.js/bindings/InternalModuleRegistry.cpp') diff --git a/src/bun.js/bindings/InternalModuleRegistry.cpp b/src/bun.js/bindings/InternalModuleRegistry.cpp index 8a81b87cd..03f946192 100644 --- a/src/bun.js/bindings/InternalModuleRegistry.cpp +++ b/src/bun.js/bindings/InternalModuleRegistry.cpp @@ -120,16 +120,23 @@ DEFINE_VISIT_CHILDREN_WITH_MODIFIER(JS_EXPORT_PRIVATE, InternalModuleRegistry); InternalModuleRegistry* InternalModuleRegistry::create(VM& vm, Structure* structure) { InternalModuleRegistry* registry = new (NotNull, allocateCell(vm)) InternalModuleRegistry(vm, structure); + registry->finishCreation(vm); + return registry; +} + +void InternalModuleRegistry::finishCreation(VM& vm) +{ + Base::finishCreation(vm); + ASSERT(inherits(info())); + for (uint8_t i = 0; i < BUN_INTERNAL_MODULE_COUNT; i++) { - registry->internalField(static_cast(i)) - .set(vm, registry, jsUndefined()); + this->internalField(static_cast(i)).set(vm, this, jsUndefined()); } - return registry; } Structure* InternalModuleRegistry::createStructure(VM& vm, JSGlobalObject* globalObject) { - return Structure::create(vm, globalObject, jsNull(), TypeInfo(InternalFieldTupleType, StructureFlags), info(), 0, 48); + return Structure::create(vm, globalObject, jsNull(), TypeInfo(InternalFieldTupleType, StructureFlags), info(), 0, 0); } JSValue InternalModuleRegistry::requireId(JSGlobalObject* globalObject, VM& vm, Field id) @@ -152,7 +159,7 @@ JSC_DEFINE_HOST_FUNCTION(InternalModuleRegistry::jsCreateInternalModuleById, (JS auto throwScope = DECLARE_THROW_SCOPE(vm); auto id = callframe->argument(0).toUInt32(lexicalGlobalObject); - auto registry = static_cast(lexicalGlobalObject)->internalModuleRegistry(); + auto registry = jsCast(lexicalGlobalObject)->internalModuleRegistry(); auto mod = registry->createInternalModuleById(lexicalGlobalObject, vm, static_cast(id)); RETURN_IF_EXCEPTION(throwScope, {}); registry->internalField(static_cast(id)).set(vm, registry, mod); -- cgit v1.2.3