Changeset 155415 in webkit
- Timestamp:
- Sep 9, 2013 10:37:51 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r155413 r155415 1 2013-09-09 Michael Saboff <msaboff@apple.com> 2 3 Add local to/from operand helpers similar to argument to/from operand2 4 https://bugs.webkit.org/show_bug.cgi?id=121056 5 6 Reviewed by Geoffrey Garen. 7 8 Added localToOperand(), operandToLocal() and operandIsLocal() to Operands.h, very similar to 9 argumentToOperand(), et al. Used the new helpers everywhere where an index into a data 10 structure is intended instead of the actual virtual register offset. When the stack is 11 changed to grow down, local register offsets can be negative. Also added the helper 12 DFG::SpeculativeJIT::generationInfoFromVirtualRegister() for the common case accessing 13 m_generationInfo[operandToLocal(val)]. 14 15 * bytecode/CodeBlock.cpp: 16 * bytecode/CodeBlock.h: 17 * bytecode/Operands.h: 18 (JSC::localToOperand): 19 (JSC::operandIsLocal): 20 (JSC::operandToLocal): 21 * bytecompiler/BytecodeGenerator.h: 22 * dfg/DFGAbstractInterpreterInlines.h: 23 * dfg/DFGByteCodeParser.cpp: 24 * dfg/DFGCFGSimplificationPhase.cpp: 25 * dfg/DFGCPSRethreadingPhase.cpp: 26 * dfg/DFGOSREntry.cpp: 27 * dfg/DFGOSRExitCompiler32_64.cpp: 28 * dfg/DFGOSRExitCompiler64.cpp: 29 * dfg/DFGScoreBoard.h: 30 * dfg/DFGSpeculativeJIT.cpp: 31 * dfg/DFGSpeculativeJIT.h: 32 (JSC::DFG::SpeculativeJIT::generationInfoFromVirtualRegister): 33 * dfg/DFGSpeculativeJIT32_64.cpp: 34 * dfg/DFGSpeculativeJIT64.cpp: 35 * dfg/DFGValidate.cpp: 36 * dfg/DFGVariableEventStream.cpp: 37 * dfg/DFGVirtualRegisterAllocationPhase.cpp: 38 * jit/JITInlines.h: 39 * jit/JITOpcodes.cpp: 40 * jit/JITOpcodes32_64.cpp: 41 1 42 2013-09-09 Filip Pizlo <fpizlo@apple.com> 2 43 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r155159 r155415 172 172 } 173 173 174 return toCString("loc", r);174 return toCString("loc", operandToLocal(r)); 175 175 } 176 176 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r155251 r155415 368 368 369 369 if (inlineCallFrame) 370 return inlineCallFrame->capturedVars.get(operand );370 return inlineCallFrame->capturedVars.get(operandToLocal(operand)); 371 371 372 372 // The activation object isn't in the captured region, but it's "captured" -
trunk/Source/JavaScriptCore/bytecode/Operands.h
r153296 r155415 29 29 #include "CallFrame.h" 30 30 #include "JSObject.h" 31 #include "VirtualRegister.h" 31 32 #include <wtf/PrintStream.h> 32 33 #include <wtf/Vector.h> 33 34 34 35 namespace JSC { 36 37 inline VirtualRegister localToOperand(int local) { return (VirtualRegister)local; } 38 inline bool operandIsLocal(int operand) { return operand >= 0; } 39 inline int operandToLocal(int operand) { return operand; } 35 40 36 41 // argument 0 is 'this'. … … 144 149 } 145 150 146 return m_locals[operand ];151 return m_locals[operandToLocal(operand)]; 147 152 } 148 153 … … 153 158 if (operandIsArgument(operand)) 154 159 return true; 155 return static_cast<size_t>(operand ) < numberOfLocals();160 return static_cast<size_t>(operandToLocal(operand)) < numberOfLocals(); 156 161 } 157 162 … … 164 169 } 165 170 166 setLocal(operand , value);171 setLocal(operandToLocal(operand), value); 167 172 } 168 173 … … 197 202 if (index < numberOfArguments()) 198 203 return argumentToOperand(index); 199 return index - numberOfArguments();204 return localToOperand(index - numberOfArguments()); 200 205 } 201 206 … … 207 212 } 208 213 209 setLocalFirstTime(operand , value);214 setLocalFirstTime(operandToLocal(operand), value); 210 215 } 211 216 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r153763 r155415 499 499 RegisterID& registerFor(int index) 500 500 { 501 if ( index >= 0)502 return m_calleeRegisters[ index];501 if (operandIsLocal(index)) 502 return m_calleeRegisters[operandToLocal(index)]; 503 503 504 504 if (index == JSStack::Callee) … … 506 506 507 507 ASSERT(m_parameters.size()); 508 return m_parameters[ index + m_parameters.size() + JSStack::CallFrameHeaderSize];508 return m_parameters[operandToArgument(index)]; 509 509 } 510 510 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r155201 r155415 155 155 forNode(node).makeTop(); 156 156 if (!operandIsArgument(node->unlinkedLocal()) 157 && m_graph.m_lazyVars.get( node->unlinkedLocal())) {157 && m_graph.m_lazyVars.get(operandToLocal(node->unlinkedLocal()))) { 158 158 // This is kind of pessimistic - we could know in some cases that the 159 159 // DFG code at the point of the OSR had already initialized the lazy … … 1599 1599 } else { 1600 1600 for (size_t i = m_codeBlock->m_numVars; i--;) { 1601 if (m_codeBlock->isCaptured( i))1601 if (m_codeBlock->isCaptured(localToOperand(i))) 1602 1602 m_state.variables().local(i).makeTop(); 1603 1603 } -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r155201 r155415 262 262 Node* getLocal(unsigned operand) 263 263 { 264 Node* node = m_currentBlock->variablesAtTail.local(operand); 264 unsigned local = operandToLocal(operand); 265 Node* node = m_currentBlock->variablesAtTail.local(local); 265 266 bool isCaptured = m_codeBlock->isCaptured(operand, inlineCallFrame()); 266 267 … … 288 289 } 289 290 } else { 290 m_preservedVars.set( operand);291 m_preservedVars.set(local); 291 292 variable = newVariableAccessData(operand, isCaptured); 292 293 } 293 294 294 295 node = injectLazyOperandSpeculation(addToGraph(GetLocal, OpInfo(variable))); 295 m_currentBlock->variablesAtTail.local( operand) = node;296 m_currentBlock->variablesAtTail.local(local) = node; 296 297 return node; 297 298 } 298 299 void setLocal(unsigned operand, Node* value, SetMode setMode = NormalSet) 299 300 { 301 unsigned local = operandToLocal(operand); 300 302 bool isCaptured = m_codeBlock->isCaptured(operand, inlineCallFrame()); 301 303 … … 312 314 m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadIndexingType)); 313 315 Node* node = addToGraph(SetLocal, OpInfo(variableAccessData), value); 314 m_currentBlock->variablesAtTail.local( operand) = node;316 m_currentBlock->variablesAtTail.local(local) = node; 315 317 } 316 318 … … 432 434 433 435 if (!operandIsArgument(operand)) 434 m_preservedVars.set(operand );436 m_preservedVars.set(operandToLocal(operand)); 435 437 436 438 Node* node = m_currentBlock->variablesAtTail.operand(operand); … … 460 462 flushDirect(inlineStackEntry->remapOperand(argumentToOperand(argument))); 461 463 for (int local = 0; local < inlineStackEntry->m_codeBlock->m_numVars; ++local) { 462 if (!inlineStackEntry->m_codeBlock->isCaptured(local ))464 if (!inlineStackEntry->m_codeBlock->isCaptured(localToOperand(local))) 463 465 continue; 464 flushDirect(inlineStackEntry->remapOperand(local ));466 flushDirect(inlineStackEntry->remapOperand(localToOperand(local))); 465 467 } 466 468 } … … 1281 1283 1282 1284 // Make sure that the area used by the call frame is reserved. 1283 for (int arg = inlineCallFrameStart + JSStack::CallFrameHeaderSize + codeBlock->m_numVars; arg-- > inlineCallFrameStart;)1285 for (int arg = operandToLocal(inlineCallFrameStart) + JSStack::CallFrameHeaderSize + codeBlock->m_numVars; arg-- > operandToLocal(inlineCallFrameStart);) 1284 1286 m_preservedVars.set(arg); 1285 1287 1286 1288 // Make sure that we have enough locals. 1287 unsigned newNumLocals = inlineCallFrameStart+ JSStack::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;1289 unsigned newNumLocals = operandToLocal(inlineCallFrameStart) + JSStack::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters; 1288 1290 if (newNumLocals > m_numLocals) { 1289 1291 m_numLocals = newNumLocals; … … 1885 1887 // Initialize all locals to undefined. 1886 1888 for (int i = 0; i < m_inlineStackTop->m_codeBlock->m_numVars; ++i) 1887 set( i, constantUndefined(), SetOnEntry);1889 set(localToOperand(i), constantUndefined(), SetOnEntry); 1888 1890 NEXT_OPCODE(op_enter); 1889 1891 … … 3152 3154 case op_init_lazy_reg: { 3153 3155 set(currentInstruction[1].u.operand, getJSConstantForValue(JSValue())); 3154 ASSERT( currentInstruction[1].u.operand >= 0);3155 m_graph.m_lazyVars.set( currentInstruction[1].u.operand);3156 ASSERT(operandIsLocal(currentInstruction[1].u.operand)); 3157 m_graph.m_lazyVars.set(operandToLocal(currentInstruction[1].u.operand)); 3156 3158 NEXT_OPCODE(op_init_lazy_reg); 3157 3159 } … … 3382 3384 else { 3383 3385 for (int i = byteCodeParser->m_codeBlock->m_numVars; i--;) { 3384 if (byteCodeParser->m_codeBlock->isCaptured( i))3386 if (byteCodeParser->m_codeBlock->isCaptured(localToOperand(i))) 3385 3387 inlineCallFrame.capturedVars.set(i); 3386 3388 } … … 3389 3391 for (int i = argumentCountIncludingThis; i--;) { 3390 3392 if (codeBlock->isCaptured(argumentToOperand(i))) 3391 inlineCallFrame.capturedVars.set( argumentToOperand(i) + inlineCallFrame.stackOffset);3393 inlineCallFrame.capturedVars.set(operandToLocal(argumentToOperand(i) + inlineCallFrame.stackOffset)); 3392 3394 } 3393 3395 for (size_t i = codeBlock->m_numVars; i--;) { 3394 if (codeBlock->isCaptured(i)) 3395 inlineCallFrame.capturedVars.set(i + inlineCallFrame.stackOffset); 3396 int localOperand = localToOperand(i); 3397 if (codeBlock->isCaptured(localOperand)) 3398 inlineCallFrame.capturedVars.set(operandToLocal(localOperand + inlineCallFrame.stackOffset)); 3396 3399 } 3397 3400 -
trunk/Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp
r155023 r155415 329 329 keepOperandAlive(block, jettisonedBlock, boundaryCodeOrigin, argumentToOperand(i)); 330 330 for (size_t i = 0; i < jettisonedBlock->variablesAtHead.numberOfLocals(); ++i) 331 keepOperandAlive(block, jettisonedBlock, boundaryCodeOrigin, i);331 keepOperandAlive(block, jettisonedBlock, boundaryCodeOrigin, localToOperand(i)); 332 332 333 333 fixJettisonedPredecessors(block, jettisonedBlock); … … 383 383 keepOperandAlive(firstBlock, jettisonedBlock, boundaryCodeOrigin, argumentToOperand(i)); 384 384 for (size_t i = 0; i < jettisonedBlock->variablesAtHead.numberOfLocals(); ++i) 385 keepOperandAlive(firstBlock, jettisonedBlock, boundaryCodeOrigin, i);385 keepOperandAlive(firstBlock, jettisonedBlock, boundaryCodeOrigin, localToOperand(i)); 386 386 } 387 387 -
trunk/Source/JavaScriptCore/dfg/DFGCPSRethreadingPhase.cpp
r153278 r155415 221 221 canonicalizeGetLocalFor<ArgumentOperand>(node, variable, operandToArgument(variable->local())); 222 222 else 223 canonicalizeGetLocalFor<LocalOperand>(node, variable, variable->local());223 canonicalizeGetLocalFor<LocalOperand>(node, variable, operandToLocal(variable->local())); 224 224 } 225 225 … … 289 289 canonicalizeFlushOrPhantomLocalFor<nodeType, ArgumentOperand>(node, variable, operandToArgument(variable->local())); 290 290 else 291 canonicalizeFlushOrPhantomLocalFor<nodeType, LocalOperand>(node, variable, variable->local());291 canonicalizeFlushOrPhantomLocalFor<nodeType, LocalOperand>(node, variable, operandToLocal(variable->local())); 292 292 } 293 293 -
trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp
r155023 r155415 140 140 for (size_t local = 0; local < entry->m_expectedValues.numberOfLocals(); ++local) { 141 141 if (entry->m_localsForcedDouble.get(local)) { 142 if (!exec->registers()[local ].jsValue().isNumber()) {142 if (!exec->registers()[localToOperand(local)].jsValue().isNumber()) { 143 143 if (Options::verboseOSR()) { 144 144 dataLog( 145 " OSR failed because variable ", local , " is ",146 exec->registers()[local ].jsValue(), ", expected number.\n");145 " OSR failed because variable ", localToOperand(local), " is ", 146 exec->registers()[localToOperand(local)].jsValue(), ", expected number.\n"); 147 147 } 148 148 return 0; … … 150 150 continue; 151 151 } 152 if (!entry->m_expectedValues.local(local).validate(exec->registers()[local ].jsValue())) {152 if (!entry->m_expectedValues.local(local).validate(exec->registers()[localToOperand(local)].jsValue())) { 153 153 if (Options::verboseOSR()) { 154 154 dataLog( 155 " OSR failed because variable ", local , " is ",156 exec->registers()[local ].jsValue(), ", expected ",155 " OSR failed because variable ", localToOperand(local), " is ", 156 exec->registers()[localToOperand(local)].jsValue(), ", expected ", 157 157 entry->m_expectedValues.local(local), ".\n"); 158 158 } … … 180 180 for (size_t local = 0; local < entry->m_expectedValues.numberOfLocals(); ++local) { 181 181 if (entry->m_localsForcedDouble.get(local)) 182 *bitwise_cast<double*>(exec->registers() + local ) = exec->registers()[local].jsValue().asNumber();182 *bitwise_cast<double*>(exec->registers() + localToOperand(local)) = exec->registers()[localToOperand(local)].jsValue().asNumber(); 183 183 } 184 184 -
trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler32_64.cpp
r153296 r155415 200 200 case Int32DisplacedInJSStack: 201 201 case CellDisplacedInJSStack: 202 case BooleanDisplacedInJSStack: 202 case BooleanDisplacedInJSStack: { 203 203 numberOfDisplacedVirtualRegisters++; 204 ASSERT( (int)recovery.virtualRegister() >= 0);204 ASSERT(operandIsLocal(recovery.virtualRegister())); 205 205 206 206 // See if we might like to store to this virtual register before doing … … 211 211 // to be rare, so the handling of it is optimized for the cases in 212 212 // which it does not happen. 213 if (recovery.virtualRegister() < (int)operands.numberOfLocals()) { 214 switch (operands.local(recovery.virtualRegister()).technique()) { 213 int local = operandToLocal(recovery.virtualRegister()); 214 if (local < (int)operands.numberOfLocals()) { 215 switch (operands.local(local).technique()) { 215 216 case InGPR: 216 217 case UnboxedInt32InGPR: … … 219 220 case InPair: 220 221 case InFPR: 221 if (!poisonedVirtualRegisters[ recovery.virtualRegister()]) {222 poisonedVirtualRegisters[ recovery.virtualRegister()] = true;222 if (!poisonedVirtualRegisters[local]) { 223 poisonedVirtualRegisters[local] = true; 223 224 numberOfPoisonedVirtualRegisters++; 224 225 } … … 229 230 } 230 231 break; 231 232 233 } 232 234 case UInt32InGPR: 233 235 haveUInt32s = true; … … 544 546 case UnboxedBooleanInGPR: { 545 547 m_jit.load32(reinterpret_cast<char*>(scratchDataBuffer + poisonIndex(virtualRegister)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload), GPRInfo::regT0); 546 m_jit.store32(GPRInfo::regT0, AssemblyHelpers::payloadFor( (VirtualRegister)virtualRegister));548 m_jit.store32(GPRInfo::regT0, AssemblyHelpers::payloadFor(localToOperand(virtualRegister))); 547 549 uint32_t tag = JSValue::EmptyValueTag; 548 550 if (recovery.technique() == InGPR) … … 552 554 else 553 555 tag = JSValue::BooleanTag; 554 m_jit.store32(AssemblyHelpers::TrustedImm32(tag), AssemblyHelpers::tagFor( (VirtualRegister)virtualRegister));556 m_jit.store32(AssemblyHelpers::TrustedImm32(tag), AssemblyHelpers::tagFor(localToOperand(virtualRegister))); 555 557 break; 556 558 } … … 561 563 m_jit.load32(reinterpret_cast<char*>(scratchDataBuffer + poisonIndex(virtualRegister)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload), GPRInfo::regT0); 562 564 m_jit.load32(reinterpret_cast<char*>(scratchDataBuffer + poisonIndex(virtualRegister)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag), GPRInfo::regT1); 563 m_jit.store32(GPRInfo::regT0, AssemblyHelpers::payloadFor( (VirtualRegister)virtualRegister));564 m_jit.store32(GPRInfo::regT1, AssemblyHelpers::tagFor( (VirtualRegister)virtualRegister));565 m_jit.store32(GPRInfo::regT0, AssemblyHelpers::payloadFor(localToOperand(virtualRegister))); 566 m_jit.store32(GPRInfo::regT1, AssemblyHelpers::tagFor(localToOperand(virtualRegister))); 565 567 break; 566 568 -
trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler64.cpp
r153296 r155415 181 181 case Int32DisplacedInJSStack: 182 182 case DoubleDisplacedInJSStack: 183 case DisplacedInJSStack: 183 case DisplacedInJSStack: { 184 184 numberOfDisplacedVirtualRegisters++; 185 ASSERT( (int)recovery.virtualRegister() >= 0);185 ASSERT(operandIsLocal(recovery.virtualRegister())); 186 186 187 187 // See if we might like to store to this virtual register before doing … … 192 192 // to be rare, so the handling of it is optimized for the cases in 193 193 // which it does not happen. 194 if (recovery.virtualRegister() < (int)operands.numberOfLocals()) { 195 switch (operands.local(recovery.virtualRegister()).technique()) { 194 int local = operandToLocal(recovery.virtualRegister()); 195 if (local < (int)operands.numberOfLocals()) { 196 switch (operands.local(local).technique()) { 196 197 case InGPR: 197 198 case UnboxedInt32InGPR: 198 199 case UInt32InGPR: 199 200 case InFPR: 200 if (!poisonedVirtualRegisters[ recovery.virtualRegister()]) {201 poisonedVirtualRegisters[ recovery.virtualRegister()] = true;201 if (!poisonedVirtualRegisters[local]) { 202 poisonedVirtualRegisters[local] = true; 202 203 numberOfPoisonedVirtualRegisters++; 203 204 } … … 208 209 } 209 210 break; 210 211 } 211 212 case UnboxedInt32InGPR: 212 213 case AlreadyInJSStackAsUnboxedInt32: … … 531 532 case InFPR: 532 533 m_jit.load64(scratchDataBuffer + poisonIndex(virtualRegister), GPRInfo::regT0); 533 m_jit.store64(GPRInfo::regT0, AssemblyHelpers::addressFor( (VirtualRegister)virtualRegister));534 m_jit.store64(GPRInfo::regT0, AssemblyHelpers::addressFor(localToOperand(virtualRegister))); 534 535 break; 535 536 -
trunk/Source/JavaScriptCore/dfg/DFGScoreBoard.h
r141069 r155415 90 90 ASSERT(!m_used[index]); 91 91 m_highWatermark = std::max(m_highWatermark, static_cast<unsigned>(index) + 1); 92 return (VirtualRegister)index;92 return localToOperand(index); 93 93 } 94 94 … … 97 97 m_used.append(0); 98 98 m_highWatermark = std::max(m_highWatermark, static_cast<unsigned>(next) + 1); 99 return (VirtualRegister)next;99 return localToOperand(next); 100 100 } 101 101 102 // Increment the usecount for the VirtualReg siter associated with 'child',103 // if it reaches the node's refcount, free the VirtualReg siter.102 // Increment the usecount for the VirtualRegister associated with 'child', 103 // if it reaches the node's refcount, free the VirtualRegister. 104 104 void use(Node* child) 105 105 { … … 108 108 109 109 // Find the virtual register number for this child, increment its use count. 110 uint32_t index = child->virtualRegister();110 uint32_t index = operandToLocal(child->virtualRegister()); 111 111 ASSERT(m_used[index] != max()); 112 112 if (child->refCount() == ++m_used[index]) { -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r155201 r155415 318 318 SilentRegisterSavePlan SpeculativeJIT::silentSavePlanForGPR(VirtualRegister spillMe, GPRReg source) 319 319 { 320 GenerationInfo& info = m_generationInfo[spillMe];320 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe); 321 321 Node* node = info.node(); 322 322 DataFormat registerFormat = info.registerFormat(); … … 437 437 SilentRegisterSavePlan SpeculativeJIT::silentSavePlanForFPR(VirtualRegister spillMe, FPRReg source) 438 438 { 439 GenerationInfo& info = m_generationInfo[spillMe];439 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe); 440 440 Node* node = info.node(); 441 441 ASSERT(info.registerFormat() == DataFormatDouble); … … 778 778 { 779 779 VirtualRegister virtualRegister = edge->virtualRegister(); 780 GenerationInfo& info = m_generationInfo[virtualRegister];780 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 781 781 782 782 switch (info.registerFormat()) { … … 1077 1077 for (unsigned i = 0; i < m_generationInfo.size(); ++i) { 1078 1078 VirtualRegister virtualRegister = (VirtualRegister)i; 1079 GenerationInfo& info = m_generationInfo[virtualRegister];1079 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 1080 1080 if (!info.alive()) 1081 1081 continue; … … 1125 1125 continue; 1126 1126 1127 GenerationInfo& info = m_generationInfo[virtualRegister];1127 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 1128 1128 #if USE(JSVALUE64) 1129 1129 if (iter.regID() != info.gpr()) { … … 1151 1151 continue; 1152 1152 1153 GenerationInfo& info = m_generationInfo[virtualRegister];1153 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 1154 1154 if (iter.regID() != info.fpr()) { 1155 1155 dataLogF("DFG_CONSISTENCY_CHECK failed: name mismatch for fpr %s (virtual register %d).\n", iter.debugName(), virtualRegister); … … 1549 1549 1550 1550 VirtualRegister virtualRegister = node->virtualRegister(); 1551 GenerationInfo& info = m_generationInfo[virtualRegister];1551 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 1552 1552 1553 1553 info.noticeOSRBirth(*m_stream, node, virtualRegister); … … 1682 1682 m_variables[i] = valueSource; 1683 1683 // FIXME: Don't emit SetLocal(Dead). https://bugs.webkit.org/show_bug.cgi?id=108019 1684 m_stream->appendAndLog(VariableEvent::setLocal( i, valueSource.dataFormat()));1684 m_stream->appendAndLog(VariableEvent::setLocal(localToOperand(i), valueSource.dataFormat())); 1685 1685 } 1686 1686 … … 2177 2177 #endif 2178 2178 VirtualRegister virtualRegister = node->virtualRegister(); 2179 GenerationInfo& info = m_generationInfo[virtualRegister];2179 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 2180 2180 2181 2181 switch (info.registerFormat()) { … … 2291 2291 Node* childNode = node->child1().node(); 2292 2292 VirtualRegister virtualRegister = childNode->virtualRegister(); 2293 GenerationInfo& info = m_generationInfo[virtualRegister];2293 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 2294 2294 2295 2295 JSValueOperand op1(this, node->child1(), ManualOperandSpeculation); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r155201 r155415 162 162 { 163 163 VirtualRegister virtualRegister = node->virtualRegister(); 164 GenerationInfo& info = m_generationInfo[virtualRegister];164 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 165 165 return info.canReuse(); 166 166 } … … 190 190 if (spillMe != InvalidVirtualRegister) { 191 191 #if USE(JSVALUE32_64) 192 GenerationInfo& info = m_generationInfo[spillMe];192 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe); 193 193 RELEASE_ASSERT(info.registerFormat() != DataFormatJSDouble); 194 194 if ((info.registerFormat() & DataFormatJS)) … … 207 207 if (spillMe != InvalidVirtualRegister) { 208 208 #if USE(JSVALUE32_64) 209 GenerationInfo& info = m_generationInfo[spillMe];209 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe); 210 210 RELEASE_ASSERT(info.registerFormat() != DataFormatJSDouble); 211 211 if ((info.registerFormat() & DataFormatJS)) … … 240 240 { 241 241 VirtualRegister virtualRegister = node->virtualRegister(); 242 GenerationInfo& info = m_generationInfo[virtualRegister];242 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 243 243 return info.registerFormat() != DataFormatNone; 244 244 } … … 246 246 { 247 247 VirtualRegister virtualRegister = node->virtualRegister(); 248 GenerationInfo& info = m_generationInfo[virtualRegister];248 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 249 249 return info.registerFormat() == DataFormatDouble; 250 250 } … … 256 256 return; 257 257 VirtualRegister virtualRegister = node->virtualRegister(); 258 GenerationInfo& info = m_generationInfo[virtualRegister];258 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 259 259 260 260 // use() returns true when the value becomes dead, and any … … 484 484 void spill(VirtualRegister spillMe) 485 485 { 486 GenerationInfo& info = m_generationInfo[spillMe];486 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe); 487 487 488 488 #if USE(JSVALUE32_64) … … 797 797 798 798 VirtualRegister virtualRegister = node->virtualRegister(); 799 GenerationInfo& info = m_generationInfo[virtualRegister];799 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 800 800 801 801 if (format == DataFormatInteger) { … … 831 831 VirtualRegister virtualRegister = node->virtualRegister(); 832 832 m_gprs.retain(reg, virtualRegister, SpillOrderCell); 833 GenerationInfo& info = m_generationInfo[virtualRegister];833 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 834 834 info.initCell(node, node->refCount(), reg); 835 835 } … … 841 841 VirtualRegister virtualRegister = node->virtualRegister(); 842 842 m_gprs.retain(reg, virtualRegister, SpillOrderBoolean); 843 GenerationInfo& info = m_generationInfo[virtualRegister];843 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 844 844 info.initBoolean(node, node->refCount(), reg); 845 845 } … … 855 855 VirtualRegister virtualRegister = node->virtualRegister(); 856 856 m_gprs.retain(reg, virtualRegister, SpillOrderJS); 857 GenerationInfo& info = m_generationInfo[virtualRegister];857 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 858 858 info.initJSValue(node, node->refCount(), reg, format); 859 859 } … … 871 871 m_gprs.retain(tag, virtualRegister, SpillOrderJS); 872 872 m_gprs.retain(payload, virtualRegister, SpillOrderJS); 873 GenerationInfo& info = m_generationInfo[virtualRegister];873 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 874 874 info.initJSValue(node, node->refCount(), tag, payload, format); 875 875 } … … 886 886 VirtualRegister virtualRegister = node->virtualRegister(); 887 887 m_gprs.retain(reg, virtualRegister, SpillOrderStorage); 888 GenerationInfo& info = m_generationInfo[virtualRegister];888 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 889 889 info.initStorage(node, node->refCount(), reg); 890 890 } … … 896 896 VirtualRegister virtualRegister = node->virtualRegister(); 897 897 m_fprs.retain(reg, virtualRegister, SpillOrderDouble); 898 GenerationInfo& info = m_generationInfo[virtualRegister];898 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 899 899 info.initDouble(node, node->refCount(), reg); 900 900 } … … 902 902 { 903 903 ASSERT(isInt32Constant(node) || isNumberConstant(node) || isJSConstant(node)); 904 m_generationInfo[node->virtualRegister()].initConstant(node, node->refCount());904 generationInfoFromVirtualRegister(node->virtualRegister()).initConstant(node, node->refCount()); 905 905 } 906 906 … … 1886 1886 1887 1887 VirtualRegister virtualRegister = node->virtualRegister(); 1888 GenerationInfo& info = m_generationInfo[virtualRegister];1888 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 1889 1889 1890 1890 return info.isJSInteger(); … … 2173 2173 return m_arguments[argument]; 2174 2174 } 2175 2176 int local = operandToLocal(operand); 2177 if ((unsigned)local >= m_variables.size()) 2178 m_variables.resize(local + 1); 2175 2179 2176 if ((unsigned)operand >= m_variables.size()) 2177 m_variables.resize(operand + 1); 2178 2179 return m_variables[operand]; 2180 return m_variables[local]; 2180 2181 } 2181 2182 … … 2185 2186 m_stream->appendAndLog(VariableEvent::setLocal(operand, valueSource.dataFormat())); 2186 2187 } 2187 2188 2189 GenerationInfo& generationInfoFromVirtualRegister(VirtualRegister virtualRegister) 2190 { 2191 return m_generationInfo[operandToLocal(virtualRegister)]; 2192 } 2193 2188 2194 // The JIT, while also provides MacroAssembler functionality. 2189 2195 JITCompiler& m_jit; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r155201 r155415 47 47 48 48 VirtualRegister virtualRegister = edge->virtualRegister(); 49 GenerationInfo& info = m_generationInfo[virtualRegister];49 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 50 50 51 51 if (info.registerFormat() == DataFormatNone) { … … 123 123 124 124 VirtualRegister virtualRegister = edge->virtualRegister(); 125 GenerationInfo& info = m_generationInfo[virtualRegister];125 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 126 126 127 127 switch (info.registerFormat()) { … … 866 866 m_interpreter.filter(value, SpecInt32); 867 867 VirtualRegister virtualRegister = edge->virtualRegister(); 868 GenerationInfo& info = m_generationInfo[virtualRegister];868 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 869 869 870 870 switch (info.registerFormat()) { … … 967 967 m_interpreter.filter(value, SpecNumber); 968 968 VirtualRegister virtualRegister = edge->virtualRegister(); 969 GenerationInfo& info = m_generationInfo[virtualRegister];969 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 970 970 971 971 if (info.registerFormat() == DataFormatNone) { … … 1104 1104 m_interpreter.filter(value, SpecCell); 1105 1105 VirtualRegister virtualRegister = edge->virtualRegister(); 1106 GenerationInfo& info = m_generationInfo[virtualRegister];1106 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 1107 1107 1108 1108 switch (info.registerFormat()) { … … 1185 1185 m_interpreter.filter(value, SpecBoolean); 1186 1186 VirtualRegister virtualRegister = edge->virtualRegister(); 1187 GenerationInfo& info = m_generationInfo[virtualRegister];1187 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 1188 1188 1189 1189 switch (info.registerFormat()) { … … 2003 2003 VirtualRegister virtualRegister = node->virtualRegister(); 2004 2004 m_fprs.retain(result.fpr(), virtualRegister, SpillOrderDouble); 2005 m_generationInfo[virtualRegister].initDouble(node, node->refCount(), result.fpr());2005 generationInfoFromVirtualRegister(virtualRegister).initDouble(node, node->refCount(), result.fpr()); 2006 2006 break; 2007 2007 } … … 2015 2015 VirtualRegister virtualRegister = node->virtualRegister(); 2016 2016 m_gprs.retain(result.gpr(), virtualRegister, SpillOrderInteger); 2017 m_generationInfo[virtualRegister].initInteger(node, node->refCount(), result.gpr());2017 generationInfoFromVirtualRegister(virtualRegister).initInteger(node, node->refCount(), result.gpr()); 2018 2018 break; 2019 2019 } … … 2027 2027 VirtualRegister virtualRegister = node->virtualRegister(); 2028 2028 m_gprs.retain(result.gpr(), virtualRegister, SpillOrderCell); 2029 m_generationInfo[virtualRegister].initCell(node, node->refCount(), result.gpr());2029 generationInfoFromVirtualRegister(virtualRegister).initCell(node, node->refCount(), result.gpr()); 2030 2030 break; 2031 2031 } … … 2039 2039 VirtualRegister virtualRegister = node->virtualRegister(); 2040 2040 m_gprs.retain(result.gpr(), virtualRegister, SpillOrderBoolean); 2041 m_generationInfo[virtualRegister].initBoolean(node, node->refCount(), result.gpr());2041 generationInfoFromVirtualRegister(virtualRegister).initBoolean(node, node->refCount(), result.gpr()); 2042 2042 break; 2043 2043 } … … 2054 2054 m_gprs.retain(tag.gpr(), virtualRegister, SpillOrderJS); 2055 2055 2056 m_generationInfo[virtualRegister].initJSValue(node, node->refCount(), tag.gpr(), result.gpr(), DataFormatJS);2056 generationInfoFromVirtualRegister(virtualRegister).initJSValue(node, node->refCount(), tag.gpr(), result.gpr(), DataFormatJS); 2057 2057 break; 2058 2058 } … … 2102 2102 } 2103 2103 SpeculatedType predictedType = node->variableAccessData()->argumentAwarePrediction(); 2104 if ( m_generationInfo[node->child1()->virtualRegister()].registerFormat() == DataFormatDouble) {2104 if (generationInfoFromVirtualRegister(node->child1()->virtualRegister()).registerFormat() == DataFormatDouble) { 2105 2105 SpeculateDoubleOperand value(this, node->child1(), ManualOperandSpeculation); 2106 2106 m_jit.storeDouble(value.fpr(), JITCompiler::addressFor(node->local())); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r155201 r155415 46 46 47 47 VirtualRegister virtualRegister = edge->virtualRegister(); 48 GenerationInfo& info = m_generationInfo[virtualRegister];48 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 49 49 50 50 if (info.registerFormat() == DataFormatNone) { … … 124 124 { 125 125 VirtualRegister virtualRegister = edge->virtualRegister(); 126 GenerationInfo& info = m_generationInfo[virtualRegister];126 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 127 127 128 128 switch (info.registerFormat()) { … … 826 826 m_interpreter.filter(value, SpecInt32); 827 827 VirtualRegister virtualRegister = edge->virtualRegister(); 828 GenerationInfo& info = m_generationInfo[virtualRegister];828 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 829 829 830 830 switch (info.registerFormat()) { … … 976 976 m_interpreter.filter(value, SpecNumber); 977 977 VirtualRegister virtualRegister = edge->virtualRegister(); 978 GenerationInfo& info = m_generationInfo[virtualRegister];978 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 979 979 980 980 if (info.registerFormat() == DataFormatNone) { … … 1133 1133 m_interpreter.filter(value, SpecCell); 1134 1134 VirtualRegister virtualRegister = edge->virtualRegister(); 1135 GenerationInfo& info = m_generationInfo[virtualRegister];1135 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 1136 1136 1137 1137 switch (info.registerFormat()) { … … 1215 1215 m_interpreter.filter(value, SpecBoolean); 1216 1216 VirtualRegister virtualRegister = edge->virtualRegister(); 1217 GenerationInfo& info = m_generationInfo[virtualRegister];1217 GenerationInfo& info = generationInfoFromVirtualRegister(virtualRegister); 1218 1218 1219 1219 switch (info.registerFormat()) { … … 1970 1970 VirtualRegister virtualRegister = node->virtualRegister(); 1971 1971 m_fprs.retain(result.fpr(), virtualRegister, SpillOrderDouble); 1972 m_generationInfo[virtualRegister].initDouble(node, node->refCount(), result.fpr());1972 generationInfoFromVirtualRegister(virtualRegister).initDouble(node, node->refCount(), result.fpr()); 1973 1973 break; 1974 1974 } … … 1982 1982 VirtualRegister virtualRegister = node->virtualRegister(); 1983 1983 m_gprs.retain(result.gpr(), virtualRegister, SpillOrderInteger); 1984 m_generationInfo[virtualRegister].initInteger(node, node->refCount(), result.gpr());1984 generationInfoFromVirtualRegister(virtualRegister).initInteger(node, node->refCount(), result.gpr()); 1985 1985 break; 1986 1986 } … … 2002 2002 format = DataFormatJS; 2003 2003 2004 m_generationInfo[virtualRegister].initJSValue(node, node->refCount(), result.gpr(), format);2004 generationInfoFromVirtualRegister(virtualRegister).initJSValue(node, node->refCount(), result.gpr(), format); 2005 2005 break; 2006 2006 } -
trunk/Source/JavaScriptCore/dfg/DFGValidate.cpp
r153274 r155415 75 75 // NB. This code is not written for performance, since it is not intended to run 76 76 // in release builds. 77 77 78 78 // Validate that all local variables at the head of the root block are dead. 79 79 BasicBlock* root = m_graph.block(0); 80 80 for (unsigned i = 0; i < root->variablesAtHead.numberOfLocals(); ++i) 81 V_EQUAL((static_cast<VirtualRegister>( i), 0), static_cast<Node*>(0), root->variablesAtHead.local(i));81 V_EQUAL((static_cast<VirtualRegister>(localToOperand(i)), 0), static_cast<Node*>(0), root->variablesAtHead.local(i)); 82 82 83 83 // Validate ref counts and uses. … … 326 326 } 327 327 for (size_t i = 0; i < block->variablesAtHead.numberOfLocals(); ++i) { 328 VALIDATE((static_cast<VirtualRegister>( i), block), !block->variablesAtHead.local(i) || block->variablesAtHead.local(i)->hasVariableAccessData(m_graph));328 VALIDATE((static_cast<VirtualRegister>(localToOperand(i)), block), !block->variablesAtHead.local(i) || block->variablesAtHead.local(i)->hasVariableAccessData(m_graph)); 329 329 if (m_graph.m_form == ThreadedCPS) 330 VALIDATE((static_cast<VirtualRegister>( i), block), !block->variablesAtTail.local(i) || block->variablesAtTail.local(i)->hasVariableAccessData(m_graph));330 VALIDATE((static_cast<VirtualRegister>(localToOperand(i)), block), !block->variablesAtTail.local(i) || block->variablesAtTail.local(i)->hasVariableAccessData(m_graph)); 331 331 332 332 getLocalPositions.local(i) = notSet; … … 394 394 for (size_t i = 0; i < block->variablesAtHead.numberOfLocals(); ++i) { 395 395 checkOperand( 396 block, getLocalPositions, setLocalPositions, i);396 block, getLocalPositions, setLocalPositions, localToOperand(i)); 397 397 } 398 398 } -
trunk/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp
r153292 r155415 116 116 unsigned numVariables; 117 117 if (codeOrigin.inlineCallFrame) 118 numVariables = baselineCodeBlockForInlineCallFrame(codeOrigin.inlineCallFrame)->m_numCalleeRegisters + codeOrigin.inlineCallFrame->stackOffset;118 numVariables = baselineCodeBlockForInlineCallFrame(codeOrigin.inlineCallFrame)->m_numCalleeRegisters + operandToLocal(codeOrigin.inlineCallFrame->stackOffset); 119 119 else 120 120 numVariables = baselineCodeBlock->m_numCalleeRegisters; … … 310 310 for (InlineCallFrame* inlineCallFrame = codeOrigin.inlineCallFrame; inlineCallFrame; inlineCallFrame = inlineCallFrame->caller.inlineCallFrame) { 311 311 for (unsigned i = JSStack::CallFrameHeaderSize; i--;) 312 valueRecoveries.setLocal( inlineCallFrame->stackOffset- i - 1, ValueRecovery::alreadyInJSStack());312 valueRecoveries.setLocal(operandToLocal(inlineCallFrame->stackOffset) - i - 1, ValueRecovery::alreadyInJSStack()); 313 313 } 314 314 } -
trunk/Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp
r153267 r155415 127 127 InlineCallFrame& inlineCallFrame = codeBlock()->inlineCallFrames()[i]; 128 128 CodeBlock* codeBlock = baselineCodeBlockForInlineCallFrame(&inlineCallFrame); 129 unsigned requiredCalleeRegisters = inlineCallFrame.stackOffset+ codeBlock->m_numCalleeRegisters;129 unsigned requiredCalleeRegisters = operandToLocal(inlineCallFrame.stackOffset) + codeBlock->m_numCalleeRegisters; 130 130 if (requiredCalleeRegisters > calleeRegisters) 131 131 calleeRegisters = requiredCalleeRegisters; -
trunk/Source/JavaScriptCore/jit/JITInlines.h
r155399 r155415 759 759 } 760 760 761 if (src == m_lastResultBytecodeRegister && m_codeBlock->isTemporaryRegisterIndex( src) && !atJumpTarget()) {761 if (src == m_lastResultBytecodeRegister && m_codeBlock->isTemporaryRegisterIndex(operandToLocal(src)) && !atJumpTarget()) { 762 762 // The argument we want is already stored in eax 763 763 if (dst != cachedResultRegister) -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r154797 r155415 837 837 size_t count = m_codeBlock->m_numVars; 838 838 for (size_t j = 0; j < count; ++j) 839 emitInitRegister( j);839 emitInitRegister(localToOperand(j)); 840 840 } 841 841 -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r154839 r155415 1100 1100 // object lifetime and increasing GC pressure. 1101 1101 for (int i = 0; i < m_codeBlock->m_numVars; ++i) 1102 emitStore( i, jsUndefined());1102 emitStore(localToOperand(i), jsUndefined()); 1103 1103 } 1104 1104
Note: See TracChangeset
for help on using the changeset viewer.