Changeset 254632 in webkit for trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
- Timestamp:
- Jan 15, 2020, 1:30:57 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r254464 r254632 114 114 , m_numArguments(m_codeBlock->numParameters()) 115 115 , m_numLocals(m_codeBlock->numCalleeLocals()) 116 , m_numTmps(m_codeBlock->numTmps())117 116 , m_parameterSlots(0) 118 117 , m_numPassedVarArgs(0) … … 142 141 m_graph.block(i)->ensureLocals(newNumLocals); 143 142 } 144 145 void ensureTmps(unsigned newNumTmps)146 {147 VERBOSE_LOG(" ensureTmps: trying to raise m_numTmps from ", m_numTmps, " to ", newNumTmps, "\n");148 if (newNumTmps <= m_numTmps)149 return;150 m_numTmps = newNumTmps;151 for (size_t i = 0; i < m_graph.numBlocks(); ++i)152 m_graph.block(i)->ensureTmps(newNumTmps);153 }154 155 143 156 144 // Helper for min and max. … … 285 273 void linkBlocks(Vector<BasicBlock*>& unlinkedBlocks, Vector<BasicBlock*>& possibleTargets); 286 274 287 void progressToNextCheckpoint() 288 { 289 m_currentIndex = BytecodeIndex(m_currentIndex.offset(), m_currentIndex.checkpoint() + 1); 290 // At this point, it's again OK to OSR exit. 291 m_exitOK = true; 292 addToGraph(ExitOK); 293 294 processSetLocalQueue(); 295 } 296 297 VariableAccessData* newVariableAccessData(Operand operand) 275 VariableAccessData* newVariableAccessData(VirtualRegister operand) 298 276 { 299 277 ASSERT(!operand.isConstant()); … … 304 282 305 283 // Get/Set the operands/result of a bytecode instruction. 306 Node* getDirect( Operandoperand)284 Node* getDirect(VirtualRegister operand) 307 285 { 308 286 ASSERT(!operand.isConstant()); 309 287 288 // Is this an argument? 310 289 if (operand.isArgument()) 311 return getArgument(operand.virtualRegister()); 312 313 return getLocalOrTmp(operand); 290 return getArgument(operand); 291 292 // Must be a local. 293 return getLocal(operand); 314 294 } 315 295 … … 321 301 if (constantIndex >= oldSize || !m_constants[constantIndex]) { 322 302 const CodeBlock& codeBlock = *m_inlineStackTop->m_codeBlock; 323 JSValue value = codeBlock.getConstant(operand );324 SourceCodeRepresentation sourceCodeRepresentation = codeBlock.constantSourceCodeRepresentation(operand );303 JSValue value = codeBlock.getConstant(operand.offset()); 304 SourceCodeRepresentation sourceCodeRepresentation = codeBlock.constantSourceCodeRepresentation(operand.offset()); 325 305 if (constantIndex >= oldSize) { 326 306 m_constants.grow(constantIndex + 1); … … 381 361 ImmediateNakedSet 382 362 }; 383 384 Node* setDirect(Operand operand, Node* value, SetMode setMode = NormalSet) 363 Node* setDirect(VirtualRegister operand, Node* value, SetMode setMode = NormalSet) 385 364 { 386 addToGraph(MovHint, OpInfo(operand ), value);365 addToGraph(MovHint, OpInfo(operand.offset()), value); 387 366 388 367 // We can't exit anymore because our OSR exit state has changed. … … 398 377 return delayed.execute(this); 399 378 } 400 379 401 380 void processSetLocalQueue() 402 381 { … … 416 395 ASSERT(node->origin.semantic.bytecodeIndex() == m_currentIndex); 417 396 ConcurrentJSLocker locker(m_inlineStackTop->m_profiledBlock->m_lock); 418 LazyOperandValueProfileKey key(m_currentIndex, node-> operand());397 LazyOperandValueProfileKey key(m_currentIndex, node->local()); 419 398 SpeculatedType prediction = m_inlineStackTop->m_lazyOperands.prediction(locker, key); 420 399 node->variableAccessData()->predict(prediction); … … 423 402 424 403 // Used in implementing get/set, above, where the operand is a local variable. 425 Node* getLocal OrTmp(Operandoperand)404 Node* getLocal(VirtualRegister operand) 426 405 { 427 ASSERT(operand.isTmp() || operand.isLocal()); 428 Node*& node = m_currentBlock->variablesAtTail.operand(operand); 406 unsigned local = operand.toLocal(); 407 408 Node* node = m_currentBlock->variablesAtTail.local(local); 429 409 430 410 // This has two goals: 1) link together variable access datas, and 2) … … 451 431 452 432 node = injectLazyOperandSpeculation(addToGraph(GetLocal, OpInfo(variable))); 433 m_currentBlock->variablesAtTail.local(local) = node; 453 434 return node; 454 435 } 455 Node* setLocal OrTmp(const CodeOrigin& semanticOrigin, Operandoperand, Node* value, SetMode setMode = NormalSet)436 Node* setLocal(const CodeOrigin& semanticOrigin, VirtualRegister operand, Node* value, SetMode setMode = NormalSet) 456 437 { 457 ASSERT(operand.isTmp() || operand.isLocal());458 438 SetForScope<CodeOrigin> originChange(m_currentSemanticOrigin, semanticOrigin); 459 439 460 if (operand.isTmp() && static_cast<unsigned>(operand.value()) >= m_numTmps) { 461 if (inlineCallFrame()) 462 dataLogLn(*inlineCallFrame()); 463 dataLogLn("Bad operand: ", operand, " but current number of tmps is: ", m_numTmps, " code block has: ", m_profiledBlock->numTmps(), " tmps."); 464 CRASH(); 465 } 466 467 if (setMode != ImmediateNakedSet && !operand.isTmp()) { 468 VirtualRegister reg = operand.virtualRegister(); 469 ArgumentPosition* argumentPosition = findArgumentPositionForLocal(reg); 440 unsigned local = operand.toLocal(); 441 442 if (setMode != ImmediateNakedSet) { 443 ArgumentPosition* argumentPosition = findArgumentPositionForLocal(operand); 470 444 if (argumentPosition) 471 445 flushDirect(operand, argumentPosition); 472 else if (m_graph.needsScopeRegister() && reg== m_codeBlock->scopeRegister())446 else if (m_graph.needsScopeRegister() && operand == m_codeBlock->scopeRegister()) 473 447 flush(operand); 474 448 } … … 480 454 m_inlineStackTop->m_exitProfile.hasExitSite(semanticOrigin.bytecodeIndex(), BadIndexingType)); 481 455 Node* node = addToGraph(SetLocal, OpInfo(variableAccessData), value); 482 m_currentBlock->variablesAtTail. operand(operand) = node;456 m_currentBlock->variablesAtTail.local(local) = node; 483 457 return node; 484 458 } … … 512 486 return node; 513 487 } 514 Node* setArgument(const CodeOrigin& semanticOrigin, Operandoperand, Node* value, SetMode setMode = NormalSet)488 Node* setArgument(const CodeOrigin& semanticOrigin, VirtualRegister operand, Node* value, SetMode setMode = NormalSet) 515 489 { 516 490 SetForScope<CodeOrigin> originChange(m_currentSemanticOrigin, semanticOrigin); 517 491 518 VirtualRegister reg = operand.virtualRegister(); 519 unsigned argument = reg.toArgument(); 492 unsigned argument = operand.toArgument(); 520 493 ASSERT(argument < m_numArguments); 521 494 522 VariableAccessData* variableAccessData = newVariableAccessData( reg);495 VariableAccessData* variableAccessData = newVariableAccessData(operand); 523 496 524 497 // Always flush arguments, except for 'this'. If 'this' is created by us, … … 526 499 if (argument || m_graph.needsFlushedThis()) { 527 500 if (setMode != ImmediateNakedSet) 528 flushDirect( reg);501 flushDirect(operand); 529 502 } 530 503 … … 562 535 return stack->m_argumentPositions[argument]; 563 536 } 564 return nullptr;565 } 566 567 ArgumentPosition* findArgumentPosition( Operandoperand)537 return 0; 538 } 539 540 ArgumentPosition* findArgumentPosition(VirtualRegister operand) 568 541 { 569 if (operand.isTmp())570 return nullptr;571 542 if (operand.isArgument()) 572 543 return findArgumentPositionForArgument(operand.toArgument()); 573 return findArgumentPositionForLocal(operand .virtualRegister());544 return findArgumentPositionForLocal(operand); 574 545 } 575 546 … … 582 553 numArguments = inlineCallFrame->argumentsWithFixup.size(); 583 554 if (inlineCallFrame->isClosureCall) 584 addFlushDirect(inlineCallFrame, remapOperand(inlineCallFrame, CallFrameSlot::callee));555 addFlushDirect(inlineCallFrame, remapOperand(inlineCallFrame, VirtualRegister(CallFrameSlot::callee))); 585 556 if (inlineCallFrame->isVarargs()) 586 addFlushDirect(inlineCallFrame, remapOperand(inlineCallFrame, CallFrameSlot::argumentCountIncludingThis));557 addFlushDirect(inlineCallFrame, remapOperand(inlineCallFrame, VirtualRegister(CallFrameSlot::argumentCountIncludingThis))); 587 558 } else 588 559 numArguments = m_graph.baselineCodeBlockFor(inlineCallFrame)->numParameters(); … … 607 578 CodeBlock* codeBlock = m_graph.baselineCodeBlockFor(inlineCallFrame); 608 579 FullBytecodeLiveness& fullLiveness = m_graph.livenessFor(codeBlock); 609 // Note: We don't need to handle tmps here because tmps are not required to be flushed to the stack.610 580 const auto& livenessAtBytecode = fullLiveness.getLiveness(bytecodeIndex, m_graph.appropriateLivenessCalculationPoint(origin, isCallerOrigin)); 611 581 for (unsigned local = codeBlock->numCalleeLocals(); local--;) { … … 617 587 } 618 588 619 void flush( Operandoperand)589 void flush(VirtualRegister operand) 620 590 { 621 591 flushDirect(m_inlineStackTop->remapOperand(operand)); 622 592 } 623 593 624 void flushDirect( Operandoperand)594 void flushDirect(VirtualRegister operand) 625 595 { 626 596 flushDirect(operand, findArgumentPosition(operand)); 627 597 } 628 598 629 void flushDirect( Operandoperand, ArgumentPosition* argumentPosition)599 void flushDirect(VirtualRegister operand, ArgumentPosition* argumentPosition) 630 600 { 631 601 addFlushOrPhantomLocal<Flush>(operand, argumentPosition); … … 633 603 634 604 template<NodeType nodeType> 635 void addFlushOrPhantomLocal( Operandoperand, ArgumentPosition* argumentPosition)605 void addFlushOrPhantomLocal(VirtualRegister operand, ArgumentPosition* argumentPosition) 636 606 { 637 607 ASSERT(!operand.isConstant()); 638 608 639 Node* &node = m_currentBlock->variablesAtTail.operand(operand);609 Node* node = m_currentBlock->variablesAtTail.operand(operand); 640 610 641 611 VariableAccessData* variable; … … 647 617 648 618 node = addToGraph(nodeType, OpInfo(variable)); 619 m_currentBlock->variablesAtTail.operand(operand) = node; 649 620 if (argumentPosition) 650 621 argumentPosition->addVariable(variable); 651 622 } 652 623 653 void phantomLocalDirect( Operandoperand)624 void phantomLocalDirect(VirtualRegister operand) 654 625 { 655 626 addFlushOrPhantomLocal<PhantomLocal>(operand, findArgumentPosition(operand)); … … 658 629 void flush(InlineStackEntry* inlineStackEntry) 659 630 { 660 auto addFlushDirect = [&] (InlineCallFrame*, Operand operand) { flushDirect(operand); };631 auto addFlushDirect = [&] (InlineCallFrame*, VirtualRegister reg) { flushDirect(reg); }; 661 632 flushImpl(inlineStackEntry->m_inlineCallFrame, addFlushDirect); 662 633 } … … 664 635 void flushForTerminal() 665 636 { 666 auto addFlushDirect = [&] (InlineCallFrame*, Operand operand) { flushDirect(operand); };667 auto addPhantomLocalDirect = [&] (InlineCallFrame*, Operand operand) { phantomLocalDirect(operand); };637 auto addFlushDirect = [&] (InlineCallFrame*, VirtualRegister reg) { flushDirect(reg); }; 638 auto addPhantomLocalDirect = [&] (InlineCallFrame*, VirtualRegister reg) { phantomLocalDirect(reg); }; 668 639 flushForTerminalImpl(currentCodeOrigin(), addFlushDirect, addPhantomLocalDirect); 669 640 } … … 792 763 Edge(child1), Edge(child2), Edge(child3)); 793 764 return addToGraph(result); 794 }795 Node* addToGraph(NodeType op, Operand operand, Node* child1)796 {797 ASSERT(op == MovHint);798 return addToGraph(op, OpInfo(operand.kind()), OpInfo(operand.value()), child1);799 765 } 800 766 Node* addToGraph(NodeType op, OpInfo info1, OpInfo info2, Edge child1, Edge child2 = Edge(), Edge child3 = Edge()) … … 1128 1094 // The number of arguments passed to the function. 1129 1095 unsigned m_numArguments; 1130 // The number of locals (vars + temporaries) used by the bytecode forthe function.1096 // The number of locals (vars + temporaries) used in the function. 1131 1097 unsigned m_numLocals; 1132 // The max number of temps used for forwarding data to an OSR exit checkpoint.1133 unsigned m_numTmps;1134 1098 // The number of slots (in units of sizeof(Register)) that we need to 1135 1099 // preallocate for arguments to outgoing calls from this frame. This … … 1198 1162 ~InlineStackEntry(); 1199 1163 1200 Operand remapOperand(Operandoperand) const1164 VirtualRegister remapOperand(VirtualRegister operand) const 1201 1165 { 1202 1166 if (!m_inlineCallFrame) 1203 1167 return operand; 1204 1205 if (operand.isTmp())1206 return Operand::tmp(operand.value() + m_inlineCallFrame->tmpOffset);1207 1168 1208 ASSERT(!operand. virtualRegister().isConstant());1209 1210 return operand.virtualRegister() + m_inlineCallFrame->stackOffset;1169 ASSERT(!operand.isConstant()); 1170 1171 return VirtualRegister(operand.offset() + m_inlineCallFrame->stackOffset); 1211 1172 } 1212 1173 }; … … 1217 1178 1218 1179 struct DelayedSetLocal { 1180 CodeOrigin m_origin; 1181 VirtualRegister m_operand; 1182 Node* m_value; 1183 SetMode m_setMode; 1184 1219 1185 DelayedSetLocal() { } 1220 DelayedSetLocal(const CodeOrigin& origin, Operandoperand, Node* value, SetMode setMode)1186 DelayedSetLocal(const CodeOrigin& origin, VirtualRegister operand, Node* value, SetMode setMode) 1221 1187 : m_origin(origin) 1222 1188 , m_operand(operand) … … 1231 1197 if (m_operand.isArgument()) 1232 1198 return parser->setArgument(m_origin, m_operand, m_value, m_setMode); 1233 return parser->setLocalOrTmp(m_origin, m_operand, m_value, m_setMode); 1234 } 1235 1236 CodeOrigin m_origin; 1237 Operand m_operand; 1238 Node* m_value { nullptr }; 1239 SetMode m_setMode; 1199 return parser->setLocal(m_origin, m_operand, m_value, m_setMode); 1200 } 1240 1201 }; 1241 1202 … … 1250 1211 { 1251 1212 ASSERT(bytecodeIndex); 1252 Ref<BasicBlock> block = adoptRef(*new BasicBlock(bytecodeIndex, m_numArguments, m_numLocals, m_numTmps,1));1213 Ref<BasicBlock> block = adoptRef(*new BasicBlock(bytecodeIndex, m_numArguments, m_numLocals, 1)); 1253 1214 BasicBlock* blockPtr = block.ptr(); 1254 1215 // m_blockLinkingTargets must always be sorted in increasing order of bytecodeBegin … … 1262 1223 BasicBlock* ByteCodeParser::allocateUntargetableBlock() 1263 1224 { 1264 Ref<BasicBlock> block = adoptRef(*new BasicBlock(BytecodeIndex(), m_numArguments, m_numLocals, m_numTmps,1));1225 Ref<BasicBlock> block = adoptRef(*new BasicBlock(BytecodeIndex(), m_numArguments, m_numLocals, 1)); 1265 1226 BasicBlock* blockPtr = block.ptr(); 1266 1227 m_graph.appendBlock(WTFMove(block)); … … 1465 1426 continue; 1466 1427 // If the target InlineCallFrame is Varargs, we do not know how many arguments are actually filled by LoadVarargs. Varargs InlineCallFrame's 1467 // argumentCountIncludingThis is maximum number of potentially filled arguments by xkLoadVarargs. We "continue" to the upper frame which may be1428 // argumentCountIncludingThis is maximum number of potentially filled arguments by LoadVarargs. We "continue" to the upper frame which may be 1468 1429 // a good target to jump into. 1469 1430 if (callFrame->isVarargs()) … … 1491 1452 if (stackEntry->m_inlineCallFrame) { 1492 1453 if (stackEntry->m_inlineCallFrame->isClosureCall) 1493 setDirect( remapOperand(stackEntry->m_inlineCallFrame, CallFrameSlot::callee), callTargetNode, NormalSet);1454 setDirect(stackEntry->remapOperand(VirtualRegister(CallFrameSlot::callee)), callTargetNode, NormalSet); 1494 1455 } else 1495 1456 addToGraph(SetCallee, callTargetNode); … … 1656 1617 int registerOffsetAfterFixup = registerOffset - numberOfStackPaddingSlots; 1657 1618 1658 Operand inlineCallFrameStart = VirtualRegister(m_inlineStackTop->remapOperand(VirtualRegister(registerOffsetAfterFixup)).value() + CallFrame::headerSizeInRegisters);1619 int inlineCallFrameStart = m_inlineStackTop->remapOperand(VirtualRegister(registerOffsetAfterFixup)).offset() + CallFrame::headerSizeInRegisters; 1659 1620 1660 1621 ensureLocals( 1661 inlineCallFrameStart.toLocal() + 1 +1622 VirtualRegister(inlineCallFrameStart).toLocal() + 1 + 1662 1623 CallFrame::headerSizeInRegisters + codeBlock->numCalleeLocals()); 1663 1624 1664 ensureTmps((m_inlineStackTop->m_inlineCallFrame ? m_inlineStackTop->m_inlineCallFrame->tmpOffset : 0) + m_inlineStackTop->m_codeBlock->numTmps() + codeBlock->numTmps());1665 1666 1625 size_t argumentPositionStart = m_graph.m_argumentPositions.size(); 1667 1626 1668 1627 if (result.isValid()) 1669 result = m_inlineStackTop->remapOperand(result) .virtualRegister();1628 result = m_inlineStackTop->remapOperand(result); 1670 1629 1671 1630 VariableAccessData* calleeVariable = nullptr; … … 1680 1639 InlineStackEntry* callerStackTop = m_inlineStackTop; 1681 1640 InlineStackEntry inlineStackEntry(this, codeBlock, codeBlock, callee.function(), result, 1682 inlineCallFrameStart.virtualRegister(), argumentCountIncludingThis, kind, continuationBlock);1641 (VirtualRegister)inlineCallFrameStart, argumentCountIncludingThis, kind, continuationBlock); 1683 1642 1684 1643 // This is where the actual inlining really happens. … … 1715 1674 // callee make it so that if we exit at <HERE>, we can recover loc9 and loc10. 1716 1675 for (int index = 0; index < argumentCountIncludingThis; ++index) { 1717 OperandargumentToGet = callerStackTop->remapOperand(virtualRegisterForArgument(index, registerOffset));1676 VirtualRegister argumentToGet = callerStackTop->remapOperand(virtualRegisterForArgument(index, registerOffset)); 1718 1677 Node* value = getDirect(argumentToGet); 1719 addToGraph(MovHint, OpInfo(argumentToGet ), value);1678 addToGraph(MovHint, OpInfo(argumentToGet.offset()), value); 1720 1679 m_setLocalQueue.append(DelayedSetLocal { currentCodeOrigin(), argumentToGet, value, ImmediateNakedSet }); 1721 1680 } … … 1761 1720 if (registerOffsetAfterFixup != registerOffset) { 1762 1721 for (int index = 0; index < argumentCountIncludingThis; ++index) { 1763 OperandargumentToGet = callerStackTop->remapOperand(virtualRegisterForArgument(index, registerOffset));1722 VirtualRegister argumentToGet = callerStackTop->remapOperand(virtualRegisterForArgument(index, registerOffset)); 1764 1723 Node* value = getDirect(argumentToGet); 1765 OperandargumentToSet = m_inlineStackTop->remapOperand(virtualRegisterForArgument(index));1766 addToGraph(MovHint, OpInfo(argumentToSet ), value);1724 VirtualRegister argumentToSet = m_inlineStackTop->remapOperand(virtualRegisterForArgument(index)); 1725 addToGraph(MovHint, OpInfo(argumentToSet.offset()), value); 1767 1726 m_setLocalQueue.append(DelayedSetLocal { currentCodeOrigin(), argumentToSet, value, ImmediateNakedSet }); 1768 1727 } 1769 1728 } 1770 1729 for (int index = 0; index < arityFixupCount; ++index) { 1771 OperandargumentToSet = m_inlineStackTop->remapOperand(virtualRegisterForArgument(argumentCountIncludingThis + index));1772 addToGraph(MovHint, OpInfo(argumentToSet ), undefined);1730 VirtualRegister argumentToSet = m_inlineStackTop->remapOperand(virtualRegisterForArgument(argumentCountIncludingThis + index)); 1731 addToGraph(MovHint, OpInfo(argumentToSet.offset()), undefined); 1773 1732 m_setLocalQueue.append(DelayedSetLocal { currentCodeOrigin(), argumentToSet, undefined, ImmediateNakedSet }); 1774 1733 } … … 1937 1896 1938 1897 int remappedRegisterOffset = 1939 m_inlineStackTop->remapOperand(VirtualRegister(registerOffset)). virtualRegister().offset();1898 m_inlineStackTop->remapOperand(VirtualRegister(registerOffset)).offset(); 1940 1899 1941 1900 ensureLocals(VirtualRegister(remappedRegisterOffset).toLocal()); 1942 1901 1943 1902 int argumentStart = registerOffset + CallFrame::headerSizeInRegisters; 1944 int remappedArgumentStart = m_inlineStackTop->remapOperand(VirtualRegister(argumentStart)). virtualRegister().offset();1903 int remappedArgumentStart = m_inlineStackTop->remapOperand(VirtualRegister(argumentStart)).offset(); 1945 1904 1946 1905 LoadVarargsData* data = m_graph.m_loadVarargsData.add(); … … 1950 1909 data->limit = maxArgumentCountIncludingThis; 1951 1910 data->mandatoryMinimum = mandatoryMinimum; 1952 1953 if (callOp == TailCallForwardVarargs) { 1954 Node* argumentCount; 1955 if (!inlineCallFrame()) 1956 argumentCount = addToGraph(GetArgumentCountIncludingThis); 1957 else if (inlineCallFrame()->isVarargs()) 1958 argumentCount = getDirect(remapOperand(inlineCallFrame(), CallFrameSlot::argumentCountIncludingThis)); 1959 else 1960 argumentCount = addToGraph(JSConstant, OpInfo(m_graph.freeze(jsNumber(inlineCallFrame()->argumentCountIncludingThis)))); 1961 addToGraph(ForwardVarargs, OpInfo(data), argumentCount); 1962 } else { 1963 Node* arguments = get(argumentsArgument); 1964 auto argCountTmp = m_inlineStackTop->remapOperand(Operand::tmp(OpCallVarargs::argCountIncludingThis)); 1965 setDirect(argCountTmp, addToGraph(VarargsLength, OpInfo(data), arguments)); 1966 progressToNextCheckpoint(); 1967 1968 addToGraph(LoadVarargs, OpInfo(data), getLocalOrTmp(argCountTmp), arguments); 1969 } 1911 1912 if (callOp == TailCallForwardVarargs) 1913 addToGraph(ForwardVarargs, OpInfo(data)); 1914 else 1915 addToGraph(LoadVarargs, OpInfo(data), get(argumentsArgument)); 1970 1916 1971 1917 // LoadVarargs may OSR exit. Hence, we need to keep alive callTargetNode, thisArgument … … 1979 1925 // before SSA. 1980 1926 1981 VariableAccessData* countVariable = newVariableAccessData( data->count);1927 VariableAccessData* countVariable = newVariableAccessData(VirtualRegister(remappedRegisterOffset + CallFrameSlot::argumentCountIncludingThis)); 1982 1928 // This is pretty lame, but it will force the count to be flushed as an int. This doesn't 1983 1929 // matter very much, since our use of a SetArgumentDefinitely and Flushes for this local slot is … … 1986 1932 countVariable->mergeIsProfitableToUnbox(true); 1987 1933 Node* setArgumentCount = addToGraph(SetArgumentDefinitely, OpInfo(countVariable)); 1988 m_currentBlock->variablesAtTail.setOperand(countVariable-> operand(), setArgumentCount);1934 m_currentBlock->variablesAtTail.setOperand(countVariable->local(), setArgumentCount); 1989 1935 1990 1936 set(VirtualRegister(argumentStart), get(thisArgument), ImmediateNakedSet); … … 2010 1956 2011 1957 Node* setArgument = addToGraph(numSetArguments >= mandatoryMinimum ? SetArgumentMaybe : SetArgumentDefinitely, OpInfo(variable)); 2012 m_currentBlock->variablesAtTail.setOperand(variable-> operand(), setArgument);1958 m_currentBlock->variablesAtTail.setOperand(variable->local(), setArgument); 2013 1959 ++numSetArguments; 2014 1960 } … … 2110 2056 VERBOSE_LOG("Register offset: ", registerOffset); 2111 2057 VirtualRegister calleeReg(registerOffset + CallFrameSlot::callee); 2112 calleeReg = m_inlineStackTop->remapOperand(calleeReg) .virtualRegister();2058 calleeReg = m_inlineStackTop->remapOperand(calleeReg); 2113 2059 VERBOSE_LOG("Callee is going to be ", calleeReg, "\n"); 2114 2060 setDirect(calleeReg, callTargetNode, ImmediateSetWithFlush); … … 5213 5159 auto bytecode = currentInstruction->as<OpNewRegexp>(); 5214 5160 ASSERT(bytecode.m_regexp.isConstant()); 5215 FrozenValue* frozenRegExp = m_graph.freezeStrong(m_inlineStackTop->m_codeBlock->getConstant(bytecode.m_regexp ));5161 FrozenValue* frozenRegExp = m_graph.freezeStrong(m_inlineStackTop->m_codeBlock->getConstant(bytecode.m_regexp.offset())); 5216 5162 set(bytecode.m_dst, addToGraph(NewRegexp, OpInfo(frozenRegExp), jsConstant(jsNumber(0)))); 5217 5163 NEXT_OPCODE(op_new_regexp); … … 6294 6240 RELEASE_ASSERT(!m_currentBlock->size() || (m_graph.compilation() && m_currentBlock->size() == 1 && m_currentBlock->at(0)->op() == CountExecution)); 6295 6241 6296 ValueProfileAnd VirtualRegisterBuffer* buffer = bytecode.metadata(codeBlock).m_buffer;6242 ValueProfileAndOperandBuffer* buffer = bytecode.metadata(codeBlock).m_buffer; 6297 6243 6298 6244 if (!buffer) { … … 6311 6257 ConcurrentJSLocker locker(m_inlineStackTop->m_profiledBlock->m_lock); 6312 6258 6313 buffer->forEach([&] (ValueProfileAnd VirtualRegister& profile) {6259 buffer->forEach([&] (ValueProfileAndOperand& profile) { 6314 6260 VirtualRegister operand(profile.m_operand); 6315 6261 SpeculatedType prediction = profile.computeUpdatedPrediction(locker); … … 6339 6285 6340 6286 unsigned numberOfLocals = 0; 6341 buffer->forEach([&] (ValueProfileAnd VirtualRegister& profile) {6287 buffer->forEach([&] (ValueProfileAndOperand& profile) { 6342 6288 VirtualRegister operand(profile.m_operand); 6343 6289 if (operand.isArgument()) … … 6346 6292 Node* value = addToGraph(ExtractCatchLocal, OpInfo(numberOfLocals), OpInfo(localPredictions[numberOfLocals])); 6347 6293 ++numberOfLocals; 6348 addToGraph(MovHint, OpInfo( operand), value);6294 addToGraph(MovHint, OpInfo(profile.m_operand), value); 6349 6295 localsToSet.uncheckedAppend(std::make_pair(operand, value)); 6350 6296 }); … … 6474 6420 case op_jneq_ptr: { 6475 6421 auto bytecode = currentInstruction->as<OpJneqPtr>(); 6476 FrozenValue* frozenPointer = m_graph.freezeStrong(m_inlineStackTop->m_codeBlock->getConstant(bytecode.m_specialPointer ));6422 FrozenValue* frozenPointer = m_graph.freezeStrong(m_inlineStackTop->m_codeBlock->getConstant(bytecode.m_specialPointer.offset())); 6477 6423 unsigned relativeOffset = jumpTarget(bytecode.m_targetLabel); 6478 6424 Node* child = get(bytecode.m_value); … … 6942 6888 auto bytecode = currentInstruction->as<OpCreateLexicalEnvironment>(); 6943 6889 ASSERT(bytecode.m_symbolTable.isConstant() && bytecode.m_initialValue.isConstant()); 6944 FrozenValue* symbolTable = m_graph.freezeStrong(m_inlineStackTop->m_codeBlock->getConstant(bytecode.m_symbolTable ));6945 FrozenValue* initialValue = m_graph.freezeStrong(m_inlineStackTop->m_codeBlock->getConstant(bytecode.m_initialValue ));6890 FrozenValue* symbolTable = m_graph.freezeStrong(m_inlineStackTop->m_codeBlock->getConstant(bytecode.m_symbolTable.offset())); 6891 FrozenValue* initialValue = m_graph.freezeStrong(m_inlineStackTop->m_codeBlock->getConstant(bytecode.m_initialValue.offset())); 6946 6892 Node* scope = get(bytecode.m_scope); 6947 6893 Node* lexicalEnvironment = addToGraph(CreateActivation, OpInfo(symbolTable), OpInfo(initialValue), scope); … … 6973 6919 // bytecode-level liveness of the scope register. 6974 6920 auto bytecode = currentInstruction->as<OpGetScope>(); 6975 Node* callee = get( CallFrameSlot::callee);6921 Node* callee = get(VirtualRegister(CallFrameSlot::callee)); 6976 6922 Node* result; 6977 6923 if (JSFunction* function = callee->dynamicCastConstant<JSFunction*>(*m_vm)) … … 7398 7344 // plan finishes. 7399 7345 m_inlineCallFrame->baselineCodeBlock.setWithoutWriteBarrier(codeBlock->baselineVersion()); 7400 m_inlineCallFrame->setTmpOffset((m_caller->m_inlineCallFrame ? m_caller->m_inlineCallFrame->tmpOffset : 0) + m_caller->m_codeBlock->numTmps());7401 7346 m_inlineCallFrame->setStackOffset(inlineCallFrameStart.offset() - CallFrame::headerSizeInRegisters); 7402 7347 m_inlineCallFrame->argumentCountIncludingThis = argumentCountIncludingThis; 7403 RELEASE_ASSERT(m_inlineCallFrame->argumentCountIncludingThis == argumentCountIncludingThis);7404 7348 if (callee) { 7405 7349 m_inlineCallFrame->calleeRecovery = ValueRecovery::constant(callee); … … 7763 7707 7764 7708 if (node->hasVariableAccessData(m_graph)) 7765 mapping.operand(node-> operand()) = node->variableAccessData();7709 mapping.operand(node->local()) = node->variableAccessData(); 7766 7710 7767 7711 if (node->op() != ForceOSRExit) … … 7783 7727 } 7784 7728 7785 auto insertLivenessPreservingOp = [&] (InlineCallFrame* inlineCallFrame, NodeType op, Operandoperand) {7729 auto insertLivenessPreservingOp = [&] (InlineCallFrame* inlineCallFrame, NodeType op, VirtualRegister operand) { 7786 7730 VariableAccessData* variable = mapping.operand(operand); 7787 7731 if (!variable) { … … 7790 7734 } 7791 7735 7792 Operand argument = unmapOperand(inlineCallFrame, operand);7736 VirtualRegister argument = operand - (inlineCallFrame ? inlineCallFrame->stackOffset : 0); 7793 7737 if (argument.isArgument() && !argument.isHeader()) { 7794 7738 const Vector<ArgumentPosition*>& arguments = m_inlineCallFrameToArgumentPositions.get(inlineCallFrame); … … 7797 7741 insertionSet.insertNode(nodeIndex, SpecNone, op, origin, OpInfo(variable)); 7798 7742 }; 7799 auto addFlushDirect = [&] (InlineCallFrame* inlineCallFrame, Operandoperand) {7743 auto addFlushDirect = [&] (InlineCallFrame* inlineCallFrame, VirtualRegister operand) { 7800 7744 insertLivenessPreservingOp(inlineCallFrame, Flush, operand); 7801 7745 }; 7802 auto addPhantomLocalDirect = [&] (InlineCallFrame* inlineCallFrame, Operandoperand) {7746 auto addPhantomLocalDirect = [&] (InlineCallFrame* inlineCallFrame, VirtualRegister operand) { 7803 7747 insertLivenessPreservingOp(inlineCallFrame, PhantomLocal, operand); 7804 7748 }; … … 7865 7809 } 7866 7810 7867 m_graph.m_tmps = m_numTmps;7868 7811 m_graph.m_localVars = m_numLocals; 7869 7812 m_graph.m_parameterSlots = m_parameterSlots;
Note:
See TracChangeset
for help on using the changeset viewer.