Diff
Modified: trunk/Source/WebCore/ChangeLog (149528 => 149529)
--- trunk/Source/WebCore/ChangeLog 2013-05-03 19:11:28 UTC (rev 149528)
+++ trunk/Source/WebCore/ChangeLog 2013-05-03 19:31:15 UTC (rev 149529)
@@ -1,3 +1,28 @@
+2013-05-03 Andreas Kling <[email protected]>
+
+ Use NotNull tag for placement new in WebCore.
+ <http://webkit.org/b/115569>
+
+ Reviewed by Antti Koivisto.
+
+ Avoid emitting null checks where we use placement new to construct objects into safe locations.
+
+ * css/StylePropertySet.cpp:
+ (WebCore::ImmutableStylePropertySet::create):
+ * dom/Element.cpp:
+ (WebCore::ShareableElementData::createWithAttributes):
+ (WebCore::ShareableElementData::ShareableElementData):
+ (WebCore::UniqueElementData::makeShareableCopy):
+ * dom/QualifiedName.cpp:
+ (WebCore::QualifiedName::init):
+ (WebCore::createQualifiedName):
+ * dom/make_names.pl:
+ (printNamesCppFile):
+ * platform/ThreadGlobalData.h:
+ (WebCore::threadGlobalData):
+ * platform/graphics/GlyphPage.h:
+ (WebCore::GlyphPage::createForMixedFontData):
+
2013-01-11 Andreas Kling <[email protected]>
Simplify CSSSelectorList creation/adoption.
Modified: trunk/Source/WebCore/css/StylePropertySet.cpp (149528 => 149529)
--- trunk/Source/WebCore/css/StylePropertySet.cpp 2013-05-03 19:11:28 UTC (rev 149528)
+++ trunk/Source/WebCore/css/StylePropertySet.cpp 2013-05-03 19:31:15 UTC (rev 149529)
@@ -69,7 +69,7 @@
PassRefPtr<ImmutableStylePropertySet> ImmutableStylePropertySet::create(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode)
{
void* slot = WTF::fastMalloc(sizeForImmutableStylePropertySetWithPropertyCount(count));
- return adoptRef(new (slot) ImmutableStylePropertySet(properties, count, cssParserMode));
+ return adoptRef(new (NotNull, slot) ImmutableStylePropertySet(properties, count, cssParserMode));
}
PassRefPtr<ImmutableStylePropertySet> StylePropertySet::immutableCopyIfNeeded() const
Modified: trunk/Source/WebCore/dom/Element.cpp (149528 => 149529)
--- trunk/Source/WebCore/dom/Element.cpp 2013-05-03 19:11:28 UTC (rev 149528)
+++ trunk/Source/WebCore/dom/Element.cpp 2013-05-03 19:31:15 UTC (rev 149529)
@@ -3010,7 +3010,7 @@
PassRefPtr<ShareableElementData> ShareableElementData::createWithAttributes(const Vector<Attribute>& attributes)
{
void* slot = WTF::fastMalloc(sizeForShareableElementDataWithAttributeCount(attributes.size()));
- return adoptRef(new (slot) ShareableElementData(attributes));
+ return adoptRef(new (NotNull, slot) ShareableElementData(attributes));
}
PassRefPtr<UniqueElementData> UniqueElementData::create()
@@ -3022,7 +3022,7 @@
: ElementData(attributes.size())
{
for (unsigned i = 0; i < m_arraySize; ++i)
- new (&m_attributeArray[i]) Attribute(attributes[i]);
+ new (NotNull, &m_attributeArray[i]) Attribute(attributes[i]);
}
ShareableElementData::~ShareableElementData()
@@ -3042,7 +3042,7 @@
}
for (unsigned i = 0; i < m_arraySize; ++i)
- new (&m_attributeArray[i]) Attribute(other.m_attributeVector.at(i));
+ new (NotNull, &m_attributeArray[i]) Attribute(other.m_attributeVector.at(i));
}
ElementData::ElementData(const ElementData& other, bool isUnique)
@@ -3093,7 +3093,7 @@
PassRefPtr<ShareableElementData> UniqueElementData::makeShareableCopy() const
{
void* slot = WTF::fastMalloc(sizeForShareableElementDataWithAttributeCount(m_attributeVector.size()));
- return adoptRef(new (slot) ShareableElementData(*this));
+ return adoptRef(new (NotNull, slot) ShareableElementData(*this));
}
void UniqueElementData::addAttribute(const QualifiedName& attributeName, const AtomicString& value)
Modified: trunk/Source/WebCore/dom/QualifiedName.cpp (149528 => 149529)
--- trunk/Source/WebCore/dom/QualifiedName.cpp 2013-05-03 19:11:28 UTC (rev 149528)
+++ trunk/Source/WebCore/dom/QualifiedName.cpp 2013-05-03 19:31:15 UTC (rev 149529)
@@ -131,7 +131,7 @@
// Use placement new to initialize the globals.
AtomicString::init();
- new ((void*)&anyName) QualifiedName(nullAtom, starAtom, starAtom);
+ new (NotNull, (void*)&anyName) QualifiedName(nullAtom, starAtom, starAtom);
initialized = true;
}
}
@@ -157,12 +157,12 @@
void createQualifiedName(void* targetAddress, StringImpl* name, const AtomicString& nameNamespace)
{
- new (reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom, AtomicString(name), nameNamespace);
+ new (NotNull, reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom, AtomicString(name), nameNamespace);
}
void createQualifiedName(void* targetAddress, StringImpl* name)
{
- new (reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom, AtomicString(name), nullAtom);
+ new (NotNull, reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom, AtomicString(name), nullAtom);
}
}
Modified: trunk/Source/WebCore/dom/make_names.pl (149528 => 149529)
--- trunk/Source/WebCore/dom/make_names.pl 2013-05-03 19:11:28 UTC (rev 149528)
+++ trunk/Source/WebCore/dom/make_names.pl 2013-05-03 19:31:15 UTC (rev 149529)
@@ -127,7 +127,7 @@
print F StaticString::GenerateStringAsserts(\%parameters);
while ( my ($name, $identifier) = each %parameters ) {
- print F " new ((void*)&$name) AtomicString(${name}Impl);\n";
+ print F " new (NotNull, (void*)&$name) AtomicString(${name}Impl);\n";
}
print F "}\n}\n}\n";
@@ -698,7 +698,7 @@
print(F " AtomicString ${lowerNamespace}NS(\"$parameters{namespaceURI}\", AtomicString::ConstructFromLiteral);\n\n");
print(F " // Namespace\n");
- print(F " new ((void*)&${lowerNamespace}NamespaceURI) AtomicString(${lowerNamespace}NS);\n");
+ print(F " new (NotNull, (void*)&${lowerNamespace}NamespaceURI) AtomicString(${lowerNamespace}NS);\n");
print(F "\n");
print F StaticString::GenerateStringAsserts(\%allStrings);
Modified: trunk/Source/WebCore/platform/ThreadGlobalData.h (149528 => 149529)
--- trunk/Source/WebCore/platform/ThreadGlobalData.h 2013-05-03 19:11:28 UTC (rev 149528)
+++ trunk/Source/WebCore/platform/ThreadGlobalData.h 2013-05-03 19:31:15 UTC (rev 149529)
@@ -118,7 +118,7 @@
if (!ThreadGlobalData::staticData) {
ThreadGlobalData::staticData = static_cast<ThreadGlobalData*>(fastMalloc(sizeof(ThreadGlobalData)));
// ThreadGlobalData constructor indirectly uses staticData, so we need to set up the memory before invoking it.
- new (ThreadGlobalData::staticData) ThreadGlobalData;
+ new (NotNull, ThreadGlobalData::staticData) ThreadGlobalData;
}
return *ThreadGlobalData::staticData;
#endif
Modified: trunk/Source/WebCore/platform/graphics/GlyphPage.h (149528 => 149529)
--- trunk/Source/WebCore/platform/graphics/GlyphPage.h 2013-05-03 19:11:28 UTC (rev 149528)
+++ trunk/Source/WebCore/platform/graphics/GlyphPage.h 2013-05-03 19:31:15 UTC (rev 149529)
@@ -71,7 +71,7 @@
static PassRefPtr<GlyphPage> createForMixedFontData(GlyphPageTreeNode* owner)
{
void* slot = fastMalloc(sizeof(GlyphPage) + sizeof(SimpleFontData*) * GlyphPage::size);
- return adoptRef(new (slot) GlyphPage(owner));
+ return adoptRef(new (NotNull, slot) GlyphPage(owner));
}
static PassRefPtr<GlyphPage> createForSingleFontData(GlyphPageTreeNode* owner, const SimpleFontData* fontData)