JSGlobalData::JSGlobalData(bool isShared) : machine(new Machine) , heap(new Heap(this)) #if ENABLE(JSC_MULTIPLE_THREADS) , arrayTable(new HashTable(JSC::arrayTable)) , dateTable(new HashTable(JSC::dateTable)) , mathTable(new HashTable(JSC::mathTable)) , numberTable(new HashTable(JSC::numberTable)) , regExpTable(new HashTable(JSC::regExpTable)) , regExpConstructorTable(new HashTable(JSC::regExpConstructorTable)) , stringTable(new HashTable(JSC::stringTable)) #else , arrayTable(&JSC::arrayTable) , dateTable(&JSC::dateTable) , mathTable(&JSC::mathTable) , numberTable(&JSC::numberTable) , regExpTable(&JSC::regExpTable) , regExpConstructorTable(&JSC::regExpConstructorTable) , stringTable(&JSC::stringTable) #endif , nullProtoStructureID(StructureID::create(jsNull())) , stringStructureID(StructureID::create(jsNull(), StringType)) , numberStructureID(StructureID::create(jsNull(), NumberType)) , identifierTable(createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , emptyList(new ArgList) , opaqueJSClassData(new HashMap<OpaqueJSClass*, OpaqueJSClassContextData*>) , newParserObjects(0) , parserObjectExtraRefCounts(0) , lexer(new Lexer(this)) , parser(new Parser) , head(0) , isSharedInstance(isShared) { }
JSGlobalData::JSGlobalData() : machine(new Machine) , heap(new Heap(machine)) #if USE(MULTIPLE_THREADS) , arrayTable(new HashTable(KJS::arrayTable)) , dateTable(new HashTable(KJS::dateTable)) , mathTable(new HashTable(KJS::mathTable)) , numberTable(new HashTable(KJS::numberTable)) , regExpTable(new HashTable(KJS::regExpTable)) , regExpConstructorTable(new HashTable(KJS::regExpConstructorTable)) , stringTable(new HashTable(KJS::stringTable)) #else , arrayTable(&KJS::arrayTable) , dateTable(&KJS::dateTable) , mathTable(&KJS::mathTable) , numberTable(&KJS::numberTable) , regExpTable(&KJS::regExpTable) , regExpConstructorTable(&KJS::regExpConstructorTable) , stringTable(&KJS::stringTable) #endif , identifierTable(createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , newParserObjects(0) , parserObjectExtraRefCounts(0) , lexer(new Lexer(this)) , parser(new Parser) , head(0) { }
JSGlobalData::JSGlobalData(bool isShared, const VPtrSet& vptrSet) : isSharedInstance(isShared) , clientData(0) , arrayTable(fastNew<HashTable>(JSC::arrayTable)) , dateTable(fastNew<HashTable>(JSC::dateTable)) , jsonTable(fastNew<HashTable>(JSC::jsonTable)) , mathTable(fastNew<HashTable>(JSC::mathTable)) , numberTable(fastNew<HashTable>(JSC::numberTable)) , regExpTable(fastNew<HashTable>(JSC::regExpTable)) , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable)) , stringTable(fastNew<HashTable>(JSC::stringTable)) , activationStructure(JSActivation::createStructure(jsNull())) , interruptedExecutionErrorStructure(JSObject::createStructure(jsNull())) , staticScopeStructure(JSStaticScopeObject::createStructure(jsNull())) , stringStructure(JSString::createStructure(jsNull())) , notAnObjectErrorStubStructure(JSNotAnObjectErrorStub::createStructure(jsNull())) , notAnObjectStructure(JSNotAnObject::createStructure(jsNull())) , propertyNameIteratorStructure(JSPropertyNameIterator::createStructure(jsNull())) , getterSetterStructure(GetterSetter::createStructure(jsNull())) , apiWrapperStructure(JSAPIValueWrapper::createStructure(jsNull())) #if USE(JSVALUE32) , numberStructure(JSNumberCell::createStructure(jsNull())) #endif , jsArrayVPtr(vptrSet.jsArrayVPtr) , jsByteArrayVPtr(vptrSet.jsByteArrayVPtr) , jsStringVPtr(vptrSet.jsStringVPtr) , jsFunctionVPtr(vptrSet.jsFunctionVPtr) , identifierTable(createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , emptyList(new MarkedArgumentBuffer) , lexer(new Lexer(this)) , parser(new Parser) , interpreter(new Interpreter) #if ENABLE(JIT) , jitStubs(this) #endif , timeoutChecker(new TimeoutChecker) , heap(this) , initializingLazyNumericCompareFunction(false) , head(0) , dynamicGlobalObject(0) , functionCodeBlockBeingReparsed(0) , firstStringifierToMark(0) , markStack(vptrSet.jsArrayVPtr) #ifndef NDEBUG , mainThreadOnly(false) #endif { #if PLATFORM(MAC) startProfilerServerIfNeeded(); #endif }
JSGlobalData::JSGlobalData(bool isShared) : isSharedInstance(isShared) , clientData(0) , arrayTable(fastNew<HashTable>(JSC::arrayTable)) , dateTable(fastNew<HashTable>(JSC::dateTable)) , jsonTable(fastNew<HashTable>(JSC::jsonTable)) , mathTable(fastNew<HashTable>(JSC::mathTable)) , numberTable(fastNew<HashTable>(JSC::numberTable)) , regExpTable(fastNew<HashTable>(JSC::regExpTable)) , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable)) , stringTable(fastNew<HashTable>(JSC::stringTable)) , activationStructure(JSActivation::createStructure(jsNull())) , interruptedExecutionErrorStructure(JSObject::createStructure(jsNull())) , staticScopeStructure(JSStaticScopeObject::createStructure(jsNull())) , stringStructure(JSString::createStructure(jsNull())) , notAnObjectErrorStubStructure(JSNotAnObjectErrorStub::createStructure(jsNull())) , notAnObjectStructure(JSNotAnObject::createStructure(jsNull())) , propertyNameIteratorStructure(JSPropertyNameIterator::createStructure(jsNull())) , getterSetterStructure(GetterSetter::createStructure(jsNull())) , apiWrapperStructure(JSAPIValueWrapper::createStructure(jsNull())) , dummyMarkableCellStructure(JSCell::createDummyStructure()) #if USE(JSVALUE32) , numberStructure(JSNumberCell::createStructure(jsNull())) #endif , identifierTable(createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , emptyList(new MarkedArgumentBuffer) , lexer(new Lexer(this)) , parser(new Parser) , interpreter(new Interpreter) , timeoutChecker(new TimeoutChecker) , heap(this) , initializingLazyNumericCompareFunction(false) , head(0) , dynamicGlobalObject(0) , functionCodeBlockBeingReparsed(0) , firstStringifierToMark(0) , markStack(jsArrayVPtr) { }
JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType, HeapType heapType) : heap(this, heapType) , globalDataType(globalDataType) , clientData(0) , topCallFrame(CallFrame::noCaller()) , arrayConstructorTable(fastNew<HashTable>(JSC::arrayConstructorTable)) , arrayPrototypeTable(fastNew<HashTable>(JSC::arrayPrototypeTable)) , booleanPrototypeTable(fastNew<HashTable>(JSC::booleanPrototypeTable)) , dateTable(fastNew<HashTable>(JSC::dateTable)) , dateConstructorTable(fastNew<HashTable>(JSC::dateConstructorTable)) , errorPrototypeTable(fastNew<HashTable>(JSC::errorPrototypeTable)) , globalObjectTable(fastNew<HashTable>(JSC::globalObjectTable)) , jsonTable(fastNew<HashTable>(JSC::jsonTable)) , mathTable(fastNew<HashTable>(JSC::mathTable)) , numberConstructorTable(fastNew<HashTable>(JSC::numberConstructorTable)) , numberPrototypeTable(fastNew<HashTable>(JSC::numberPrototypeTable)) , objectConstructorTable(fastNew<HashTable>(JSC::objectConstructorTable)) , objectPrototypeTable(fastNew<HashTable>(JSC::objectPrototypeTable)) , privateNamePrototypeTable(fastNew<HashTable>(JSC::privateNamePrototypeTable)) , regExpTable(fastNew<HashTable>(JSC::regExpTable)) , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable)) , regExpPrototypeTable(fastNew<HashTable>(JSC::regExpPrototypeTable)) , stringTable(fastNew<HashTable>(JSC::stringTable)) , stringConstructorTable(fastNew<HashTable>(JSC::stringConstructorTable)) , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , emptyList(new MarkedArgumentBuffer) #if ENABLE(ASSEMBLER) , executableAllocator(*this) #endif , parserArena(adoptPtr(new ParserArena)) , keywords(adoptPtr(new Keywords(this))) , interpreter(0) , jsArrayClassInfo(&JSArray::s_info) , jsFinalObjectClassInfo(&JSFinalObject::s_info) #if ENABLE(DFG_JIT) , sizeOfLastScratchBuffer(0) #endif , dynamicGlobalObject(0) , cachedUTCOffset(std::numeric_limits<double>::quiet_NaN()) , maxReentryDepth(threadStackType == ThreadStackTypeSmall ? MaxSmallThreadReentryDepth : MaxLargeThreadReentryDepth) , m_enabledProfiler(0) , m_regExpCache(new RegExpCache(this)) #if ENABLE(REGEXP_TRACING) , m_rtTraceList(new RTTraceList()) #endif #ifndef NDEBUG , exclusiveThread(0) #endif #if CPU(X86) && ENABLE(JIT) , m_timeoutCount(512) #endif , m_newStringsSinceLastHashConst(0) #if ENABLE(ASSEMBLER) && (ENABLE(CLASSIC_INTERPRETER) || ENABLE(LLINT)) , m_canUseAssembler(enableAssembler(executableAllocator)) #endif #if ENABLE(GC_VALIDATION) , m_initializingObjectClass(0) #endif , m_inDefineOwnProperty(false) { interpreter = new Interpreter; // Need to be careful to keep everything consistent here JSLockHolder lock(this); IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable); structureStructure.set(*this, Structure::createStructure(*this)); debuggerActivationStructure.set(*this, DebuggerActivation::createStructure(*this, 0, jsNull())); activationStructure.set(*this, JSActivation::createStructure(*this, 0, jsNull())); interruptedExecutionErrorStructure.set(*this, InterruptedExecutionError::createStructure(*this, 0, jsNull())); terminatedExecutionErrorStructure.set(*this, TerminatedExecutionError::createStructure(*this, 0, jsNull())); staticScopeStructure.set(*this, JSStaticScopeObject::createStructure(*this, 0, jsNull())); strictEvalActivationStructure.set(*this, StrictEvalActivation::createStructure(*this, 0, jsNull())); stringStructure.set(*this, JSString::createStructure(*this, 0, jsNull())); notAnObjectStructure.set(*this, JSNotAnObject::createStructure(*this, 0, jsNull())); propertyNameIteratorStructure.set(*this, JSPropertyNameIterator::createStructure(*this, 0, jsNull())); getterSetterStructure.set(*this, GetterSetter::createStructure(*this, 0, jsNull())); apiWrapperStructure.set(*this, JSAPIValueWrapper::createStructure(*this, 0, jsNull())); scopeChainNodeStructure.set(*this, ScopeChainNode::createStructure(*this, 0, jsNull())); executableStructure.set(*this, ExecutableBase::createStructure(*this, 0, jsNull())); nativeExecutableStructure.set(*this, NativeExecutable::createStructure(*this, 0, jsNull())); evalExecutableStructure.set(*this, EvalExecutable::createStructure(*this, 0, jsNull())); programExecutableStructure.set(*this, ProgramExecutable::createStructure(*this, 0, jsNull())); functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, 0, jsNull())); regExpStructure.set(*this, RegExp::createStructure(*this, 0, jsNull())); structureChainStructure.set(*this, StructureChain::createStructure(*this, 0, jsNull())); wtfThreadData().setCurrentIdentifierTable(existingEntryIdentifierTable); #if ENABLE(JIT) jitStubs = adoptPtr(new JITThunks(this)); #endif interpreter->initialize(&llintData, this->canUseJIT()); initializeHostCallReturnValue(); // This is needed to convince the linker not to drop host call return support. heap.notifyIsSafeToCollect(); llintData.performAssertions(*this); }
JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType) : globalDataType(globalDataType) , clientData(0) , arrayTable(fastNew<HashTable>(JSC::arrayTable)) , dateTable(fastNew<HashTable>(JSC::dateTable)) , jsonTable(fastNew<HashTable>(JSC::jsonTable)) , mathTable(fastNew<HashTable>(JSC::mathTable)) , numberTable(fastNew<HashTable>(JSC::numberTable)) , regExpTable(fastNew<HashTable>(JSC::regExpTable)) , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable)) , stringTable(fastNew<HashTable>(JSC::stringTable)) , activationStructure(JSActivation::createStructure(jsNull())) , interruptedExecutionErrorStructure(JSObject::createStructure(jsNull())) , terminatedExecutionErrorStructure(JSObject::createStructure(jsNull())) , staticScopeStructure(JSStaticScopeObject::createStructure(jsNull())) , stringStructure(JSString::createStructure(jsNull())) , notAnObjectErrorStubStructure(JSNotAnObjectErrorStub::createStructure(jsNull())) , notAnObjectStructure(JSNotAnObject::createStructure(jsNull())) , propertyNameIteratorStructure(JSPropertyNameIterator::createStructure(jsNull())) , getterSetterStructure(GetterSetter::createStructure(jsNull())) , apiWrapperStructure(JSAPIValueWrapper::createStructure(jsNull())) , dummyMarkableCellStructure(JSCell::createDummyStructure()) #if USE(JSVALUE32) , numberStructure(JSNumberCell::createStructure(jsNull())) #endif , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , emptyList(new MarkedArgumentBuffer) , lexer(new Lexer(this)) , parser(new Parser) , interpreter(new Interpreter) #if ENABLE(JIT) , jitStubs(this) #endif , heap(this) , initializingLazyNumericCompareFunction(false) , head(0) , dynamicGlobalObject(0) , functionCodeBlockBeingReparsed(0) , firstStringifierToMark(0) , markStack(jsArrayVPtr) , cachedUTCOffset(NaN) , weakRandom(static_cast<int>(currentTime())) , maxReentryDepth(threadStackType == ThreadStackTypeSmall ? MaxSmallThreadReentryDepth : MaxLargeThreadReentryDepth) #ifndef NDEBUG , exclusiveThread(0) #endif { #if PLATFORM(MAC) startProfilerServerIfNeeded(); #endif }
JSGlobalData::JSGlobalData(GlobalDataType globalDataType, HeapType heapType) : #if ENABLE(ASSEMBLER) executableAllocator(*this), #endif heap(this, heapType) , globalDataType(globalDataType) , clientData(0) , topCallFrame(CallFrame::noCaller()) , arrayConstructorTable(fastNew<HashTable>(JSC::arrayConstructorTable)) , arrayPrototypeTable(fastNew<HashTable>(JSC::arrayPrototypeTable)) , booleanPrototypeTable(fastNew<HashTable>(JSC::booleanPrototypeTable)) , dateTable(fastNew<HashTable>(JSC::dateTable)) , dateConstructorTable(fastNew<HashTable>(JSC::dateConstructorTable)) , errorPrototypeTable(fastNew<HashTable>(JSC::errorPrototypeTable)) , globalObjectTable(fastNew<HashTable>(JSC::globalObjectTable)) , jsonTable(fastNew<HashTable>(JSC::jsonTable)) , mathTable(fastNew<HashTable>(JSC::mathTable)) , numberConstructorTable(fastNew<HashTable>(JSC::numberConstructorTable)) , numberPrototypeTable(fastNew<HashTable>(JSC::numberPrototypeTable)) , objectConstructorTable(fastNew<HashTable>(JSC::objectConstructorTable)) , objectPrototypeTable(fastNew<HashTable>(JSC::objectPrototypeTable)) , privateNamePrototypeTable(fastNew<HashTable>(JSC::privateNamePrototypeTable)) , regExpTable(fastNew<HashTable>(JSC::regExpTable)) , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable)) , regExpPrototypeTable(fastNew<HashTable>(JSC::regExpPrototypeTable)) , stringTable(fastNew<HashTable>(JSC::stringTable)) , stringConstructorTable(fastNew<HashTable>(JSC::stringConstructorTable)) , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , emptyList(new MarkedArgumentBuffer) , parserArena(adoptPtr(new ParserArena)) , keywords(adoptPtr(new Keywords(this))) , interpreter(0) , jsArrayClassInfo(&JSArray::s_info) , jsFinalObjectClassInfo(&JSFinalObject::s_info) #if ENABLE(DFG_JIT) , sizeOfLastScratchBuffer(0) #endif , dynamicGlobalObject(0) , cachedUTCOffset(QNaN) , m_enabledProfiler(0) , m_regExpCache(new RegExpCache(this)) #if ENABLE(REGEXP_TRACING) , m_rtTraceList(new RTTraceList()) #endif #ifndef NDEBUG , exclusiveThread(0) #endif #if CPU(X86) && ENABLE(JIT) , m_timeoutCount(512) #endif , m_newStringsSinceLastHashConst(0) #if ENABLE(ASSEMBLER) , m_canUseAssembler(enableAssembler(executableAllocator)) #endif #if ENABLE(JIT) , m_canUseJIT(m_canUseAssembler && Options::useJIT()) #endif #if ENABLE(YARR_JIT) , m_canUseRegExpJIT(m_canUseAssembler && Options::useRegExpJIT()) #endif #if ENABLE(GC_VALIDATION) , m_initializingObjectClass(0) #endif , m_inDefineOwnProperty(false) , m_codeCache(CodeCache::create()) { interpreter = new Interpreter(*this); // Need to be careful to keep everything consistent here JSLockHolder lock(this); IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable); structureStructure.set(*this, Structure::createStructure(*this)); structureRareDataStructure.set(*this, StructureRareData::createStructure(*this, 0, jsNull())); debuggerActivationStructure.set(*this, DebuggerActivation::createStructure(*this, 0, jsNull())); interruptedExecutionErrorStructure.set(*this, InterruptedExecutionError::createStructure(*this, 0, jsNull())); terminatedExecutionErrorStructure.set(*this, TerminatedExecutionError::createStructure(*this, 0, jsNull())); stringStructure.set(*this, JSString::createStructure(*this, 0, jsNull())); notAnObjectStructure.set(*this, JSNotAnObject::createStructure(*this, 0, jsNull())); propertyNameIteratorStructure.set(*this, JSPropertyNameIterator::createStructure(*this, 0, jsNull())); getterSetterStructure.set(*this, GetterSetter::createStructure(*this, 0, jsNull())); apiWrapperStructure.set(*this, JSAPIValueWrapper::createStructure(*this, 0, jsNull())); JSScopeStructure.set(*this, JSScope::createStructure(*this, 0, jsNull())); executableStructure.set(*this, ExecutableBase::createStructure(*this, 0, jsNull())); nativeExecutableStructure.set(*this, NativeExecutable::createStructure(*this, 0, jsNull())); evalExecutableStructure.set(*this, EvalExecutable::createStructure(*this, 0, jsNull())); programExecutableStructure.set(*this, ProgramExecutable::createStructure(*this, 0, jsNull())); functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, 0, jsNull())); regExpStructure.set(*this, RegExp::createStructure(*this, 0, jsNull())); sharedSymbolTableStructure.set(*this, SharedSymbolTable::createStructure(*this, 0, jsNull())); structureChainStructure.set(*this, StructureChain::createStructure(*this, 0, jsNull())); sparseArrayValueMapStructure.set(*this, SparseArrayValueMap::createStructure(*this, 0, jsNull())); withScopeStructure.set(*this, JSWithScope::createStructure(*this, 0, jsNull())); unlinkedFunctionExecutableStructure.set(*this, UnlinkedFunctionExecutable::createStructure(*this, 0, jsNull())); unlinkedProgramCodeBlockStructure.set(*this, UnlinkedProgramCodeBlock::createStructure(*this, 0, jsNull())); unlinkedEvalCodeBlockStructure.set(*this, UnlinkedEvalCodeBlock::createStructure(*this, 0, jsNull())); unlinkedFunctionCodeBlockStructure.set(*this, UnlinkedFunctionCodeBlock::createStructure(*this, 0, jsNull())); smallStrings.initializeCommonStrings(*this); wtfThreadData().setCurrentIdentifierTable(existingEntryIdentifierTable); #if ENABLE(JIT) jitStubs = adoptPtr(new JITThunks()); performPlatformSpecificJITAssertions(this); #endif interpreter->initialize(this->canUseJIT()); #if ENABLE(JIT) initializeHostCallReturnValue(); // This is needed to convince the linker not to drop host call return support. #endif heap.notifyIsSafeToCollect(); LLInt::Data::performAssertions(*this); if (Options::enableProfiler()) m_perBytecodeProfiler = adoptPtr(new Profiler::Database(*this)); #if ENABLE(DFG_JIT) if (canUseJIT()) m_dfgState = adoptPtr(new DFG::LongLivedState()); #endif }
JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType) : globalDataType(globalDataType) , clientData(0) , arrayConstructorTable(fastNew<HashTable>(JSC::arrayConstructorTable)) , arrayPrototypeTable(fastNew<HashTable>(JSC::arrayPrototypeTable)) , booleanPrototypeTable(fastNew<HashTable>(JSC::booleanPrototypeTable)) , dateTable(fastNew<HashTable>(JSC::dateTable)) , dateConstructorTable(fastNew<HashTable>(JSC::dateConstructorTable)) , errorPrototypeTable(fastNew<HashTable>(JSC::errorPrototypeTable)) , globalObjectTable(fastNew<HashTable>(JSC::globalObjectTable)) , jsonTable(fastNew<HashTable>(JSC::jsonTable)) , mathTable(fastNew<HashTable>(JSC::mathTable)) , numberConstructorTable(fastNew<HashTable>(JSC::numberConstructorTable)) , numberPrototypeTable(fastNew<HashTable>(JSC::numberPrototypeTable)) , objectConstructorTable(fastNew<HashTable>(JSC::objectConstructorTable)) , objectPrototypeTable(fastNew<HashTable>(JSC::objectPrototypeTable)) , regExpTable(fastNew<HashTable>(JSC::regExpTable)) , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable)) , regExpPrototypeTable(fastNew<HashTable>(JSC::regExpPrototypeTable)) , stringTable(fastNew<HashTable>(JSC::stringTable)) , stringConstructorTable(fastNew<HashTable>(JSC::stringConstructorTable)) , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , emptyList(new MarkedArgumentBuffer) #if ENABLE(ASSEMBLER) , executableAllocator(*this) , regexAllocator(*this) #endif , lexer(new Lexer(this)) , parser(new Parser) , interpreter(0) , heap(this) , globalObjectCount(0) , dynamicGlobalObject(0) , cachedUTCOffset(NaN) , maxReentryDepth(threadStackType == ThreadStackTypeSmall ? MaxSmallThreadReentryDepth : MaxLargeThreadReentryDepth) , m_regExpCache(new RegExpCache(this)) #if ENABLE(REGEXP_TRACING) , m_rtTraceList(new RTTraceList()) #endif #ifndef NDEBUG , exclusiveThread(0) #endif { interpreter = new Interpreter(*this); if (globalDataType == Default) m_stack = wtfThreadData().stack(); // Need to be careful to keep everything consistent here IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable); JSLock lock(SilenceAssertionsOnly); structureStructure.set(*this, Structure::createStructure(*this)); debuggerActivationStructure.set(*this, DebuggerActivation::createStructure(*this, jsNull())); activationStructure.set(*this, JSActivation::createStructure(*this, jsNull())); interruptedExecutionErrorStructure.set(*this, JSNonFinalObject::createStructure(*this, jsNull())); terminatedExecutionErrorStructure.set(*this, JSNonFinalObject::createStructure(*this, jsNull())); staticScopeStructure.set(*this, JSStaticScopeObject::createStructure(*this, jsNull())); strictEvalActivationStructure.set(*this, StrictEvalActivation::createStructure(*this, jsNull())); stringStructure.set(*this, JSString::createStructure(*this, jsNull())); notAnObjectStructure.set(*this, JSNotAnObject::createStructure(*this, jsNull())); propertyNameIteratorStructure.set(*this, JSPropertyNameIterator::createStructure(*this, jsNull())); getterSetterStructure.set(*this, GetterSetter::createStructure(*this, jsNull())); apiWrapperStructure.set(*this, JSAPIValueWrapper::createStructure(*this, jsNull())); scopeChainNodeStructure.set(*this, ScopeChainNode::createStructure(*this, jsNull())); executableStructure.set(*this, ExecutableBase::createStructure(*this, jsNull())); nativeExecutableStructure.set(*this, NativeExecutable::createStructure(*this, jsNull())); evalExecutableStructure.set(*this, EvalExecutable::createStructure(*this, jsNull())); programExecutableStructure.set(*this, ProgramExecutable::createStructure(*this, jsNull())); functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, jsNull())); dummyMarkableCellStructure.set(*this, JSCell::createDummyStructure(*this)); regExpStructure.set(*this, RegExp::createStructure(*this, jsNull())); structureChainStructure.set(*this, StructureChain::createStructure(*this, jsNull())); #if ENABLE(JSC_ZOMBIES) zombieStructure.set(*this, JSZombie::createStructure(*this, jsNull())); #endif wtfThreadData().setCurrentIdentifierTable(existingEntryIdentifierTable); #if PLATFORM(MAC) startProfilerServerIfNeeded(); #endif #if ENABLE(JIT) && ENABLE(INTERPRETER) #if USE(CF) CFStringRef canUseJITKey = CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman); CFBooleanRef canUseJIT = (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey, kCFPreferencesCurrentApplication); if (canUseJIT) { m_canUseJIT = kCFBooleanTrue == canUseJIT; CFRelease(canUseJIT); } else { char* canUseJITString = getenv("JavaScriptCoreUseJIT"); m_canUseJIT = !canUseJITString || atoi(canUseJITString); } CFRelease(canUseJITKey); #elif OS(UNIX) char* canUseJITString = getenv("JavaScriptCoreUseJIT"); m_canUseJIT = !canUseJITString || atoi(canUseJITString); #else m_canUseJIT = true; #endif #endif #if ENABLE(JIT) #if ENABLE(INTERPRETER) if (m_canUseJIT) m_canUseJIT = executableAllocator.isValid(); #endif jitStubs = adoptPtr(new JITThunks(this)); #endif }
JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType, HeapSize heapSize) : globalDataType(globalDataType) , clientData(0) , topCallFrame(CallFrame::noCaller()) , arrayConstructorTable(fastNew<HashTable>(JSC::arrayConstructorTable)) , arrayPrototypeTable(fastNew<HashTable>(JSC::arrayPrototypeTable)) , booleanPrototypeTable(fastNew<HashTable>(JSC::booleanPrototypeTable)) , dateTable(fastNew<HashTable>(JSC::dateTable)) , dateConstructorTable(fastNew<HashTable>(JSC::dateConstructorTable)) , errorPrototypeTable(fastNew<HashTable>(JSC::errorPrototypeTable)) , globalObjectTable(fastNew<HashTable>(JSC::globalObjectTable)) , jsonTable(fastNew<HashTable>(JSC::jsonTable)) , mathTable(fastNew<HashTable>(JSC::mathTable)) , numberConstructorTable(fastNew<HashTable>(JSC::numberConstructorTable)) , numberPrototypeTable(fastNew<HashTable>(JSC::numberPrototypeTable)) , objectConstructorTable(fastNew<HashTable>(JSC::objectConstructorTable)) , objectPrototypeTable(fastNew<HashTable>(JSC::objectPrototypeTable)) , regExpTable(fastNew<HashTable>(JSC::regExpTable)) , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable)) , regExpPrototypeTable(fastNew<HashTable>(JSC::regExpPrototypeTable)) , stringTable(fastNew<HashTable>(JSC::stringTable)) , stringConstructorTable(fastNew<HashTable>(JSC::stringConstructorTable)) , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , emptyList(new MarkedArgumentBuffer) #if ENABLE(ASSEMBLER) , executableAllocator(*this) #endif , parserArena(adoptPtr(new ParserArena)) , keywords(adoptPtr(new Keywords(this))) , interpreter(0) , heap(this, heapSize) #if ENABLE(DFG_JIT) , sizeOfLastScratchBuffer(0) #endif , dynamicGlobalObject(0) , cachedUTCOffset(std::numeric_limits<double>::quiet_NaN()) , maxReentryDepth(threadStackType == ThreadStackTypeSmall ? MaxSmallThreadReentryDepth : MaxLargeThreadReentryDepth) , m_regExpCache(new RegExpCache(this)) #if ENABLE(REGEXP_TRACING) , m_rtTraceList(new RTTraceList()) #endif #ifndef NDEBUG , exclusiveThread(0) #endif #if CPU(X86) && ENABLE(JIT) , m_timeoutCount(512) #endif #if ENABLE(GC_VALIDATION) , m_isInitializingObject(false) #endif { interpreter = new Interpreter; if (globalDataType == Default) m_stack = wtfThreadData().stack(); // Need to be careful to keep everything consistent here IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable); JSLock lock(SilenceAssertionsOnly); structureStructure.set(*this, Structure::createStructure(*this)); debuggerActivationStructure.set(*this, DebuggerActivation::createStructure(*this, 0, jsNull())); activationStructure.set(*this, JSActivation::createStructure(*this, 0, jsNull())); interruptedExecutionErrorStructure.set(*this, InterruptedExecutionError::createStructure(*this, 0, jsNull())); terminatedExecutionErrorStructure.set(*this, TerminatedExecutionError::createStructure(*this, 0, jsNull())); staticScopeStructure.set(*this, JSStaticScopeObject::createStructure(*this, 0, jsNull())); strictEvalActivationStructure.set(*this, StrictEvalActivation::createStructure(*this, 0, jsNull())); stringStructure.set(*this, JSString::createStructure(*this, 0, jsNull())); notAnObjectStructure.set(*this, JSNotAnObject::createStructure(*this, 0, jsNull())); propertyNameIteratorStructure.set(*this, JSPropertyNameIterator::createStructure(*this, 0, jsNull())); getterSetterStructure.set(*this, GetterSetter::createStructure(*this, 0, jsNull())); apiWrapperStructure.set(*this, JSAPIValueWrapper::createStructure(*this, 0, jsNull())); scopeChainNodeStructure.set(*this, ScopeChainNode::createStructure(*this, 0, jsNull())); executableStructure.set(*this, ExecutableBase::createStructure(*this, 0, jsNull())); nativeExecutableStructure.set(*this, NativeExecutable::createStructure(*this, 0, jsNull())); evalExecutableStructure.set(*this, EvalExecutable::createStructure(*this, 0, jsNull())); programExecutableStructure.set(*this, ProgramExecutable::createStructure(*this, 0, jsNull())); functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, 0, jsNull())); regExpStructure.set(*this, RegExp::createStructure(*this, 0, jsNull())); structureChainStructure.set(*this, StructureChain::createStructure(*this, 0, jsNull())); wtfThreadData().setCurrentIdentifierTable(existingEntryIdentifierTable); #if ENABLE(JIT) && ENABLE(INTERPRETER) #if USE(CF) CFStringRef canUseJITKey = CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman); CFBooleanRef canUseJIT = (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey, kCFPreferencesCurrentApplication); if (canUseJIT) { m_canUseJIT = kCFBooleanTrue == canUseJIT; CFRelease(canUseJIT); } else { char* canUseJITString = getenv("JavaScriptCoreUseJIT"); m_canUseJIT = !canUseJITString || atoi(canUseJITString); } CFRelease(canUseJITKey); #elif OS(UNIX) char* canUseJITString = getenv("JavaScriptCoreUseJIT"); m_canUseJIT = !canUseJITString || atoi(canUseJITString); #else m_canUseJIT = true; #endif #endif #if ENABLE(JIT) #if ENABLE(INTERPRETER) if (m_canUseJIT) m_canUseJIT = executableAllocator.isValid(); #endif jitStubs = adoptPtr(new JITThunks(this)); #endif interpreter->initialize(this->canUseJIT()); heap.notifyIsSafeToCollect(); }
VM::VM(VMType vmType, HeapType heapType) : m_apiLock(adoptRef(new JSLock(this))) #if ENABLE(ASSEMBLER) , executableAllocator(*this) #endif , heap(this, heapType) , vmType(vmType) , clientData(0) , topCallFrame(CallFrame::noCaller()->removeHostCallFrameFlag()) , arrayConstructorTable(adoptPtr(new HashTable(JSC::arrayConstructorTable))) , arrayPrototypeTable(adoptPtr(new HashTable(JSC::arrayPrototypeTable))) , booleanPrototypeTable(adoptPtr(new HashTable(JSC::booleanPrototypeTable))) , dataViewTable(adoptPtr(new HashTable(JSC::dataViewTable))) , dateTable(adoptPtr(new HashTable(JSC::dateTable))) , dateConstructorTable(adoptPtr(new HashTable(JSC::dateConstructorTable))) , errorPrototypeTable(adoptPtr(new HashTable(JSC::errorPrototypeTable))) , globalObjectTable(adoptPtr(new HashTable(JSC::globalObjectTable))) , jsonTable(adoptPtr(new HashTable(JSC::jsonTable))) , numberConstructorTable(adoptPtr(new HashTable(JSC::numberConstructorTable))) , numberPrototypeTable(adoptPtr(new HashTable(JSC::numberPrototypeTable))) , objectConstructorTable(adoptPtr(new HashTable(JSC::objectConstructorTable))) , privateNamePrototypeTable(adoptPtr(new HashTable(JSC::privateNamePrototypeTable))) , regExpTable(adoptPtr(new HashTable(JSC::regExpTable))) , regExpConstructorTable(adoptPtr(new HashTable(JSC::regExpConstructorTable))) , regExpPrototypeTable(adoptPtr(new HashTable(JSC::regExpPrototypeTable))) , stringConstructorTable(adoptPtr(new HashTable(JSC::stringConstructorTable))) #if ENABLE(PROMISES) , promisePrototypeTable(adoptPtr(new HashTable(JSC::promisePrototypeTable))) , promiseConstructorTable(adoptPtr(new HashTable(JSC::promiseConstructorTable))) , promiseResolverPrototypeTable(adoptPtr(new HashTable(JSC::promiseResolverPrototypeTable))) #endif , identifierTable(vmType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , emptyList(new MarkedArgumentBuffer) , parserArena(adoptPtr(new ParserArena)) , keywords(adoptPtr(new Keywords(this))) , interpreter(0) , jsArrayClassInfo(JSArray::info()) , jsFinalObjectClassInfo(JSFinalObject::info()) #if ENABLE(DFG_JIT) , sizeOfLastScratchBuffer(0) #endif , dynamicGlobalObject(0) , m_enabledProfiler(0) , m_regExpCache(new RegExpCache(this)) #if ENABLE(REGEXP_TRACING) , m_rtTraceList(new RTTraceList()) #endif , exclusiveThread(0) , m_newStringsSinceLastHashCons(0) #if ENABLE(ASSEMBLER) , m_canUseAssembler(enableAssembler(executableAllocator)) #endif #if ENABLE(JIT) , m_canUseJIT(m_canUseAssembler && Options::useJIT()) #endif #if ENABLE(YARR_JIT) , m_canUseRegExpJIT(m_canUseAssembler && Options::useRegExpJIT()) #endif #if ENABLE(GC_VALIDATION) , m_initializingObjectClass(0) #endif , m_inDefineOwnProperty(false) , m_codeCache(CodeCache::create()) { interpreter = new Interpreter(*this); // Need to be careful to keep everything consistent here JSLockHolder lock(this); IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable); structureStructure.set(*this, Structure::createStructure(*this)); structureRareDataStructure.set(*this, StructureRareData::createStructure(*this, 0, jsNull())); debuggerActivationStructure.set(*this, DebuggerActivation::createStructure(*this, 0, jsNull())); terminatedExecutionErrorStructure.set(*this, TerminatedExecutionError::createStructure(*this, 0, jsNull())); stringStructure.set(*this, JSString::createStructure(*this, 0, jsNull())); notAnObjectStructure.set(*this, JSNotAnObject::createStructure(*this, 0, jsNull())); propertyNameIteratorStructure.set(*this, JSPropertyNameIterator::createStructure(*this, 0, jsNull())); getterSetterStructure.set(*this, GetterSetter::createStructure(*this, 0, jsNull())); apiWrapperStructure.set(*this, JSAPIValueWrapper::createStructure(*this, 0, jsNull())); JSScopeStructure.set(*this, JSScope::createStructure(*this, 0, jsNull())); executableStructure.set(*this, ExecutableBase::createStructure(*this, 0, jsNull())); nativeExecutableStructure.set(*this, NativeExecutable::createStructure(*this, 0, jsNull())); evalExecutableStructure.set(*this, EvalExecutable::createStructure(*this, 0, jsNull())); programExecutableStructure.set(*this, ProgramExecutable::createStructure(*this, 0, jsNull())); functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, 0, jsNull())); regExpStructure.set(*this, RegExp::createStructure(*this, 0, jsNull())); sharedSymbolTableStructure.set(*this, SharedSymbolTable::createStructure(*this, 0, jsNull())); structureChainStructure.set(*this, StructureChain::createStructure(*this, 0, jsNull())); sparseArrayValueMapStructure.set(*this, SparseArrayValueMap::createStructure(*this, 0, jsNull())); withScopeStructure.set(*this, JSWithScope::createStructure(*this, 0, jsNull())); unlinkedFunctionExecutableStructure.set(*this, UnlinkedFunctionExecutable::createStructure(*this, 0, jsNull())); unlinkedProgramCodeBlockStructure.set(*this, UnlinkedProgramCodeBlock::createStructure(*this, 0, jsNull())); unlinkedEvalCodeBlockStructure.set(*this, UnlinkedEvalCodeBlock::createStructure(*this, 0, jsNull())); unlinkedFunctionCodeBlockStructure.set(*this, UnlinkedFunctionCodeBlock::createStructure(*this, 0, jsNull())); propertyTableStructure.set(*this, PropertyTable::createStructure(*this, 0, jsNull())); smallStrings.initializeCommonStrings(*this); wtfThreadData().setCurrentIdentifierTable(existingEntryIdentifierTable); #if ENABLE(JIT) jitStubs = adoptPtr(new JITThunks()); performPlatformSpecificJITAssertions(this); #endif interpreter->initialize(this->canUseJIT()); #if ENABLE(JIT) initializeHostCallReturnValue(); // This is needed to convince the linker not to drop host call return support. #endif heap.notifyIsSafeToCollect(); LLInt::Data::performAssertions(*this); if (Options::enableProfiler()) { m_perBytecodeProfiler = adoptPtr(new Profiler::Database(*this)); StringPrintStream pathOut; #if !OS(WINCE) const char* profilerPath = getenv("JSC_PROFILER_PATH"); if (profilerPath) pathOut.print(profilerPath, "/"); #endif pathOut.print("JSCProfile-", getCurrentProcessID(), "-", m_perBytecodeProfiler->databaseID(), ".json"); m_perBytecodeProfiler->registerToSaveAtExit(pathOut.toCString().data()); } #if ENABLE(DFG_JIT) if (canUseJIT()) dfgState = adoptPtr(new DFG::LongLivedState()); #endif // Initialize this last, as a free way of asserting that VM initialization itself // won't use this. m_typedArrayController = adoptRef(new SimpleTypedArrayController()); }
JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType) : globalDataType(globalDataType) , clientData(0) , arrayTable(fastNew<HashTable>(JSC::arrayTable)) , dateTable(fastNew<HashTable>(JSC::dateTable)) , jsonTable(fastNew<HashTable>(JSC::jsonTable)) , mathTable(fastNew<HashTable>(JSC::mathTable)) , numberTable(fastNew<HashTable>(JSC::numberTable)) , regExpTable(fastNew<HashTable>(JSC::regExpTable)) , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable)) , stringTable(fastNew<HashTable>(JSC::stringTable)) , activationStructure(JSActivation::createStructure(jsNull())) , interruptedExecutionErrorStructure(JSObject::createStructure(jsNull())) , terminatedExecutionErrorStructure(JSObject::createStructure(jsNull())) , staticScopeStructure(JSStaticScopeObject::createStructure(jsNull())) , strictEvalActivationStructure(StrictEvalActivation::createStructure(jsNull())) , stringStructure(JSString::createStructure(jsNull())) , notAnObjectErrorStubStructure(JSNotAnObjectErrorStub::createStructure(jsNull())) , notAnObjectStructure(JSNotAnObject::createStructure(jsNull())) , propertyNameIteratorStructure(JSPropertyNameIterator::createStructure(jsNull())) , getterSetterStructure(GetterSetter::createStructure(jsNull())) , apiWrapperStructure(JSAPIValueWrapper::createStructure(jsNull())) , dummyMarkableCellStructure(JSCell::createDummyStructure()) #if USE(JSVALUE32) , numberStructure(JSNumberCell::createStructure(jsNull())) #endif , identifierTable(globalDataType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable()) , propertyNames(new CommonIdentifiers(this)) , emptyList(new MarkedArgumentBuffer) , lexer(new Lexer(this)) , parser(new Parser) , interpreter(new Interpreter) , heap(this) , head(0) , dynamicGlobalObject(0) , functionCodeBlockBeingReparsed(0) , firstStringifierToMark(0) , markStack(jsArrayVPtr) , cachedUTCOffset(NaN) , maxReentryDepth(threadStackType == ThreadStackTypeSmall ? MaxSmallThreadReentryDepth : MaxLargeThreadReentryDepth) , m_regExpCache(new RegExpCache(this)) #if ENABLE(REGEXP_TRACING) , m_rtTraceList(new RTTraceList()) #endif #ifndef NDEBUG , exclusiveThread(0) #endif { #if PLATFORM(MAC) startProfilerServerIfNeeded(); #endif #if ENABLE(JIT) && ENABLE(INTERPRETER) #if PLATFORM(CF) CFStringRef canUseJITKey = CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman); CFBooleanRef canUseJIT = (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey, kCFPreferencesCurrentApplication); if (canUseJIT) { m_canUseJIT = kCFBooleanTrue == canUseJIT; CFRelease(canUseJIT); } else m_canUseJIT = !getenv("JavaScriptCoreUseJIT"); CFRelease(canUseJITKey); #elif OS(UNIX) m_canUseJIT = !getenv("JavaScriptCoreUseJIT"); #else m_canUseJIT = true; #endif #endif #if ENABLE(JIT) #if ENABLE(INTERPRETER) if (m_canUseJIT) m_canUseJIT = executableAllocator.isValid(); #endif jitStubs = new JITThunks(this); #endif }