- return unlinkedCode;
-}
-
-template <class UnlinkedCodeBlockType, class ExecutableType>
-UnlinkedCodeBlockType* CodeCache::getCodeBlock(VM& vm, JSScope* scope, ExecutableType* executable, const SourceCode& source, JSParserStrictness strictness, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError& error)
-{
- // We completely skip the cache if we're an eval that isn't at the top of the scope chain.
- if (CacheTypes<UnlinkedCodeBlockType>::codeType == SourceCodeKey::EvalType) {
- if (scope->next() && !scope->isActivationObject())
- return generateBytecode<UnlinkedCodeBlockType, ExecutableType>(vm, scope, executable, source, strictness, debuggerMode, profilerMode, error);
- }
-
- SourceCodeKey key = SourceCodeKey(source, String(), CacheTypes<UnlinkedCodeBlockType>::codeType, strictness);
- CodeCacheMap::AddResult addResult = m_sourceCode.add(key, SourceCodeValue());
- bool canCache = debuggerMode == DebuggerOff && profilerMode == ProfilerOff;
-
- if (!addResult.isNewEntry && canCache) {
- UnlinkedCodeBlockType* unlinkedCode = jsCast<UnlinkedCodeBlockType*>(addResult.iterator->value.cell.get());
- unsigned firstLine = source.firstLine() + unlinkedCode->firstLine();
- unsigned startColumn = source.firstLine() ? source.startColumn() : 0;
- executable->recordParse(unlinkedCode->codeFeatures(), unlinkedCode->hasCapturedVariables(), firstLine, firstLine + unlinkedCode->lineCount(), startColumn);
- return unlinkedCode;