Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/bytecode/CodeBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ CodeBlock::~CodeBlock()

#if ENABLE(JIT) && USE(BUN_JSC_ADDITIONS)
if (jitType() == JITType::BaselineJIT)
static_cast<BaselineJITCode*>(m_jitCode.get())->m_ownerWentAwayAt = ApproximateTime::now();
static_cast<BaselineJITCode*>(m_jitCode.get())->m_ownerWentAwayAt = vm.heap.lastGCBoundaryTime();
#endif

if (JITCode::isBaselineCode(jitType())) {
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/heap/Heap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ void Heap::releaseUnusedSharedBaselineCode()
#if ENABLE(JIT) && USE(BUN_JSC_ADDITIONS)
if (!Options::useBaselineJITCodeSharing() || !Options::useExecutionCountForCodeBlockAging())
return;
ApproximateTime cutoff = ApproximateTime::now() - CodeBlock::timeToLive(JITType::BaselineJIT) * Options::codeBlockAgingLeaseMultiplier();
MonotonicTime cutoff = m_currentGCStartTime - CodeBlock::timeToLive(JITType::BaselineJIT) * Options::codeBlockAgingLeaseMultiplier();
// End phase: the world is stopped and allocation already is, so no HeapIterationScope.
auto visit = [&] (HeapCell* cell, HeapCell::Kind) {
auto& code = static_cast<UnlinkedCodeBlock*>(cell)->m_unlinkedBaselineCode;
Expand Down
4 changes: 4 additions & 0 deletions Source/JavaScriptCore/heap/Heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,10 @@ class Heap {
MutatorState mutatorState() const { return m_mutatorState; }
std::optional<CollectionScope> collectionScope() const { return m_collectionScope; }
std::optional<CollectionScope> lastCollectionScope() const { return m_lastCollectionScope; }
#if USE(BUN_JSC_ADDITIONS)
// The most recent collection boundary: the end of the last one, or the start of the one in progress.
MonotonicTime lastGCBoundaryTime() const { return std::max(m_lastGCEndTime, m_currentGCStartTime); }
#endif
bool hasHeapAccess() const { return m_worldState.load() & hasAccessBit; }
bool worldIsStopped() const { return m_worldIsStopped; }
bool worldIsRunning() const { return !worldIsStopped(); }
Expand Down
10 changes: 6 additions & 4 deletions Source/JavaScriptCore/jit/BaselineJITCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "CallLinkInfo.h"
#include "JITCode.h"
#include <wtf/ApproximateTime.h>
#include <wtf/MonotonicTime.h>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
#include "JITCodeMap.h"
#include "PropertyInlineCache.h"
#include <wtf/ButterflyArray.h>
Expand Down Expand Up @@ -107,9 +107,11 @@ class BaselineJITCode : public DirectJITCode, public MathICHolder {
JITCodeMap m_jitCodeMap;
JITConstantPool m_constantPool;
std::unique_ptr<PCToCodeOriginMap> m_pcToCodeOriginMap;
// When a CodeBlock running this code last went away; UnlinkedCodeBlock's cached copy is released once no CodeBlock
// has used it for a while (Heap::releaseUnusedSharedBaselineCode).
ApproximateTime m_ownerWentAwayAt { ApproximateTime::now() };
#if USE(BUN_JSC_ADDITIONS)
// The collection in which a CodeBlock running this code last died (Heap::lastGCBoundaryTime); UnlinkedCodeBlock's
// cached copy is released once no CodeBlock has used it for a while (Heap::releaseUnusedSharedBaselineCode).
MonotonicTime m_ownerWentAwayAt;
#endif
private:
// The percentage of ValueProfiles that had some profiling data in them.
double m_livenessRate { 0 };
Expand Down
Loading