Changeset 244295 in webkit
- Timestamp:
- Apr 15, 2019 2:55:33 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r244241 r244295 1 2019-04-15 Tadeu Zagallo <tzagallo@apple.com> 2 3 Incremental bytecode cache should not append function updates when loaded from memory 4 https://bugs.webkit.org/show_bug.cgi?id=196865 5 6 Reviewed by Filip Pizlo. 7 8 * stress/bytecode-cache-shared-code-block.js: Added. 9 (b): 10 (program): 11 1 12 2019-04-13 Tadeu Zagallo <tzagallo@apple.com> 2 13 -
trunk/Source/JavaScriptCore/ChangeLog
r244287 r244295 1 2019-04-15 Tadeu Zagallo <tzagallo@apple.com> 2 3 Incremental bytecode cache should not append function updates when loaded from memory 4 https://bugs.webkit.org/show_bug.cgi?id=196865 5 6 Reviewed by Filip Pizlo. 7 8 Function updates hold the assumption that a function can only be executed/cached 9 after its containing code block has already been cached. This assumptions does 10 not hold if the UnlinkedCodeBlock is loaded from memory by the CodeCache, since 11 we might have two independent SourceProviders executing different paths of the 12 code and causing the same UnlinkedCodeBlock to be modified in memory. 13 Use a RefPtr instead of Ref for m_cachedBytecode in ShellSourceProvider to distinguish 14 between a new, empty cache and a cache that was not loaded and therefore cannot be updated. 15 16 * jsc.cpp: 17 (ShellSourceProvider::ShellSourceProvider): 18 1 19 2019-04-15 Saam barati <sbarati@apple.com> 2 20 -
trunk/Source/JavaScriptCore/jsc.cpp
r244149 r244295 973 973 RefPtr<CachedBytecode> cachedBytecode() const override 974 974 { 975 if (!m_cachedBytecode ->size())975 if (!m_cachedBytecode) 976 976 loadBytecode(); 977 977 return m_cachedBytecode.copyRef(); … … 980 980 void updateCache(const UnlinkedFunctionExecutable* executable, const SourceCode&, CodeSpecializationKind kind, const UnlinkedFunctionCodeBlock* codeBlock) const override 981 981 { 982 if (!cacheEnabled() )982 if (!cacheEnabled() || !m_cachedBytecode) 983 983 return; 984 984 Ref<CachedBytecode> cachedBytecode = encodeFunctionCodeBlock(*executable->vm(), codeBlock); … … 990 990 if (!cacheEnabled()) 991 991 return; 992 if (!m_cachedBytecode) 993 m_cachedBytecode = CachedBytecode::create(); 992 994 m_cachedBytecode->addGlobalUpdate(generator()); 993 995 } … … 996 998 { 997 999 #if OS(DARWIN) 998 if (!cacheEnabled() || !m_cachedBytecode ->hasUpdates())1000 if (!cacheEnabled() || !m_cachedBytecode || !m_cachedBytecode->hasUpdates()) 999 1001 return; 1000 1002 1001 1003 auto clearBytecode = makeScopeExit([&] { 1002 m_cachedBytecode = CachedBytecode::create();1004 m_cachedBytecode = nullptr; 1003 1005 }); 1004 1006 … … 1076 1078 ShellSourceProvider(const String& source, const SourceOrigin& sourceOrigin, URL&& url, const TextPosition& startPosition, SourceProviderSourceType sourceType) 1077 1079 : StringSourceProvider(source, sourceOrigin, WTFMove(url), startPosition, sourceType) 1078 , m_cachedBytecode(CachedBytecode::create()) 1079 { 1080 loadBytecode(); 1080 { 1081 1081 } 1082 1082 … … 1087 1087 } 1088 1088 1089 mutable Ref <CachedBytecode> m_cachedBytecode;1089 mutable RefPtr<CachedBytecode> m_cachedBytecode; 1090 1090 }; 1091 1091
Note: See TracChangeset
for help on using the changeset viewer.