Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (287757 => 287758)
--- trunk/Source/_javascript_Core/ChangeLog 2022-01-07 18:06:43 UTC (rev 287757)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-01-07 18:36:15 UTC (rev 287758)
@@ -1,3 +1,43 @@
+2022-01-07 Yusuke Suzuki <[email protected]>
+
+ [JSC] Clean up StructureStubInfo
+ https://bugs.webkit.org/show_bug.cgi?id=234943
+
+ Reviewed by Saam Barati.
+
+ Use std::unique_ptr<PolymorphicAccess> instead of raw pointer.
+
+ * bytecode/CheckPrivateBrandStatus.cpp:
+ (JSC::CheckPrivateBrandStatus::computeForStubInfoWithoutExitSiteFeedback):
+ * bytecode/DeleteByStatus.cpp:
+ (JSC::DeleteByStatus::computeForStubInfoWithoutExitSiteFeedback):
+ * bytecode/GetByStatus.cpp:
+ (JSC::GetByStatus::computeForStubInfoWithoutExitSiteFeedback):
+ * bytecode/InByStatus.cpp:
+ (JSC::InByStatus::computeForStubInfoWithoutExitSiteFeedback):
+ * bytecode/InstanceOfStatus.cpp:
+ (JSC::InstanceOfStatus::computeForStubInfo):
+ * bytecode/PutByStatus.cpp:
+ (JSC::PutByStatus::computeForStubInfo):
+ * bytecode/SetPrivateBrandStatus.cpp:
+ (JSC::SetPrivateBrandStatus::computeForStubInfoWithoutExitSiteFeedback):
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::deref):
+ (JSC::StructureStubInfo::aboutToDie):
+ (JSC::StructureStubInfo::addAccessCase):
+ (JSC::StructureStubInfo::visitAggregateImpl):
+ (JSC::StructureStubInfo::visitWeakReferences):
+ (JSC::StructureStubInfo::propagateTransitions):
+ (JSC::StructureStubInfo::summary const):
+ (JSC::StructureStubInfo::containsPC const):
+ (JSC::StructureStubInfo::~StructureStubInfo): Deleted.
+ * bytecode/StructureStubInfo.h:
+ (JSC::StructureStubInfo::offsetOfCodePtr):
+ (JSC::StructureStubInfo::offsetOfDoneLocation):
+ (JSC::StructureStubInfo::offsetOfSlowPathStartLocation):
+ (JSC::StructureStubInfo::offsetOfSlowOperation):
+ (JSC::StructureStubInfo::offsetOfCountdown):
+
2022-01-06 Saam Barati <[email protected]>
preparePatchpointForExceptions needs to handle tuples
Modified: trunk/Source/_javascript_Core/bytecode/CheckPrivateBrandStatus.cpp (287757 => 287758)
--- trunk/Source/_javascript_Core/bytecode/CheckPrivateBrandStatus.cpp 2022-01-07 18:06:43 UTC (rev 287757)
+++ trunk/Source/_javascript_Core/bytecode/CheckPrivateBrandStatus.cpp 2022-01-07 18:36:15 UTC (rev 287758)
@@ -100,7 +100,7 @@
return CheckPrivateBrandStatus(NoInformation);
case CacheType::Stub: {
- PolymorphicAccess* list = stubInfo->u.stub;
+ PolymorphicAccess* list = stubInfo->m_stub.get();
for (unsigned listIndex = 0; listIndex < list->size(); ++listIndex) {
const AccessCase& access = list->at(listIndex);
Modified: trunk/Source/_javascript_Core/bytecode/DeleteByStatus.cpp (287757 => 287758)
--- trunk/Source/_javascript_Core/bytecode/DeleteByStatus.cpp 2022-01-07 18:06:43 UTC (rev 287757)
+++ trunk/Source/_javascript_Core/bytecode/DeleteByStatus.cpp 2022-01-07 18:36:15 UTC (rev 287758)
@@ -99,7 +99,7 @@
return DeleteByStatus(NoInformation);
case CacheType::Stub: {
- PolymorphicAccess* list = stubInfo->u.stub;
+ PolymorphicAccess* list = stubInfo->m_stub.get();
for (unsigned listIndex = 0; listIndex < list->size(); ++listIndex) {
const AccessCase& access = list->at(listIndex);
Modified: trunk/Source/_javascript_Core/bytecode/GetByStatus.cpp (287757 => 287758)
--- trunk/Source/_javascript_Core/bytecode/GetByStatus.cpp 2022-01-07 18:06:43 UTC (rev 287757)
+++ trunk/Source/_javascript_Core/bytecode/GetByStatus.cpp 2022-01-07 18:36:15 UTC (rev 287758)
@@ -236,7 +236,7 @@
}
case CacheType::Stub: {
- PolymorphicAccess* list = stubInfo->u.stub;
+ PolymorphicAccess* list = stubInfo->m_stub.get();
if (list->size() == 1) {
const AccessCase& access = list->at(0);
switch (access.type()) {
Modified: trunk/Source/_javascript_Core/bytecode/InByStatus.cpp (287757 => 287758)
--- trunk/Source/_javascript_Core/bytecode/InByStatus.cpp 2022-01-07 18:06:43 UTC (rev 287757)
+++ trunk/Source/_javascript_Core/bytecode/InByStatus.cpp 2022-01-07 18:36:15 UTC (rev 287758)
@@ -160,7 +160,7 @@
}
case CacheType::Stub: {
- PolymorphicAccess* list = stubInfo->u.stub;
+ PolymorphicAccess* list = stubInfo->m_stub.get();
for (unsigned listIndex = 0; listIndex < list->size(); ++listIndex) {
const AccessCase& access = list->at(listIndex);
if (access.viaProxy())
Modified: trunk/Source/_javascript_Core/bytecode/InstanceOfStatus.cpp (287757 => 287758)
--- trunk/Source/_javascript_Core/bytecode/InstanceOfStatus.cpp 2022-01-07 18:06:43 UTC (rev 287757)
+++ trunk/Source/_javascript_Core/bytecode/InstanceOfStatus.cpp 2022-01-07 18:36:15 UTC (rev 287758)
@@ -83,7 +83,7 @@
if (stubInfo->cacheType() != CacheType::Stub)
return TakesSlowPath; // This is conservative. It could be that we have no information.
- PolymorphicAccess* list = stubInfo->u.stub;
+ PolymorphicAccess* list = stubInfo->m_stub.get();
InstanceOfStatus result;
for (unsigned listIndex = 0; listIndex < list->size(); ++listIndex) {
const AccessCase& access = list->at(listIndex);
Modified: trunk/Source/_javascript_Core/bytecode/PutByStatus.cpp (287757 => 287758)
--- trunk/Source/_javascript_Core/bytecode/PutByStatus.cpp 2022-01-07 18:06:43 UTC (rev 287757)
+++ trunk/Source/_javascript_Core/bytecode/PutByStatus.cpp 2022-01-07 18:36:15 UTC (rev 287758)
@@ -188,7 +188,7 @@
}
case CacheType::Stub: {
- PolymorphicAccess* list = stubInfo->u.stub;
+ PolymorphicAccess* list = stubInfo->m_stub.get();
PutByStatus result;
result.m_state = Simple;
Modified: trunk/Source/_javascript_Core/bytecode/SetPrivateBrandStatus.cpp (287757 => 287758)
--- trunk/Source/_javascript_Core/bytecode/SetPrivateBrandStatus.cpp 2022-01-07 18:06:43 UTC (rev 287757)
+++ trunk/Source/_javascript_Core/bytecode/SetPrivateBrandStatus.cpp 2022-01-07 18:36:15 UTC (rev 287758)
@@ -100,7 +100,7 @@
return SetPrivateBrandStatus(NoInformation);
case CacheType::Stub: {
- PolymorphicAccess* list = stubInfo->u.stub;
+ PolymorphicAccess* list = stubInfo->m_stub.get();
for (unsigned listIndex = 0; listIndex < list->size(); ++listIndex) {
const AccessCase& access = list->at(listIndex);
Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp (287757 => 287758)
--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp 2022-01-07 18:06:43 UTC (rev 287757)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp 2022-01-07 18:36:15 UTC (rev 287758)
@@ -39,9 +39,7 @@
static constexpr bool verbose = false;
}
-StructureStubInfo::~StructureStubInfo()
-{
-}
+StructureStubInfo::~StructureStubInfo() = default;
void StructureStubInfo::initGetByIdSelf(const ConcurrentJSLockerBase& locker, CodeBlock* codeBlock, Structure* inlineAccessBaseStructure, PropertyOffset offset, CacheableIdentifier identifier)
{
@@ -90,7 +88,7 @@
{
switch (m_cacheType) {
case CacheType::Stub:
- delete u.stub;
+ m_stub.reset();
return;
case CacheType::Unset:
case CacheType::GetByIdSelf:
@@ -108,7 +106,7 @@
{
switch (m_cacheType) {
case CacheType::Stub:
- u.stub->aboutToDie();
+ m_stub->aboutToDie();
return;
case CacheType::Unset:
case CacheType::GetByIdSelf:
@@ -139,7 +137,7 @@
AccessGenerationResult result;
if (m_cacheType == CacheType::Stub) {
- result = u.stub->addCase(locker, vm, codeBlock, *this, accessCase.releaseNonNull());
+ result = m_stub->addCase(locker, vm, codeBlock, *this, accessCase.releaseNonNull());
if (StructureStubInfoInternal::verbose)
dataLog("Had stub, result: ", result, "\n");
@@ -176,7 +174,7 @@
}
setCacheType(locker, CacheType::Stub);
- u.stub = access.release();
+ m_stub = WTFMove(access);
}
ASSERT(m_cacheType == CacheType::Stub);
@@ -202,7 +200,7 @@
// PolymorphicAccess.
clearBufferedStructures();
- result = u.stub->regenerate(locker, vm, globalObject, codeBlock, ecmaMode, *this);
+ result = m_stub->regenerate(locker, vm, globalObject, codeBlock, ecmaMode, *this);
if (StructureStubInfoInternal::verbose)
dataLog("Regeneration result: ", result, "\n");
@@ -323,7 +321,7 @@
case CacheType::GetByIdSelf:
return;
case CacheType::Stub:
- u.stub->visitAggregate(visitor);
+ m_stub->visitAggregate(visitor);
return;
}
@@ -348,7 +346,7 @@
if (Structure* structure = inlineAccessBaseStructure(vm))
isValid &= vm.heap.isMarked(structure);
if (m_cacheType == CacheType::Stub)
- isValid &= u.stub->visitWeak(vm);
+ isValid &= m_stub->visitWeak(vm);
if (isValid)
return;
@@ -364,7 +362,7 @@
structure->markIfCheap(visitor);
if (m_cacheType == CacheType::Stub)
- u.stub->propagateTransitions(visitor);
+ m_stub->propagateTransitions(visitor);
}
template void StructureStubInfo::propagateTransitions(AbstractSlotVisitor&);
@@ -375,7 +373,7 @@
StubInfoSummary takesSlowPath = StubInfoSummary::TakesSlowPath;
StubInfoSummary simple = StubInfoSummary::Simple;
if (m_cacheType == CacheType::Stub) {
- PolymorphicAccess* list = u.stub;
+ PolymorphicAccess* list = m_stub.get();
for (unsigned i = 0; i < list->size(); ++i) {
const AccessCase& access = list->at(i);
if (access.doesCalls(vm)) {
@@ -407,7 +405,7 @@
{
if (m_cacheType != CacheType::Stub)
return false;
- return u.stub->containsPC(pc);
+ return m_stub->containsPC(pc);
}
ALWAYS_INLINE void StructureStubInfo::setCacheType(const ConcurrentJSLockerBase&, CacheType newCacheType)
Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h (287757 => 287758)
--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h 2022-01-07 18:06:43 UTC (rev 287757)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h 2022-01-07 18:36:15 UTC (rev 287758)
@@ -32,6 +32,7 @@
#include "JITStubRoutine.h"
#include "MacroAssembler.h"
#include "Options.h"
+#include "PolymorphicAccess.h"
#include "PutKind.h"
#include "RegisterSet.h"
#include "Structure.h"
@@ -350,13 +351,14 @@
};
public:
- CodeOrigin codeOrigin;
- PropertyOffset byIdSelfOffset;
static ptrdiff_t offsetOfByIdSelfOffset() { return OBJECT_OFFSETOF(StructureStubInfo, byIdSelfOffset); }
static ptrdiff_t offsetOfInlineAccessBaseStructure() { return OBJECT_OFFSETOF(StructureStubInfo, m_inlineAccessBaseStructure); }
- union {
- PolymorphicAccess* stub;
- } u;
+ static ptrdiff_t offsetOfCodePtr() { return OBJECT_OFFSETOF(StructureStubInfo, m_codePtr); }
+ static ptrdiff_t offsetOfDoneLocation() { return OBJECT_OFFSETOF(StructureStubInfo, doneLocation); }
+ static ptrdiff_t offsetOfSlowPathStartLocation() { return OBJECT_OFFSETOF(StructureStubInfo, slowPathStartLocation); }
+ static ptrdiff_t offsetOfSlowOperation() { return OBJECT_OFFSETOF(StructureStubInfo, m_slowOperation); }
+ static ptrdiff_t offsetOfCountdown() { return OBJECT_OFFSETOF(StructureStubInfo, countdown); }
+
Structure* inlineAccessBaseStructure(VM& vm)
{
if (!m_inlineAccessBaseStructure)
@@ -363,6 +365,10 @@
return nullptr;
return vm.getStructure(m_inlineAccessBaseStructure);
}
+
+ CodeOrigin codeOrigin;
+ PropertyOffset byIdSelfOffset;
+ std::unique_ptr<PolymorphicAccess> m_stub;
StructureID m_inlineAccessBaseStructure { 0 };
private:
CacheableIdentifier m_identifier;
@@ -383,12 +389,6 @@
MacroAssemblerCodePtr<JITStubRoutinePtrTag> m_codePtr;
- static ptrdiff_t offsetOfCodePtr() { return OBJECT_OFFSETOF(StructureStubInfo, m_codePtr); }
- static ptrdiff_t offsetOfDoneLocation() { return OBJECT_OFFSETOF(StructureStubInfo, doneLocation); }
- static ptrdiff_t offsetOfSlowPathStartLocation() { return OBJECT_OFFSETOF(StructureStubInfo, slowPathStartLocation); }
- static ptrdiff_t offsetOfSlowOperation() { return OBJECT_OFFSETOF(StructureStubInfo, m_slowOperation); }
- static ptrdiff_t offsetOfCountdown() { return OBJECT_OFFSETOF(StructureStubInfo, countdown); }
-
RegisterSet usedRegisters;
GPRReg baseGPR { InvalidGPRReg };