WebKit Bugzilla
Attachment 359673 Details for
Bug 193646
: [JSC] Lazily initialize JSModuleLoader
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193646-20190120233834.patch (text/plain), 10.61 KB, created by
Yusuke Suzuki
on 2019-01-20 23:38:35 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2019-01-20 23:38:35 PST
Size:
10.61 KB
patch
obsolete
>Subversion Revision: 240229 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index dbc7d46ad189e0e9407da5935177173aa925c0b8..0d0f4cfb573e0f86c8352ab1955279a02081537a 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,27 @@ >+2019-01-20 Yusuke Suzuki <ysuzuki@apple.com> >+ >+ [JSC] Lazily initialize JSModuleLoader >+ https://bugs.webkit.org/show_bug.cgi?id=193646 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Lazily initialize JSModuleLoader so that we do not need to initialize it until we need modules. >+ >+ * runtime/HashMapImpl.h: >+ (JSC::HashMapBuffer::create): >+ (JSC::HashMapImpl::finishCreation): >+ (JSC::HashMapImpl::setUpHeadAndTail): >+ (JSC::HashMapImpl::makeAndSetNewBuffer): >+ * runtime/JSGlobalObject.cpp: >+ (JSC::JSGlobalObject::init): >+ (JSC::JSGlobalObject::visitChildren): >+ * runtime/JSGlobalObject.h: >+ (JSC::JSGlobalObject::moduleLoader const): >+ * runtime/JSMap.h: >+ * runtime/JSModuleLoader.cpp: >+ (JSC::JSModuleLoader::finishCreation): >+ * runtime/JSModuleLoader.h: >+ > 2019-01-20 Saam Barati <sbarati@apple.com> > > DFG: When inlining DataView set* intrinsics we need to set undefined as our result >diff --git a/Source/JavaScriptCore/runtime/HashMapImpl.h b/Source/JavaScriptCore/runtime/HashMapImpl.h >index 4e87c892f91dd62f6d634ee312302d2b32e4d64e..c332a2b7141e2414ac7edb5bff7ad1d661303151 100644 >--- a/Source/JavaScriptCore/runtime/HashMapImpl.h >+++ b/Source/JavaScriptCore/runtime/HashMapImpl.h >@@ -203,13 +203,14 @@ class HashMapBuffer { > return bitwise_cast<BucketType**>(this); > } > >- static HashMapBuffer* create(ExecState* exec, VM& vm, JSCell*, uint32_t capacity) >+ static HashMapBuffer* create(ExecState* nullOrExecForOOM, VM& vm, JSCell*, uint32_t capacity) > { > auto scope = DECLARE_THROW_SCOPE(vm); > size_t allocationSize = HashMapBuffer::allocationSize(capacity); > void* data = vm.jsValueGigacageAuxiliarySpace.allocateNonVirtual(vm, allocationSize, nullptr, AllocationFailureMode::ReturnNull); > if (!data) { >- throwOutOfMemoryError(exec, scope); >+ RELEASE_ASSERT(nullOrExecForOOM); >+ throwOutOfMemoryError(nullOrExecForOOM, scope); > return nullptr; > } > >@@ -371,17 +372,17 @@ class HashMapImpl : public JSNonFinalObject { > return m_buffer->buffer(); > } > >- void finishCreation(ExecState* exec, VM& vm) >+ void finishCreation(ExecState* nullOrExecForOOM, VM& vm) > { > ASSERT_WITH_MESSAGE(HashMapBucket<HashMapBucketDataKey>::offsetOfKey() == HashMapBucket<HashMapBucketDataKeyValue>::offsetOfKey(), "We assume this to be true in the DFG and FTL JIT."); > > auto scope = DECLARE_THROW_SCOPE(vm); > Base::finishCreation(vm); > >- makeAndSetNewBuffer(exec, vm); >+ makeAndSetNewBuffer(nullOrExecForOOM, vm); > RETURN_IF_EXCEPTION(scope, void()); > >- setUpHeadAndTail(exec, vm); >+ setUpHeadAndTail(vm); > } > > void finishCreation(ExecState* exec, VM& vm, HashMapImpl* base) >@@ -397,7 +398,7 @@ class HashMapImpl : public JSNonFinalObject { > makeAndSetNewBuffer(exec, vm); > RETURN_IF_EXCEPTION(scope, void()); > >- setUpHeadAndTail(exec, vm); >+ setUpHeadAndTail(vm); > > HashMapBucketType* bucket = base->m_head.get()->next(); > while (bucket) { >@@ -576,7 +577,7 @@ class HashMapImpl : public JSNonFinalObject { > return JSC::shouldShrink(m_capacity, m_keyCount); > } > >- ALWAYS_INLINE void setUpHeadAndTail(ExecState*, VM& vm) >+ ALWAYS_INLINE void setUpHeadAndTail(VM& vm) > { > m_head.set(vm, this, HashMapBucketType::create(vm)); > m_tail.set(vm, this, HashMapBucketType::create(vm)); >@@ -709,11 +710,11 @@ class HashMapImpl : public JSNonFinalObject { > } > } > >- void makeAndSetNewBuffer(ExecState* exec, VM& vm) >+ void makeAndSetNewBuffer(ExecState* nullOrExecForOOM, VM& vm) > { > ASSERT(!(m_capacity & (m_capacity - 1))); > >- HashMapBufferType* buffer = HashMapBufferType::create(exec, vm, this, m_capacity); >+ HashMapBufferType* buffer = HashMapBufferType::create(nullOrExecForOOM, vm, this, m_capacity); > if (UNLIKELY(!buffer)) > return; > >diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp >index e540048ed8a8b790d9d86dd91901fef85f4c9a7f..2c6edf0d2c8093c65881de5a7bc438854e128a27 100644 >--- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp >+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp >@@ -788,9 +788,12 @@ putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Construct > ReflectObject* reflectObject = ReflectObject::create(vm, this, ReflectObject::createStructure(vm, this, m_objectPrototype.get())); > putDirectWithoutTransition(vm, vm.propertyNames->Reflect, reflectObject, static_cast<unsigned>(PropertyAttribute::DontEnum)); > >- m_moduleLoader.set(vm, this, JSModuleLoader::create(globalExec(), vm, this, JSModuleLoader::createStructure(vm, this, jsNull()))); >+ m_moduleLoader.initLater( >+ [] (const Initializer<JSModuleLoader>& init) { >+ init.set(JSModuleLoader::create(init.vm, init.owner, JSModuleLoader::createStructure(init.vm, init.owner, jsNull()))); >+ }); > if (Options::exposeInternalModuleLoader()) >- putDirectWithoutTransition(vm, vm.propertyNames->Loader, m_moduleLoader.get(), static_cast<unsigned>(PropertyAttribute::DontEnum)); >+ putDirectWithoutTransition(vm, vm.propertyNames->Loader, moduleLoader(), static_cast<unsigned>(PropertyAttribute::DontEnum)); > > JSFunction* builtinLog = JSFunction::create(vm, this, 1, vm.propertyNames->emptyIdentifier.string(), globalFuncBuiltinLog); > JSFunction* builtinDescribe = JSFunction::create(vm, this, 1, vm.propertyNames->emptyIdentifier.string(), globalFuncBuiltinDescribe); >@@ -1574,7 +1577,7 @@ void JSGlobalObject::visitChildren(JSCell* cell, SlotVisitor& visitor) > visitor.append(thisObject->m_functionProtoHasInstanceSymbolFunction); > thisObject->m_throwTypeErrorGetterSetter.visit(visitor); > visitor.append(thisObject->m_throwTypeErrorArgumentsCalleeAndCallerGetterSetter); >- visitor.append(thisObject->m_moduleLoader); >+ thisObject->m_moduleLoader.visit(visitor); > > visitor.append(thisObject->m_objectPrototype); > visitor.append(thisObject->m_functionPrototype); >diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h >index d52d0fbfc9828e69666af5b52014b8f39c6e56ef..b1d96ad3b58584b722871c682b18071aab9c42fa 100644 >--- a/Source/JavaScriptCore/runtime/JSGlobalObject.h >+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h >@@ -300,7 +300,7 @@ class JSGlobalObject : public JSSegmentedVariableObject { > WriteBarrier<JSObject> m_regExpProtoUnicodeGetter; > WriteBarrier<GetterSetter> m_throwTypeErrorArgumentsCalleeAndCallerGetterSetter; > >- WriteBarrier<JSModuleLoader> m_moduleLoader; >+ LazyProperty<JSGlobalObject, JSModuleLoader> m_moduleLoader; > > WriteBarrier<ObjectPrototype> m_objectPrototype; > WriteBarrier<FunctionPrototype> m_functionPrototype; >@@ -611,7 +611,7 @@ class JSGlobalObject : public JSSegmentedVariableObject { > return m_throwTypeErrorArgumentsCalleeAndCallerGetterSetter.get(); > } > >- JSModuleLoader* moduleLoader() const { return m_moduleLoader.get(); } >+ JSModuleLoader* moduleLoader() const { return m_moduleLoader.get(this); } > > ObjectPrototype* objectPrototype() const { return m_objectPrototype.get(); } > FunctionPrototype* functionPrototype() const { return m_functionPrototype.get(); } >diff --git a/Source/JavaScriptCore/runtime/JSMap.h b/Source/JavaScriptCore/runtime/JSMap.h >index f0ebb54d1842c0f34f0fa3034654a0df65c15f11..c25ebb286f6c20aaf0f766c7f5ad0a80a5d54774 100644 >--- a/Source/JavaScriptCore/runtime/JSMap.h >+++ b/Source/JavaScriptCore/runtime/JSMap.h >@@ -41,10 +41,10 @@ class JSMap final : public HashMapImpl<HashMapBucket<HashMapBucketDataKeyValue>> > return Structure::create(vm, globalObject, prototype, TypeInfo(JSMapType, StructureFlags), info()); > } > >- static JSMap* create(ExecState* exec, VM& vm, Structure* structure) >+ static JSMap* create(ExecState* nullOrExecForOOM, VM& vm, Structure* structure) > { > JSMap* instance = new (NotNull, allocateCell<JSMap>(vm.heap)) JSMap(vm, structure); >- instance->finishCreation(exec, vm); >+ instance->finishCreation(nullOrExecForOOM, vm); > return instance; > } > >diff --git a/Source/JavaScriptCore/runtime/JSModuleLoader.cpp b/Source/JavaScriptCore/runtime/JSModuleLoader.cpp >index 982baa7a58f47fdce0be27184aff0dbd03175163..2fda0ed5ae1a9961c9a5096551afb7e98108b92a 100644 >--- a/Source/JavaScriptCore/runtime/JSModuleLoader.cpp >+++ b/Source/JavaScriptCore/runtime/JSModuleLoader.cpp >@@ -100,13 +100,13 @@ JSModuleLoader::JSModuleLoader(VM& vm, Structure* structure) > { > } > >-void JSModuleLoader::finishCreation(ExecState* exec, VM& vm, JSGlobalObject* globalObject) >+void JSModuleLoader::finishCreation(VM& vm, JSGlobalObject* globalObject) > { > auto scope = DECLARE_CATCH_SCOPE(vm); > > Base::finishCreation(vm); > ASSERT(inherits(vm, info())); >- JSMap* map = JSMap::create(exec, vm, globalObject->mapStructure()); >+ JSMap* map = JSMap::create(nullptr, vm, globalObject->mapStructure()); > scope.releaseAssertNoException(); > putDirect(vm, Identifier::fromString(&vm, "registry"), map); > } >diff --git a/Source/JavaScriptCore/runtime/JSModuleLoader.h b/Source/JavaScriptCore/runtime/JSModuleLoader.h >index 33ebc42e075bb8320a7d8636c61953ae3336cadf..eaa8e5715d75ab6b080f9f7cb38c897322ad1c2a 100644 >--- a/Source/JavaScriptCore/runtime/JSModuleLoader.h >+++ b/Source/JavaScriptCore/runtime/JSModuleLoader.h >@@ -50,10 +50,10 @@ class JSModuleLoader final : public JSNonFinalObject { > Ready, > }; > >- static JSModuleLoader* create(ExecState* exec, VM& vm, JSGlobalObject* globalObject, Structure* structure) >+ static JSModuleLoader* create(VM& vm, JSGlobalObject* globalObject, Structure* structure) > { > JSModuleLoader* object = new (NotNull, allocateCell<JSModuleLoader>(vm.heap)) JSModuleLoader(vm, structure); >- object->finishCreation(exec, vm, globalObject); >+ object->finishCreation(vm, globalObject); > return object; > } > >@@ -85,7 +85,7 @@ class JSModuleLoader final : public JSNonFinalObject { > JSModuleNamespaceObject* getModuleNamespaceObject(ExecState*, JSValue moduleRecord); > > protected: >- void finishCreation(ExecState*, VM&, JSGlobalObject*); >+ void finishCreation(VM&, JSGlobalObject*); > }; > > } // namespace JSC
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193646
:
359672
|
359673
|
359709