AdaptiveInferredPropertyValueWatchpointBase.cpp [plain text]
#include "config.h"
#include "AdaptiveInferredPropertyValueWatchpointBase.h"
#include "JSCInlines.h"
namespace JSC {
AdaptiveInferredPropertyValueWatchpointBase::AdaptiveInferredPropertyValueWatchpointBase(const ObjectPropertyCondition& key)
: m_key(key)
{
RELEASE_ASSERT(key.kind() == PropertyCondition::Equivalence);
}
void AdaptiveInferredPropertyValueWatchpointBase::install()
{
RELEASE_ASSERT(m_key.isWatchable());
m_key.object()->structure()->addTransitionWatchpoint(&m_structureWatchpoint);
PropertyOffset offset = m_key.object()->structure()->getConcurrently(m_key.uid());
WatchpointSet* set = m_key.object()->structure()->propertyReplacementWatchpointSet(offset);
set->add(&m_propertyWatchpoint);
}
void AdaptiveInferredPropertyValueWatchpointBase::fire(const FireDetail& detail)
{
if (m_structureWatchpoint.isOnList())
m_structureWatchpoint.remove();
if (m_propertyWatchpoint.isOnList())
m_propertyWatchpoint.remove();
if (!isValid())
return;
if (m_key.isWatchable(PropertyCondition::EnsureWatchability)) {
install();
return;
}
handleFire(detail);
}
bool AdaptiveInferredPropertyValueWatchpointBase::isValid() const
{
return true;
}
void AdaptiveInferredPropertyValueWatchpointBase::StructureWatchpoint::fireInternal(const FireDetail& detail)
{
ptrdiff_t myOffset = OBJECT_OFFSETOF(AdaptiveInferredPropertyValueWatchpointBase, m_structureWatchpoint);
AdaptiveInferredPropertyValueWatchpointBase* parent = bitwise_cast<AdaptiveInferredPropertyValueWatchpointBase*>(bitwise_cast<char*>(this) - myOffset);
parent->fire(detail);
}
void AdaptiveInferredPropertyValueWatchpointBase::PropertyWatchpoint::fireInternal(const FireDetail& detail)
{
ptrdiff_t myOffset = OBJECT_OFFSETOF(AdaptiveInferredPropertyValueWatchpointBase, m_propertyWatchpoint);
AdaptiveInferredPropertyValueWatchpointBase* parent = bitwise_cast<AdaptiveInferredPropertyValueWatchpointBase*>(bitwise_cast<char*>(this) - myOffset);
parent->fire(detail);
}
}