WebKit Bugzilla
Attachment 362129 Details for
Bug 194648
: [JSC] LLIntEntryPoint creates same DirectJITCode for all functions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP - Patch
llint-entry-code.diff (text/plain), 7.20 KB, created by
Caio Lima
on 2019-02-15 10:47:53 PST
(
hide
)
Description:
WIP - Patch
Filename:
MIME Type:
Creator:
Caio Lima
Created:
2019-02-15 10:47:53 PST
Size:
7.20 KB
patch
obsolete
>diff --git a/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp b/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp >index a7b76378f75..5933543ac81 100644 >--- a/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp >+++ b/Source/JavaScriptCore/llint/LLIntEntrypoint.cpp >@@ -45,13 +45,11 @@ static void setFunctionEntrypoint(VM& vm, CodeBlock* codeBlock) > #if ENABLE(JIT) > if (VM::canUseJIT()) { > if (kind == CodeForCall) { >- codeBlock->setJITCode( >- adoptRef(*new DirectJITCode(vm.getCTIStub(functionForCallEntryThunkGenerator).retagged<JSEntryPtrTag>(), vm.getCTIStub(functionForCallArityCheckThunkGenerator).retaggedCode<JSEntryPtrTag>(), JITCode::InterpreterThunk))); >+ codeBlock->setJITCode(makeRef(*vm.getFunctionForCallEntryCode())); > return; > } > ASSERT(kind == CodeForConstruct); >- codeBlock->setJITCode( >- adoptRef(*new DirectJITCode(vm.getCTIStub(functionForConstructEntryThunkGenerator).retagged<JSEntryPtrTag>(), vm.getCTIStub(functionForConstructArityCheckThunkGenerator).retaggedCode<JSEntryPtrTag>(), JITCode::InterpreterThunk))); >+ codeBlock->setJITCode(makeRef(*vm.getFunctionForConstructEntryCode())); > return; > } > #endif // ENABLE(JIT) >@@ -78,9 +76,7 @@ static void setEvalEntrypoint(VM& vm, CodeBlock* codeBlock) > { > #if ENABLE(JIT) > if (VM::canUseJIT()) { >- MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = vm.getCTIStub(evalEntryThunkGenerator).retagged<JSEntryPtrTag>(); >- codeBlock->setJITCode( >- adoptRef(*new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk))); >+ codeBlock->setJITCode(makeRef(*vm.getEvalEntryCode())); > return; > } > #endif // ENABLE(JIT) >@@ -99,8 +95,7 @@ static void setProgramEntrypoint(VM& vm, CodeBlock* codeBlock) > #if ENABLE(JIT) > if (VM::canUseJIT()) { > MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = vm.getCTIStub(programEntryThunkGenerator).retagged<JSEntryPtrTag>(); >- codeBlock->setJITCode( >- adoptRef(*new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk))); >+ codeBlock->setJITCode(makeRef(*vm.getProgramEntryCode())); > return; > } > #endif // ENABLE(JIT) >@@ -118,9 +113,7 @@ static void setModuleProgramEntrypoint(VM& vm, CodeBlock* codeBlock) > { > #if ENABLE(JIT) > if (VM::canUseJIT()) { >- MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = vm.getCTIStub(moduleProgramEntryThunkGenerator).retagged<JSEntryPtrTag>(); >- codeBlock->setJITCode( >- adoptRef(*new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk))); >+ codeBlock->setJITCode(makeRef(*vm.getModuleProgramEntryCode())); > return; > } > #endif // ENABLE(JIT) >diff --git a/Source/JavaScriptCore/runtime/VM.cpp b/Source/JavaScriptCore/runtime/VM.cpp >index 79022d62181..385ace837f3 100644 >--- a/Source/JavaScriptCore/runtime/VM.cpp >+++ b/Source/JavaScriptCore/runtime/VM.cpp >@@ -106,6 +106,7 @@ > #include "JSWebAssemblyCodeBlockHeapCellType.h" > #include "JSWithScope.h" > #include "LLIntData.h" >+#include "LLIntThunks.h" > #include "Lexer.h" > #include "Lookup.h" > #include "MinimumReservedZoneSize.h" >@@ -408,6 +409,11 @@ VM::VM(VMType vmType, HeapType heapType) > > #if ENABLE(JIT) > jitStubs = std::make_unique<JITThunks>(); >+ m_functionForCallEntryCode = nullptr; >+ m_functionForConstructEntryCode = nullptr; >+ m_evalEntryCode = nullptr; >+ m_programEntryCode = nullptr; >+ m_moduleProgramEntryCode = nullptr; > #endif > > #if ENABLE(FTL_JIT) >@@ -599,6 +605,66 @@ Ref<VM> VM::create(HeapType heapType) > return adoptRef(*new VM(Default, heapType)); > } > >+#if ENABLE(JIT) >+DirectJITCode* VM::getFunctionForCallEntryCode() >+{ >+ auto locker = holdLock(m_llintEntryCodeLock); >+ if (!m_functionForCallEntryCode) { >+ DirectJITCode* code = new DirectJITCode(this->getCTIStub(LLInt::functionForCallEntryThunkGenerator).retagged<JSEntryPtrTag>(), this->getCTIStub(LLInt::functionForCallArityCheckThunkGenerator).retaggedCode<JSEntryPtrTag>(), JITCode::InterpreterThunk); >+ m_functionForCallEntryCode = adoptRef(*code); >+ } >+ >+ return m_functionForCallEntryCode.leakRef(); >+} >+ >+DirectJITCode* VM::getFunctionForConstructEntryCode() >+{ >+ auto locker = holdLock(m_llintEntryCodeLock); >+ if (!m_functionForConstructEntryCode) { >+ DirectJITCode* code = new DirectJITCode(this->getCTIStub(LLInt::functionForConstructEntryThunkGenerator).retagged<JSEntryPtrTag>(), this->getCTIStub(LLInt::functionForConstructArityCheckThunkGenerator).retaggedCode<JSEntryPtrTag>(), JITCode::InterpreterThunk); >+ m_functionForConstructEntryCode = adoptRef(*code); >+ } >+ >+ return m_functionForConstructEntryCode.leakRef(); >+} >+ >+DirectJITCode* VM::getEvalEntryCode() >+{ >+ auto locker = holdLock(m_llintEntryCodeLock); >+ if (!m_evalEntryCode) { >+ MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = this->getCTIStub(LLInt::evalEntryThunkGenerator).retagged<JSEntryPtrTag>(); >+ DirectJITCode* code = new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk); >+ m_evalEntryCode = adoptRef(*code); >+ } >+ >+ return m_evalEntryCode.leakRef(); >+} >+ >+DirectJITCode* VM::getProgramEntryCode() >+{ >+ auto locker = holdLock(m_llintEntryCodeLock); >+ if (!m_programEntryCode) { >+ MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = this->getCTIStub(LLInt::programEntryThunkGenerator).retagged<JSEntryPtrTag>(); >+ DirectJITCode* code = new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk); >+ m_programEntryCode = adoptRef(*code); >+ } >+ >+ return m_programEntryCode.leakRef(); >+} >+ >+DirectJITCode* VM::getModuleProgramEntryCode() >+{ >+ auto locker = holdLock(m_llintEntryCodeLock); >+ if (!m_moduleProgramEntryCode) { >+ MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = this->getCTIStub(LLInt::moduleProgramEntryThunkGenerator).retagged<JSEntryPtrTag>(); >+ DirectJITCode* code = new DirectJITCode(codeRef, codeRef.code(), JITCode::InterpreterThunk); >+ m_moduleProgramEntryCode = adoptRef(*code); >+ } >+ >+ return m_moduleProgramEntryCode.leakRef(); >+} >+#endif // ENABLE(JIT) >+ > bool VM::sharedInstanceExists() > { > return sharedInstanceInternal(); >diff --git a/Source/JavaScriptCore/runtime/VM.h b/Source/JavaScriptCore/runtime/VM.h >index 5ab352ff61c..a59e5e2d2b1 100644 >--- a/Source/JavaScriptCore/runtime/VM.h >+++ b/Source/JavaScriptCore/runtime/VM.h >@@ -158,6 +158,7 @@ class VMEntryScope; > class Watchdog; > class Watchpoint; > class WatchpointSet; >+class DirectJITCode; > > #if ENABLE(FTL_JIT) > namespace FTL { >@@ -628,6 +629,21 @@ public: > return jitStubs->ctiStub(this, generator); > } > >+ DirectJITCode* getFunctionForCallEntryCode(); >+ DirectJITCode* getFunctionForConstructEntryCode(); >+ DirectJITCode* getEvalEntryCode(); >+ DirectJITCode* getProgramEntryCode(); >+ DirectJITCode* getModuleProgramEntryCode(); >+ >+private: >+ Lock m_llintEntryCodeLock; >+ RefPtr<DirectJITCode> m_functionForCallEntryCode; >+ RefPtr<DirectJITCode> m_functionForConstructEntryCode; >+ RefPtr<DirectJITCode> m_evalEntryCode; >+ RefPtr<DirectJITCode> m_programEntryCode; >+ RefPtr<DirectJITCode> m_moduleProgramEntryCode; >+ >+public: > #endif // ENABLE(JIT) > #if ENABLE(FTL_JIT) > std::unique_ptr<FTL::Thunks> ftlThunks;
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 194648
:
362008
|
362009
|
362010
|
362036
|
362129
|
362148
|
362306
|
362313
|
362326
|
362897
|
364555
|
364689