https://bugs.webkit.org/show_bug.cgi?id=166586
Reviewed by Darin Adler.
Source/WebCore:
* bindings/scripts/StaticString.pm:
(GenerateStrings):
Source/WTF:
It is more handy way to define static StringImpl. It calculates the length
and hash value by using the constexpr constructor and function. So we do
not need to calculate these things in Perl script.
And it allows us to use StaticStringImpl in the hand written C++ code.
Previously, we need to calculate the length and hash value by hand if we
would like to use StaticASCIILiteral in the hand written C++ code, and it
meant that we cannot use it at all in the hand written C++ code.
* wtf/text/AtomicStringImpl.cpp:
(WTF::AtomicStringImpl::addSlowCase):
(WTF::AtomicStringImpl::lookUpSlowCase):
* wtf/text/AtomicStringImpl.h:
* wtf/text/StringImpl.h:
* wtf/text/SymbolImpl.h:
* wtf/text/UniquedStringImpl.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210227
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-01-02 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Use StaticStringImpl instead of StaticASCIILiteral
+ https://bugs.webkit.org/show_bug.cgi?id=166586
+
+ Reviewed by Darin Adler.
+
+ It is more handy way to define static StringImpl. It calculates the length
+ and hash value by using the constexpr constructor and function. So we do
+ not need to calculate these things in Perl script.
+ And it allows us to use StaticStringImpl in the hand written C++ code.
+ Previously, we need to calculate the length and hash value by hand if we
+ would like to use StaticASCIILiteral in the hand written C++ code, and it
+ meant that we cannot use it at all in the hand written C++ code.
+
+ * wtf/text/AtomicStringImpl.cpp:
+ (WTF::AtomicStringImpl::addSlowCase):
+ (WTF::AtomicStringImpl::lookUpSlowCase):
+ * wtf/text/AtomicStringImpl.h:
+ * wtf/text/StringImpl.h:
+ * wtf/text/SymbolImpl.h:
+ * wtf/text/UniquedStringImpl.h:
+
2017-01-02 Andreas Kling <akling@apple.com>
Discard media controls JS/CSS caches under memory pressure.
if (!string.length())
return *static_cast<AtomicStringImpl*>(StringImpl::empty());
- if (string.isSymbol()) {
+ if (string.isSymbol() || string.isStatic()) {
if (string.is8Bit())
return *add(string.characters8(), string.length());
return *add(string.characters16(), string.length());
if (!string.length())
return *static_cast<AtomicStringImpl*>(StringImpl::empty());
- if (string.isSymbol()) {
+ if (string.isSymbol() || string.isStatic()) {
if (string.is8Bit())
return *add(string.characters8(), string.length());
return *add(string.characters16(), string.length());
if (!string.length())
return static_cast<AtomicStringImpl*>(StringImpl::empty());
- if (string.isSymbol()) {
+ if (string.isSymbol() || string.isStatic()) {
if (string.is8Bit())
return lookUpInternal(string.characters8(), string.length());
return lookUpInternal(string.characters16(), string.length());
};
#if !ASSERT_DISABLED
-// AtomicStringImpls created from StaticASCIILiteral will ASSERT
+// AtomicStringImpls created from StaticStringImpl will ASSERT
// in the generic ValueCheck<T>::checkConsistency
// as they are not allocated by fastMalloc.
// We don't currently have any way to detect that case
#endif
public:
- // FIXME: It should be replaced with StaticStringImpl.
- // https://bugs.webkit.org/show_bug.cgi?id=165134
- struct StaticASCIILiteral {
- // These member variables must match the layout of StringImpl.
- unsigned m_refCount;
- unsigned m_length;
- const LChar* m_data8;
- unsigned m_hashAndFlags;
-
- // These values mimic ConstructFromLiteral.
- static const unsigned s_initialRefCount = s_refCountIncrement;
- static const unsigned s_initialFlags = s_hashFlag8BitBuffer | StringNormal | BufferInternal;
- static const unsigned s_hashShift = s_flagCount;
- };
-
#ifndef NDEBUG
void assertHashIsCorrect()
{
#endif
private:
- // These member variables must match the layout of StaticASCIILiteral and StaticStringImpl.
+ // These member variables must match the layout of StaticStringImpl.
unsigned m_refCount;
unsigned m_length;
union {
mutable unsigned m_hashAndFlags;
};
-static_assert(sizeof(StringImpl) == sizeof(StringImpl::StaticASCIILiteral), "");
static_assert(sizeof(StringImpl) == sizeof(StringImpl::StaticStringImpl), "");
#if !ASSERT_DISABLED
-// StringImpls created from StaticASCIILiteral will ASSERT
+// StringImpls created from StaticStringImpl will ASSERT
// in the generic ValueCheck<T>::checkConsistency
// as they are not allocated by fastMalloc.
// We don't currently have any way to detect that case
}
#if !ASSERT_DISABLED
-// SymbolImpls created from StaticASCIILiteral will ASSERT
+// SymbolImpls created from StaticStringImpl will ASSERT
// in the generic ValueCheck<T>::checkConsistency
// as they are not allocated by fastMalloc.
// We don't currently have any way to detect that case
};
#if !ASSERT_DISABLED
-// UniquedStringImpls created from StaticASCIILiteral will ASSERT
+// UniquedStringImpls created from StaticStringImpl will ASSERT
// in the generic ValueCheck<T>::checkConsistency
// as they are not allocated by fastMalloc.
// We don't currently have any way to detect that case
+2017-01-02 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Use StaticStringImpl instead of StaticASCIILiteral
+ https://bugs.webkit.org/show_bug.cgi?id=166586
+
+ Reviewed by Darin Adler.
+
+ * bindings/scripts/StaticString.pm:
+ (GenerateStrings):
+
2017-01-02 Andreas Kling <akling@apple.com>
Drop the render tree for documents in the page cache.
my @result = ();
- for my $name (sort keys %strings) {
- push(@result, "static const LChar ${name}String8[] = \"$strings{$name}\";\n");
- }
+ push(@result, <<END);
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable: 4307)
+#endif
+END
push(@result, "\n");
for my $name (sort keys %strings) {
my $value = $strings{$name};
- my $length = length($value);
- my $hash = Hasher::GenerateHashValue($value);
- push(@result, <<END);
-static StringImpl::StaticASCIILiteral ${name}Data = {
- StringImpl::StaticASCIILiteral::s_initialRefCount,
- $length,
- ${name}String8,
- StringImpl::StaticASCIILiteral::s_initialFlags | (${hash} << StringImpl::StaticASCIILiteral::s_hashShift)
-};
-END
+ push(@result, "static StringImpl::StaticStringImpl ${name}Data(\"${value}\");\n");
}
push(@result, "\n");
+ push(@result, <<END);
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+END
+
return join "", @result;
}