DFGDesiredGlobalProperties.cpp [plain text]
#include "config.h"
#include "DFGDesiredGlobalProperties.h"
#if ENABLE(DFG_JIT)
#include "CodeBlock.h"
#include "DFGCommonData.h"
#include "DFGDesiredIdentifiers.h"
#include "JSCInlines.h"
#include "JSGlobalObject.h"
namespace JSC { namespace DFG {
bool DesiredGlobalProperties::isStillValidOnMainThread(VM& vm, DesiredIdentifiers& identifiers)
{
bool isStillValid = true;
for (const auto& property : m_set) {
auto* uid = identifiers.at(property.identifierNumber());
JSGlobalObject* globalObject = property.globalObject();
{
SymbolTable* symbolTable = globalObject->globalLexicalEnvironment()->symbolTable();
ConcurrentJSLocker locker(symbolTable->m_lock);
if (!symbolTable->contains(locker, uid))
continue;
}
property.globalObject()->ensureReferencedPropertyWatchpointSet(uid).fireAll(vm, "Lexical binding shadows an existing global property");
isStillValid = false;
}
return isStillValid;
}
void DesiredGlobalProperties::reallyAdd(CodeBlock* codeBlock, DesiredIdentifiers& identifiers, CommonData& common)
{
for (const auto& property : m_set) {
auto* uid = identifiers.at(property.identifierNumber());
auto& watchpointSet = property.globalObject()->ensureReferencedPropertyWatchpointSet(uid);
ASSERT(watchpointSet.isStillValid());
watchpointSet.add(common.watchpoints.add(codeBlock));
}
}
} }
#endif // ENABLE(DFG_JIT)