Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3d0e6c14b12c2641c27faaf2f213483432d13b7a
https://github.com/WebKit/WebKit/commit/3d0e6c14b12c2641c27faaf2f213483432d13b7a
Author: Sosuke Suzuki <[email protected]>
Date: 2026-08-17 (Mon, 17 Aug 2026)
Changed paths:
M Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
M Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
M Source/JavaScriptCore/bytecode/UnlinkedGlobalCodeBlock.h
M Source/JavaScriptCore/runtime/CachedTypes.cpp
Log Message:
-----------
[JSC] Move the fields only global code uses out of `UnlinkedCodeBlock`
https://bugs.webkit.org/show_bug.cgi?id=321764
Reviewed by Yusuke Suzuki.
UnlinkedCodeBlock has m_features, m_lineCount, m_endColumn and the two source
URL directives.
Only Program / Eval / Module code writes them, so that CodeCache can copy them
into the new
executable on a cache hit. Function code never touches them because
UnlinkedFunctionExecutable
has its own copies. Still, every UnlinkedFunctionCodeBlock pays 22 bytes for
them.
This patch moves them to UnlinkedGlobalCodeBlock, as GlobalExecutable already
does on the linked
side, and moves m_llintExecuteCounter next to the remaining small fields so
that the freed bytes
are not lost to padding. CachedCodeBlock is split in the same way.
sizeof(UnlinkedFunctionCodeBlock) goes from 216 to 192 bytes, so its cell goes
from 224 to 192
bytes. That is 32 bytes per function that has been compiled to bytecode (1,665
of them, 53 KB,
after loading typescript.js and compiling one file). The global code blocks do
not change in size.
* Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
* Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::setHasTailCalls):
(JSC::UnlinkedCodeBlock::allowDirectEvalCache const): Deleted.
(JSC::UnlinkedCodeBlock::usesImportMeta const): Deleted.
(JSC::UnlinkedCodeBlock::recordParse): Deleted.
(JSC::UnlinkedCodeBlock::sourceURLDirective const): Deleted.
(JSC::UnlinkedCodeBlock::sourceMappingURLDirective const): Deleted.
(JSC::UnlinkedCodeBlock::setSourceURLDirective): Deleted.
(JSC::UnlinkedCodeBlock::setSourceMappingURLDirective): Deleted.
(JSC::UnlinkedCodeBlock::codeFeatures const): Deleted.
(JSC::UnlinkedCodeBlock::lexicallyScopedFeatures const): Deleted.
(JSC::UnlinkedCodeBlock::hasCapturedVariables const): Deleted.
(JSC::UnlinkedCodeBlock::lineCount const): Deleted.
(JSC::UnlinkedCodeBlock::startColumn const): Deleted.
(JSC::UnlinkedCodeBlock::endColumn const): Deleted.
* Source/JavaScriptCore/bytecode/UnlinkedGlobalCodeBlock.h:
(JSC::UnlinkedGlobalCodeBlock::recordParse):
(JSC::UnlinkedGlobalCodeBlock::sourceURLDirective const):
(JSC::UnlinkedGlobalCodeBlock::sourceMappingURLDirective const):
(JSC::UnlinkedGlobalCodeBlock::setSourceURLDirective):
(JSC::UnlinkedGlobalCodeBlock::setSourceMappingURLDirective):
(JSC::UnlinkedGlobalCodeBlock::codeFeatures const):
(JSC::UnlinkedGlobalCodeBlock::allowDirectEvalCache const):
(JSC::UnlinkedGlobalCodeBlock::lexicallyScopedFeatures const):
(JSC::UnlinkedGlobalCodeBlock::hasCapturedVariables const):
(JSC::UnlinkedGlobalCodeBlock::lineCount const):
(JSC::UnlinkedGlobalCodeBlock::startColumn const):
(JSC::UnlinkedGlobalCodeBlock::endColumn const):
* Source/JavaScriptCore/runtime/CachedTypes.cpp:
(JSC::CachedCodeBlock::isBuiltinDefaultClassConstructor const):
(JSC::CachedCodeBlock::hasCheckpoints const):
(JSC::CachedGlobalCodeBlock::encode):
(JSC::CachedGlobalCodeBlock::features const):
(JSC::CachedGlobalCodeBlock::lexicallyScopedFeatures const):
(JSC::CachedGlobalCodeBlock::hasCapturedVariables const):
(JSC::CachedGlobalCodeBlock::lineCount const):
(JSC::CachedGlobalCodeBlock::endColumn const):
(JSC::CachedGlobalCodeBlock::sourceURLDirective const):
(JSC::CachedGlobalCodeBlock::sourceMappingURLDirective const):
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
(JSC::UnlinkedGlobalCodeBlock::UnlinkedGlobalCodeBlock):
(JSC::CachedCodeBlock<CodeBlockType>::encode):
(JSC::CachedCodeBlock::sourceURLDirective const): Deleted.
(JSC::CachedCodeBlock::sourceMappingURLDirective const): Deleted.
(JSC::CachedCodeBlock::hasCapturedVariables const): Deleted.
(JSC::CachedCodeBlock::lineCount const): Deleted.
(JSC::CachedCodeBlock::endColumn const): Deleted.
(JSC::CachedCodeBlock::features const): Deleted.
(JSC::CachedCodeBlock::lexicallyScopedFeatures const): Deleted.
Canonical link: https://commits.webkit.org/319346@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications