Changeset 172614 in webkit for trunk/Source/JavaScriptCore/bytecode
- Timestamp:
- Aug 14, 2014, 4:59:44 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore/bytecode
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/BytecodeList.json
r172176 r172614 110 110 { "name" : "op_resolve_scope", "length" : 6 }, 111 111 { "name" : "op_get_from_scope", "length" : 8 }, 112 { "name" : "op_get_from_scope_with_profile", "length" : 9 },113 112 { "name" : "op_put_to_scope", "length" : 7 }, 114 { "name" : "op_put_to_scope_with_profile", "length" : 8 },115 113 { "name" : "op_push_with_scope", "length" : 2 }, 116 114 { "name" : "op_pop_scope", "length" : 1 }, … … 123 121 { "name" : "op_profile_did_call", "length" : 2 }, 124 122 { "name" : "op_end", "length" : 2 }, 125 { "name" : "op_profile_types_with_high_fidelity", "length" : 4},123 { "name" : "op_profile_types_with_high_fidelity", "length" : 6 }, 126 124 { "name" : "op_get_enumerable_length", "length" : 3 }, 127 125 { "name" : "op_has_indexed_property", "length" : 5 }, -
trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h
r172176 r172614 107 107 case op_put_by_id_out_of_line: 108 108 case op_put_by_id: 109 case op_put_to_scope_with_profile:110 109 case op_put_to_scope: { 111 110 functor(codeBlock, instruction, opcodeID, instruction[1].u.operand); … … 124 123 case op_init_global_const: 125 124 case op_push_name_scope: 126 case op_get_from_scope_with_profile:127 125 case op_get_from_scope: 128 126 case op_to_primitive: … … 252 250 case op_push_with_scope: 253 251 case op_put_to_scope: 254 case op_put_to_scope_with_profile:255 252 case op_pop_scope: 256 253 case op_end: … … 322 319 case op_call_varargs: 323 320 case op_construct_varargs: 324 case op_get_from_scope_with_profile:325 321 case op_get_from_scope: 326 322 case op_call: -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r172176 r172614 1524 1524 break; 1525 1525 } 1526 case op_put_to_scope_with_profile:1527 1526 case op_put_to_scope: { 1528 1527 int r0 = (++it)->u.operand; … … 1533 1532 int operand = (++it)->u.operand; // Operand 1534 1533 printLocationAndOp(out, exec, location, it, "put_to_scope"); 1535 if (opcode == op_put_to_scope_with_profile)1536 ++it;1537 1534 out.printf("%s, %s, %s, %u<%s|%s>, <structure>, %d", 1538 1535 registerName(r0).data(), idName(id0, identifier(id0)).data(), registerName(r1).data(), … … 1717 1714 1718 1715 if (SymbolTable* symbolTable = unlinkedCodeBlock->symbolTable()) { 1716 if (m_vm->isProfilingTypesWithHighFidelity()) { 1717 ConcurrentJITLocker locker(symbolTable->m_lock); 1718 symbolTable->prepareForHighFidelityTypeProfiling(locker); 1719 } 1720 1719 1721 if (codeType() == FunctionCode && symbolTable->captureCount()) { 1720 1722 m_symbolTable.set(*m_vm, m_ownerExecutable.get(), symbolTable->cloneCapturedNames(*m_vm)); … … 1950 1952 } 1951 1953 1952 case op_get_from_scope_with_profile:1953 1954 case op_get_from_scope: { 1954 int offset = (pc[0].u.opcode == op_get_from_scope_with_profile ? 2 : 1); 1955 ValueProfile* profile = &m_valueProfiles[pc[opLength - offset].u.operand]; 1955 ValueProfile* profile = &m_valueProfiles[pc[opLength - 1].u.operand]; 1956 1956 ASSERT(profile->m_bytecodeOffset == -1); 1957 1957 profile->m_bytecodeOffset = i; 1958 instructions[i + opLength - offset] = profile;1958 instructions[i + opLength - 1] = profile; 1959 1959 1960 1960 // get_from_scope dst, scope, id, ResolveModeAndType, Structure, Operand … … 1970 1970 instructions[i + 6].u.pointer = reinterpret_cast<void*>(op.operand); 1971 1971 1972 if (pc[0].u.opcode == op_get_from_scope_with_profile) { 1973 // The format of this instruction is: get_from_scope_with_profile dst, scope, id, ResolveModeAndType, Structure, Operand, ..., TypeLocation 1974 size_t instructionOffset = i + opLength - 1; 1975 TypeLocation* location = scopeDependentProfile(op, ident, instructionOffset); 1976 instructions[i + 8].u.location = location; 1977 } 1978 break; 1979 } 1980 1981 case op_put_to_scope_with_profile: 1972 break; 1973 } 1974 1982 1975 case op_put_to_scope: { 1983 1976 // put_to_scope scope, id, value, ResolveModeAndType, Structure, Operand … … 1996 1989 instructions[i + 6].u.pointer = reinterpret_cast<void*>(op.operand); 1997 1990 1998 if (pc[0].u.opcode == op_put_to_scope_with_profile) {1999 // The format of this instruction is: put_to_scope_with_profile scope, id, value, ResolveModeAndType, Structure, Operand, TypeLocation*2000 size_t instructionOffset = i + opLength - 1;2001 TypeLocation* location = scopeDependentProfile(op, ident, instructionOffset);2002 instructions[i + 7].u.location = location;2003 }2004 1991 break; 2005 1992 } 2006 1993 2007 1994 case op_profile_types_with_high_fidelity: { 1995 // The format of this instruction is: op_profile_types_with_high_fidelity regToProfile, TypeLocation*, flag, identifier?, resolveType? 2008 1996 size_t instructionOffset = i + opLength - 1; 2009 1997 unsigned divotStart, divotEnd; … … 2011 1999 RefPtr<TypeSet> globalTypeSet; 2012 2000 bool shouldAnalyze = m_unlinkedCode->highFidelityTypeProfileExpressionInfoForBytecodeOffset(instructionOffset, divotStart, divotEnd); 2013 VirtualRegister virtualRegister(pc[1].u.operand); 2014 SymbolTable* symbolTable = m_symbolTable.get(); 2015 2001 VirtualRegister profileRegister(pc[1].u.operand); 2016 2002 ProfileTypesWithHighFidelityBytecodeFlag flag = static_cast<ProfileTypesWithHighFidelityBytecodeFlag>(pc[3].u.operand); 2003 SymbolTable* symbolTable = nullptr; 2004 2017 2005 switch (flag) { 2006 case ProfileTypesBytecodePutToScope: 2007 case ProfileTypesBytecodeGetFromScope: { 2008 const Identifier& ident = identifier(pc[4].u.operand); 2009 ResolveType type = static_cast<ResolveType>(pc[5].u.operand); 2010 ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), scope, ident, (flag == ProfileTypesBytecodeGetFromScope ? Get : Put), type); 2011 2012 // FIXME: handle other values for op.type here, and also consider what to do when we can't statically determine the globalID 2013 // https://bugs.webkit.org/show_bug.cgi?id=135184 2014 if (op.type == ClosureVar) 2015 symbolTable = op.activation->symbolTable(); 2016 else if (op.type == GlobalVar) 2017 symbolTable = m_globalObject.get()->symbolTable(); 2018 2019 if (symbolTable) { 2020 ConcurrentJITLocker locker(symbolTable->m_lock); 2021 // If our parent scope was created while profiling was disabled, it will not have prepared for profiling yet. 2022 symbolTable->prepareForHighFidelityTypeProfiling(locker); 2023 globalVariableID = symbolTable->uniqueIDForVariable(locker, ident.impl(), *vm()); 2024 globalTypeSet = symbolTable->globalTypeSetForVariable(locker, ident.impl(), *vm()); 2025 } else 2026 globalVariableID = HighFidelityNoGlobalIDExists; 2027 2028 break; 2029 } 2018 2030 case ProfileTypesBytecodeHasGlobalID: { 2031 symbolTable = m_symbolTable.get(); 2019 2032 ConcurrentJITLocker locker(symbolTable->m_lock); 2020 globalVariableID = symbolTable->uniqueIDForRegister(locker, virtualRegister.offset(), *vm());2021 globalTypeSet = symbolTable->globalTypeSetForRegister(locker, virtualRegister.offset(), *vm());2033 globalVariableID = symbolTable->uniqueIDForRegister(locker, profileRegister.offset(), *vm()); 2034 globalTypeSet = symbolTable->globalTypeSetForRegister(locker, profileRegister.offset(), *vm()); 2022 2035 break; 2023 2036 } … … 2025 2038 case ProfileTypesBytecodeFunctionArgument: { 2026 2039 globalVariableID = HighFidelityNoGlobalIDExists; 2027 break;2028 }2029 case ProfileTypesBytecodeFunctionThisObject: {2030 globalVariableID = HighFidelityThisStatement;2031 2040 break; 2032 2041 } … … 2044 2053 } 2045 2054 2046 std::pair<TypeLocation*, bool> locationPair = vm()->highFidelityTypeProfiler()->typeLocationCache()->getTypeLocation(globalVariableID, m_ownerExecutable->sourceID(), divotStart, divotEnd, globalTypeSet, vm()); 2055 std::pair<TypeLocation*, bool> locationPair = vm()->highFidelityTypeProfiler()->typeLocationCache()->getTypeLocation(globalVariableID, 2056 m_ownerExecutable->sourceID(), divotStart, divotEnd, globalTypeSet, vm()); 2047 2057 TypeLocation* location = locationPair.first; 2048 2058 bool isNewLocation = locationPair.second; … … 2525 2535 break; 2526 2536 } 2527 case op_get_from_scope_with_profile:2528 2537 case op_get_from_scope: 2529 case op_put_to_scope_with_profile:2530 2538 case op_put_to_scope: { 2531 2539 ResolveModeAndType modeAndType = … … 3936 3944 #endif 3937 3945 3938 TypeLocation* CodeBlock::scopeDependentProfile(ResolveOp op, const Identifier& ident, size_t instructionOffset)3939 {3940 unsigned divotStart, divotEnd;3941 bool shouldAnalyze = m_unlinkedCode->highFidelityTypeProfileExpressionInfoForBytecodeOffset(instructionOffset, divotStart, divotEnd);3942 GlobalVariableID globalVariableID;3943 RefPtr<TypeSet> globalTypeSet;3944 3945 // FIXME: handle other values for op.type here, and also consider what to do when we can't statically determine the globalID3946 SymbolTable* symbolTable = nullptr;3947 if (op.type == ClosureVar)3948 symbolTable = op.activation->symbolTable();3949 else if (op.type == GlobalVar)3950 symbolTable = m_globalObject.get()->symbolTable();3951 3952 if (symbolTable) {3953 ConcurrentJITLocker locker(symbolTable->m_lock);3954 globalVariableID = symbolTable->uniqueIDForVariable(locker, ident.impl(), *vm());3955 globalTypeSet = symbolTable->globalTypeSetForVariable(locker, ident.impl(), *vm());3956 } else3957 globalVariableID = HighFidelityNoGlobalIDExists;3958 3959 std::pair<TypeLocation*, bool> locationPair = vm()->highFidelityTypeProfiler()->typeLocationCache()->getTypeLocation(globalVariableID, m_ownerExecutable->sourceID(), divotStart, divotEnd, globalTypeSet, vm());3960 TypeLocation* location = locationPair.first;3961 bool isNewLocation = locationPair.second;3962 3963 if (shouldAnalyze & isNewLocation)3964 vm()->highFidelityTypeProfiler()->insertNewLocation(location);3965 3966 return location;3967 }3968 3969 3946 } // namespace JSC -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r172176 r172614 1021 1021 } 1022 1022 1023 TypeLocation* scopeDependentProfile(ResolveOp, const Identifier&, size_t);1024 1025 1023 #if ENABLE(JIT) 1026 1024 void resetStubInternal(RepatchBuffer&, StructureStubInfo&); -
trunk/Source/JavaScriptCore/bytecode/TypeLocation.h
r172176 r172614 34 34 HighFidelityNeedsUniqueIDGeneration = -1, 35 35 HighFidelityNoGlobalIDExists = -2, 36 HighFidelityReturnStatement = -3, 37 HighFidelityThisStatement = -4 36 HighFidelityReturnStatement = -3 38 37 }; 39 38 … … 42 41 class TypeLocation { 43 42 public: 44 TypeLocation() 45 : m_divotForFunctionOffsetIfReturnStatement(UINT_MAX) 43 TypeLocation() 44 : m_lastSeenType(TypeNothing) 45 , m_divotForFunctionOffsetIfReturnStatement(UINT_MAX) 46 46 , m_instructionTypeSet(TypeSet::create()) 47 47 , m_globalTypeSet(nullptr) … … 50 50 51 51 GlobalVariableID m_globalVariableID; 52 RuntimeType m_lastSeenType; 52 53 intptr_t m_sourceID; 53 54 unsigned m_divotStart;
Note:
See TracChangeset
for help on using the changeset viewer.