summaryrefslogtreecommitdiffstats
path: root/Source/JavaScriptCore/wtf/text/StringImplBase.h
diff options
context:
space:
mode:
authorNaiem Shaik <snaiem@codeaurora.org>2012-07-19 10:45:56 -0700
committerSteve Kondik <shade@chemlab.org>2013-01-20 18:38:33 -0800
commit0f5d4355d7a384679722338d55f65bbb92350cfc (patch)
treedf4a638aa4e81152ee68f0d523ed706128a251ff /Source/JavaScriptCore/wtf/text/StringImplBase.h
parent8f6cf525ead3381029545c1d292c8586ec45ddb0 (diff)
downloadexternal_webkit-0f5d4355d7a384679722338d55f65bbb92350cfc.zip
external_webkit-0f5d4355d7a384679722338d55f65bbb92350cfc.tar.gz
external_webkit-0f5d4355d7a384679722338d55f65bbb92350cfc.tar.bz2
DOM Optimizations
DOM traversal optimizations DOM Core optimizations Prefetch optimization for DOM Tree Traversal Conflicts: Source/WebKit/android/jni/WebViewCore.cpp Change-Id: Icbb8a7229ee9cff1a5401b57c8181f18b9a6d6e0
Diffstat (limited to 'Source/JavaScriptCore/wtf/text/StringImplBase.h')
-rw-r--r--Source/JavaScriptCore/wtf/text/StringImplBase.h55
1 files changed, 34 insertions, 21 deletions
diff --git a/Source/JavaScriptCore/wtf/text/StringImplBase.h b/Source/JavaScriptCore/wtf/text/StringImplBase.h
index 26bc1d9..b6a7210 100644
--- a/Source/JavaScriptCore/wtf/text/StringImplBase.h
+++ b/Source/JavaScriptCore/wtf/text/StringImplBase.h
@@ -33,9 +33,9 @@ namespace WTF {
class StringImplBase {
WTF_MAKE_NONCOPYABLE(StringImplBase); WTF_MAKE_FAST_ALLOCATED;
public:
- bool isStringImpl() { return (m_refCountAndFlags & s_refCountInvalidForStringImpl) != s_refCountInvalidForStringImpl; }
+ bool isStringImpl() { return !(m_static && m_shouldReportCost); }
unsigned length() const { return m_length; }
- void ref() { m_refCountAndFlags += s_refCountIncrement; }
+ void ref() { ++m_refCount; }
protected:
enum BufferOwnership {
@@ -49,7 +49,14 @@ protected:
StringImplBase() { }
StringImplBase(unsigned length, BufferOwnership ownership)
- : m_refCountAndFlags(s_refCountIncrement | s_refCountFlagShouldReportedCost | ownership)
+ : m_lower(false)
+ , m_hasTerminatingNullCharacter(false)
+ , m_atomic(false)
+ , m_static(false)
+ , m_shouldReportCost(true)
+ , m_identifier(false)
+ , m_bufferOwnership(ownership)
+ , m_refCount(1)
, m_length(length)
{
ASSERT(isStringImpl());
@@ -57,7 +64,14 @@ protected:
enum StaticStringConstructType { ConstructStaticString };
StringImplBase(unsigned length, StaticStringConstructType)
- : m_refCountAndFlags(s_refCountFlagStatic | s_refCountFlagIsIdentifier | BufferOwned)
+ : m_lower(false)
+ , m_hasTerminatingNullCharacter(false)
+ , m_atomic(false)
+ , m_static(true)
+ , m_shouldReportCost(false)
+ , m_identifier(true)
+ , m_bufferOwnership(BufferOwned)
+ , m_refCount(0)
, m_length(length)
{
ASSERT(isStringImpl());
@@ -67,29 +81,28 @@ protected:
// and sets the flags into a state marking the object as such.
enum NonStringImplConstructType { ConstructNonStringImpl };
StringImplBase(NonStringImplConstructType)
- : m_refCountAndFlags(s_refCountIncrement | s_refCountInvalidForStringImpl)
+ : m_lower(false)
+ , m_hasTerminatingNullCharacter(false)
+ , m_atomic(false)
+ , m_static(true)
+ , m_shouldReportCost(true)
+ , m_identifier(false)
+ , m_bufferOwnership(0)
+ , m_refCount(1)
, m_length(0)
{
ASSERT(!isStringImpl());
}
- // The bottom 7 bits hold flags, the top 25 bits hold the ref count.
- // When dereferencing StringImpls we check for the ref count AND the
- // static bit both being zero - static strings are never deleted.
- static const unsigned s_refCountMask = 0xFFFFFF80;
- static const unsigned s_refCountIncrement = 0x80;
- static const unsigned s_refCountFlagStatic = 0x40;
- static const unsigned s_refCountFlagHasTerminatingNullCharacter = 0x20;
- static const unsigned s_refCountFlagIsAtomic = 0x10;
- static const unsigned s_refCountFlagShouldReportedCost = 0x8;
- static const unsigned s_refCountFlagIsIdentifier = 0x4;
- static const unsigned s_refCountMaskBufferOwnership = 0x3;
- // An invalid permutation of flags (static & shouldReportedCost - static strings do not
- // set shouldReportedCost in the constructor, and this bit is only ever cleared, not set).
- // Used by "ConstructNonStringImpl" constructor, above.
- static const unsigned s_refCountInvalidForStringImpl = s_refCountFlagStatic | s_refCountFlagShouldReportedCost;
+ bool m_lower : 1;
+ bool m_hasTerminatingNullCharacter : 1;
+ bool m_atomic : 1;
+ bool m_static : 1;
+ bool m_shouldReportCost : 1;
+ bool m_identifier : 1;
+ unsigned m_bufferOwnership : 2;
+ unsigned m_refCount : 24;
- unsigned m_refCountAndFlags;
unsigned m_length;
};