Skip to content

Commit f856b06

Browse files
committed
Unreviewed, follow-up after 279021@main
https://bugs.webkit.org/show_bug.cgi?id=274445 rdar://128405738 * Source/JavaScriptCore/bytecode/AccessCase.cpp: (JSC::AccessCase::canBeShared): * Source/JavaScriptCore/bytecode/SharedJITStubSet.h: (JSC::SharedJITStubSet::Searcher::Translator::hash): (JSC::SharedJITStubSet::Searcher::Translator::equal): (JSC::SharedJITStubSet::Searcher::Searcher): Canonical link: https://commits.webkit.org/279050@main
1 parent a3c5034 commit f856b06

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

Source/JavaScriptCore/bytecode/AccessCase.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,8 +1535,7 @@ bool AccessCase::canBeShared(const AccessCase& lhs, const AccessCase& rhs)
15351535
case ProxyObjectLoad:
15361536
case ProxyObjectStore:
15371537
case IndexedProxyObjectLoad: {
1538-
// Getter / Setter / ProxyObjectHas / ProxyObjectLoad / ProxyObjectStore / IndexedProxyObjectLoad rely on CodeBlock, which makes sharing impossible.
1539-
return false;
1538+
return true;
15401539
}
15411540

15421541
case IntrinsicGetter: {

Source/JavaScriptCore/bytecode/SharedJITStubSet.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ class SharedJITStubSet {
8686
struct Translator {
8787
static unsigned hash(const Searcher& searcher)
8888
{
89-
return PolymorphicAccessJITStubRoutine::computeHash(searcher.m_cases);
89+
return searcher.m_hash;
9090
}
9191

9292
static bool equal(const Hash::Key a, const Searcher& b)
9393
{
94-
if (a.m_stubInfoKey == b.m_stubInfoKey) {
94+
if (a.m_stubInfoKey == b.m_stubInfoKey && Hash::hash(a) == b.m_hash) {
9595
// FIXME: The ordering of cases does not matter for sharing capabilities.
9696
// We can potentially increase success rate by making this comparison / hashing non ordering sensitive.
9797
const auto& aCases = a.m_wrapped->cases();
@@ -108,8 +108,16 @@ class SharedJITStubSet {
108108
}
109109
};
110110

111+
Searcher(StructureStubInfoKey&& stubInfoKey, std::span<const Ref<AccessCase>>&& span)
112+
: m_stubInfoKey(WTFMove(stubInfoKey))
113+
, m_cases(WTFMove(span))
114+
, m_hash(PolymorphicAccessJITStubRoutine::computeHash(m_cases))
115+
{
116+
}
117+
111118
StructureStubInfoKey m_stubInfoKey;
112119
std::span<const Ref<AccessCase>> m_cases;
120+
unsigned m_hash { 0 };
113121
};
114122

115123
struct PointerTranslator {

0 commit comments

Comments
 (0)