Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (290107 => 290108)
--- trunk/Source/_javascript_Core/ChangeLog 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-02-18 03:46:49 UTC (rev 290108)
@@ -1,3 +1,16 @@
+2022-02-17 Chris Dumez <[email protected]>
+
+ Clean up / optimize call sites constructing vectors
+ https://bugs.webkit.org/show_bug.cgi?id=236748
+ <rdar://problem/89090710>
+
+ Reviewed by Darin Adler.
+
+ Follow-up to r290026 to address feedback from Darin.
+
+ * b3/air/AirCode.cpp:
+ (JSC::B3::Air::Code::setNumEntrypoints):
+
2022-02-17 Mikhail R. Gadelha <[email protected]>
[32bit] Increase fixedExecutableMemoryPoolSize on ARM to 32MB
Modified: trunk/Source/_javascript_Core/b3/air/AirCode.cpp (290107 => 290108)
--- trunk/Source/_javascript_Core/b3/air/AirCode.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/_javascript_Core/b3/air/AirCode.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -333,7 +333,7 @@
void Code::setNumEntrypoints(unsigned numEntryPoints)
{
- m_prologueGenerators = Vector { numEntryPoints, m_defaultPrologueGenerator.copyRef() };
+ m_prologueGenerators = { numEntryPoints, m_defaultPrologueGenerator.copyRef() };
}
} } } // namespace JSC::B3::Air
Modified: trunk/Source/WebCore/ChangeLog (290107 => 290108)
--- trunk/Source/WebCore/ChangeLog 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/ChangeLog 2022-02-18 03:46:49 UTC (rev 290108)
@@ -1,3 +1,48 @@
+2022-02-17 Chris Dumez <[email protected]>
+
+ Clean up / optimize call sites constructing vectors
+ https://bugs.webkit.org/show_bug.cgi?id=236748
+ <rdar://problem/89090710>
+
+ Reviewed by Darin Adler.
+
+ Follow-up to r290026 to address feedback from Darin.
+
+ * Modules/encryptedmedia/MediaKeySession.cpp:
+ (WebCore::MediaKeySession::updateKeyStatuses):
+ * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
+ (WebCore::IDBServer::SQLiteIDBCursor::currentData):
+ * accessibility/isolatedtree/AXIsolatedObject.cpp:
+ (WebCore::AXIsolatedObject::setMathscripts):
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneDeserializer::readString):
+ * css/StyleProperties.cpp:
+ (WebCore::DeferredStyleProperties::DeferredStyleProperties):
+ * css/StyleRule.cpp:
+ (WebCore::DeferredStyleGroupRuleList::DeferredStyleGroupRuleList):
+ * dom/ElementData.cpp:
+ (WebCore::UniqueElementData::UniqueElementData):
+ * loader/archive/cf/LegacyWebArchive.cpp:
+ (WebCore::LegacyWebArchive::createFromSelection):
+ * page/csp/ContentSecurityPolicy.cpp:
+ (WebCore::ContentSecurityPolicy::responseHeaders const):
+ * platform/encryptedmedia/CDMProxy.cpp:
+ (WebCore::KeyStore::convertToJSKeyStatusVector const):
+ * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
+ (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::updateLicense):
+ * platform/text/LocaleICU.cpp:
+ (WebCore::createFallbackMonthLabels):
+ * platform/text/LocaleNone.cpp:
+ (WebCore::LocaleNone::shortMonthLabels):
+ * platform/text/cocoa/LocaleCocoa.mm:
+ (WebCore::LocaleCocoa::monthLabels):
+ (WebCore::LocaleCocoa::shortMonthLabels):
+ (WebCore::LocaleCocoa::standAloneMonthLabels):
+ (WebCore::LocaleCocoa::shortStandAloneMonthLabels):
+ * testing/MockCDMFactory.cpp:
+ (WebCore::MockCDMInstanceSession::updateLicense):
+ (WebCore::MockCDMInstanceSession::removeSessionData):
+
2022-02-17 Diego Pino Garcia <[email protected]>
[WPE] Unreviewed, fix non-unified build after r290089
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (290107 => 290108)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -701,7 +701,7 @@
};
m_statuses = WTF::map(WTFMove(inputStatuses), [](auto&& status) {
- return std::make_pair(WTFMove(status.first), toMediaKeyStatus(status.second));
+ return std::pair { WTFMove(status.first), toMediaKeyStatus(status.second) };
});
// 5. Queue a task to fire a simple event named keystatuseschange at the session.
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp (290107 => 290108)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -116,7 +116,7 @@
}
Vector<IDBCursorRecord> prefetchedRecords;
- prefetchedRecords.reserveInitialCapacity(m_fetchedRecords.size());
+ prefetchedRecords.reserveInitialCapacity(m_fetchedRecords.size() - 1);
bool isFirst = true;
for (auto& record : m_fetchedRecords) {
if (record.isTerminalRecord())
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (290107 => 290108)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -445,7 +445,7 @@
return;
auto idPairs = pairs.map([](auto& mathPair) {
- return std::make_pair(mathPair.first ? mathPair.first->objectID() : AXID(), mathPair.second ? mathPair.second->objectID() : AXID());
+ return std::pair { mathPair.first ? mathPair.first->objectID() : AXID(), mathPair.second ? mathPair.second->objectID() : AXID() };
});
setProperty(propertyName, WTFMove(idPairs));
}
Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (290107 => 290108)
--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -2455,14 +2455,13 @@
str = String(reinterpret_cast<const UChar*>(ptr), length);
ptr += length * sizeof(UChar);
#else
- Vector<UChar> buffer;
- buffer.reserveInitialCapacity(length);
- for (unsigned i = 0; i < length; i++) {
- uint16_t ch;
- readLittleEndian(ptr, end, ch);
- buffer.uncheckedAppend(ch);
+ UChar* characters;
+ str = String::createUninitialized(length, characters);
+ for (unsigned i = 0; i < length; ++i) {
+ uint16_t c;
+ readLittleEndian(ptr, end, c);
+ characters[i] = c;
}
- str = String::adopt(WTFMove(buffer));
#endif
return true;
}
Modified: trunk/Source/WebCore/css/StyleProperties.cpp (290107 => 290108)
--- trunk/Source/WebCore/css/StyleProperties.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/css/StyleProperties.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -1803,10 +1803,9 @@
DeferredStyleProperties::DeferredStyleProperties(const CSSParserTokenRange& range, CSSDeferredParser& parser)
: StylePropertiesBase(parser.mode(), DeferredPropertiesType)
+ , m_tokens(range.begin(), range.end() - range.begin())
, m_parser(parser)
{
- size_t length = range.end() - range.begin();
- m_tokens.append(range.begin(), length);
}
DeferredStyleProperties::~DeferredStyleProperties() = default;
Modified: trunk/Source/WebCore/css/StyleRule.cpp (290107 => 290108)
--- trunk/Source/WebCore/css/StyleRule.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/css/StyleRule.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -366,10 +366,9 @@
StyleRuleFontPaletteValues::~StyleRuleFontPaletteValues() = default;
DeferredStyleGroupRuleList::DeferredStyleGroupRuleList(const CSSParserTokenRange& range, CSSDeferredParser& parser)
- : m_parser(parser)
+ : m_tokens(range.begin(), range.end() - range.begin())
+ , m_parser(parser)
{
- size_t length = range.end() - range.begin();
- m_tokens.append(range.begin(), length);
}
DeferredStyleGroupRuleList::~DeferredStyleGroupRuleList() = default;
Modified: trunk/Source/WebCore/css/calc/CSSCalcValue.cpp (290107 => 290108)
--- trunk/Source/WebCore/css/calc/CSSCalcValue.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/css/calc/CSSCalcValue.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -66,14 +66,9 @@
static Vector<Ref<CSSCalcExpressionNode>> createCSS(const Vector<std::unique_ptr<CalcExpressionNode>>& nodes, const RenderStyle& style)
{
- Vector<Ref<CSSCalcExpressionNode>> values;
- values.reserveInitialCapacity(nodes.size());
- for (auto& node : nodes) {
- if (auto cssNode = createCSS(*node, style))
- values.uncheckedAppend(cssNode.releaseNonNull());
- }
- values.shrinkToFit();
- return values;
+ return WTF::compactMap(nodes, [&](auto& node) -> RefPtr<CSSCalcExpressionNode> {
+ return createCSS(*node, style);
+ });
}
static RefPtr<CSSCalcExpressionNode> createCSS(const CalcExpressionNode& node, const RenderStyle& style)
Modified: trunk/Source/WebCore/dom/ElementData.cpp (290107 => 290108)
--- trunk/Source/WebCore/dom/ElementData.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/dom/ElementData.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -140,12 +140,11 @@
UniqueElementData::UniqueElementData(const ShareableElementData& other)
: ElementData(other, true)
+ , m_attributeVector(other.m_attributeArray, other.length())
{
// An ShareableElementData should never have a mutable inline StyleProperties attached.
ASSERT(!other.m_inlineStyle || !other.m_inlineStyle->isMutable());
m_inlineStyle = other.m_inlineStyle;
-
- m_attributeVector.append(other.m_attributeArray, other.length());
}
Ref<UniqueElementData> ElementData::makeUniqueCopy() const
Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (290107 => 290108)
--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -610,7 +610,7 @@
String iframeMarkup = "<iframe frameborder=\"no\" marginwidth=\"0\" marginheight=\"0\" width=\"98%%\" height=\"98%%\" src="" + frame->loader().documentLoader()->response().url().string() + "\"></iframe>";
auto iframeResource = ArchiveResource::create(utf8Buffer(iframeMarkup), aboutBlankURL(), "text/html", "UTF-8", String());
- return create(iframeResource.releaseNonNull(), { }, Vector { archive.releaseNonNull() });
+ return create(iframeResource.releaseNonNull(), { }, { archive.releaseNonNull() });
}
}
Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp (290107 => 290108)
--- trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -162,7 +162,7 @@
if (!m_cachedResponseHeaders) {
ContentSecurityPolicyResponseHeaders result;
result.m_headers = m_policies.map([](auto& policy) {
- return std::make_pair(policy->header(), policy->headerType());
+ return std::pair { policy->header(), policy->headerType() };
});
result.m_httpStatusCode = m_httpStatusCode;
m_cachedResponseHeaders = WTFMove(result);
Modified: trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp (290107 => 290108)
--- trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/platform/encryptedmedia/CDMProxy.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -226,7 +226,7 @@
CDMInstanceSession::KeyStatusVector KeyStore::convertToJSKeyStatusVector() const
{
return m_keys.map([](auto& key) {
- return std::make_pair(key->idAsSharedBuffer(), key->status());
+ return std::pair { key->idAsSharedBuffer(), key->status() };
});
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm (290107 => 290108)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm 2022-02-18 03:46:49 UTC (rev 290108)
@@ -937,7 +937,7 @@
// FIXME(rdar://problem/35592277): stash the callback and call it once AVContentKeyResponse supports a success callback.
struct objc_method_description method = protocol_getMethodDescription(@protocol(AVContentKeySessionDelegate), @selector(contentKeySession:contentKeyRequestDidSucceed:), NO, YES);
if (!method.name) {
- KeyStatusVector keyStatuses { std::make_pair(WTFMove(keyIDs.first()), KeyStatus::Usable) };
+ KeyStatusVector keyStatuses { std::pair { WTFMove(keyIDs.first()), KeyStatus::Usable } };
callback(false, std::make_optional(WTFMove(keyStatuses)), std::nullopt, std::nullopt, Succeeded);
return;
}
Modified: trunk/Source/WebCore/platform/text/LocaleICU.cpp (290107 => 290108)
--- trunk/Source/WebCore/platform/text/LocaleICU.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/platform/text/LocaleICU.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -188,9 +188,9 @@
static std::unique_ptr<Vector<String>> createFallbackMonthLabels()
{
auto labels = makeUnique<Vector<String>>();
- labels->reserveInitialCapacity(WTF_ARRAY_LENGTH(WTF::monthFullName));
- for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthFullName); ++i)
- labels->uncheckedAppend(WTF::monthFullName[i]);
+ labels->reserveInitialCapacity(std::size(WTF::monthFullName));
+ for (auto* monthName : WTF::monthFullName)
+ labels->uncheckedAppend(monthName);
return labels;
}
Modified: trunk/Source/WebCore/platform/text/LocaleNone.cpp (290107 => 290108)
--- trunk/Source/WebCore/platform/text/LocaleNone.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/platform/text/LocaleNone.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -116,9 +116,9 @@
{
if (!m_shortMonthLabels.isEmpty())
return m_shortMonthLabels;
- m_shortMonthLabels.reserveCapacity(WTF_ARRAY_LENGTH(WTF::monthName));
- for (unsigned i = 0; i < WTF_ARRAY_LENGTH(WTF::monthName); ++i)
- m_shortMonthLabels.uncheckedAppend(WTF::monthName[i]);
+ m_shortMonthLabels.reserveCapacity(std::size(WTF::monthName));
+ for (auto* monthName : WTF::monthName)
+ m_shortMonthLabels.uncheckedAppend(monthName);
return m_shortMonthLabels;
}
Modified: trunk/Source/WebCore/platform/text/cocoa/LocaleCocoa.mm (290107 => 290108)
--- trunk/Source/WebCore/platform/text/cocoa/LocaleCocoa.mm 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/platform/text/cocoa/LocaleCocoa.mm 2022-02-18 03:46:49 UTC (rev 290108)
@@ -39,6 +39,7 @@
#import <wtf/HashMap.h>
#import <wtf/Language.h>
#import <wtf/RetainPtr.h>
+#import <wtf/cocoa/VectorCocoa.h>
#import <wtf/text/AtomStringHash.h>
#import "LocalizedDateCache.h"
@@ -106,13 +107,12 @@
{
if (!m_monthLabels.isEmpty())
return m_monthLabels;
- m_monthLabels.reserveCapacity(12);
NSArray *array = [shortDateFormatter().get() monthSymbols];
if ([array count] == 12) {
- for (unsigned i = 0; i < 12; ++i)
- m_monthLabels.uncheckedAppend(String([array objectAtIndex:i]));
+ m_monthLabels = makeVector<String>(array);
return m_monthLabels;
}
+ m_monthLabels.reserveCapacity(12);
for (auto& name : WTF::monthFullName)
m_monthLabels.uncheckedAppend(name);
return m_monthLabels;
@@ -200,13 +200,12 @@
{
if (!m_shortMonthLabels.isEmpty())
return m_shortMonthLabels;
- m_shortMonthLabels.reserveCapacity(12);
NSArray *array = [shortDateFormatter().get() shortMonthSymbols];
if ([array count] == 12) {
- for (unsigned i = 0; i < 12; ++i)
- m_shortMonthLabels.uncheckedAppend([array objectAtIndex:i]);
+ m_shortMonthLabels = makeVector<String>(array);
return m_shortMonthLabels;
}
+ m_shortMonthLabels.reserveCapacity(12);
for (auto& name : WTF::monthName)
m_shortMonthLabels.uncheckedAppend(name);
return m_shortMonthLabels;
@@ -218,9 +217,7 @@
return m_standAloneMonthLabels;
NSArray *array = [shortDateFormatter().get() standaloneMonthSymbols];
if ([array count] == 12) {
- m_standAloneMonthLabels.reserveCapacity(12);
- for (unsigned i = 0; i < 12; ++i)
- m_standAloneMonthLabels.uncheckedAppend([array objectAtIndex:i]);
+ m_standAloneMonthLabels = makeVector<String>(array);
return m_standAloneMonthLabels;
}
m_standAloneMonthLabels = shortMonthLabels();
@@ -231,11 +228,10 @@
{
if (!m_shortStandAloneMonthLabels.isEmpty())
return m_shortStandAloneMonthLabels;
+
NSArray *array = [shortDateFormatter().get() shortStandaloneMonthSymbols];
if ([array count] == 12) {
- m_shortStandAloneMonthLabels.reserveCapacity(12);
- for (unsigned i = 0; i < 12; ++i)
- m_shortStandAloneMonthLabels.uncheckedAppend([array objectAtIndex:i]);
+ m_shortStandAloneMonthLabels = makeVector<String>(array);
return m_shortStandAloneMonthLabels;
}
m_shortStandAloneMonthLabels = shortMonthLabels();
Modified: trunk/Source/WebCore/testing/MockCDMFactory.cpp (290107 => 290108)
--- trunk/Source/WebCore/testing/MockCDMFactory.cpp 2022-02-18 03:37:28 UTC (rev 290107)
+++ trunk/Source/WebCore/testing/MockCDMFactory.cpp 2022-02-18 03:46:49 UTC (rev 290108)
@@ -344,7 +344,7 @@
const auto* keys = factory->keysForSessionWithID(sessionID);
if (keys) {
changedKeys = keys->map([](auto& key) {
- return std::make_pair(key.copyRef(), KeyStatus::Usable);
+ return std::pair { key.copyRef(), KeyStatus::Usable };
});
}
}
@@ -393,7 +393,7 @@
auto keys = factory->removeKeysFromSessionWithID(id);
auto keyStatusVector = WTF::map(WTFMove(keys), [](auto&& key) {
- return std::make_pair(WTFMove(key), KeyStatus::Released);
+ return std::pair { WTFMove(key), KeyStatus::Released };
});
CString message { "remove-message" };