diff options
Diffstat (limited to 'Source/JavaScriptCore/bytecode/CodeBlock.h')
-rw-r--r-- | Source/JavaScriptCore/bytecode/CodeBlock.h | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index a8b2a5871..1d56999ff 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -64,7 +64,6 @@ #include "Nodes.h" #include "RegExpObject.h" #include "StructureStubInfo.h" -#include "UString.h" #include "UnconditionalFinalizer.h" #include "ValueProfile.h" #include "Watchpoint.h" @@ -75,6 +74,7 @@ #include <wtf/RefPtr.h> #include <wtf/SegmentedVector.h> #include <wtf/Vector.h> +#include <wtf/text/WTFString.h> // Set ENABLE_BYTECODE_COMMENTS to 1 to enable recording bytecode generator // comments for the bytecodes that it generates. This will allow @@ -118,9 +118,9 @@ namespace JSC { public: enum CopyParsedBlockTag { CopyParsedBlock }; protected: - CodeBlock(CopyParsedBlockTag, CodeBlock& other, SymbolTable*); + CodeBlock(CopyParsedBlockTag, CodeBlock& other); - CodeBlock(ScriptExecutable* ownerExecutable, CodeType, JSGlobalObject*, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable*, bool isConstructor, PassOwnPtr<CodeBlock> alternative); + CodeBlock(ScriptExecutable* ownerExecutable, CodeType, JSGlobalObject*, PassRefPtr<SourceProvider>, unsigned sourceOffset, bool isConstructor, PassOwnPtr<CodeBlock> alternative); WriteBarrier<JSGlobalObject> m_globalObject; Heap* m_heap; @@ -229,12 +229,14 @@ namespace JSC { { return *(binarySearch<MethodCallLinkInfo, unsigned, getMethodCallLinkInfoBytecodeIndex>(m_methodCallLinkInfos.begin(), m_methodCallLinkInfos.size(), bytecodeIndex)); } +#endif // ENABLE(JIT) #if ENABLE(LLINT) Instruction* adjustPCIfAtCallSite(Instruction*); #endif unsigned bytecodeOffset(ExecState*, ReturnAddressPtr); +#if ENABLE(JIT) unsigned bytecodeOffsetForCallAtIndex(unsigned index) { if (!m_rareData) @@ -254,6 +256,8 @@ namespace JSC { { m_incomingCalls.push(incoming); } +#endif // ENABLE(JIT) + #if ENABLE(LLINT) void linkIncomingCall(LLIntCallLinkInfo* incoming) { @@ -262,7 +266,6 @@ namespace JSC { #endif // ENABLE(LLINT) void unlinkIncomingCalls(); -#endif // ENABLE(JIT) #if ENABLE(DFG_JIT) || ENABLE(LLINT) void setJITCodeMap(PassOwnPtr<CompactJITCodeMap> jitCodeMap) @@ -445,7 +448,7 @@ namespace JSC { MacroAssemblerCodePtr getJITCodeWithArityCheck() { return m_jitCodeWithArityCheck; } JITCode::JITType getJITType() { return m_jitCode.jitType(); } ExecutableMemoryHandle* executableMemory() { return getJITCode().getExecutableMemory(); } - virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*, unsigned bytecodeIndex) = 0; + virtual JSObject* compileOptimized(ExecState*, JSScope*, unsigned bytecodeIndex) = 0; virtual void jettison() = 0; enum JITCompilationResult { AlreadyCompiled, CouldNotCompile, CompiledSuccessfully }; JITCompilationResult jitCompile(ExecState* exec) @@ -583,7 +586,7 @@ namespace JSC { void clearEvalCache(); - UString nameForRegister(int registerNumber); + String nameForRegister(int registerNumber); void addPropertyAccessInstruction(unsigned propertyAccessInstruction) { @@ -931,7 +934,7 @@ namespace JSC { if (!codeOrigin.inlineCallFrame) return globalObject(); // FIXME: if we ever inline based on executable not function, this code will need to change. - return codeOrigin.inlineCallFrame->callee->scope()->globalObject.get(); + return codeOrigin.inlineCallFrame->callee->scope()->globalObject(); } // Jump Tables @@ -949,8 +952,7 @@ namespace JSC { StringJumpTable& stringSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_stringSwitchJumpTables[tableIndex]; } - SymbolTable* symbolTable() { return m_symbolTable; } - SharedSymbolTable* sharedSymbolTable() { ASSERT(m_codeType == FunctionCode); return static_cast<SharedSymbolTable*>(m_symbolTable); } + SharedSymbolTable* symbolTable() { return m_symbolTable.get(); } EvalCodeCache& evalCodeCache() { createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; } @@ -1361,7 +1363,7 @@ namespace JSC { Vector<WriteBarrier<FunctionExecutable> > m_functionDecls; Vector<WriteBarrier<FunctionExecutable> > m_functionExprs; - SymbolTable* m_symbolTable; + WriteBarrier<SharedSymbolTable> m_symbolTable; OwnPtr<CodeBlock> m_alternative; @@ -1423,18 +1425,14 @@ namespace JSC { class GlobalCodeBlock : public CodeBlock { protected: GlobalCodeBlock(CopyParsedBlockTag, GlobalCodeBlock& other) - : CodeBlock(CopyParsedBlock, other, &m_unsharedSymbolTable) - , m_unsharedSymbolTable(other.m_unsharedSymbolTable) + : CodeBlock(CopyParsedBlock, other) { } GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, PassOwnPtr<CodeBlock> alternative) - : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, &m_unsharedSymbolTable, false, alternative) + : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, false, alternative) { } - - private: - SymbolTable m_unsharedSymbolTable; }; class ProgramCodeBlock : public GlobalCodeBlock { @@ -1451,7 +1449,7 @@ namespace JSC { #if ENABLE(JIT) protected: - virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*, unsigned bytecodeIndex); + virtual JSObject* compileOptimized(ExecState*, JSScope*, unsigned bytecodeIndex); virtual void jettison(); virtual bool jitCompileImpl(ExecState*); virtual CodeBlock* replacement(); @@ -1486,7 +1484,7 @@ namespace JSC { #if ENABLE(JIT) protected: - virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*, unsigned bytecodeIndex); + virtual JSObject* compileOptimized(ExecState*, JSScope*, unsigned bytecodeIndex); virtual void jettison(); virtual bool jitCompileImpl(ExecState*); virtual CodeBlock* replacement(); @@ -1501,30 +1499,18 @@ namespace JSC { class FunctionCodeBlock : public CodeBlock { public: FunctionCodeBlock(CopyParsedBlockTag, FunctionCodeBlock& other) - : CodeBlock(CopyParsedBlock, other, other.sharedSymbolTable()) + : CodeBlock(CopyParsedBlock, other) { - // The fact that we have to do this is yucky, but is necessary because of the - // class hierarchy issues described in the comment block for the main - // constructor, below. - sharedSymbolTable()->ref(); } - // Rather than using the usual RefCounted::create idiom for SharedSymbolTable we just use new - // as we need to initialise the CodeBlock before we could initialise any RefPtr to hold the shared - // symbol table, so we just pass as a raw pointer with a ref count of 1. We then manually deref - // in the destructor. FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, bool isConstructor, PassOwnPtr<CodeBlock> alternative = nullptr) - : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, SharedSymbolTable::create().leakRef(), isConstructor, alternative) - { - } - ~FunctionCodeBlock() + : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, isConstructor, alternative) { - sharedSymbolTable()->deref(); } #if ENABLE(JIT) protected: - virtual JSObject* compileOptimized(ExecState*, ScopeChainNode*, unsigned bytecodeIndex); + virtual JSObject* compileOptimized(ExecState*, JSScope*, unsigned bytecodeIndex); virtual void jettison(); virtual bool jitCompileImpl(ExecState*); virtual CodeBlock* replacement(); |