Changeset 172820 in webkit for trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
- Timestamp:
- Aug 20, 2014, 6:03:20 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.