Changeset 172820 in webkit for trunk/Source/JavaScriptCore/bytecode
- Timestamp:
- Aug 20, 2014, 6:03:20 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore/bytecode
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/BytecodeList.json
r172665 r172820 121 121 { "name" : "op_profile_did_call", "length" : 2 }, 122 122 { "name" : "op_end", "length" : 2 }, 123 { "name" : "op_profile_type s_with_high_fidelity", "length" : 6 },123 { "name" : "op_profile_type", "length" : 6 }, 124 124 { "name" : "op_get_enumerable_length", "length" : 3 }, 125 125 { "name" : "op_has_indexed_property", "length" : 5 }, -
trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h
r172614 r172820 66 66 case op_profile_will_call: 67 67 case op_profile_did_call: 68 case op_profile_type s_with_high_fidelity:68 case op_profile_type: 69 69 case op_throw: 70 70 case op_push_with_scope: … … 288 288 case op_put_by_index: 289 289 case op_tear_off_arguments: 290 case op_profile_type s_with_high_fidelity:290 case op_profile_type: 291 291 case op_touch_entry: 292 292 #define LLINT_HELPER_OPCODES(opcode, length) case opcode: -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r172808 r172820 41 41 #include "Debugger.h" 42 42 #include "FunctionExecutableDump.h" 43 #include "HighFidelityTypeProfiler.h"44 43 #include "Interpreter.h" 45 44 #include "JIT.h" … … 50 49 #include "JSNameScope.h" 51 50 #include "LLIntEntrypoint.h" 52 #include "TypeLocationCache.h"53 51 #include "LowLevelInterpreter.h" 54 52 #include "JSCInlines.h" … … 61 59 #include "SlotVisitorInlines.h" 62 60 #include "StackVisitor.h" 61 #include "TypeLocationCache.h" 62 #include "TypeProfiler.h" 63 63 #include "UnlinkedInstructionStream.h" 64 64 #include <wtf/BagToHashMap.h> … … 840 840 break; 841 841 } 842 case op_profile_type s_with_high_fidelity: {842 case op_profile_type: { 843 843 int r0 = (++it)->u.operand; 844 844 ++it; 845 845 ++it; 846 printLocationAndOp(out, exec, location, it, "op_profile_type s_with_high_fidelity");846 printLocationAndOp(out, exec, location, it, "op_profile_type"); 847 847 out.printf("%s", registerName(r0).data()); 848 848 break; … … 1715 1715 1716 1716 if (SymbolTable* symbolTable = unlinkedCodeBlock->symbolTable()) { 1717 if (m_vm-> isProfilingTypesWithHighFidelity()) {1717 if (m_vm->typeProfiler()) { 1718 1718 ConcurrentJITLocker locker(symbolTable->m_lock); 1719 symbolTable->prepareFor HighFidelityTypeProfiling(locker);1719 symbolTable->prepareForTypeProfiling(locker); 1720 1720 } 1721 1721 … … 1730 1730 setNumParameters(unlinkedCodeBlock->numParameters()); 1731 1731 1732 if (vm()-> isProfilingTypesWithHighFidelity())1733 vm()-> highFidelityTypeProfiler()->functionHasExecutedCache()->removeUnexecutedRange(m_ownerExecutable->sourceID(), m_ownerExecutable->highFidelityTypeProfilingStartOffset(), m_ownerExecutable->highFidelityTypeProfilingEndOffset());1732 if (vm()->typeProfiler()) 1733 vm()->typeProfiler()->functionHasExecutedCache()->removeUnexecutedRange(m_ownerExecutable->sourceID(), m_ownerExecutable->typeProfilingStartOffset(), m_ownerExecutable->typeProfilingEndOffset()); 1734 1734 1735 1735 setConstantRegisters(unlinkedCodeBlock->constantRegisters()); … … 1739 1739 for (size_t count = unlinkedCodeBlock->numberOfFunctionDecls(), i = 0; i < count; ++i) { 1740 1740 UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionDecl(i); 1741 if (vm()-> isProfilingTypesWithHighFidelity())1742 vm()-> highFidelityTypeProfiler()->functionHasExecutedCache()->insertUnexecutedRange(m_ownerExecutable->sourceID(), unlinkedExecutable->highFidelityTypeProfilingStartOffset(), unlinkedExecutable->highFidelityTypeProfilingEndOffset());1741 if (vm()->typeProfiler()) 1742 vm()->typeProfiler()->functionHasExecutedCache()->insertUnexecutedRange(m_ownerExecutable->sourceID(), unlinkedExecutable->typeProfilingStartOffset(), unlinkedExecutable->typeProfilingEndOffset()); 1743 1743 unsigned lineCount = unlinkedExecutable->lineCount(); 1744 1744 unsigned firstLine = ownerExecutable->lineNo() + unlinkedExecutable->firstLineOffset(); … … 1757 1757 for (size_t count = unlinkedCodeBlock->numberOfFunctionExprs(), i = 0; i < count; ++i) { 1758 1758 UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionExpr(i); 1759 if (vm()-> isProfilingTypesWithHighFidelity())1760 vm()-> highFidelityTypeProfiler()->functionHasExecutedCache()->insertUnexecutedRange(m_ownerExecutable->sourceID(), unlinkedExecutable->highFidelityTypeProfilingStartOffset(), unlinkedExecutable->highFidelityTypeProfilingEndOffset());1759 if (vm()->typeProfiler()) 1760 vm()->typeProfiler()->functionHasExecutedCache()->insertUnexecutedRange(m_ownerExecutable->sourceID(), unlinkedExecutable->typeProfilingStartOffset(), unlinkedExecutable->typeProfilingEndOffset()); 1761 1761 unsigned lineCount = unlinkedExecutable->lineCount(); 1762 1762 unsigned firstLine = ownerExecutable->lineNo() + unlinkedExecutable->firstLineOffset(); … … 1993 1993 } 1994 1994 1995 case op_profile_type s_with_high_fidelity: {1996 // The format of this instruction is: op_profile_type s_with_high_fidelityregToProfile, TypeLocation*, flag, identifier?, resolveType?1995 case op_profile_type: { 1996 // The format of this instruction is: op_profile_type regToProfile, TypeLocation*, flag, identifier?, resolveType? 1997 1997 size_t instructionOffset = i + opLength - 1; 1998 1998 unsigned divotStart, divotEnd; 1999 1999 GlobalVariableID globalVariableID; 2000 2000 RefPtr<TypeSet> globalTypeSet; 2001 bool shouldAnalyze = m_unlinkedCode-> highFidelityTypeProfileExpressionInfoForBytecodeOffset(instructionOffset, divotStart, divotEnd);2001 bool shouldAnalyze = m_unlinkedCode->typeProfilerExpressionInfoForBytecodeOffset(instructionOffset, divotStart, divotEnd); 2002 2002 VirtualRegister profileRegister(pc[1].u.operand); 2003 ProfileType sWithHighFidelityBytecodeFlag flag = static_cast<ProfileTypesWithHighFidelityBytecodeFlag>(pc[3].u.operand);2003 ProfileTypeBytecodeFlag flag = static_cast<ProfileTypeBytecodeFlag>(pc[3].u.operand); 2004 2004 SymbolTable* symbolTable = nullptr; 2005 2005 2006 2006 switch (flag) { 2007 case ProfileType sBytecodePutToScope:2008 case ProfileType sBytecodeGetFromScope: {2007 case ProfileTypeBytecodePutToScope: 2008 case ProfileTypeBytecodeGetFromScope: { 2009 2009 const Identifier& ident = identifier(pc[4].u.operand); 2010 2010 ResolveType type = static_cast<ResolveType>(pc[5].u.operand); 2011 ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), needsActivation(), scope, ident, (flag == ProfileType sBytecodeGetFromScope ? Get : Put), type);2011 ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), needsActivation(), scope, ident, (flag == ProfileTypeBytecodeGetFromScope ? Get : Put), type); 2012 2012 2013 2013 // FIXME: handle other values for op.type here, and also consider what to do when we can't statically determine the globalID … … 2021 2021 ConcurrentJITLocker locker(symbolTable->m_lock); 2022 2022 // If our parent scope was created while profiling was disabled, it will not have prepared for profiling yet. 2023 symbolTable->prepareFor HighFidelityTypeProfiling(locker);2023 symbolTable->prepareForTypeProfiling(locker); 2024 2024 globalVariableID = symbolTable->uniqueIDForVariable(locker, ident.impl(), *vm()); 2025 2025 globalTypeSet = symbolTable->globalTypeSetForVariable(locker, ident.impl(), *vm()); 2026 2026 } else 2027 globalVariableID = HighFidelityNoGlobalIDExists;2027 globalVariableID = TypeProfilerNoGlobalIDExists; 2028 2028 2029 2029 break; 2030 2030 } 2031 case ProfileType sBytecodeHasGlobalID: {2031 case ProfileTypeBytecodeHasGlobalID: { 2032 2032 symbolTable = m_symbolTable.get(); 2033 2033 ConcurrentJITLocker locker(symbolTable->m_lock); … … 2036 2036 break; 2037 2037 } 2038 case ProfileType sBytecodeDoesNotHaveGlobalID:2039 case ProfileType sBytecodeFunctionArgument: {2040 globalVariableID = HighFidelityNoGlobalIDExists;2038 case ProfileTypeBytecodeDoesNotHaveGlobalID: 2039 case ProfileTypeBytecodeFunctionArgument: { 2040 globalVariableID = TypeProfilerNoGlobalIDExists; 2041 2041 break; 2042 2042 } 2043 case ProfileType sBytecodeFunctionReturnStatement: {2043 case ProfileTypeBytecodeFunctionReturnStatement: { 2044 2044 globalTypeSet = returnStatementTypeSet(); 2045 globalVariableID = HighFidelityReturnStatement;2045 globalVariableID = TypeProfilerReturnStatement; 2046 2046 if (!shouldAnalyze) { 2047 2047 // Because some return statements are added implicitly (to return undefined at the end of a function), and these nodes don't emit expression ranges, give them some range. … … 2054 2054 } 2055 2055 2056 std::pair<TypeLocation*, bool> locationPair = vm()-> highFidelityTypeProfiler()->typeLocationCache()->getTypeLocation(globalVariableID,2056 std::pair<TypeLocation*, bool> locationPair = vm()->typeProfiler()->typeLocationCache()->getTypeLocation(globalVariableID, 2057 2057 m_ownerExecutable->sourceID(), divotStart, divotEnd, globalTypeSet, vm()); 2058 2058 TypeLocation* location = locationPair.first; 2059 2059 bool isNewLocation = locationPair.second; 2060 2060 2061 if (ProfileType sBytecodeFunctionReturnStatement)2061 if (ProfileTypeBytecodeFunctionReturnStatement) 2062 2062 location->m_divotForFunctionOffsetIfReturnStatement = m_sourceOffset; 2063 2063 2064 2064 if (shouldAnalyze && isNewLocation) 2065 vm()-> highFidelityTypeProfiler()->insertNewLocation(location);2065 vm()->typeProfiler()->insertNewLocation(location); 2066 2066 2067 2067 instructions[i + 2].u.location = location; -
trunk/Source/JavaScriptCore/bytecode/TypeLocation.h
r172614 r172820 31 31 namespace JSC { 32 32 33 enum HighFidelityGlobalIDFlags {34 HighFidelityNeedsUniqueIDGeneration = -1,35 HighFidelityNoGlobalIDExists = -2,36 HighFidelityReturnStatement = -333 enum TypeProfilerGlobalIDFlags { 34 TypeProfilerNeedsUniqueIDGeneration = -1, 35 TypeProfilerNoGlobalIDExists = -2, 36 TypeProfilerReturnStatement = -3 37 37 }; 38 38 -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
r172176 r172820 100 100 , m_startOffset(node->source().startOffset() - source.startOffset()) 101 101 , m_sourceLength(node->source().length()) 102 , m_ highFidelityTypeProfilingStartOffset(node->functionNameStart())103 , m_ highFidelityTypeProfilingEndOffset(node->startStartOffset() + node->source().length() - 1)102 , m_typeProfilingStartOffset(node->functionNameStart()) 103 , m_typeProfilingEndOffset(node->startStartOffset() + node->source().length() - 1) 104 104 , m_features(node->features()) 105 105 , m_functionMode(node->functionMode()) … … 403 403 } 404 404 405 bool UnlinkedCodeBlock:: highFidelityTypeProfileExpressionInfoForBytecodeOffset(unsigned bytecodeOffset, unsigned& startDivot, unsigned& endDivot)405 bool UnlinkedCodeBlock::typeProfilerExpressionInfoForBytecodeOffset(unsigned bytecodeOffset, unsigned& startDivot, unsigned& endDivot) 406 406 { 407 407 static const bool verbose = false; 408 auto iter = m_ highFidelityTypeProfileInfoMap.find(bytecodeOffset);409 if (iter == m_ highFidelityTypeProfileInfoMap.end()) {408 auto iter = m_typeProfilerInfoMap.find(bytecodeOffset); 409 if (iter == m_typeProfilerInfoMap.end()) { 410 410 if (verbose) 411 411 dataLogF("Don't have assignment info for offset:%u\n", bytecodeOffset); … … 415 415 } 416 416 417 HighFidelityTypeProfileExpressionRange& range = iter->value;417 TypeProfilerExpressionRange& range = iter->value; 418 418 startDivot = range.m_startDivot; 419 419 endDivot = range.m_endDivot; … … 421 421 } 422 422 423 void UnlinkedCodeBlock::add HighFidelityTypeProfileExpressionInfo(unsigned instructionOffset, unsigned startDivot, unsigned endDivot)424 { 425 HighFidelityTypeProfileExpressionRange range;423 void UnlinkedCodeBlock::addTypeProfilerExpressionInfo(unsigned instructionOffset, unsigned startDivot, unsigned endDivot) 424 { 425 TypeProfilerExpressionRange range; 426 426 range.m_startDivot = startDivot; 427 427 range.m_endDivot = endDivot; 428 m_ highFidelityTypeProfileInfoMap.set(instructionOffset, range);428 m_typeProfilerInfoMap.set(instructionOffset, range); 429 429 } 430 430 -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
r172176 r172820 126 126 unsigned startOffset() const { return m_startOffset; } 127 127 unsigned sourceLength() { return m_sourceLength; } 128 unsigned highFidelityTypeProfilingStartOffset() const { return m_highFidelityTypeProfilingStartOffset; }129 unsigned highFidelityTypeProfilingEndOffset() const { return m_highFidelityTypeProfilingEndOffset; }128 unsigned typeProfilingStartOffset() const { return m_typeProfilingStartOffset; } 129 unsigned typeProfilingEndOffset() const { return m_typeProfilingEndOffset; } 130 130 131 131 String paramString() const; … … 188 188 unsigned m_startOffset; 189 189 unsigned m_sourceLength; 190 unsigned m_ highFidelityTypeProfilingStartOffset;191 unsigned m_ highFidelityTypeProfilingEndOffset;190 unsigned m_typeProfilingStartOffset; 191 unsigned m_typeProfilingEndOffset; 192 192 193 193 CodeFeatures m_features; … … 277 277 int startOffset, int endOffset, unsigned line, unsigned column); 278 278 279 void add HighFidelityTypeProfileExpressionInfo(unsigned instructionOffset, unsigned startDivot, unsigned endDivot);279 void addTypeProfilerExpressionInfo(unsigned instructionOffset, unsigned startDivot, unsigned endDivot); 280 280 281 281 bool hasExpressionInfo() { return m_expressionInfo.size(); } … … 471 471 int& startOffset, int& endOffset, unsigned& line, unsigned& column); 472 472 473 bool highFidelityTypeProfileExpressionInfoForBytecodeOffset(unsigned bytecodeOffset, unsigned& startDivot, unsigned& endDivot);473 bool typeProfilerExpressionInfoForBytecodeOffset(unsigned bytecodeOffset, unsigned& startDivot, unsigned& endDivot); 474 474 475 475 void recordParse(CodeFeatures features, bool hasCapturedVariables, unsigned firstLine, unsigned lineCount, unsigned endColumn) … … 584 584 OwnPtr<RareData> m_rareData; 585 585 Vector<ExpressionRangeInfo> m_expressionInfo; 586 struct HighFidelityTypeProfileExpressionRange {586 struct TypeProfilerExpressionRange { 587 587 unsigned m_startDivot; 588 588 unsigned m_endDivot; 589 589 }; 590 HashMap<unsigned, HighFidelityTypeProfileExpressionRange> m_highFidelityTypeProfileInfoMap;590 HashMap<unsigned, TypeProfilerExpressionRange> m_typeProfilerInfoMap; 591 591 592 592 protected:
Note:
See TracChangeset
for help on using the changeset viewer.