Title: [152595] trunk/Source/WTF
- Revision
- 152595
- Author
- mikhail.pozdnya...@intel.com
- Date
- 2013-07-12 09:40:07 -0700 (Fri, 12 Jul 2013)
Log Message
Improve StringImpl::constructInternal() method
https://bugs.webkit.org/show_bug.cgi?id=118503
Reviewed by Benjamin Poulain.
StringImpl::constructInternal used 'if ()' statement to decide which constructor
to invoke hence compiler had to compile both branches even though optimizer would
have then removed one of those, and as the function is inline it could affect
slightly the compilation time.
The problem is solved via template specialization.
* wtf/text/StringImpl.h:
(WTF::LChar):
(WTF::UChar):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (152594 => 152595)
--- trunk/Source/WTF/ChangeLog 2013-07-12 16:36:02 UTC (rev 152594)
+++ trunk/Source/WTF/ChangeLog 2013-07-12 16:40:07 UTC (rev 152595)
@@ -1,3 +1,21 @@
+2013-07-12 Mikhail Pozdnyakov <mikhail.pozdnya...@intel.com>
+
+ Improve StringImpl::constructInternal() method
+ https://bugs.webkit.org/show_bug.cgi?id=118503
+
+ Reviewed by Benjamin Poulain.
+
+ StringImpl::constructInternal used 'if ()' statement to decide which constructor
+ to invoke hence compiler had to compile both branches even though optimizer would
+ have then removed one of those, and as the function is inline it could affect
+ slightly the compilation time.
+
+ The problem is solved via template specialization.
+
+ * wtf/text/StringImpl.h:
+ (WTF::LChar):
+ (WTF::UChar):
+
2013-07-11 Patrick Gansterer <par...@webkit.org>
Remove unused Windows CE files
Modified: trunk/Source/WTF/wtf/text/StringImpl.h (152594 => 152595)
--- trunk/Source/WTF/wtf/text/StringImpl.h 2013-07-12 16:36:02 UTC (rev 152594)
+++ trunk/Source/WTF/wtf/text/StringImpl.h 2013-07-12 16:40:07 UTC (rev 152595)
@@ -850,13 +850,10 @@
};
#endif
-template <typename CharType>
-ALWAYS_INLINE PassRefPtr<StringImpl> StringImpl::constructInternal(StringImpl* impl, unsigned length)
-{
- if (sizeof(CharType) == sizeof(char))
- return adoptRef(new (NotNull, impl) StringImpl(length, Force8BitConstructor));
- return adoptRef(new (NotNull, impl) StringImpl(length));
-}
+template <>
+ALWAYS_INLINE PassRefPtr<StringImpl> StringImpl::constructInternal<LChar>(StringImpl* impl, unsigned length) { return adoptRef(new (NotNull, impl) StringImpl(length, Force8BitConstructor)); }
+template <>
+ALWAYS_INLINE PassRefPtr<StringImpl> StringImpl::constructInternal<UChar>(StringImpl* impl, unsigned length) { return adoptRef(new (NotNull, impl) StringImpl(length)); }
template <>
ALWAYS_INLINE const LChar* StringImpl::getCharacters<LChar>() const { return characters8(); }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes