diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSGlobalData.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/JSGlobalData.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h index f8833104a..90925778b 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalData.h +++ b/Source/JavaScriptCore/runtime/JSGlobalData.h @@ -35,6 +35,7 @@ #include "Heap.h" #include "Intrinsic.h" #include "JITStubs.h" +#include "JSLock.h" #include "JSValue.h" #include "LLIntData.h" #include "NumericStrings.h" @@ -46,8 +47,8 @@ #include <wtf/BumpPointerAllocator.h> #include <wtf/Forward.h> #include <wtf/HashMap.h> -#include <wtf/RefCounted.h> #include <wtf/SimpleStats.h> +#include <wtf/ThreadSafeRefCounted.h> #include <wtf/ThreadSpecific.h> #include <wtf/WTFThreadData.h> #if ENABLE(REGEXP_TRACING) @@ -152,7 +153,7 @@ namespace JSC { }; #endif - class JSGlobalData : public RefCounted<JSGlobalData> { + class JSGlobalData : public ThreadSafeRefCounted<JSGlobalData> { public: // WebCore has a one-to-one mapping of threads to JSGlobalDatas; // either create() or createLeaked() should only be called once @@ -180,6 +181,10 @@ namespace JSC { void makeUsableFromMultipleThreads() { heap.machineThreads().makeUsableFromMultipleThreads(); } + private: + JSLock m_apiLock; + + public: Heap heap; // The heap is our first data member to ensure that it's destructed after all the objects that reference it. GlobalDataType globalDataType; @@ -390,6 +395,13 @@ namespace JSC { unsigned m_timeoutCount; #endif + unsigned m_newStringsSinceLastHashConst; + + static const unsigned s_minNumberOfNewStringsToHashConst = 100; + + bool haveEnoughNewStringsToHashConst() { return m_newStringsSinceLastHashConst > s_minNumberOfNewStringsToHashConst; } + void resetNewStringsSinceLastHashConst() { m_newStringsSinceLastHashConst = 0; } + #define registerTypedArrayFunction(type, capitalizedType) \ void registerTypedArrayDescriptor(const capitalizedType##Array*, const TypedArrayDescriptor& descriptor) \ { \ @@ -409,6 +421,8 @@ namespace JSC { registerTypedArrayFunction(float64, Float64); #undef registerTypedArrayFunction + JSLock& apiLock() { return m_apiLock; } + private: friend class LLIntOffsetsExtractor; |