Changeset 47304 in webkit for trunk/JavaScriptCore/bytecode/EvalCodeCache.h
- Timestamp:
- Aug 14, 2009, 6:14:00 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/bytecode/EvalCodeCache.h
r47022 r47304 30 30 #define EvalCodeCache_h 31 31 32 #include "Executable.h" 32 33 #include "JSGlobalObject.h" 33 34 #include "Nodes.h" … … 42 43 class EvalCodeCache { 43 44 public: 44 PassRefPtr<Eval Node> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)45 PassRefPtr<EvalExecutable> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue) 45 46 { 46 RefPtr<Eval Node> evalNode;47 RefPtr<EvalExecutable> evalExecutable; 47 48 48 49 if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject()) 49 eval Node = m_cacheMap.get(evalSource.rep());50 evalExecutable = m_cacheMap.get(evalSource.rep()); 50 51 51 if (!evalNode) { 52 int errorLine; 53 UString errorMessage; 54 55 SourceCode source = makeSource(evalSource); 56 evalNode = exec->globalData().parser->parse<EvalNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errorLine, &errorMessage); 57 if (evalNode) { 58 if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries) 59 m_cacheMap.set(evalSource.rep(), evalNode); 60 } else { 61 exceptionValue = Error::create(exec, SyntaxError, errorMessage, errorLine, source.provider()->asID(), 0); 52 if (!evalExecutable) { 53 evalExecutable = new EvalExecutable(makeSource(evalSource)); 54 exceptionValue = evalExecutable->parse(exec); 55 if (exceptionValue) 62 56 return 0; 63 } 57 58 if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries) 59 m_cacheMap.set(evalSource.rep(), evalExecutable); 64 60 } 65 61 66 return eval Node.release();62 return evalExecutable.release(); 67 63 } 68 64 … … 79 75 static const int maxCacheEntries = 64; 80 76 81 typedef HashMap<RefPtr<UString::Rep>, RefPtr<Eval Node> > EvalCacheMap;77 typedef HashMap<RefPtr<UString::Rep>, RefPtr<EvalExecutable> > EvalCacheMap; 82 78 EvalCacheMap m_cacheMap; 83 79 };
Note:
See TracChangeset
for help on using the changeset viewer.