Skip to content

Commit

Permalink
[JSC] Reduce sizeof(CodeBlock) from 232 to 224
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=265508
rdar://118917365

Reviewed by Mark Lam.

This patch reduces sizeof(CodeBlock) by using float for m_previousCounter.
This is OK since BaselineExecutableCounter is anyway keeping m_totalCount as float,
so it is aligned to that precision.

* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finalizeUnconditionally):
* Source/JavaScriptCore/bytecode/CodeBlock.h:

Canonical link: https://commits.webkit.org/271273@main
  • Loading branch information
Constellation committed Nov 29, 2023
1 parent 538824c commit b8cd89e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/bytecode/CodeBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@ void CodeBlock::finalizeUnconditionally(VM& vm, CollectionScope)
if (!VM::useUnlinkedCodeBlockJettisoning())
return;
JITCode* jitCode = m_jitCode.get();
double count = 0;
float count = 0;
bool alwaysActive = false;
switch (JITCode::jitTypeFor(jitCode)) {
case JITType::None:
Expand Down
8 changes: 4 additions & 4 deletions Source/JavaScriptCore/bytecode/CodeBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,8 @@ class CodeBlock : public JSCell {

const void* const m_instructionsRawPointer { nullptr };
SentinelLinkedList<CallLinkInfoBase, PackedRawSentinelNode<CallLinkInfoBase>> m_incomingCalls;
uint16_t m_optimizationDelayCounter { 0 };
uint16_t m_reoptimizationRetryCounter { 0 };
StructureWatchpointMap m_llintGetByIdWatchpointMap;
RefPtr<JITCode> m_jitCode;
#if ENABLE(JIT)
Expand Down Expand Up @@ -980,11 +982,9 @@ class CodeBlock : public JSCell {

BaselineExecutionCounter m_jitExecuteCounter;

uint16_t m_optimizationDelayCounter { 0 };
uint16_t m_reoptimizationRetryCounter { 0 };
float m_previousCounter { 0 };

ApproximateTime m_creationTime;
double m_previousCounter { 0 };

std::unique_ptr<RareData> m_rareData;

Expand All @@ -995,7 +995,7 @@ class CodeBlock : public JSCell {
};
/* This check is for normal Release builds; ASSERT_ENABLED changes the size. */
#if defined(NDEBUG) && !defined(ASSERT_ENABLED) && COMPILER(GCC_COMPATIBLE)
static_assert(sizeof(CodeBlock) <= 240, "Keep it small for memory saving");
static_assert(sizeof(CodeBlock) <= 224, "Keep it small for memory saving");
#endif

template <typename ExecutableType>
Expand Down

0 comments on commit b8cd89e

Please sign in to comment.