Changeset 136860 in webkit
- Timestamp:
- Dec 6, 2012 11:26:20 AM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r136790 r136860 1 2012-12-05 Oliver Hunt <oliver@apple.com> 2 3 Remove harmful string->function cache 4 https://bugs.webkit.org/show_bug.cgi?id=104193 5 6 Reviewed by Alexey Proskuryakov. 7 8 Remove the string->function code cache that turned out to actually 9 be quite harmful. 10 11 * runtime/CodeCache.cpp: 12 (JSC::CodeCache::getFunctionCodeBlock): 13 * runtime/CodeCache.h: 14 (JSC::CodeCache::clear): 15 1 16 2012-12-05 Halton Huo <halton.huo@intel.com> 2 17 -
trunk/Source/JavaScriptCore/parser/ASTBuilder.h
r136261 r136860 268 268 return FunctionBodyNode::create(m_globalData, location, inStrictContext); 269 269 } 270 271 void setFunctionStart(FunctionBodyNode* body, int functionStart)272 {273 body->setFunctionStart(functionStart);274 }275 270 276 271 template <bool> PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, const Identifier* name, ParameterNode* params, FunctionBodyNode* body, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine) -
trunk/Source/JavaScriptCore/parser/Nodes.cpp
r136261 r136860 42 42 #include "RegExpObject.h" 43 43 #include "SamplingTool.h" 44 #include "SourceProviderCacheItem.h"45 44 #include <wtf/Assertions.h> 46 45 #include <wtf/RefCountedLeakCounter.h> -
trunk/Source/JavaScriptCore/parser/Nodes.h
r136261 r136860 47 47 class JSScope; 48 48 class ScopeNode; 49 class SourceProviderCacheItem;50 49 51 50 typedef unsigned CodeFeatures; … … 1426 1425 FunctionNameIsInScopeToggle functionNameIsInScopeToggle() { return m_functionNameIsInScopeToggle; } 1427 1426 1428 void setFunctionStart(int functionStart) { m_functionStart = functionStart; }1429 int functionStart() const { return m_functionStart; }1430 1431 1427 static const bool scopeIsFunction = true; 1432 1428 … … 1439 1435 FunctionNameIsInScopeToggle m_functionNameIsInScopeToggle; 1440 1436 RefPtr<FunctionParameters> m_parameters; 1441 int m_functionStart;1442 1437 }; 1443 1438 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r136261 r136860 843 843 844 844 closeBracePos = cachedInfo->closeBracePos; 845 context.setFunctionStart(body, functionStart);846 845 m_token = cachedInfo->closeBraceToken(); 847 846 m_lexer->setOffset(m_token.m_location.endOffset); … … 871 870 functionScope->saveFunctionInfo(newInfo.get()); 872 871 } 873 context.setFunctionStart(body, functionStart); 874 872 875 873 failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo)); 876 874 matchOrFail(CLOSEBRACE); -
trunk/Source/JavaScriptCore/parser/Parser.h
r136261 r136860 510 510 ScopeStack m_scopeStack; 511 511 512 const SourceProviderCacheItem* findCachedFunctionInfo(int openBracePos) 512 const SourceProviderCacheItem* findCachedFunctionInfo(int openBracePos) 513 513 { 514 514 return m_functionCache ? m_functionCache->get(openBracePos) : 0; -
trunk/Source/JavaScriptCore/parser/SyntaxChecker.h
r136261 r136860 152 152 ExpressionType createFunctionExpr(const JSTokenLocation&, const Identifier*, int, int, int, int, int, int) { return FunctionExpr; } 153 153 int createFunctionBody(const JSTokenLocation&, bool) { return 1; } 154 void setFunctionStart(int, int) { }155 154 int createArguments() { return 1; } 156 155 int createArguments(int) { return 1; } -
trunk/Source/JavaScriptCore/runtime/CodeCache.cpp
r136261 r136860 133 133 UnlinkedFunctionCodeBlock* CodeCache::getFunctionCodeBlock(JSGlobalData& globalData, UnlinkedFunctionExecutable* executable, const SourceCode& source, CodeSpecializationKind kind, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError& error) 134 134 { 135 if (debuggerMode == DebuggerOn || profilerMode == ProfilerOn) 136 return generateFunctionCodeBlock(globalData, executable, source, kind, debuggerMode, profilerMode, error); 137 138 SourceCode functionSource(source.provider(), executable->functionStartOffset(), source.endOffset(), source.firstLine()); 139 CodeBlockKey key = makeCodeBlockKey(functionSource, kind == CodeForCall ? FunctionCallType : FunctionConstructType, executable->isInStrictContext() ? JSParseStrict : JSParseNormal); 140 if (const Strong<UnlinkedFunctionCodeBlock>* cacheEntry = m_cachedFunctionExecutables.find(key)) { 141 if (cacheEntry) { 142 UnlinkedFunctionCodeBlock* unlinkedCode = cacheEntry->get(); 143 unsigned firstLine = source.firstLine() + unlinkedCode->firstLine(); 144 executable->recordParse(unlinkedCode->codeFeatures(), unlinkedCode->hasCapturedVariables(), firstLine, firstLine + unlinkedCode->lineCount()); 145 m_recentlyUsedFunctionCode.add(unlinkedCode, *cacheEntry); 146 return unlinkedCode; 147 } 148 } 149 UnlinkedFunctionCodeBlock* result = generateFunctionCodeBlock(globalData, executable, source, kind, debuggerMode, profilerMode, error); 150 m_cachedFunctionExecutables.add(key, Strong<UnlinkedFunctionCodeBlock>(globalData, result)); 151 return result; 135 return generateFunctionCodeBlock(globalData, executable, source, kind, debuggerMode, profilerMode, error); 152 136 } 153 137 -
trunk/Source/JavaScriptCore/runtime/CodeCache.h
r136773 r136860 114 114 { 115 115 m_cachedCodeBlocks.clear(); 116 m_cachedFunctionExecutables.clear();117 116 m_cachedGlobalFunctions.clear(); 118 117 m_recentlyUsedFunctionCode.clear(); … … 139 138 140 139 CacheMap<CodeBlockKey, Strong<UnlinkedCodeBlock>, kMaxCodeBlockEntries> m_cachedCodeBlocks; 141 CacheMap<CodeBlockKey, Strong<UnlinkedFunctionCodeBlock>, kMaxFunctionCodeBlocks> m_cachedFunctionExecutables;142 140 CacheMap<GlobalFunctionKey, Strong<UnlinkedFunctionExecutable>, kMaxFunctionCodeBlocks> m_cachedGlobalFunctions; 143 141 CacheMap<UnlinkedFunctionCodeBlock*, Strong<UnlinkedFunctionCodeBlock>, kMaxFunctionCodeBlocks> m_recentlyUsedFunctionCode;
Note: See TracChangeset
for help on using the changeset viewer.