[JSC] Lazily initialize JSModuleLoader
Created attachment 359672 [details] Patch
Created attachment 359673 [details] Patch
Comment on attachment 359673 [details] Patch r=me.
Comment on attachment 359673 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=359673&action=review > Source/JavaScriptCore/runtime/HashMapImpl.h:206 > + static HashMapBuffer* create(ExecState* nullOrExecForOOM, VM& vm, JSCell*, uint32_t capacity) not a fan of this, why not globalExec? > Source/JavaScriptCore/runtime/JSModuleLoader.cpp:109 > + JSMap* map = JSMap::create(nullptr, vm, globalObject->mapStructure()); why not globalExec?
Comment on attachment 359673 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=359673&action=review >> Source/JavaScriptCore/runtime/JSModuleLoader.cpp:109 >> + JSMap* map = JSMap::create(nullptr, vm, globalObject->mapStructure()); > > why not globalExec? If you don't want an exception to be thrown, I'd use globalExec, and then releaseAssertNoException here instead of passing in nullptr. I think the abstraction is backwards this way, but not in the way I propose.
Comment on attachment 359673 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=359673&action=review Thanks! >> Source/JavaScriptCore/runtime/HashMapImpl.h:206 >> + static HashMapBuffer* create(ExecState* nullOrExecForOOM, VM& vm, JSCell*, uint32_t capacity) > > not a fan of this, why not globalExec? Personally, rather, I would like to drop this ExecState* parameter for simple `JSMap::create()` / `JSModuleLoader::create` cases because it allocates fixed amount of memory which is not so large. But in the meantime, we still have this parameter. So, using globalExec makes sense. Fixed. >>> Source/JavaScriptCore/runtime/JSModuleLoader.cpp:109 >>> + JSMap* map = JSMap::create(nullptr, vm, globalObject->mapStructure()); >> >> why not globalExec? > > If you don't want an exception to be thrown, I'd use globalExec, and then releaseAssertNoException here instead of passing in nullptr. I think the abstraction is backwards this way, but not in the way I propose. Fixed.
Created attachment 359709 [details] Patch
Committed r240242: <https://trac.webkit.org/changeset/240242>
<rdar://problem/47432806>