DFGDesiredWatchpoints.cpp [plain text]
#include "config.h"
#include "DFGDesiredWatchpoints.h"
#if ENABLE(DFG_JIT)
#include "ArrayBufferNeuteringWatchpoint.h"
#include "CodeBlock.h"
#include "JSCInlines.h"
namespace JSC { namespace DFG {
void ArrayBufferViewWatchpointAdaptor::add(
CodeBlock* codeBlock, JSArrayBufferView* view, Watchpoint* watchpoint)
{
ArrayBufferNeuteringWatchpoint* neuteringWatchpoint =
ArrayBufferNeuteringWatchpoint::create(*codeBlock->vm());
neuteringWatchpoint->set()->add(watchpoint);
codeBlock->addConstant(neuteringWatchpoint);
codeBlock->vm()->heap.addReference(neuteringWatchpoint, view->buffer());
}
void InferredValueAdaptor::add(
CodeBlock* codeBlock, InferredValue* inferredValue, Watchpoint* watchpoint)
{
codeBlock->addConstant(inferredValue); inferredValue->add(watchpoint);
}
DesiredWatchpoints::DesiredWatchpoints() { }
DesiredWatchpoints::~DesiredWatchpoints() { }
void DesiredWatchpoints::addLazily(WatchpointSet* set)
{
m_sets.addLazily(set);
}
void DesiredWatchpoints::addLazily(InlineWatchpointSet& set)
{
m_inlineSets.addLazily(&set);
}
void DesiredWatchpoints::addLazily(InferredValue* inferredValue)
{
m_inferredValues.addLazily(inferredValue);
}
void DesiredWatchpoints::addLazily(JSArrayBufferView* view)
{
m_bufferViews.addLazily(view);
}
bool DesiredWatchpoints::consider(Structure* structure)
{
if (!structure->dfgShouldWatch())
return false;
addLazily(structure->transitionWatchpointSet());
return true;
}
void DesiredWatchpoints::reallyAdd(CodeBlock* codeBlock, CommonData& commonData)
{
m_sets.reallyAdd(codeBlock, commonData);
m_inlineSets.reallyAdd(codeBlock, commonData);
m_inferredValues.reallyAdd(codeBlock, commonData);
m_bufferViews.reallyAdd(codeBlock, commonData);
}
bool DesiredWatchpoints::areStillValid() const
{
return m_sets.areStillValid()
&& m_inlineSets.areStillValid()
&& m_inferredValues.areStillValid()
&& m_bufferViews.areStillValid();
}
} }
#endif // ENABLE(DFG_JIT)