Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (285245 => 285246)
--- trunk/Source/_javascript_Core/ChangeLog 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-11-04 00:05:38 UTC (rev 285246)
@@ -1,3 +1,24 @@
+2021-11-03 Yusuke Suzuki <ysuz...@apple.com>
+
+ [JSC] Clean up StructureStubInfo initialization
+ https://bugs.webkit.org/show_bug.cgi?id=232652
+
+ Reviewed by Saam Barati.
+
+ This patch enhances FixedVector to initialize it from the other containers.
+ So we can simplify baseline StructureStubInfo initialization.
+ Now, StructureStubInfo::initializeFromUnlinkedStructureStubInfo becomes
+ StructureStubInfo constructor taking const UnlinkedStructureStubInfo&.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::setupWithUnlinkedBaselineCode):
+ * bytecode/StructureStubInfo.cpp:
+ (JSC::StructureStubInfo::StructureStubInfo):
+ (JSC::StructureStubInfo::initializeFromUnlinkedStructureStubInfo): Deleted.
+ * bytecode/StructureStubInfo.h:
+ * jit/JIT.cpp:
+ (JSC::JIT::link):
+
2021-11-02 Ross Kirsling <ross.kirsl...@sony.com>
[JSC] Add LLInt fast path for OpMod on x86_64
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (285245 => 285246)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2021-11-04 00:05:38 UTC (rev 285246)
@@ -782,7 +782,7 @@
RELEASE_ASSERT(jitData.m_jitConstantPool.isEmpty());
jitData.m_jitConstantPool = FixedVector<void*>(jitCode->m_constantPool.size());
- jitData.m_stubInfos = FixedVector<StructureStubInfo>(jitCode->m_unlinkedStubInfos.size());
+ jitData.m_stubInfos = FixedVector<StructureStubInfo>(jitCode->m_unlinkedStubInfos);
jitData.m_callLinkInfos = FixedVector<CallLinkInfo>(jitCode->m_unlinkedCalls.size());
for (size_t i = 0; i < jitCode->m_constantPool.size(); ++i) {
auto entry = jitCode->m_constantPool.at(i);
@@ -800,9 +800,7 @@
}
case JITConstantPool::Type::StructureStubInfo: {
unsigned index = bitwise_cast<uintptr_t>(entry.pointer());
- UnlinkedStructureStubInfo& unlinkedStubInfo = jitCode->m_unlinkedStubInfos[index];
StructureStubInfo& stubInfo = jitData.m_stubInfos[index];
- stubInfo.initializeFromUnlinkedStructureStubInfo(this, unlinkedStubInfo);
jitData.m_jitConstantPool[i] = &stubInfo;
break;
}
Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp (285245 => 285246)
--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp 2021-11-04 00:05:38 UTC (rev 285246)
@@ -415,14 +415,13 @@
m_cacheType = newCacheType;
}
-void StructureStubInfo::initializeFromUnlinkedStructureStubInfo(CodeBlock*, UnlinkedStructureStubInfo& unlinkedStubInfo)
+StructureStubInfo::StructureStubInfo(const UnlinkedStructureStubInfo& unlinkedStubInfo)
+ : StructureStubInfo(unlinkedStubInfo.accessType, CodeOrigin(unlinkedStubInfo.bytecodeIndex))
{
- accessType = unlinkedStubInfo.accessType;
start = unlinkedStubInfo.start;
doneLocation = unlinkedStubInfo.doneLocation;
slowPathStartLocation = unlinkedStubInfo.slowPathStartLocation;
callSiteIndex = CallSiteIndex(BytecodeIndex(unlinkedStubInfo.bytecodeIndex.offset()));
- codeOrigin = CodeOrigin(unlinkedStubInfo.bytecodeIndex);
m_codePtr = slowPathStartLocation;
propertyIsInt32 = unlinkedStubInfo.propertyIsInt32;
Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h (285245 => 285246)
--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h 2021-11-04 00:05:38 UTC (rev 285246)
@@ -103,9 +103,7 @@
regs.thisGPR = InvalidGPRReg;
}
- StructureStubInfo()
- : StructureStubInfo(AccessType::GetById, { })
- { }
+ StructureStubInfo(const UnlinkedStructureStubInfo& unlinkedStubInfo);
~StructureStubInfo();
@@ -122,8 +120,6 @@
void deref();
void aboutToDie();
- void initializeFromUnlinkedStructureStubInfo(CodeBlock*, UnlinkedStructureStubInfo&);
-
DECLARE_VISIT_AGGREGATE;
// Check if the stub has weak references that are dead. If it does, then it resets itself,
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (285245 => 285246)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2021-11-04 00:05:38 UTC (rev 285246)
@@ -1007,13 +1007,9 @@
MacroAssemblerCodePtr<JSEntryPtrTag> withArityCheck = patchBuffer.locationOf<JSEntryPtrTag>(m_arityCheck);
m_jitCode = adoptRef(*new BaselineJITCode(result, withArityCheck));
- m_jitCode->m_unlinkedCalls = FixedVector<UnlinkedCallLinkInfo>(m_unlinkedCalls.size());
- if (m_jitCode->m_unlinkedCalls.size())
- std::move(m_unlinkedCalls.begin(), m_unlinkedCalls.end(), m_jitCode->m_unlinkedCalls.begin());
+ m_jitCode->m_unlinkedCalls = WTFMove(m_unlinkedCalls);
m_jitCode->m_evalCallLinkInfos = WTFMove(m_evalCallLinkInfos);
- m_jitCode->m_unlinkedStubInfos = FixedVector<UnlinkedStructureStubInfo>(m_unlinkedStubInfos.size());
- if (m_jitCode->m_unlinkedStubInfos.size())
- std::move(m_unlinkedStubInfos.begin(), m_unlinkedStubInfos.end(), m_jitCode->m_unlinkedStubInfos.begin());
+ m_jitCode->m_unlinkedStubInfos = WTFMove(m_unlinkedStubInfos);
m_jitCode->m_switchJumpTables = WTFMove(m_switchJumpTables);
m_jitCode->m_stringSwitchJumpTables = WTFMove(m_stringSwitchJumpTables);
m_jitCode->m_jitCodeMap = jitCodeMapBuilder.finalize();
Modified: trunk/Source/WTF/ChangeLog (285245 => 285246)
--- trunk/Source/WTF/ChangeLog 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/WTF/ChangeLog 2021-11-04 00:05:38 UTC (rev 285246)
@@ -1,3 +1,20 @@
+2021-11-03 Yusuke Suzuki <ysuz...@apple.com>
+
+ [JSC] Clean up StructureStubInfo initialization
+ https://bugs.webkit.org/show_bug.cgi?id=232652
+
+ Reviewed by Saam Barati.
+
+ * wtf/FixedVector.h:
+ (WTF::FixedVector::FixedVector):
+ (WTF::FixedVector::operator=):
+ * wtf/RefCountedArray.h:
+ (WTF::RefCountedArray::RefCountedArray):
+ (WTF::RefCountedArray::operator=):
+ * wtf/SegmentedVector.h:
+ * wtf/Vector.h:
+ (WTF::VectorTypeOperations::uninitializedCopy):
+
2021-11-03 David Kilzer <ddkil...@apple.com>
Disable WebXR on tvOS and watchOS
Modified: trunk/Source/WTF/wtf/FixedVector.h (285245 => 285246)
--- trunk/Source/WTF/wtf/FixedVector.h 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/WTF/wtf/FixedVector.h 2021-11-04 00:05:38 UTC (rev 285246)
@@ -63,30 +63,18 @@
: m_storage(size)
{ }
- template<size_t inlineCapacity, typename OverflowHandler>
- explicit FixedVector(const Vector<T, inlineCapacity, OverflowHandler>& other)
- : m_storage(other)
+ template<typename Container, std::enable_if_t<!std::is_integral_v<Container>, bool> = true>
+ explicit FixedVector(Container&& other)
+ : m_storage(std::forward<Container>(other))
{ }
- template<size_t inlineCapacity, typename OverflowHandler>
- FixedVector& operator=(const Vector<T, inlineCapacity, OverflowHandler>& other)
+ template<typename Container, std::enable_if_t<!std::is_integral_v<Container>, bool> = true>
+ FixedVector& operator=(Container&& other)
{
- m_storage = other;
+ m_storage = std::forward<Container>(other);
return *this;
}
- template<size_t inlineCapacity, typename OverflowHandler>
- explicit FixedVector(Vector<T, inlineCapacity, OverflowHandler>&& other)
- : m_storage(WTFMove(other))
- { }
-
- template<size_t inlineCapacity, typename OverflowHandler>
- FixedVector& operator=(Vector<T, inlineCapacity, OverflowHandler>&& other)
- {
- m_storage = WTFMove(other);
- return *this;
- }
-
size_t size() const { return m_storage.size(); }
bool isEmpty() const { return m_storage.isEmpty(); }
size_t byteSize() const { return m_storage.byteSize(); }
Modified: trunk/Source/WTF/wtf/RefCountedArray.h (285245 => 285246)
--- trunk/Source/WTF/wtf/RefCountedArray.h 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/WTF/wtf/RefCountedArray.h 2021-11-04 00:05:38 UTC (rev 285246)
@@ -93,32 +93,36 @@
return result;
}
- template<size_t inlineCapacity, typename OverflowHandler>
- explicit RefCountedArray(const Vector<T, inlineCapacity, OverflowHandler>& other)
+ template<typename Container, std::enable_if_t<!std::is_integral_v<Container>, bool> = true>
+ explicit RefCountedArray(const Container& container)
{
- if (other.isEmpty()) {
+ unsigned size = std::size(container);
+ if (!size) {
PtrTraits::exchange(m_data, nullptr);
return;
}
- T* data = ""
+ T* data = ""
m_data = data;
- VectorTypeOperations<T>::uninitializedCopy(other.begin(), other.end(), data);
+ VectorTypeOperations<T>::uninitializedCopy(std::begin(container), std::end(container), data);
}
- template<size_t inlineCapacity, typename OverflowHandler>
- explicit RefCountedArray(Vector<T, inlineCapacity, OverflowHandler>&& other)
+ template<typename Container, std::enable_if_t<!std::is_integral_v<Container> && !std::is_lvalue_reference_v<Container>, bool> = true>
+ explicit RefCountedArray(Container&& other)
{
- Vector<T, inlineCapacity, OverflowHandler> vector(WTFMove(other));
- if (vector.isEmpty()) {
+ Container container(std::forward<Container>(other));
+ unsigned size = std::size(container);
+ if (!size) {
PtrTraits::exchange(m_data, nullptr);
return;
}
- T* data = ""
+ T* data = ""
m_data = data;
- for (unsigned index = 0; index < vector.size(); ++index)
- new (data + index) T(WTFMove(vector[index]));
+ auto iterator = std::begin(container);
+ auto end = std::end(container);
+ for (; iterator != end; ++iterator)
+ new (data++) T(WTFMove(*iterator));
}
template<typename OtherTraits = PtrTraits>
@@ -132,16 +136,17 @@
return assign<PtrTraits>(other);
}
- template<size_t inlineCapacity, typename OverflowHandler>
- RefCountedArray& operator=(const Vector<T, inlineCapacity, OverflowHandler>& other)
+ template<typename Container, typename = std::enable_if_t<!std::is_integral_v<Container>>>
+ RefCountedArray& operator=(const Container& container)
{
T* oldData = data();
- if (other.isEmpty())
+ unsigned size = std::size(container);
+ if (!size)
PtrTraits::exchange(m_data, nullptr);
else {
- T* data = ""
+ T* data = ""
m_data = data;
- VectorTypeOperations<T>::uninitializedCopy(other.begin(), other.end(), data);
+ VectorTypeOperations<T>::uninitializedCopy(std::begin(container), std::end(container), data);
}
if (!oldData)
return *this;
@@ -156,18 +161,21 @@
return *this;
}
- template<size_t inlineCapacity, typename OverflowHandler>
- RefCountedArray& operator=(Vector<T, inlineCapacity, OverflowHandler>&& other)
+ template<typename Container, std::enable_if_t<!std::is_integral_v<Container> && !std::is_lvalue_reference_v<Container>, bool> = true>
+ RefCountedArray& operator=(Container&& other)
{
- Vector<T, inlineCapacity, OverflowHandler> vector(WTFMove(other));
+ Container container(std::forward<Container>(other));
T* oldData = data();
- if (vector.isEmpty())
+ unsigned size = std::size(container);
+ if (!size)
PtrTraits::exchange(m_data, nullptr);
else {
- T* data = ""
+ T* data = ""
m_data = data;
- for (unsigned index = 0; index < vector.size(); ++index)
- new (data + index) T(WTFMove(vector[index]));
+ auto iterator = std::begin(container);
+ auto end = std::end(container);
+ for (; iterator != end; ++iterator)
+ new (data++) T(WTFMove(*iterator));
}
if (!oldData)
return *this;
Modified: trunk/Source/WTF/wtf/SegmentedVector.h (285245 => 285246)
--- trunk/Source/WTF/wtf/SegmentedVector.h 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/WTF/wtf/SegmentedVector.h 2021-11-04 00:05:38 UTC (rev 285246)
@@ -108,7 +108,19 @@
using iterator = Iterator;
SegmentedVector() = default;
+ SegmentedVector(SegmentedVector&& other)
+ : SegmentedVector()
+ {
+ swap(other);
+ }
+ SegmentedVector& operator=(SegmentedVector&& other)
+ {
+ SegmentedVector moved(WTFMove(other));
+ swap(moved);
+ return *this;
+ }
+
~SegmentedVector()
{
deleteAllSegments();
@@ -221,6 +233,12 @@
m_segments.shrinkToFit();
}
+ void swap(SegmentedVector& other)
+ {
+ std::swap(m_size, other.m_size);
+ m_segments.swap(other.m_segments);
+ }
+
private:
struct Segment {
#if COMPILER(MSVC)
Modified: trunk/Source/WTF/wtf/Vector.h (285245 => 285246)
--- trunk/Source/WTF/wtf/Vector.h 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/WTF/wtf/Vector.h 2021-11-04 00:05:38 UTC (rev 285246)
@@ -163,8 +163,8 @@
template<typename T>
struct VectorCopier<false, T>
{
- template<typename U>
- static void uninitializedCopy(const T* src, const T* srcEnd, U* dst)
+ template<typename InputIterator, typename U>
+ static void uninitializedCopy(InputIterator src, InputIterator srcEnd, U* dst)
{
while (src != srcEnd) {
new (NotNull, dst) U(*src);
@@ -181,8 +181,8 @@
{
memcpy(static_cast<void*>(dst), static_cast<void*>(const_cast<T*>(src)), reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src));
}
- template<typename U>
- static void uninitializedCopy(const T* src, const T* srcEnd, U* dst)
+ template<typename InputIterator, typename U>
+ static void uninitializedCopy(InputIterator src, InputIterator srcEnd, U* dst)
{
VectorCopier<false, T>::uninitializedCopy(src, srcEnd, dst);
}
@@ -265,7 +265,8 @@
VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::moveOverlapping(src, srcEnd, dst);
}
- static void uninitializedCopy(const T* src, const T* srcEnd, T* dst)
+ template<typename InputIterator>
+ static void uninitializedCopy(InputIterator src, InputIterator srcEnd, T* dst)
{
VectorCopier<VectorTraits<T>::canCopyWithMemcpy, T>::uninitializedCopy(src, srcEnd, dst);
}
Modified: trunk/Source/WebCore/ChangeLog (285245 => 285246)
--- trunk/Source/WebCore/ChangeLog 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/WebCore/ChangeLog 2021-11-04 00:05:38 UTC (rev 285246)
@@ -1,3 +1,13 @@
+2021-11-03 Yusuke Suzuki <ysuz...@apple.com>
+
+ [JSC] Clean up StructureStubInfo initialization
+ https://bugs.webkit.org/show_bug.cgi?id=232652
+
+ Reviewed by Saam Barati.
+
+ * inspector/InspectorOverlay.cpp:
+ (WebCore::InspectorOverlay::fontForLayoutLabel):
+
2021-11-03 Tyler Wilcock <tyle...@apple.com>
AX: WKAccessibilityWebPageObjectMac.mm should expose accessibilityChildrenInNavigationOrder and NSAccessibilityChildrenInNavigationOrderAttribute
Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (285245 => 285246)
--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp 2021-11-04 00:05:38 UTC (rev 285246)
@@ -1207,7 +1207,7 @@
FontCascade InspectorOverlay::fontForLayoutLabel()
{
FontCascadeDescription fontDescription;
- fontDescription.setFamilies({ "system-ui" });
+ fontDescription.setFamilies(Vector<AtomString> { "system-ui" });
fontDescription.setWeight(FontSelectionValue(500));
fontDescription.setComputedSize(12);
Modified: trunk/Tools/ChangeLog (285245 => 285246)
--- trunk/Tools/ChangeLog 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Tools/ChangeLog 2021-11-04 00:05:38 UTC (rev 285246)
@@ -1,3 +1,13 @@
+2021-11-03 Yusuke Suzuki <ysuz...@apple.com>
+
+ [JSC] Clean up StructureStubInfo initialization
+ https://bugs.webkit.org/show_bug.cgi?id=232652
+
+ Reviewed by Saam Barati.
+
+ * TestWebKitAPI/Tests/WTF/FixedVector.cpp:
+ (TestWebKitAPI::TEST):
+
2021-11-03 Alex Christensen <achristen...@webkit.org>
[ iOS Debug ] TestWebKitAPI.ResourceLoadStatistics.GrandfatherCallback is failing
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/FixedVector.cpp (285245 => 285246)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/FixedVector.cpp 2021-11-03 23:55:18 UTC (rev 285245)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/FixedVector.cpp 2021-11-04 00:05:38 UTC (rev 285246)
@@ -171,6 +171,81 @@
EXPECT_EQ(vec2[index].value(), index);
}
+template<typename T>
+class NoncopyableVector : public Vector<T> {
+ WTF_MAKE_NONCOPYABLE(NoncopyableVector);
+public:
+ NoncopyableVector() = default;
+ NoncopyableVector(NoncopyableVector&&) = default;
+ NoncopyableVector& operator=(NoncopyableVector&&) = default;
+};
+
+TEST(WTF_FixedVector, MoveContainer)
+{
+ NoncopyableVector<MoveOnly> vec1;
+ vec1.constructAndAppend(0);
+ vec1.constructAndAppend(1);
+ vec1.constructAndAppend(2);
+ vec1.constructAndAppend(3);
+ EXPECT_EQ(vec1.size(), 4U);
+ FixedVector<MoveOnly> vec2(WTFMove(vec1));
+ EXPECT_EQ(vec1.size(), 0U);
+ EXPECT_EQ(vec2.size(), 4U);
+ for (unsigned index = 0; index < vec2.size(); ++index)
+ EXPECT_EQ(vec2[index].value(), index);
+}
+
+TEST(WTF_FixedVector, MoveAssignContainer)
+{
+ FixedVector<MoveOnly> vec2;
+ {
+ NoncopyableVector<MoveOnly> vec1;
+ vec1.constructAndAppend(0);
+ vec1.constructAndAppend(1);
+ vec1.constructAndAppend(2);
+ vec1.constructAndAppend(3);
+ EXPECT_EQ(vec1.size(), 4U);
+ vec2 = WTFMove(vec1);
+ EXPECT_EQ(vec1.size(), 0U);
+ }
+ EXPECT_EQ(vec2.size(), 4U);
+ for (unsigned index = 0; index < vec2.size(); ++index)
+ EXPECT_EQ(vec2[index].value(), index);
+}
+
+TEST(WTF_FixedVector, ReferenceContainer)
+{
+ NoncopyableVector<unsigned> vec1;
+ vec1.constructAndAppend(0);
+ vec1.constructAndAppend(1);
+ vec1.constructAndAppend(2);
+ vec1.constructAndAppend(3);
+ EXPECT_EQ(vec1.size(), 4U);
+ FixedVector<unsigned> vec2(vec1);
+ EXPECT_EQ(vec1.size(), 4U);
+ EXPECT_EQ(vec2.size(), 4U);
+ for (unsigned index = 0; index < vec2.size(); ++index)
+ EXPECT_EQ(vec2[index], index);
+}
+
+TEST(WTF_FixedVector, ReferenceAssignContainer)
+{
+ FixedVector<unsigned> vec2;
+ {
+ NoncopyableVector<unsigned> vec1;
+ vec1.constructAndAppend(0);
+ vec1.constructAndAppend(1);
+ vec1.constructAndAppend(2);
+ vec1.constructAndAppend(3);
+ EXPECT_EQ(vec1.size(), 4U);
+ vec2 = vec1;
+ EXPECT_EQ(vec1.size(), 4U);
+ }
+ EXPECT_EQ(vec2.size(), 4U);
+ for (unsigned index = 0; index < vec2.size(); ++index)
+ EXPECT_EQ(vec2[index], index);
+}
+
TEST(WTF_FixedVector, Swap)
{
FixedVector<unsigned> vec1(3);