WebKit Bugzilla
Attachment 340169 Details for
Bug 185539
: Don't use inferred types when the JIT is disabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
b-backup.diff (text/plain), 11.02 KB, created by
Saam Barati
on 2018-05-10 21:46:22 PDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Saam Barati
Created:
2018-05-10 21:46:22 PDT
Size:
11.02 KB
patch
obsolete
>Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 231687) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,43 @@ >+2018-05-10 Saam Barati <sbarati@apple.com> >+ >+ Don't use inferred types when the JIT is disabled >+ https://bugs.webkit.org/show_bug.cgi?id=185539 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ There are many JSC API clients that run with the JIT disabled. They were >+ all allocating and tracking inferred types for no benefit. Inferred types >+ only benefit programs when they make it to the DFG/FTL. I was seeing cases >+ where the inferred type machinery used ~0.5MB. This patch makes is so we >+ don't allocate that machinery when the JIT is disabled. >+ >+ * interpreter/AbstractPC.cpp: >+ (JSC::AbstractPC::AbstractPC): >+ * jit/JITThunks.cpp: >+ (JSC::JITThunks::ctiNativeCall): >+ (JSC::JITThunks::ctiNativeConstruct): >+ (JSC::JITThunks::ctiNativeTailCall): >+ (JSC::JITThunks::ctiNativeTailCallWithoutSavedTags): >+ (JSC::JITThunks::ctiInternalFunctionCall): >+ (JSC::JITThunks::ctiInternalFunctionConstruct): >+ (JSC::JITThunks::hostFunctionStub): >+ * llint/LLIntEntrypoint.cpp: >+ (JSC::LLInt::setFunctionEntrypoint): >+ (JSC::LLInt::setEvalEntrypoint): >+ (JSC::LLInt::setProgramEntrypoint): >+ (JSC::LLInt::setModuleProgramEntrypoint): >+ * llint/LLIntSlowPaths.cpp: >+ (JSC::LLInt::shouldJIT): >+ * runtime/Structure.cpp: >+ (JSC::Structure::willStoreValueSlow): >+ * runtime/Structure.h: >+ * runtime/VM.cpp: >+ (JSC::processCanUseJIT): >+ (JSC::VM::VM): >+ (JSC::VM::canUseJIT): Deleted. >+ * runtime/VM.h: >+ (JSC::VM::canUseJIT const): >+ > 2018-05-09 Yusuke Suzuki <utatane.tea@gmail.com> > > [JSC] Object.assign for final objects should be faster >Index: Source/JavaScriptCore/interpreter/AbstractPC.cpp >=================================================================== >--- Source/JavaScriptCore/interpreter/AbstractPC.cpp (revision 231687) >+++ Source/JavaScriptCore/interpreter/AbstractPC.cpp (working copy) >@@ -39,7 +39,7 @@ AbstractPC::AbstractPC(VM& vm, ExecState > UNUSED_PARAM(exec); > > #if ENABLE(JIT) >- if (VM::canUseJIT()) { >+ if (vm.canUseJIT()) { > m_pointer = exec->returnPC().value(); > m_mode = JIT; > return; >Index: Source/JavaScriptCore/jit/JITThunks.cpp >=================================================================== >--- Source/JavaScriptCore/jit/JITThunks.cpp (revision 231687) >+++ Source/JavaScriptCore/jit/JITThunks.cpp (working copy) >@@ -47,37 +47,37 @@ JITThunks::~JITThunks() > > MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiNativeCall(VM* vm) > { >- ASSERT(VM::canUseJIT()); >+ ASSERT(vm->canUseJIT()); > return ctiStub(vm, nativeCallGenerator).code(); > } > > MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiNativeConstruct(VM* vm) > { >- ASSERT(VM::canUseJIT()); >+ ASSERT(vm->canUseJIT()); > return ctiStub(vm, nativeConstructGenerator).code(); > } > > MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiNativeTailCall(VM* vm) > { >- ASSERT(VM::canUseJIT()); >+ ASSERT(vm->canUseJIT()); > return ctiStub(vm, nativeTailCallGenerator).code(); > } > > MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiNativeTailCallWithoutSavedTags(VM* vm) > { >- ASSERT(VM::canUseJIT()); >+ ASSERT(vm->canUseJIT()); > return ctiStub(vm, nativeTailCallWithoutSavedTagsGenerator).code(); > } > > MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiInternalFunctionCall(VM* vm) > { >- ASSERT(VM::canUseJIT()); >+ ASSERT(vm->canUseJIT()); > return ctiStub(vm, internalFunctionCallGenerator).code(); > } > > MacroAssemblerCodePtr<JITThunkPtrTag> JITThunks::ctiInternalFunctionConstruct(VM* vm) > { >- ASSERT(VM::canUseJIT()); >+ ASSERT(vm->canUseJIT()); > return ctiStub(vm, internalFunctionConstructGenerator).code(); > } > >@@ -116,7 +116,7 @@ NativeExecutable* JITThunks::hostFunctio > NativeExecutable* JITThunks::hostFunctionStub(VM* vm, TaggedNativeFunction function, TaggedNativeFunction constructor, ThunkGenerator generator, Intrinsic intrinsic, const DOMJIT::Signature* signature, const String& name) > { > ASSERT(!isCompilationThread()); >- ASSERT(VM::canUseJIT()); >+ ASSERT(vm->canUseJIT()); > > if (NativeExecutable* nativeExecutable = m_hostFunctionStubMap->get(std::make_tuple(function, constructor, name))) > return nativeExecutable; >Index: Source/JavaScriptCore/llint/LLIntEntrypoint.cpp >=================================================================== >--- Source/JavaScriptCore/llint/LLIntEntrypoint.cpp (revision 231687) >+++ Source/JavaScriptCore/llint/LLIntEntrypoint.cpp (working copy) >@@ -43,7 +43,7 @@ static void setFunctionEntrypoint(VM& vm > CodeSpecializationKind kind = codeBlock->specializationKind(); > > #if ENABLE(JIT) >- if (VM::canUseJIT()) { >+ if (vm.canUseJIT()) { > if (kind == CodeForCall) { > codeBlock->setJITCode( > adoptRef(*new DirectJITCode(vm.getCTIStub(functionForCallEntryThunkGenerator).retagged<JSEntryPtrTag>(), vm.getCTIStub(functionForCallArityCheckThunkGenerator).retaggedCode<JSEntryPtrTag>(), JITCode::InterpreterThunk))); >@@ -70,7 +70,7 @@ static void setFunctionEntrypoint(VM& vm > static void setEvalEntrypoint(VM& vm, CodeBlock* codeBlock) > { > #if ENABLE(JIT) >- if (VM::canUseJIT()) { >+ if (vm.canUseJIT()) { > MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = vm.getCTIStub(evalEntryThunkGenerator).retagged<JSEntryPtrTag>(); > codeBlock->setJITCode( > adoptRef(*new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk))); >@@ -87,7 +87,7 @@ static void setEvalEntrypoint(VM& vm, Co > static void setProgramEntrypoint(VM& vm, CodeBlock* codeBlock) > { > #if ENABLE(JIT) >- if (VM::canUseJIT()) { >+ if (vm.canUseJIT()) { > MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = vm.getCTIStub(programEntryThunkGenerator).retagged<JSEntryPtrTag>(); > codeBlock->setJITCode( > adoptRef(*new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk))); >@@ -104,7 +104,7 @@ static void setProgramEntrypoint(VM& vm, > static void setModuleProgramEntrypoint(VM& vm, CodeBlock* codeBlock) > { > #if ENABLE(JIT) >- if (VM::canUseJIT()) { >+ if (vm.canUseJIT()) { > MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = vm.getCTIStub(moduleProgramEntryThunkGenerator).retagged<JSEntryPtrTag>(); > codeBlock->setJITCode( > adoptRef(*new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk))); >Index: Source/JavaScriptCore/llint/LLIntSlowPaths.cpp >=================================================================== >--- Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (revision 231687) >+++ Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (working copy) >@@ -325,7 +325,7 @@ inline bool shouldJIT(CodeBlock* codeBlo > || !ensureGlobalJITWhitelist().contains(codeBlock)) > return false; > >- return VM::canUseJIT() && Options::useBaselineJIT(); >+ return codeBlock->vm()->canUseJIT() && Options::useBaselineJIT(); > } > > // Returns true if we should try to OSR. >Index: Source/JavaScriptCore/runtime/Structure.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/Structure.cpp (revision 231687) >+++ Source/JavaScriptCore/runtime/Structure.cpp (working copy) >@@ -895,6 +895,8 @@ void Structure::willStoreValueSlow( > ASSERT(structure()->classInfo() == info()); > ASSERT(!hasBeenDictionary()); > >+ ASSERT_WITH_MESSAGE(vm.canUseJIT(), "We don't want to use memory for inferred types unless we're using the JIT."); >+ > // Create the inferred type table before doing anything else, so that we don't GC after we have already > // grabbed a pointer into the property map. > InferredTypeTable* table = m_inferredTypeTable.get(); >Index: Source/JavaScriptCore/runtime/Structure.h >=================================================================== >--- Source/JavaScriptCore/runtime/Structure.h (revision 231687) >+++ Source/JavaScriptCore/runtime/Structure.h (working copy) >@@ -608,7 +608,7 @@ public: > ALWAYS_INLINE void willStoreValueForNewTransition( > VM& vm, PropertyName propertyName, JSValue value, bool shouldOptimize) > { >- if (hasBeenDictionary() || (!shouldOptimize && !m_inferredTypeTable)) >+ if (hasBeenDictionary() || (!shouldOptimize && !m_inferredTypeTable) || !vm.canUseJIT()) > return; > willStoreValueSlow(vm, propertyName, value, shouldOptimize, InferredTypeTable::NewProperty); > } >@@ -619,7 +619,7 @@ public: > ALWAYS_INLINE void willStoreValueForExistingTransition( > VM& vm, PropertyName propertyName, JSValue value, bool shouldOptimize) > { >- if (hasBeenDictionary() || !m_inferredTypeTable) >+ if (hasBeenDictionary() || !m_inferredTypeTable || !vm.canUseJIT()) > return; > willStoreValueSlow(vm, propertyName, value, shouldOptimize, InferredTypeTable::NewProperty); > } >@@ -628,7 +628,7 @@ public: > ALWAYS_INLINE void willStoreValueForReplace( > VM& vm, PropertyName propertyName, JSValue value, bool shouldOptimize) > { >- if (hasBeenDictionary()) >+ if (hasBeenDictionary() || !vm.canUseJIT()) > return; > willStoreValueSlow(vm, propertyName, value, shouldOptimize, InferredTypeTable::OldProperty); > } >Index: Source/JavaScriptCore/runtime/VM.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/VM.cpp (revision 231687) >+++ Source/JavaScriptCore/runtime/VM.cpp (working copy) >@@ -210,7 +210,7 @@ bool VM::canUseAssembler() > #endif > } > >-bool VM::canUseJIT() >+static bool processCanUseJIT() > { > #if ENABLE(JIT) > static std::once_flag onceKey; >@@ -345,6 +345,7 @@ VM::VM(VMType vmType, HeapType heapType) > , m_codeCache(std::make_unique<CodeCache>()) > , m_builtinExecutables(std::make_unique<BuiltinExecutables>(*this)) > , m_typeProfilerEnabledCount(0) >+ , m_canUseJIT(processCanUseJIT()) > , m_primitiveGigacageEnabled(IsWatched) > , m_controlFlowProfilerEnabledCount(0) > , m_shadowChicken(std::make_unique<ShadowChicken>()) >Index: Source/JavaScriptCore/runtime/VM.h >=================================================================== >--- Source/JavaScriptCore/runtime/VM.h (revision 231687) >+++ Source/JavaScriptCore/runtime/VM.h (working copy) >@@ -555,7 +555,7 @@ public: > }; > > static JS_EXPORT_PRIVATE bool canUseAssembler(); >- static JS_EXPORT_PRIVATE bool canUseJIT(); >+ ALWAYS_INLINE bool canUseJIT() const { return m_canUseJIT; } > static JS_EXPORT_PRIVATE bool canUseRegExpJIT(); > > SourceProviderCache* addSourceProviderCache(SourceProvider*); >@@ -901,6 +901,7 @@ private: > std::unique_ptr<TypeProfilerLog> m_typeProfilerLog; > unsigned m_typeProfilerEnabledCount; > bool m_needToFirePrimitiveGigacageEnabled { false }; >+ bool m_canUseJIT; > Lock m_scratchBufferLock; > Vector<ScratchBuffer*> m_scratchBuffers; > size_t m_sizeOfLastScratchBuffer { 0 };
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
Flags:
ysuzuki
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185539
:
340169
|
340173