Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Source/JavaScriptCore/runtime/CodeCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,15 @@ class CodeCacheMap {
prune();

iterator findResult = m_map.find(key);
if (findResult == m_map.end())
return fetchFromDisk<UnlinkedCodeBlockType>(vm, key);
if (findResult == m_map.end()) {
// A block decoded from the provider's cached bytecode is as reusable as one we generated: remember it the
// way getUnlinkedGlobalCodeBlock() remembers those, so another global in this VM loading the same source
// links against this block instead of decoding its own copy of the unlinked tree.
UnlinkedCodeBlockType* decoded = fetchFromDisk<UnlinkedCodeBlockType>(vm, key);
if (decoded && Options::useCodeCache())
addCache(key, SourceCodeValue(vm, decoded, m_age));
return decoded;
}

int64_t age = m_age - findResult->value.age;
if (age > m_capacity) {
Expand Down
Loading