#define JSGlobalData_h
#include "CachedTranscendentalFunction.h"
-#include "Collector.h"
+#include "Heap.h"
#include "DateInstanceCache.h"
#include "ExecutableAllocator.h"
+#include "Strong.h"
#include "JITStubs.h"
#include "JSValue.h"
-#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>
+#include <wtf/WTFThreadData.h>
+#if ENABLE(REGEXP_TRACING)
+#include <wtf/ListHashSet.h>
+#endif
struct OpaqueJSClass;
struct OpaqueJSClassContextData;
class CodeBlock;
class CommonIdentifiers;
+ class HandleStack;
class IdentifierTable;
class Interpreter;
class JSGlobalObject;
class JSObject;
class Lexer;
+ class NativeExecutable;
class Parser;
class RegExpCache;
class Stringifier;
class Structure;
class UString;
+#if ENABLE(REGEXP_TRACING)
+ class RegExp;
+#endif
struct HashTable;
- struct Instruction;
+ struct Instruction;
struct DSTOffsetCache {
DSTOffsetCache()
};
bool isSharedInstance() { return globalDataType == APIShared; }
+ bool usingAPI() { return globalDataType != Default; }
static bool sharedInstanceExists();
static JSGlobalData& sharedInstance();
#if ENABLE(JSC_MULTIPLE_THREADS)
// Will start tracking threads that use the heap, which is resource-heavy.
- void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThreads(); }
+ void makeUsableFromMultipleThreads() { heap.machineThreads().makeUsableFromMultipleThreads(); }
#endif
GlobalDataType globalDataType;
ClientData* clientData;
- const HashTable* arrayTable;
+ const HashTable* arrayConstructorTable;
+ const HashTable* arrayPrototypeTable;
+ const HashTable* booleanPrototypeTable;
const HashTable* dateTable;
+ const HashTable* dateConstructorTable;
+ const HashTable* errorPrototypeTable;
+ const HashTable* globalObjectTable;
const HashTable* jsonTable;
const HashTable* mathTable;
- const HashTable* numberTable;
+ const HashTable* numberConstructorTable;
+ const HashTable* numberPrototypeTable;
+ const HashTable* objectConstructorTable;
+ const HashTable* objectPrototypeTable;
const HashTable* regExpTable;
const HashTable* regExpConstructorTable;
+ const HashTable* regExpPrototypeTable;
const HashTable* stringTable;
+ const HashTable* stringConstructorTable;
- RefPtr<Structure> activationStructure;
- RefPtr<Structure> interruptedExecutionErrorStructure;
- RefPtr<Structure> terminatedExecutionErrorStructure;
- RefPtr<Structure> staticScopeStructure;
- 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;
+ Strong<Structure> structureStructure;
+ Strong<Structure> debuggerActivationStructure;
+ Strong<Structure> activationStructure;
+ Strong<Structure> interruptedExecutionErrorStructure;
+ Strong<Structure> terminatedExecutionErrorStructure;
+ Strong<Structure> staticScopeStructure;
+ Strong<Structure> strictEvalActivationStructure;
+ Strong<Structure> stringStructure;
+ Strong<Structure> notAnObjectStructure;
+ Strong<Structure> propertyNameIteratorStructure;
+ Strong<Structure> getterSetterStructure;
+ Strong<Structure> apiWrapperStructure;
+ Strong<Structure> scopeChainNodeStructure;
+ Strong<Structure> executableStructure;
+ Strong<Structure> nativeExecutableStructure;
+ Strong<Structure> evalExecutableStructure;
+ Strong<Structure> programExecutableStructure;
+ Strong<Structure> functionExecutableStructure;
+ Strong<Structure> dummyMarkableCellStructure;
+ Strong<Structure> regExpStructure;
+ Strong<Structure> structureChainStructure;
+
+#if ENABLE(JSC_ZOMBIES)
+ Strong<Structure> zombieStructure;
#endif
static void storeVPtrs();
#if ENABLE(ASSEMBLER)
ExecutableAllocator executableAllocator;
+ ExecutableAllocator regexAllocator;
#endif
-#if ENABLE(JIT)
-#if ENABLE(INTERPRETER)
- bool canUseJIT() { return m_canUseJIT; }
-#endif
+#if !ENABLE(JIT)
+ bool canUseJIT() { return false; } // interpreter only
+#elif !ENABLE(INTERPRETER)
+ bool canUseJIT() { return true; } // jit only
#else
- bool canUseJIT() { return false; }
+ bool canUseJIT() { return m_canUseJIT; }
#endif
+
+ const StackBounds& stack()
+ {
+ return wtfThreadData().stack();
+ }
+
Lexer* lexer;
Parser* parser;
Interpreter* interpreter;
#if ENABLE(JIT)
OwnPtr<JITThunks> jitStubs;
- NativeExecutable* getThunk(ThunkGenerator generator)
+ MacroAssemblerCodePtr getCTIStub(ThunkGenerator generator)
{
- return jitStubs->specializedThunk(this, generator);
+ return jitStubs->ctiStub(this, generator);
}
+ NativeExecutable* getHostFunction(NativeFunction, ThunkGenerator);
#endif
+ NativeExecutable* getHostFunction(NativeFunction);
+
TimeoutChecker timeoutChecker;
Terminator terminator;
Heap heap;
ReturnAddressPtr exceptionLocation;
#endif
- const Vector<Instruction>& numericCompareFunction(ExecState*);
- Vector<Instruction> lazyNumericCompareFunction;
- bool initializingLazyNumericCompareFunction;
-
HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
- JSGlobalObject* head;
+ unsigned globalObjectCount;
JSGlobalObject* dynamicGlobalObject;
- HashSet<JSObject*> arrayVisitedElements;
-
- CodeBlock* functionCodeBlockBeingReparsed;
- Stringifier* firstStringifierToMark;
-
- MarkStack markStack;
+ HashSet<JSObject*> stringRecursionCheckVisitedObjects;
double cachedUTCOffset;
DSTOffsetCache dstOffsetCache;
int maxReentryDepth;
RegExpCache* m_regExpCache;
+ BumpPointerAllocator m_regExpAllocator;
+
+#if ENABLE(REGEXP_TRACING)
+ typedef ListHashSet<RefPtr<RegExp> > RTTraceList;
+ RTTraceList* m_rtTraceList;
+#endif
#ifndef NDEBUG
ThreadIdentifier exclusiveThread;
void startSampling();
void stopSampling();
void dumpSampleData(ExecState* exec);
+ void recompileAllJSFunctions();
RegExpCache* regExpCache() { return m_regExpCache; }
+#if ENABLE(REGEXP_TRACING)
+ void addRegExpToTrace(PassRefPtr<RegExp> regExp);
+#endif
+ void dumpRegExpTrace();
+ HandleSlot allocateGlobalHandle() { return heap.allocateGlobalHandle(); }
+ HandleSlot allocateLocalHandle() { return heap.allocateLocalHandle(); }
+ void clearBuiltinStructures();
+
+ bool isCollectorBusy() { return heap.isBusy(); }
+ void releaseExecutableMemory();
+
private:
JSGlobalData(GlobalDataType, ThreadStackType);
static JSGlobalData*& sharedInstanceInternal();
#if ENABLE(JIT) && ENABLE(INTERPRETER)
bool m_canUseJIT;
#endif
+ StackBounds m_stack;
};
+ inline HandleSlot allocateGlobalHandle(JSGlobalData& globalData)
+ {
+ return globalData.allocateGlobalHandle();
+ }
+
} // namespace JSC
#endif // JSGlobalData_h