X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/6fe7ccc865dc7d7541b93c5bcaf6368d2c98a174..4be4e30906bcb8ee30b4d189205cb70bad6707ce:/bytecode/EvalCodeCache.h diff --git a/bytecode/EvalCodeCache.h b/bytecode/EvalCodeCache.h index fba1d32..5d04637 100644 --- a/bytecode/EvalCodeCache.h +++ b/bytecode/EvalCodeCache.h @@ -31,46 +31,44 @@ #include "Executable.h" #include "JSGlobalObject.h" -#include "Nodes.h" -#include "Parser.h" #include "SourceCode.h" -#include "UString.h" #include #include #include namespace JSC { + class CodeCache; class SlotVisitor; class EvalCodeCache { public: - EvalExecutable* tryGet(bool inStrictContext, const UString& evalSource, ScopeChainNode* scopeChain) + EvalExecutable* tryGet(bool inStrictContext, const String& evalSource, JSScope* scope) { - if (!inStrictContext && evalSource.length() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject()) + if (!inStrictContext && evalSource.length() < maxCacheableSourceLength && scope->begin()->isVariableObject()) return m_cacheMap.get(evalSource.impl()).get(); return 0; } - EvalExecutable* getSlow(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue) + EvalExecutable* getSlow(ExecState* exec, CodeCache* codeCache, ScriptExecutable* owner, bool inStrictContext, const String& evalSource, JSScope* scope, JSValue& exceptionValue) { - EvalExecutable* evalExecutable = EvalExecutable::create(exec, makeSource(evalSource), inStrictContext); - exceptionValue = evalExecutable->compile(exec, scopeChain); + EvalExecutable* evalExecutable = EvalExecutable::create(exec, codeCache, makeSource(evalSource), inStrictContext); + exceptionValue = evalExecutable->compile(exec, scope); if (exceptionValue) return 0; - if (!inStrictContext && evalSource.length() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries) - m_cacheMap.set(evalSource.impl(), WriteBarrier(exec->globalData(), owner, evalExecutable)); + if (!inStrictContext && evalSource.length() < maxCacheableSourceLength && scope->begin()->isVariableObject() && m_cacheMap.size() < maxCacheEntries) + m_cacheMap.set(evalSource.impl(), WriteBarrier(exec->vm(), owner, evalExecutable)); return evalExecutable; } - - EvalExecutable* get(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue) + + EvalExecutable* get(ExecState* exec, CodeCache* codeCache, ScriptExecutable* owner, bool inStrictContext, const String& evalSource, JSScope* scope, JSValue& exceptionValue) { - EvalExecutable* evalExecutable = tryGet(inStrictContext, evalSource, scopeChain); + EvalExecutable* evalExecutable = tryGet(inStrictContext, evalSource, scope); if (!evalExecutable) - evalExecutable = getSlow(exec, owner, inStrictContext, evalSource, scopeChain, exceptionValue); + evalExecutable = getSlow(exec, codeCache, owner, inStrictContext, evalSource, scope, exceptionValue); return evalExecutable; }