WebKit Bugzilla
Attachment 362047 Details for
Bug 194659
: [JSC] Non-JIT entrypoints should share NativeJITCode per entrypoint type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194659-20190214122648.patch (text/plain), 9.46 KB, created by
Yusuke Suzuki
on 2019-02-14 12:26:48 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2019-02-14 12:26:48 PST
Size:
9.46 KB
patch
obsolete
>Subversion Revision: 241557 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index f1323bbaa0d67bafc8a248623f87ad43b4181ed0..befb7f0966a37ecd48eb9ec7575a46e264ee0ca7 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,29 @@ >+2019-02-14 Yusuke Suzuki <ysuzuki@apple.com> >+ >+ [JSC] Non-JIT entrypoints should share NativeJITCode per entrypoint type >+ https://bugs.webkit.org/show_bug.cgi?id=194659 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Non-JIT entrypoints create NativeJITCode every time it is called. But it is meaningless since these entry point code are identical. >+ We should create one per entrypoint type (for function, we should have CodeForCall and CodeForConstruct) and continue to use them. >+ And we use NativeJITCode instead of DirectJITCode if it does not have difference between usual entrypoint and arity check entrypoint. >+ >+ * dfg/DFGJITCode.h: >+ * dfg/DFGJITFinalizer.cpp: >+ (JSC::DFG::JITFinalizer::finalize): >+ (JSC::DFG::JITFinalizer::finalizeFunction): >+ * jit/JITCode.cpp: >+ (JSC::DirectJITCode::initializeCodeRefForDFG): >+ (JSC::DirectJITCode::initializeCodeRef): Deleted. >+ (JSC::NativeJITCode::initializeCodeRef): Deleted. >+ * jit/JITCode.h: >+ * llint/LLIntEntrypoint.cpp: >+ (JSC::LLInt::setFunctionEntrypoint): >+ (JSC::LLInt::setEvalEntrypoint): >+ (JSC::LLInt::setProgramEntrypoint): >+ (JSC::LLInt::setModuleProgramEntrypoint): Retagged is removed since the tag is the same. >+ > 2019-02-14 Yusuke Suzuki <ysuzuki@apple.com> > > [JSC] Should have default NativeJITCode >diff --git a/Source/JavaScriptCore/dfg/DFGJITCode.h b/Source/JavaScriptCore/dfg/DFGJITCode.h >index 847a8356ad79304e06070e36d4162f72a7f8ed1c..262e04f401f13ce783070cd9915f231e2afd2eb0 100644 >--- a/Source/JavaScriptCore/dfg/DFGJITCode.h >+++ b/Source/JavaScriptCore/dfg/DFGJITCode.h >@@ -127,6 +127,8 @@ class JITCode : public DirectJITCode { > static ptrdiff_t commonDataOffset() { return OBJECT_OFFSETOF(JITCode, common); } > > Optional<CodeOrigin> findPC(CodeBlock*, void* pc) override; >+ >+ using DirectJITCode::initializeCodeRefForDFG; > > private: > friend class JITCompiler; // Allow JITCompiler to call setCodeRef(). >diff --git a/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp b/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp >index 73326e2d33f491916eb1a06d3a956418de87f016..15882c6f96d2fd0e81eee0729f8337de84d54c58 100644 >--- a/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp >+++ b/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp >@@ -57,7 +57,7 @@ size_t JITFinalizer::codeSize() > bool JITFinalizer::finalize() > { > MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = FINALIZE_DFG_CODE(*m_linkBuffer, JSEntryPtrTag, "DFG JIT code for %s", toCString(CodeBlockWithJITType(m_plan.codeBlock(), JITCode::DFGJIT)).data()); >- m_jitCode->initializeCodeRef(codeRef, codeRef.code()); >+ m_jitCode->initializeCodeRefForDFG(codeRef, codeRef.code()); > > m_plan.codeBlock()->setJITCode(m_jitCode.copyRef()); > >@@ -69,7 +69,7 @@ bool JITFinalizer::finalize() > bool JITFinalizer::finalizeFunction() > { > RELEASE_ASSERT(!m_withArityCheck.isEmptyValue()); >- m_jitCode->initializeCodeRef( >+ m_jitCode->initializeCodeRefForDFG( > FINALIZE_DFG_CODE(*m_linkBuffer, JSEntryPtrTag, "DFG JIT code for %s", toCString(CodeBlockWithJITType(m_plan.codeBlock(), JITCode::DFGJIT)).data()), > m_withArityCheck); > m_plan.codeBlock()->setJITCode(m_jitCode.copyRef()); >diff --git a/Source/JavaScriptCore/jit/JITCode.cpp b/Source/JavaScriptCore/jit/JITCode.cpp >index 714ab23a4355adb12415e6bd7fa55eeec3855feb..e295a8aba74f0e644c95865c8fe40cae7d27e645 100644 >--- a/Source/JavaScriptCore/jit/JITCode.cpp >+++ b/Source/JavaScriptCore/jit/JITCode.cpp >@@ -172,7 +172,7 @@ DirectJITCode::~DirectJITCode() > { > } > >-void DirectJITCode::initializeCodeRef(JITCode::CodeRef<JSEntryPtrTag> ref, JITCode::CodePtr<JSEntryPtrTag> withArityCheck) >+void DirectJITCode::initializeCodeRefForDFG(JITCode::CodeRef<JSEntryPtrTag> ref, JITCode::CodePtr<JSEntryPtrTag> withArityCheck) > { > RELEASE_ASSERT(!m_ref); > m_ref = ref; >@@ -210,12 +210,6 @@ NativeJITCode::~NativeJITCode() > { > } > >-void NativeJITCode::initializeCodeRef(CodeRef<JSEntryPtrTag> ref) >-{ >- ASSERT(!m_ref); >- m_ref = ref; >-} >- > JITCode::CodePtr<JSEntryPtrTag> NativeJITCode::addressForCall(ArityCheckMode arity) > { > RELEASE_ASSERT(m_ref); >diff --git a/Source/JavaScriptCore/jit/JITCode.h b/Source/JavaScriptCore/jit/JITCode.h >index 8474b9a07624c6f00fdaec75fdcd5b43762b9ad5..875f59210ac6a106e3fd02ecdfc8b3c3db9d1819 100644 >--- a/Source/JavaScriptCore/jit/JITCode.h >+++ b/Source/JavaScriptCore/jit/JITCode.h >@@ -236,10 +236,11 @@ class DirectJITCode : public JITCodeWithCodeRef { > DirectJITCode(CodeRef<JSEntryPtrTag>, CodePtr<JSEntryPtrTag> withArityCheck, JITType, Intrinsic); // For generated thunk. > virtual ~DirectJITCode(); > >- void initializeCodeRef(CodeRef<JSEntryPtrTag>, CodePtr<JSEntryPtrTag> withArityCheck); >- > CodePtr<JSEntryPtrTag> addressForCall(ArityCheckMode) override; > >+protected: >+ void initializeCodeRefForDFG(CodeRef<JSEntryPtrTag>, CodePtr<JSEntryPtrTag> withArityCheck); >+ > private: > CodePtr<JSEntryPtrTag> m_withArityCheck; > }; >@@ -249,8 +250,6 @@ class NativeJITCode : public JITCodeWithCodeRef { > NativeJITCode(JITType); > NativeJITCode(CodeRef<JSEntryPtrTag>, JITType, Intrinsic); > virtual ~NativeJITCode(); >- >- void initializeCodeRef(CodeRef<JSEntryPtrTag>); > > CodePtr<JSEntryPtrTag> addressForCall(ArityCheckMode) override; > }; >diff --git a/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp b/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp >index f7ad74c5ae2ce7b6a1048131f45e9db52261f4cd..a7b76378f75dc774dab44894bf5cf6286df8fd39 100644 >--- a/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp >+++ b/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp >@@ -58,13 +58,20 @@ static void setFunctionEntrypoint(VM& vm, CodeBlock* codeBlock) > > UNUSED_PARAM(vm); > if (kind == CodeForCall) { >- codeBlock->setJITCode( >- adoptRef(*new DirectJITCode(getCodeRef<JSEntryPtrTag>(llint_function_for_call_prologue), getCodePtr<JSEntryPtrTag>(llint_function_for_call_arity_check), JITCode::InterpreterThunk))); >- return; >+ static DirectJITCode* jitCode; >+ static std::once_flag onceKey; >+ std::call_once(onceKey, [&] { >+ jitCode = new DirectJITCode(getCodeRef<JSEntryPtrTag>(llint_function_for_call_prologue), getCodePtr<JSEntryPtrTag>(llint_function_for_call_arity_check), JITCode::InterpreterThunk); >+ }); >+ codeBlock->setJITCode(makeRef(*jitCode)); >+ } else { >+ static DirectJITCode* jitCode; >+ static std::once_flag onceKey; >+ std::call_once(onceKey, [&] { >+ jitCode = new DirectJITCode(getCodeRef<JSEntryPtrTag>(llint_function_for_construct_prologue), getCodePtr<JSEntryPtrTag>(llint_function_for_construct_arity_check), JITCode::InterpreterThunk); >+ }); >+ codeBlock->setJITCode(makeRef(*jitCode)); > } >- ASSERT(kind == CodeForConstruct); >- codeBlock->setJITCode( >- adoptRef(*new DirectJITCode(getCodeRef<JSEntryPtrTag>(llint_function_for_construct_prologue), getCodePtr<JSEntryPtrTag>(llint_function_for_construct_arity_check), JITCode::InterpreterThunk))); > } > > static void setEvalEntrypoint(VM& vm, CodeBlock* codeBlock) >@@ -79,9 +86,12 @@ static void setEvalEntrypoint(VM& vm, CodeBlock* codeBlock) > #endif // ENABLE(JIT) > > UNUSED_PARAM(vm); >- MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = getCodeRef<JSEntryPtrTag>(llint_eval_prologue); >- codeBlock->setJITCode( >- adoptRef(*new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk))); >+ static NativeJITCode* jitCode; >+ static std::once_flag onceKey; >+ std::call_once(onceKey, [&] { >+ jitCode = new NativeJITCode(getCodeRef<JSEntryPtrTag>(llint_eval_prologue), JITCode::InterpreterThunk, NoIntrinsic); >+ }); >+ codeBlock->setJITCode(makeRef(*jitCode)); > } > > static void setProgramEntrypoint(VM& vm, CodeBlock* codeBlock) >@@ -96,9 +106,12 @@ static void setProgramEntrypoint(VM& vm, CodeBlock* codeBlock) > #endif // ENABLE(JIT) > > UNUSED_PARAM(vm); >- MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = getCodeRef<JSEntryPtrTag>(llint_program_prologue); >- codeBlock->setJITCode( >- adoptRef(*new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk))); >+ static NativeJITCode* jitCode; >+ static std::once_flag onceKey; >+ std::call_once(onceKey, [&] { >+ jitCode = new NativeJITCode(getCodeRef<JSEntryPtrTag>(llint_program_prologue), JITCode::InterpreterThunk, NoIntrinsic); >+ }); >+ codeBlock->setJITCode(makeRef(*jitCode)); > } > > static void setModuleProgramEntrypoint(VM& vm, CodeBlock* codeBlock) >@@ -113,9 +126,12 @@ static void setModuleProgramEntrypoint(VM& vm, CodeBlock* codeBlock) > #endif // ENABLE(JIT) > > UNUSED_PARAM(vm); >- MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = getCodeRef<JSEntryPtrTag>(llint_module_program_prologue).retagged<JSEntryPtrTag>(); >- codeBlock->setJITCode( >- adoptRef(*new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk))); >+ static NativeJITCode* jitCode; >+ static std::once_flag onceKey; >+ std::call_once(onceKey, [&] { >+ jitCode = new NativeJITCode(getCodeRef<JSEntryPtrTag>(llint_module_program_prologue), JITCode::InterpreterThunk, NoIntrinsic); >+ }); >+ codeBlock->setJITCode(makeRef(*jitCode)); > } > > void setEntrypoint(VM& vm, CodeBlock* codeBlock)
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:
mark.lam
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194659
: 362047