mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Make every function cacheable even if script is not cacheable
Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
2c070415ba
commit
f04616e4a5
2 changed files with 10 additions and 12 deletions
|
|
@ -312,7 +312,7 @@ ScriptParser::InitializeScriptResult ScriptParser::initializeScript(String* orig
|
|||
if (result.first) {
|
||||
GC_disable();
|
||||
|
||||
Script* script = new Script(srcName, source, nullptr, originLineOffset, false, cacheable, srcHash);
|
||||
Script* script = new Script(srcName, source, nullptr, originLineOffset, false, srcHash);
|
||||
CodeCacheEntry& entry = result.second;
|
||||
|
||||
codeCache->prepareCacheLoading(m_context, srcHash, Optional<size_t>(), entry);
|
||||
|
|
@ -370,7 +370,6 @@ ScriptParser::InitializeScriptResult ScriptParser::initializeScript(String* orig
|
|||
script = new Script(srcName, source, programNode->moduleData(), originLineOffset, !parentCodeBlock
|
||||
#if defined(ENABLE_CODE_CACHE)
|
||||
,
|
||||
cacheable,
|
||||
srcHash
|
||||
#endif
|
||||
);
|
||||
|
|
@ -475,9 +474,13 @@ void ScriptParser::generateFunctionByteCode(ExecutionState& state, InterpretedCo
|
|||
|
||||
#if defined(ENABLE_CODE_CACHE)
|
||||
CodeCache* codeCache = m_context->vmInstance()->codeCache();
|
||||
bool cacheable = codeBlock->script()->isCacheable() && codeBlock->src().length() > codeCache->minSourceLength();
|
||||
bool cacheable = codeCache->enabled() && codeBlock->src().length() > codeCache->minSourceLength();
|
||||
// Lode code from cache
|
||||
size_t srcHash = codeBlock->script()->sourceCodeHashValue();
|
||||
size_t srcHash = 0;
|
||||
// loading source code hash value can cause computing hash value of entire source code
|
||||
if (cacheable) {
|
||||
srcHash = codeBlock->script()->sourceCodeHashValue();
|
||||
}
|
||||
|
||||
// Load cache
|
||||
if (cacheable) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue