diff options
Diffstat (limited to 'JavaScriptCore/runtime/JSGlobalData.h')
| -rw-r--r-- | JavaScriptCore/runtime/JSGlobalData.h | 93 |
1 files changed, 73 insertions, 20 deletions
diff --git a/JavaScriptCore/runtime/JSGlobalData.h b/JavaScriptCore/runtime/JSGlobalData.h index 0f1f3c6..1819a0c 100644 --- a/JavaScriptCore/runtime/JSGlobalData.h +++ b/JavaScriptCore/runtime/JSGlobalData.h @@ -29,6 +29,7 @@ #ifndef JSGlobalData_h #define JSGlobalData_h +#include "CachedTranscendentalFunction.h" #include "Collector.h" #include "DateInstanceCache.h" #include "ExecutableAllocator.h" @@ -37,11 +38,17 @@ #include "MarkStack.h" #include "NumericStrings.h" #include "SmallStrings.h" +#include "Terminator.h" #include "TimeoutChecker.h" #include "WeakRandom.h" +#include <wtf/BumpPointerAllocator.h> #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/RefCounted.h> +#include <wtf/ThreadSpecific.h> +#if ENABLE(REGEXP_TRACING) +#include <wtf/ListHashSet.h> +#endif struct OpaqueJSClass; struct OpaqueJSClassContextData; @@ -56,9 +63,13 @@ namespace JSC { class JSObject; class Lexer; class Parser; + class RegExpCache; class Stringifier; class Structure; class UString; +#if ENABLE(REGEXP_TRACING) + class RegExp; +#endif struct HashTable; struct Instruction; @@ -83,18 +94,35 @@ namespace JSC { double increment; }; + enum ThreadStackType { + ThreadStackTypeLarge, + ThreadStackTypeSmall + }; + class JSGlobalData : public RefCounted<JSGlobalData> { public: + // WebCore has a one-to-one mapping of threads to JSGlobalDatas; + // either create() or createLeaked() should only be called once + // on a thread, this is the 'default' JSGlobalData (it uses the + // thread's default string uniquing table from wtfThreadData). + // API contexts created using the new context group aware interface + // create APIContextGroup objects which require less locking of JSC + // than the old singleton APIShared JSGlobalData created for use by + // the original API. + enum GlobalDataType { Default, APIContextGroup, APIShared }; + struct ClientData { virtual ~ClientData() = 0; }; + bool isSharedInstance() { return globalDataType == APIShared; } + bool usingAPI() { return globalDataType != Default; } static bool sharedInstanceExists(); static JSGlobalData& sharedInstance(); - static PassRefPtr<JSGlobalData> create(); - static PassRefPtr<JSGlobalData> createLeaked(); - static PassRefPtr<JSGlobalData> createNonDefault(); + static PassRefPtr<JSGlobalData> create(ThreadStackType); + static PassRefPtr<JSGlobalData> createLeaked(ThreadStackType); + static PassRefPtr<JSGlobalData> createContextGroup(ThreadStackType); ~JSGlobalData(); #if ENABLE(JSC_MULTIPLE_THREADS) @@ -102,7 +130,7 @@ namespace JSC { void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThreads(); } #endif - bool isSharedInstance; + GlobalDataType globalDataType; ClientData* clientData; const HashTable* arrayTable; @@ -116,19 +144,16 @@ namespace JSC { RefPtr<Structure> activationStructure; RefPtr<Structure> interruptedExecutionErrorStructure; + RefPtr<Structure> terminatedExecutionErrorStructure; RefPtr<Structure> staticScopeStructure; + RefPtr<Structure> strictEvalActivationStructure; RefPtr<Structure> stringStructure; - RefPtr<Structure> notAnObjectErrorStubStructure; RefPtr<Structure> notAnObjectStructure; RefPtr<Structure> propertyNameIteratorStructure; RefPtr<Structure> getterSetterStructure; RefPtr<Structure> apiWrapperStructure; RefPtr<Structure> dummyMarkableCellStructure; -#if USE(JSVALUE32) - RefPtr<Structure> numberStructure; -#endif - static void storeVPtrs(); static JS_EXPORTDATA void* jsArrayVPtr; static JS_EXPORTDATA void* jsByteArrayVPtr; @@ -146,13 +171,27 @@ namespace JSC { ExecutableAllocator executableAllocator; #endif +#if !ENABLE(JIT) + bool canUseJIT() { return false; } // interpreter only +#elif !ENABLE(INTERPRETER) + bool canUseJIT() { return true; } // jit only +#else + bool canUseJIT() { return m_canUseJIT; } +#endif Lexer* lexer; Parser* parser; Interpreter* interpreter; #if ENABLE(JIT) - JITThunks jitStubs; + OwnPtr<JITThunks> jitStubs; + MacroAssemblerCodePtr getCTIStub(ThunkGenerator generator) + { + return jitStubs->ctiStub(this, generator); + } + PassRefPtr<NativeExecutable> getHostFunction(NativeFunction function); + PassRefPtr<NativeExecutable> getHostFunction(NativeFunction function, ThunkGenerator generator); #endif TimeoutChecker timeoutChecker; + Terminator terminator; Heap heap; JSValue exception; @@ -160,10 +199,6 @@ namespace JSC { ReturnAddressPtr exceptionLocation; #endif - const Vector<Instruction>& numericCompareFunction(ExecState*); - Vector<Instruction> lazyNumericCompareFunction; - bool initializingLazyNumericCompareFunction; - HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData; JSGlobalObject* head; @@ -171,7 +206,6 @@ namespace JSC { HashSet<JSObject*> arrayVisitedElements; - CodeBlock* functionCodeBlockBeingReparsed; Stringifier* firstStringifierToMark; MarkStack markStack; @@ -181,24 +215,43 @@ namespace JSC { UString cachedDateString; double cachedDateStringValue; - - WeakRandom weakRandom; + + int maxReentryDepth; + + RegExpCache* m_regExpCache; + + BumpPointerAllocator m_regexAllocator; + +#if ENABLE(REGEXP_TRACING) + typedef ListHashSet<RefPtr<RegExp> > RTTraceList; + RTTraceList* m_rtTraceList; +#endif #ifndef NDEBUG - bool mainThreadOnly; + ThreadIdentifier exclusiveThread; #endif + CachedTranscendentalFunction<sin> cachedSin; + void resetDateCache(); void startSampling(); void stopSampling(); void dumpSampleData(ExecState* exec); + RegExpCache* regExpCache() { return m_regExpCache; } +#if ENABLE(REGEXP_TRACING) + void addRegExpToTrace(PassRefPtr<RegExp> regExp); +#endif + void dumpRegExpTrace(); private: - JSGlobalData(bool isShared); + JSGlobalData(GlobalDataType, ThreadStackType); static JSGlobalData*& sharedInstanceInternal(); void createNativeThunk(); +#if ENABLE(JIT) && ENABLE(INTERPRETER) + bool m_canUseJIT; +#endif }; - + } // namespace JSC #endif // JSGlobalData_h |
