Diff
Modified: branches/safari-609.1.20.2-branch/Source/_javascript_Core/ChangeLog (256875 => 256876)
--- branches/safari-609.1.20.2-branch/Source/_javascript_Core/ChangeLog 2020-02-19 00:01:22 UTC (rev 256875)
+++ branches/safari-609.1.20.2-branch/Source/_javascript_Core/ChangeLog 2020-02-19 00:01:27 UTC (rev 256876)
@@ -1,73 +1,5 @@
2020-02-14 Russell Epstein <repst...@apple.com>
- Cherry-pick r256498. rdar://problem/59478929
-
- [JSC] Compact JITCodeMap by storing BytecodeIndex and CodeLocation separately
- https://bugs.webkit.org/show_bug.cgi?id=207673
-
- Reviewed by Mark Lam.
-
- Source/_javascript_Core:
-
- While BytecodeIndex is 4 bytes, CodeLocation is 8 bytes. So the tuple of them "JITCodeMap::Entry"
- becomes 16 bytes because it adds 4 bytes padding. We should store BytecodeIndex and CodeLocation separately
- to avoid this padding.
-
- This patch introduces JITCodeMapBuilder. We use this to build JITCodeMap data structure as a immutable final result.
-
- * jit/JIT.cpp:
- (JSC::JIT::link):
- * jit/JITCodeMap.h:
- (JSC::JITCodeMap::JITCodeMap):
- (JSC::JITCodeMap::find const):
- (JSC::JITCodeMap::operator bool const):
- (JSC::JITCodeMap::codeLocations const):
- (JSC::JITCodeMap::indexes const):
- (JSC::JITCodeMapBuilder::append):
- (JSC::JITCodeMapBuilder::finalize):
- (JSC::JITCodeMap::Entry::Entry): Deleted.
- (JSC::JITCodeMap::Entry::bytecodeIndex const): Deleted.
- (JSC::JITCodeMap::Entry::codeLocation): Deleted.
- (JSC::JITCodeMap::append): Deleted.
- (JSC::JITCodeMap::finish): Deleted.
-
- Source/WTF:
-
- * wtf/MallocPtr.h:
-
- git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 2020-02-12 Yusuke Suzuki <ysuz...@apple.com>
-
- [JSC] Compact JITCodeMap by storing BytecodeIndex and CodeLocation separately
- https://bugs.webkit.org/show_bug.cgi?id=207673
-
- Reviewed by Mark Lam.
-
- While BytecodeIndex is 4 bytes, CodeLocation is 8 bytes. So the tuple of them "JITCodeMap::Entry"
- becomes 16 bytes because it adds 4 bytes padding. We should store BytecodeIndex and CodeLocation separately
- to avoid this padding.
-
- This patch introduces JITCodeMapBuilder. We use this to build JITCodeMap data structure as a immutable final result.
-
- * jit/JIT.cpp:
- (JSC::JIT::link):
- * jit/JITCodeMap.h:
- (JSC::JITCodeMap::JITCodeMap):
- (JSC::JITCodeMap::find const):
- (JSC::JITCodeMap::operator bool const):
- (JSC::JITCodeMap::codeLocations const):
- (JSC::JITCodeMap::indexes const):
- (JSC::JITCodeMapBuilder::append):
- (JSC::JITCodeMapBuilder::finalize):
- (JSC::JITCodeMap::Entry::Entry): Deleted.
- (JSC::JITCodeMap::Entry::bytecodeIndex const): Deleted.
- (JSC::JITCodeMap::Entry::codeLocation): Deleted.
- (JSC::JITCodeMap::append): Deleted.
- (JSC::JITCodeMap::finish): Deleted.
-
-2020-02-14 Russell Epstein <repst...@apple.com>
-
Cherry-pick r256467. rdar://problem/59478994
[JSC] Make RegExpCache small
Modified: branches/safari-609.1.20.2-branch/Source/_javascript_Core/jit/JIT.cpp (256875 => 256876)
--- branches/safari-609.1.20.2-branch/Source/_javascript_Core/jit/JIT.cpp 2020-02-19 00:01:22 UTC (rev 256875)
+++ branches/safari-609.1.20.2-branch/Source/_javascript_Core/jit/JIT.cpp 2020-02-19 00:01:27 UTC (rev 256876)
@@ -894,14 +894,13 @@
patchBuffer.locationOfNearCall<JSInternalPtrTag>(compilationInfo.hotPathOther));
}
- {
- JITCodeMapBuilder jitCodeMapBuilder;
- for (unsigned bytecodeOffset = 0; bytecodeOffset < m_labels.size(); ++bytecodeOffset) {
- if (m_labels[bytecodeOffset].isSet())
- jitCodeMapBuilder.append(BytecodeIndex(bytecodeOffset), patchBuffer.locationOf<JSEntryPtrTag>(m_labels[bytecodeOffset]));
- }
- m_codeBlock->setJITCodeMap(jitCodeMapBuilder.finalize());
+ JITCodeMap jitCodeMap;
+ for (unsigned bytecodeOffset = 0; bytecodeOffset < m_labels.size(); ++bytecodeOffset) {
+ if (m_labels[bytecodeOffset].isSet())
+ jitCodeMap.append(BytecodeIndex(bytecodeOffset), patchBuffer.locationOf<JSEntryPtrTag>(m_labels[bytecodeOffset]));
}
+ jitCodeMap.finish();
+ m_codeBlock->setJITCodeMap(WTFMove(jitCodeMap));
MacroAssemblerCodePtr<JSEntryPtrTag> withArityCheck = patchBuffer.locationOf<JSEntryPtrTag>(m_arityCheck);
Modified: branches/safari-609.1.20.2-branch/Source/_javascript_Core/jit/JITCodeMap.h (256875 => 256876)
--- branches/safari-609.1.20.2-branch/Source/_javascript_Core/jit/JITCodeMap.h 2020-02-19 00:01:22 UTC (rev 256875)
+++ branches/safari-609.1.20.2-branch/Source/_javascript_Core/jit/JITCodeMap.h 2020-02-19 00:01:27 UTC (rev 256876)
@@ -34,63 +34,47 @@
namespace JSC {
class JITCodeMap {
-public:
- static_assert(std::is_trivially_destructible_v<BytecodeIndex>);
- static_assert(std::is_trivially_destructible_v<CodeLocationLabel<JSEntryPtrTag>>);
- static_assert(alignof(CodeLocationLabel<JSEntryPtrTag>) >= alignof(BytecodeIndex), "Putting CodeLocationLabel vector first since we can avoid alignment consideration of BytecodeIndex vector");
- JITCodeMap() = default;
- JITCodeMap(Vector<BytecodeIndex>&& indexes, Vector<CodeLocationLabel<JSEntryPtrTag>>&& codeLocations)
- : m_size(indexes.size())
- {
- ASSERT(indexes.size() == codeLocations.size());
- m_pointer = MallocPtr<uint8_t>::malloc(sizeof(CodeLocationLabel<JSEntryPtrTag>) * m_size + sizeof(BytecodeIndex) * m_size);
- std::copy(codeLocations.begin(), codeLocations.end(), this->codeLocations());
- std::copy(indexes.begin(), indexes.end(), this->indexes());
- }
+private:
+ struct Entry {
+ Entry() { }
- CodeLocationLabel<JSEntryPtrTag> find(BytecodeIndex bytecodeIndex) const
- {
- auto* index = binarySearch<BytecodeIndex, BytecodeIndex>(indexes(), m_size, bytecodeIndex, [] (BytecodeIndex* index) { return *index; });
- if (!index)
- return CodeLocationLabel<JSEntryPtrTag>();
- return codeLocations()[index - indexes()];
- }
+ Entry(BytecodeIndex bytecodeIndex, CodeLocationLabel<JSEntryPtrTag> codeLocation)
+ : m_bytecodeIndex(bytecodeIndex)
+ , m_codeLocation(codeLocation)
+ { }
- explicit operator bool() const { return m_size; }
+ inline BytecodeIndex bytecodeIndex() const { return m_bytecodeIndex; }
+ inline CodeLocationLabel<JSEntryPtrTag> codeLocation() { return m_codeLocation; }
-private:
- CodeLocationLabel<JSEntryPtrTag>* codeLocations() const
- {
- return bitwise_cast<CodeLocationLabel<JSEntryPtrTag>*>(m_pointer.get());
- }
+ private:
+ BytecodeIndex m_bytecodeIndex;
+ CodeLocationLabel<JSEntryPtrTag> m_codeLocation;
+ };
- BytecodeIndex* indexes() const
- {
- return bitwise_cast<BytecodeIndex*>(m_pointer.get() + sizeof(CodeLocationLabel<JSEntryPtrTag>) * m_size);
- }
-
- MallocPtr<uint8_t> m_pointer;
- unsigned m_size { 0 };
-};
-
-class JITCodeMapBuilder {
- WTF_MAKE_NONCOPYABLE(JITCodeMapBuilder);
public:
- JITCodeMapBuilder() = default;
void append(BytecodeIndex bytecodeIndex, CodeLocationLabel<JSEntryPtrTag> codeLocation)
{
- m_indexes.append(bytecodeIndex);
- m_codeLocations.append(codeLocation);
+ m_entries.append({ bytecodeIndex, codeLocation });
}
- JITCodeMap finalize()
+ void finish() { m_entries.shrinkToFit(); }
+
+ CodeLocationLabel<JSEntryPtrTag> find(BytecodeIndex bytecodeIndex) const
{
- return JITCodeMap(WTFMove(m_indexes), WTFMove(m_codeLocations));
+ auto* entry =
+ binarySearch<Entry, BytecodeIndex>(m_entries,
+ m_entries.size(), bytecodeIndex, [] (Entry* entry) {
+ return entry->bytecodeIndex();
+ });
+ if (!entry)
+ return CodeLocationLabel<JSEntryPtrTag>();
+ return entry->codeLocation();
}
+ explicit operator bool() const { return m_entries.size(); }
+
private:
- Vector<BytecodeIndex> m_indexes;
- Vector<CodeLocationLabel<JSEntryPtrTag>> m_codeLocations;
+ Vector<Entry> m_entries;
};
} // namespace JSC
Modified: branches/safari-609.1.20.2-branch/Source/WTF/ChangeLog (256875 => 256876)
--- branches/safari-609.1.20.2-branch/Source/WTF/ChangeLog 2020-02-19 00:01:22 UTC (rev 256875)
+++ branches/safari-609.1.20.2-branch/Source/WTF/ChangeLog 2020-02-19 00:01:27 UTC (rev 256876)
@@ -34,54 +34,6 @@
2020-02-14 Russell Epstein <repst...@apple.com>
- Cherry-pick r256498. rdar://problem/59478929
-
- [JSC] Compact JITCodeMap by storing BytecodeIndex and CodeLocation separately
- https://bugs.webkit.org/show_bug.cgi?id=207673
-
- Reviewed by Mark Lam.
-
- Source/_javascript_Core:
-
- While BytecodeIndex is 4 bytes, CodeLocation is 8 bytes. So the tuple of them "JITCodeMap::Entry"
- becomes 16 bytes because it adds 4 bytes padding. We should store BytecodeIndex and CodeLocation separately
- to avoid this padding.
-
- This patch introduces JITCodeMapBuilder. We use this to build JITCodeMap data structure as a immutable final result.
-
- * jit/JIT.cpp:
- (JSC::JIT::link):
- * jit/JITCodeMap.h:
- (JSC::JITCodeMap::JITCodeMap):
- (JSC::JITCodeMap::find const):
- (JSC::JITCodeMap::operator bool const):
- (JSC::JITCodeMap::codeLocations const):
- (JSC::JITCodeMap::indexes const):
- (JSC::JITCodeMapBuilder::append):
- (JSC::JITCodeMapBuilder::finalize):
- (JSC::JITCodeMap::Entry::Entry): Deleted.
- (JSC::JITCodeMap::Entry::bytecodeIndex const): Deleted.
- (JSC::JITCodeMap::Entry::codeLocation): Deleted.
- (JSC::JITCodeMap::append): Deleted.
- (JSC::JITCodeMap::finish): Deleted.
-
- Source/WTF:
-
- * wtf/MallocPtr.h:
-
- git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
-
- 2020-02-12 Yusuke Suzuki <ysuz...@apple.com>
-
- [JSC] Compact JITCodeMap by storing BytecodeIndex and CodeLocation separately
- https://bugs.webkit.org/show_bug.cgi?id=207673
-
- Reviewed by Mark Lam.
-
- * wtf/MallocPtr.h:
-
-2020-02-14 Russell Epstein <repst...@apple.com>
-
Cherry-pick r256482. rdar://problem/59478881
Shrink CachedResource
Modified: branches/safari-609.1.20.2-branch/Source/WTF/wtf/MallocPtr.h (256875 => 256876)
--- branches/safari-609.1.20.2-branch/Source/WTF/wtf/MallocPtr.h 2020-02-19 00:01:22 UTC (rev 256875)
+++ branches/safari-609.1.20.2-branch/Source/WTF/wtf/MallocPtr.h 2020-02-19 00:01:27 UTC (rev 256876)
@@ -26,7 +26,6 @@
#pragma once
#include <wtf/FastMalloc.h>
-#include <wtf/Noncopyable.h>
// MallocPtr is a smart pointer class that calls fastFree in its destructor.
// It is intended to be used for pointers where the C++ lifetime semantics
@@ -35,7 +34,6 @@
namespace WTF {
template<typename T, typename Malloc = FastMalloc> class MallocPtr {
- WTF_MAKE_NONCOPYABLE(MallocPtr);
public:
MallocPtr() = default;