X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/4be4e30906bcb8ee30b4d189205cb70bad6707ce..81345200c95645a1b0d2635520f96ad55dfde63f:/bytecode/EvalCodeCache.h?ds=inline diff --git a/bytecode/EvalCodeCache.h b/bytecode/EvalCodeCache.h index 5d04637..65deb94 100644 --- a/bytecode/EvalCodeCache.h +++ b/bytecode/EvalCodeCache.h @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -38,7 +38,6 @@ namespace JSC { - class CodeCache; class SlotVisitor; class EvalCodeCache { @@ -50,29 +49,18 @@ namespace JSC { return 0; } - EvalExecutable* getSlow(ExecState* exec, CodeCache* codeCache, ScriptExecutable* owner, bool inStrictContext, const String& evalSource, JSScope* scope, JSValue& exceptionValue) + EvalExecutable* getSlow(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, const String& evalSource, JSScope* scope) { - EvalExecutable* evalExecutable = EvalExecutable::create(exec, codeCache, makeSource(evalSource), inStrictContext); - exceptionValue = evalExecutable->compile(exec, scope); - if (exceptionValue) + EvalExecutable* evalExecutable = EvalExecutable::create(exec, makeSource(evalSource), inStrictContext); + if (!evalExecutable) return 0; - + 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, CodeCache* codeCache, ScriptExecutable* owner, bool inStrictContext, const String& evalSource, JSScope* scope, JSValue& exceptionValue) - { - EvalExecutable* evalExecutable = tryGet(inStrictContext, evalSource, scope); - - if (!evalExecutable) - evalExecutable = getSlow(exec, codeCache, owner, inStrictContext, evalSource, scope, exceptionValue); - - return evalExecutable; - } - bool isEmpty() const { return m_cacheMap.isEmpty(); } void visitAggregate(SlotVisitor&); @@ -86,7 +74,7 @@ namespace JSC { static const unsigned maxCacheableSourceLength = 256; static const int maxCacheEntries = 64; - typedef HashMap, WriteBarrier > EvalCacheMap; + typedef HashMap, WriteBarrier> EvalCacheMap; EvalCacheMap m_cacheMap; };