Changeset 192935 in webkit for trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
- Timestamp:
- Dec 1, 2015, 5:37:19 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r192914 r192935 586 586 static_cast<unsigned long>(instructions().size()), 587 587 static_cast<unsigned long>(instructions().size() * sizeof(Instruction)), 588 m_numParameters, m_numCallee Locals, m_numVars);588 m_numParameters, m_numCalleeRegisters, m_numVars); 589 589 if (needsActivation() && codeType() == FunctionCode) 590 590 out.printf("; lexical environment in r%d", activationRegister().offset()); … … 681 681 } 682 682 683 if (m_rareData && !m_rareData->m_liveCalleeLocalsAtYield.isEmpty()) {684 out.printf("\nLive Callee Locals:\n");685 unsigned i = 0;686 do {687 const FastBitVector& liveness = m_rareData->m_liveCalleeLocalsAtYield[i];688 out.printf(" live%1u = ", i);689 liveness.dump(out);690 out.printf("\n");691 ++i;692 } while (i < m_rareData->m_liveCalleeLocalsAtYield.size());693 }694 695 683 out.printf("\n"); 696 684 } … … 1316 1304 break; 1317 1305 } 1318 case op_new_generator_func: {1319 int r0 = (++it)->u.operand;1320 int r1 = (++it)->u.operand;1321 int f0 = (++it)->u.operand;1322 printLocationAndOp(out, exec, location, it, "new_generator_func");1323 out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);1324 break;1325 }1326 1306 case op_new_arrow_func_exp: { 1327 1307 int r0 = (++it)->u.operand; … … 1338 1318 int f0 = (++it)->u.operand; 1339 1319 printLocationAndOp(out, exec, location, it, "new_func_exp"); 1340 out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0);1341 break;1342 }1343 case op_new_generator_func_exp: {1344 int r0 = (++it)->u.operand;1345 int r1 = (++it)->u.operand;1346 int f0 = (++it)->u.operand;1347 printLocationAndOp(out, exec, location, it, "new_generator_func_exp");1348 1320 out.printf("%s, %s, f%d", registerName(r0).data(), registerName(r1).data(), f0); 1349 1321 break; … … 1537 1509 break; 1538 1510 } 1539 case op_save: {1540 int generator = (++it)->u.operand;1541 unsigned liveCalleeLocalsIndex = (++it)->u.unsignedValue;1542 int offset = (++it)->u.operand;1543 const FastBitVector& liveness = m_rareData->m_liveCalleeLocalsAtYield[liveCalleeLocalsIndex];1544 printLocationAndOp(out, exec, location, it, "save");1545 out.printf("%s, ", registerName(generator).data());1546 liveness.dump(out);1547 out.printf("(@live%1u), %d(->%d)", liveCalleeLocalsIndex, offset, location + offset);1548 break;1549 }1550 case op_resume: {1551 int generator = (++it)->u.operand;1552 unsigned liveCalleeLocalsIndex = (++it)->u.unsignedValue;1553 const FastBitVector& liveness = m_rareData->m_liveCalleeLocalsAtYield[liveCalleeLocalsIndex];1554 printLocationAndOp(out, exec, location, it, "resume");1555 out.printf("%s, ", registerName(generator).data());1556 liveness.dump(out);1557 out.printf("(@live%1u)", liveCalleeLocalsIndex);1558 break;1559 }1560 1511 case op_assert: { 1561 1512 int condition = (++it)->u.operand; … … 1722 1673 , m_globalObject(other.m_globalObject) 1723 1674 , m_heap(other.m_heap) 1724 , m_numCallee Locals(other.m_numCalleeLocals)1675 , m_numCalleeRegisters(other.m_numCalleeRegisters) 1725 1676 , m_numVars(other.m_numVars) 1726 1677 , m_isConstructor(other.m_isConstructor) … … 1779 1730 m_rareData->m_switchJumpTables = other.m_rareData->m_switchJumpTables; 1780 1731 m_rareData->m_stringSwitchJumpTables = other.m_rareData->m_stringSwitchJumpTables; 1781 m_rareData->m_liveCalleeLocalsAtYield = other.m_rareData->m_liveCalleeLocalsAtYield;1782 1732 } 1783 1733 … … 1790 1740 , m_globalObject(scope->globalObject()->vm(), this, scope->globalObject()) 1791 1741 , m_heap(&m_globalObject->vm().heap) 1792 , m_numCallee Locals(unlinkedCodeBlock->m_numCalleeLocals)1742 , m_numCalleeRegisters(unlinkedCodeBlock->m_numCalleeRegisters) 1793 1743 , m_numVars(unlinkedCodeBlock->m_numVars) 1794 1744 , m_isConstructor(unlinkedCodeBlock->isConstructor()) … … 1960 1910 HashSet<JSModuleEnvironment*> stronglyReferencedModuleEnvironments; 1961 1911 1962 // Bookkeep the merge point bytecode offsets.1963 Vector<size_t> mergePointBytecodeOffsets;1964 1965 1912 RefCountedArray<Instruction> instructions(instructionCount); 1966 1913 … … 2251 2198 } 2252 2199 2253 case op_save: {2254 unsigned liveCalleeLocalsIndex = pc[2].u.index;2255 int offset = pc[3].u.operand;2256 if (liveCalleeLocalsIndex >= mergePointBytecodeOffsets.size())2257 mergePointBytecodeOffsets.resize(liveCalleeLocalsIndex + 1);2258 mergePointBytecodeOffsets[liveCalleeLocalsIndex] = i + offset;2259 break;2260 }2261 2262 2200 default: 2263 2201 break; … … 2270 2208 2271 2209 m_instructions = WTF::move(instructions); 2272 2273 // Perform bytecode liveness analysis to determine which locals are live and should be resumed when executing op_resume.2274 if (unlinkedCodeBlock->parseMode() == SourceParseMode::GeneratorBodyMode) {2275 if (size_t count = mergePointBytecodeOffsets.size()) {2276 createRareDataIfNecessary();2277 BytecodeLivenessAnalysis liveness(this);2278 m_rareData->m_liveCalleeLocalsAtYield.grow(count);2279 size_t liveCalleeLocalsIndex = 0;2280 for (size_t bytecodeOffset : mergePointBytecodeOffsets) {2281 m_rareData->m_liveCalleeLocalsAtYield[liveCalleeLocalsIndex] = liveness.getLivenessInfoAtBytecodeOffset(bytecodeOffset);2282 ++liveCalleeLocalsIndex;2283 }2284 }2285 }2286 2210 2287 2211 // Set optimization thresholds only after m_instructions is initialized, since these … … 2308 2232 , m_globalObject(globalObject->vm(), this, globalObject) 2309 2233 , m_heap(&m_globalObject->vm().heap) 2310 , m_numCallee Locals(0)2234 , m_numCalleeRegisters(0) 2311 2235 , m_numVars(0) 2312 2236 , m_isConstructor(false) … … 3135 3059 m_rareData->m_switchJumpTables.shrinkToFit(); 3136 3060 m_rareData->m_stringSwitchJumpTables.shrinkToFit(); 3137 m_rareData->m_liveCalleeLocalsAtYield.shrinkToFit();3138 3061 } 3139 3062 } // else don't shrink these, because we would have already pointed pointers into these tables. … … 4107 4030 FastBitVector liveAtHead = liveness.getLivenessInfoAtBytecodeOffset(0); 4108 4031 4109 if (liveAtHead.numBits() != static_cast<size_t>(m_numCallee Locals)) {4032 if (liveAtHead.numBits() != static_cast<size_t>(m_numCalleeRegisters)) { 4110 4033 beginValidationDidFail(); 4111 4034 dataLog(" Wrong number of bits in result!\n"); … … 4115 4038 } 4116 4039 4117 for (unsigned i = m_numCallee Locals; i--;) {4040 for (unsigned i = m_numCalleeRegisters; i--;) { 4118 4041 VirtualRegister reg = virtualRegisterForLocal(i); 4119 4042
Note:
See TracChangeset
for help on using the changeset viewer.