StructureStubClearingWatchpoint.h [plain text]
#pragma once
#include "ObjectPropertyCondition.h"
#include "Watchpoint.h"
#if ENABLE(JIT)
#include <wtf/FastMalloc.h>
#include <wtf/Noncopyable.h>
namespace JSC {
class CodeBlock;
class StructureStubInfo;
class WatchpointsOnStructureStubInfo;
class StructureStubClearingWatchpoint : public Watchpoint {
WTF_MAKE_NONCOPYABLE(StructureStubClearingWatchpoint);
WTF_MAKE_FAST_ALLOCATED;
public:
StructureStubClearingWatchpoint(
const ObjectPropertyCondition& key,
WatchpointsOnStructureStubInfo& holder,
std::unique_ptr<StructureStubClearingWatchpoint> next)
: m_key(key)
, m_holder(holder)
, m_next(WTFMove(next))
{
}
virtual ~StructureStubClearingWatchpoint();
static StructureStubClearingWatchpoint* push(
const ObjectPropertyCondition& key,
WatchpointsOnStructureStubInfo& holder,
std::unique_ptr<StructureStubClearingWatchpoint>& head);
protected:
void fireInternal(VM&, const FireDetail&) override;
private:
ObjectPropertyCondition m_key;
WatchpointsOnStructureStubInfo& m_holder;
std::unique_ptr<StructureStubClearingWatchpoint> m_next;
};
class WatchpointsOnStructureStubInfo {
WTF_MAKE_NONCOPYABLE(WatchpointsOnStructureStubInfo);
WTF_MAKE_FAST_ALLOCATED;
public:
WatchpointsOnStructureStubInfo(CodeBlock* codeBlock, StructureStubInfo* stubInfo)
: m_codeBlock(codeBlock)
, m_stubInfo(stubInfo)
{
}
~WatchpointsOnStructureStubInfo();
StructureStubClearingWatchpoint* addWatchpoint(const ObjectPropertyCondition& key);
static StructureStubClearingWatchpoint* ensureReferenceAndAddWatchpoint(
std::unique_ptr<WatchpointsOnStructureStubInfo>& holderRef,
CodeBlock*, StructureStubInfo*, const ObjectPropertyCondition& key);
CodeBlock* codeBlock() const { return m_codeBlock; }
StructureStubInfo* stubInfo() const { return m_stubInfo; }
private:
CodeBlock* m_codeBlock;
StructureStubInfo* m_stubInfo;
std::unique_ptr<StructureStubClearingWatchpoint> m_head;
};
}
#endif // ENABLE(JIT)