Changeset 156482 in webkit
- Timestamp:
- Sep 26, 2013 11:31:29 AM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 65 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r156480 r156482 1 2013-09-26 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r156474. 4 http://trac.webkit.org/changeset/156474 5 https://bugs.webkit.org/show_bug.cgi?id=121966 6 7 Broke the builds. (Requested by xenon on #webkit). 8 9 * bytecode/CodeBlock.cpp: 10 (JSC::CodeBlock::registerName): 11 (JSC::CodeBlock::dumpBytecode): 12 (JSC::CodeBlock::CodeBlock): 13 (JSC::CodeBlock::createActivation): 14 (JSC::CodeBlock::nameForRegister): 15 * bytecode/CodeBlock.h: 16 (JSC::unmodifiedArgumentsRegister): 17 (JSC::CodeBlock::isKnownNotImmediate): 18 (JSC::CodeBlock::setThisRegister): 19 (JSC::CodeBlock::thisRegister): 20 (JSC::CodeBlock::setArgumentsRegister): 21 (JSC::CodeBlock::argumentsRegister): 22 (JSC::CodeBlock::uncheckedArgumentsRegister): 23 (JSC::CodeBlock::setActivationRegister): 24 (JSC::CodeBlock::activationRegister): 25 (JSC::CodeBlock::uncheckedActivationRegister): 26 (JSC::CodeBlock::usesArguments): 27 (JSC::CodeBlock::isCaptured): 28 * bytecode/Instruction.h: 29 * bytecode/LazyOperandValueProfile.h: 30 (JSC::LazyOperandValueProfileKey::LazyOperandValueProfileKey): 31 (JSC::LazyOperandValueProfileKey::operator!): 32 (JSC::LazyOperandValueProfileKey::hash): 33 (JSC::LazyOperandValueProfileKey::operand): 34 (JSC::LazyOperandValueProfileKey::isHashTableDeletedValue): 35 (JSC::LazyOperandValueProfile::LazyOperandValueProfile): 36 * bytecode/MethodOfGettingAValueProfile.cpp: 37 (JSC::MethodOfGettingAValueProfile::fromLazyOperand): 38 (JSC::MethodOfGettingAValueProfile::getSpecFailBucket): 39 * bytecode/Operands.h: 40 (JSC::localToOperand): 41 (JSC::operandIsLocal): 42 (JSC::operandToLocal): 43 (JSC::operandIsArgument): 44 (JSC::operandToArgument): 45 (JSC::argumentToOperand): 46 (JSC::Operands::operand): 47 (JSC::Operands::hasOperand): 48 (JSC::Operands::setOperand): 49 (JSC::Operands::operandForIndex): 50 (JSC::Operands::setOperandFirstTime): 51 * bytecode/UnlinkedCodeBlock.cpp: 52 (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): 53 * bytecode/UnlinkedCodeBlock.h: 54 (JSC::UnlinkedCodeBlock::setThisRegister): 55 (JSC::UnlinkedCodeBlock::setActivationRegister): 56 (JSC::UnlinkedCodeBlock::setArgumentsRegister): 57 (JSC::UnlinkedCodeBlock::usesArguments): 58 (JSC::UnlinkedCodeBlock::argumentsRegister): 59 (JSC::UnlinkedCodeBlock::usesGlobalObject): 60 (JSC::UnlinkedCodeBlock::setGlobalObjectRegister): 61 (JSC::UnlinkedCodeBlock::globalObjectRegister): 62 (JSC::UnlinkedCodeBlock::thisRegister): 63 (JSC::UnlinkedCodeBlock::activationRegister): 64 * bytecode/ValueRecovery.h: 65 (JSC::ValueRecovery::displacedInJSStack): 66 (JSC::ValueRecovery::virtualRegister): 67 (JSC::ValueRecovery::dumpInContext): 68 * bytecode/VirtualRegister.h: 69 (WTF::printInternal): 70 * bytecompiler/BytecodeGenerator.cpp: 71 (JSC::BytecodeGenerator::generate): 72 (JSC::BytecodeGenerator::addVar): 73 (JSC::BytecodeGenerator::BytecodeGenerator): 74 (JSC::BytecodeGenerator::createLazyRegisterIfNecessary): 75 (JSC::BytecodeGenerator::newRegister): 76 (JSC::BytecodeGenerator::emitLoadGlobalObject): 77 (JSC::BytecodeGenerator::emitGetArgumentsLength): 78 (JSC::BytecodeGenerator::emitGetArgumentByVal): 79 (JSC::BytecodeGenerator::createArgumentsIfNecessary): 80 (JSC::BytecodeGenerator::emitReturn): 81 * bytecompiler/BytecodeGenerator.h: 82 (JSC::BytecodeGenerator::registerFor): 83 * bytecompiler/RegisterID.h: 84 (JSC::RegisterID::RegisterID): 85 (JSC::RegisterID::setIndex): 86 (JSC::RegisterID::index): 87 * debugger/DebuggerCallFrame.cpp: 88 (JSC::DebuggerCallFrame::thisObject): 89 * dfg/DFGAbstractHeap.h: 90 (JSC::DFG::AbstractHeap::Payload::Payload): 91 * dfg/DFGAbstractInterpreterInlines.h: 92 (JSC::DFG::::executeEffects): 93 (JSC::DFG::::clobberCapturedVars): 94 * dfg/DFGArgumentPosition.h: 95 (JSC::DFG::ArgumentPosition::dump): 96 * dfg/DFGArgumentsSimplificationPhase.cpp: 97 (JSC::DFG::ArgumentsSimplificationPhase::run): 98 (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse): 99 (JSC::DFG::ArgumentsSimplificationPhase::isOKToOptimize): 100 * dfg/DFGByteCodeParser.cpp: 101 (JSC::DFG::ByteCodeParser::newVariableAccessData): 102 (JSC::DFG::ByteCodeParser::getDirect): 103 (JSC::DFG::ByteCodeParser::get): 104 (JSC::DFG::ByteCodeParser::setDirect): 105 (JSC::DFG::ByteCodeParser::set): 106 (JSC::DFG::ByteCodeParser::getLocal): 107 (JSC::DFG::ByteCodeParser::setLocal): 108 (JSC::DFG::ByteCodeParser::getArgument): 109 (JSC::DFG::ByteCodeParser::setArgument): 110 (JSC::DFG::ByteCodeParser::findArgumentPositionForLocal): 111 (JSC::DFG::ByteCodeParser::findArgumentPosition): 112 (JSC::DFG::ByteCodeParser::flush): 113 (JSC::DFG::ByteCodeParser::flushDirect): 114 (JSC::DFG::ByteCodeParser::getToInt32): 115 (JSC::DFG::ByteCodeParser::getThis): 116 (JSC::DFG::ByteCodeParser::addCall): 117 (JSC::DFG::ByteCodeParser::InlineStackEntry::remapOperand): 118 (JSC::DFG::ByteCodeParser::handleCall): 119 (JSC::DFG::ByteCodeParser::emitFunctionChecks): 120 (JSC::DFG::ByteCodeParser::emitArgumentPhantoms): 121 (JSC::DFG::ByteCodeParser::handleInlining): 122 (JSC::DFG::ByteCodeParser::handleMinMax): 123 (JSC::DFG::ByteCodeParser::handleIntrinsic): 124 (JSC::DFG::ByteCodeParser::handleTypedArrayConstructor): 125 (JSC::DFG::ByteCodeParser::handleConstantInternalFunction): 126 (JSC::DFG::ByteCodeParser::handleGetByOffset): 127 (JSC::DFG::ByteCodeParser::handleGetById): 128 (JSC::DFG::ByteCodeParser::parseBlock): 129 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): 130 (JSC::DFG::ByteCodeParser::parse): 131 * dfg/DFGCFGSimplificationPhase.cpp: 132 * dfg/DFGCPSRethreadingPhase.cpp: 133 (JSC::DFG::CPSRethreadingPhase::canonicalizeGetLocal): 134 (JSC::DFG::CPSRethreadingPhase::canonicalizeFlushOrPhantomLocal): 135 (JSC::DFG::CPSRethreadingPhase::canonicalizeSetArgument): 136 * dfg/DFGCapabilities.cpp: 137 (JSC::DFG::capabilityLevel): 138 * dfg/DFGConstantFoldingPhase.cpp: 139 (JSC::DFG::ConstantFoldingPhase::isCapturedAtOrAfter): 140 * dfg/DFGFlushLivenessAnalysisPhase.cpp: 141 (JSC::DFG::FlushLivenessAnalysisPhase::setForNode): 142 * dfg/DFGGraph.cpp: 143 (JSC::DFG::Graph::dump): 144 * dfg/DFGGraph.h: 145 (JSC::DFG::Graph::argumentsRegisterFor): 146 (JSC::DFG::Graph::uncheckedArgumentsRegisterFor): 147 (JSC::DFG::Graph::uncheckedActivationRegisterFor): 148 (JSC::DFG::Graph::valueProfileFor): 149 * dfg/DFGJITCode.cpp: 150 (JSC::DFG::JITCode::reconstruct): 151 * dfg/DFGNode.h: 152 (JSC::DFG::Node::Node): 153 (JSC::DFG::Node::convertToGetLocalUnlinked): 154 (JSC::DFG::Node::hasVirtualRegister): 155 (JSC::DFG::Node::virtualRegister): 156 (JSC::DFG::Node::setVirtualRegister): 157 * dfg/DFGOSREntry.cpp: 158 (JSC::DFG::prepareOSREntry): 159 * dfg/DFGOSREntrypointCreationPhase.cpp: 160 (JSC::DFG::OSREntrypointCreationPhase::run): 161 * dfg/DFGOSRExit.h: 162 * dfg/DFGOSRExitCompiler32_64.cpp: 163 (JSC::DFG::OSRExitCompiler::compileExit): 164 * dfg/DFGOSRExitCompiler64.cpp: 165 (JSC::DFG::OSRExitCompiler::compileExit): 166 * dfg/DFGRegisterBank.h: 167 (JSC::DFG::RegisterBank::tryAllocate): 168 (JSC::DFG::RegisterBank::allocateSpecific): 169 (JSC::DFG::RegisterBank::retain): 170 (JSC::DFG::RegisterBank::isInUse): 171 (JSC::DFG::RegisterBank::dump): 172 (JSC::DFG::RegisterBank::releaseAtIndex): 173 (JSC::DFG::RegisterBank::allocateInternal): 174 (JSC::DFG::RegisterBank::MapEntry::MapEntry): 175 * dfg/DFGScoreBoard.h: 176 (JSC::DFG::ScoreBoard::allocate): 177 (JSC::DFG::ScoreBoard::use): 178 * dfg/DFGSpeculativeJIT.cpp: 179 (JSC::DFG::SpeculativeJIT::SpeculativeJIT): 180 (JSC::DFG::SpeculativeJIT::checkConsistency): 181 (JSC::DFG::SpeculativeJIT::compileMovHint): 182 (JSC::DFG::SpeculativeJIT::compileInlineStart): 183 (JSC::DFG::SpeculativeJIT::compileCurrentBlock): 184 * dfg/DFGSpeculativeJIT.h: 185 (JSC::DFG::SpeculativeJIT::allocate): 186 (JSC::DFG::SpeculativeJIT::fprAllocate): 187 (JSC::DFG::SpeculativeJIT::silentSpillAllRegistersImpl): 188 (JSC::DFG::SpeculativeJIT::flushRegisters): 189 (JSC::DFG::SpeculativeJIT::isFlushed): 190 (JSC::DFG::SpeculativeJIT::argumentSlot): 191 (JSC::DFG::SpeculativeJIT::argumentTagSlot): 192 (JSC::DFG::SpeculativeJIT::argumentPayloadSlot): 193 (JSC::DFG::SpeculativeJIT::valueSourceForOperand): 194 (JSC::DFG::SpeculativeJIT::setNodeForOperand): 195 (JSC::DFG::SpeculativeJIT::valueSourceReferenceForOperand): 196 (JSC::DFG::SpeculativeJIT::recordSetLocal): 197 (JSC::DFG::SpeculativeJIT::generationInfoFromVirtualRegister): 198 (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor): 199 * dfg/DFGSpeculativeJIT64.cpp: 200 (JSC::DFG::SpeculativeJIT::compile): 201 * dfg/DFGValidate.cpp: 202 (JSC::DFG::Validate::validate): 203 (JSC::DFG::Validate::validateCPS): 204 (JSC::DFG::Validate::checkOperand): 205 (JSC::DFG::Validate::reportValidationContext): 206 * dfg/DFGValueRecoveryOverride.h: 207 (JSC::DFG::ValueRecoveryOverride::ValueRecoveryOverride): 208 * dfg/DFGVariableAccessData.h: 209 (JSC::DFG::VariableAccessData::operand): 210 (JSC::DFG::VariableAccessData::shouldUseDoubleFormatAccordingToVote): 211 (JSC::DFG::VariableAccessData::tallyVotesForShouldUseDoubleFormat): 212 (JSC::DFG::VariableAccessData::flushFormat): 213 * dfg/DFGVariableEvent.h: 214 (JSC::DFG::VariableEvent::spill): 215 (JSC::DFG::VariableEvent::setLocal): 216 * dfg/DFGVariableEventStream.cpp: 217 (JSC::DFG::VariableEventStream::reconstruct): 218 * dfg/DFGVirtualRegisterAllocationPhase.cpp: 219 (JSC::DFG::VirtualRegisterAllocationPhase::run): 220 * ftl/FTLExitArgumentForOperand.h: 221 (JSC::FTL::ExitArgumentForOperand::ExitArgumentForOperand): 222 (JSC::FTL::ExitArgumentForOperand::operand): 223 * ftl/FTLLink.cpp: 224 (JSC::FTL::link): 225 * ftl/FTLLowerDFGToLLVM.cpp: 226 (JSC::FTL::LowerDFGToLLVM::LowerDFGToLLVM): 227 (JSC::FTL::LowerDFGToLLVM::compileGetArgument): 228 (JSC::FTL::LowerDFGToLLVM::compileExtractOSREntryLocal): 229 (JSC::FTL::LowerDFGToLLVM::compileCallOrConstruct): 230 (JSC::FTL::LowerDFGToLLVM::appendOSRExit): 231 (JSC::FTL::LowerDFGToLLVM::observeMovHint): 232 (JSC::FTL::LowerDFGToLLVM::addressFor): 233 (JSC::FTL::LowerDFGToLLVM::payloadFor): 234 (JSC::FTL::LowerDFGToLLVM::tagFor): 235 * ftl/FTLOSREntry.cpp: 236 (JSC::FTL::prepareOSREntry): 237 * ftl/FTLOSRExit.cpp: 238 (JSC::FTL::OSRExit::convertToForward): 239 * ftl/FTLOSRExit.h: 240 * ftl/FTLOSRExitCompiler.cpp: 241 (JSC::FTL::compileStub): 242 * interpreter/CallFrame.h: 243 * interpreter/Interpreter.cpp: 244 (JSC::Interpreter::dumpRegisters): 245 (JSC::unwindCallFrame): 246 (JSC::Interpreter::unwind): 247 * jit/AssemblyHelpers.h: 248 (JSC::AssemblyHelpers::addressFor): 249 (JSC::AssemblyHelpers::tagFor): 250 (JSC::AssemblyHelpers::payloadFor): 251 (JSC::AssemblyHelpers::argumentsRegisterFor): 252 * jit/JIT.h: 253 * jit/JITCall.cpp: 254 (JSC::JIT::compileLoadVarargs): 255 * jit/JITInlines.h: 256 (JSC::JIT::emitGetVirtualRegister): 257 * jit/JITOpcodes.cpp: 258 (JSC::JIT::emit_op_tear_off_arguments): 259 (JSC::JIT::emit_op_get_pnames): 260 (JSC::JIT::emit_op_enter): 261 (JSC::JIT::emit_op_create_arguments): 262 (JSC::JIT::emitSlow_op_get_argument_by_val): 263 * jit/JITOpcodes32_64.cpp: 264 (JSC::JIT::emit_op_enter): 265 * jit/JITStubs.cpp: 266 (JSC::DEFINE_STUB_FUNCTION): 267 * llint/LLIntSlowPaths.cpp: 268 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 269 * profiler/ProfilerBytecodeSequence.cpp: 270 (JSC::Profiler::BytecodeSequence::BytecodeSequence): 271 * runtime/CommonSlowPaths.cpp: 272 (JSC::SLOW_PATH_DECL): 273 * runtime/JSActivation.cpp: 274 (JSC::JSActivation::argumentsGetter): 275 1 276 2013-09-26 Oliver Hunt <oliver@apple.com> 2 277 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r156474 r156482 169 169 170 170 if (operandIsArgument(r)) { 171 if (! VirtualRegister(r).toArgument())171 if (!operandToArgument(r)) 172 172 return "this"; 173 return toCString("arg", VirtualRegister(r).toArgument());174 } 175 176 return toCString("loc", VirtualRegister(r).toLocal());173 return toCString("arg", operandToArgument(r)); 174 } 175 176 return toCString("loc", operandToLocal(r)); 177 177 } 178 178 … … 515 515 out.printf( 516 516 "; uses arguments, in r%d, r%d", 517 argumentsRegister() .offset(),518 unmodifiedArgumentsRegister(argumentsRegister()) .offset());517 argumentsRegister(), 518 unmodifiedArgumentsRegister(argumentsRegister())); 519 519 } 520 520 if (needsFullScopeChain() && codeType() == FunctionCode) 521 out.printf("; activation in r%d", activationRegister() .offset());521 out.printf("; activation in r%d", activationRegister()); 522 522 out.printf("\n"); 523 523 … … 1620 1620 setConstantRegisters(unlinkedCodeBlock->constantRegisters()); 1621 1621 if (unlinkedCodeBlock->usesGlobalObject()) 1622 m_constantRegisters[unlinkedCodeBlock->globalObjectRegister() .offset()].set(*m_vm, ownerExecutable, m_globalObject.get());1622 m_constantRegisters[unlinkedCodeBlock->globalObjectRegister()].set(*m_vm, ownerExecutable, m_globalObject.get()); 1623 1623 m_functionDecls.grow(unlinkedCodeBlock->numberOfFunctionDecls()); 1624 1624 for (size_t count = unlinkedCodeBlock->numberOfFunctionDecls(), i = 0; i < count; ++i) { … … 2558 2558 ASSERT(codeType() == FunctionCode); 2559 2559 ASSERT(needsFullScopeChain()); 2560 ASSERT(!callFrame->uncheckedR(activationRegister() .offset()).jsValue());2560 ASSERT(!callFrame->uncheckedR(activationRegister()).jsValue()); 2561 2561 JSActivation* activation = JSActivation::create(callFrame->vm(), callFrame, this); 2562 callFrame->uncheckedR(activationRegister() .offset()) = JSValue(activation);2562 callFrame->uncheckedR(activationRegister()) = JSValue(activation); 2563 2563 callFrame->setScope(activation); 2564 2564 } … … 3328 3328 } 3329 3329 3330 String CodeBlock::nameForRegister( VirtualRegister virtualRegister)3330 String CodeBlock::nameForRegister(int registerNumber) 3331 3331 { 3332 3332 ConcurrentJITLocker locker(symbolTable()->m_lock); 3333 3333 SymbolTable::Map::iterator end = symbolTable()->end(locker); 3334 3334 for (SymbolTable::Map::iterator ptr = symbolTable()->begin(locker); ptr != end; ++ptr) { 3335 if (ptr->value.getIndex() == virtualRegister.offset()) {3335 if (ptr->value.getIndex() == registerNumber) { 3336 3336 // FIXME: This won't work from the compilation thread. 3337 3337 // https://bugs.webkit.org/show_bug.cgi?id=115300 … … 3339 3339 } 3340 3340 } 3341 if (needsActivation() && virtualRegister == activationRegister())3341 if (needsActivation() && registerNumber == activationRegister()) 3342 3342 return ASCIILiteral("activation"); 3343 if ( virtualRegister == thisRegister())3343 if (registerNumber == thisRegister()) 3344 3344 return ASCIILiteral("this"); 3345 3345 if (usesArguments()) { 3346 if ( virtualRegister == argumentsRegister())3346 if (registerNumber == argumentsRegister()) 3347 3347 return ASCIILiteral("arguments"); 3348 if (unmodifiedArgumentsRegister(argumentsRegister()) == virtualRegister)3348 if (unmodifiedArgumentsRegister(argumentsRegister()) == registerNumber) 3349 3349 return ASCIILiteral("real arguments"); 3350 3350 } 3351 if (virtualRegister.isArgument()) 3352 return String::format("arguments[%3d]", virtualRegister.toArgument()).impl(); 3353 3351 if (registerNumber < 0) { 3352 int argumentPosition = -registerNumber; 3353 argumentPosition -= JSStack::CallFrameHeaderSize + 1; 3354 return String::format("arguments[%3d]", argumentPosition - 1).impl(); 3355 } 3354 3356 return ""; 3355 3357 } -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r156474 r156482 72 72 #include "UnconditionalFinalizer.h" 73 73 #include "ValueProfile.h" 74 #include "VirtualRegister.h"75 74 #include "Watchpoint.h" 76 75 #include <wtf/FastMalloc.h> … … 88 87 class RepatchBuffer; 89 88 90 inline VirtualRegister unmodifiedArgumentsRegister(VirtualRegister argumentsRegister) { return VirtualRegister(argumentsRegister.offset() + 1); }89 inline int unmodifiedArgumentsRegister(int argumentsRegister) { return argumentsRegister + 1; } 91 90 92 91 static ALWAYS_INLINE int missingThisObjectMarker() { return std::numeric_limits<int>::max(); } … … 150 149 inline bool isKnownNotImmediate(int index) 151 150 { 152 if (index == m_thisRegister .offset()&& !m_isStrictMode)151 if (index == m_thisRegister && !m_isStrictMode) 153 152 return true; 154 153 … … 300 299 VM* vm() { return m_vm; } 301 300 302 void setThisRegister( VirtualRegisterthisRegister) { m_thisRegister = thisRegister; }303 VirtualRegisterthisRegister() const { return m_thisRegister; }301 void setThisRegister(int thisRegister) { m_thisRegister = thisRegister; } 302 int thisRegister() const { return m_thisRegister; } 304 303 305 304 bool needsFullScopeChain() const { return m_unlinkedCode->needsFullScopeChain(); } 306 305 bool usesEval() const { return m_unlinkedCode->usesEval(); } 307 306 308 void setArgumentsRegister( VirtualRegisterargumentsRegister)309 { 310 ASSERT(argumentsRegister .isValid());307 void setArgumentsRegister(int argumentsRegister) 308 { 309 ASSERT(argumentsRegister != (int)InvalidVirtualRegister); 311 310 m_argumentsRegister = argumentsRegister; 312 311 ASSERT(usesArguments()); 313 312 } 314 VirtualRegisterargumentsRegister() const313 int argumentsRegister() const 315 314 { 316 315 ASSERT(usesArguments()); 317 316 return m_argumentsRegister; 318 317 } 319 VirtualRegisteruncheckedArgumentsRegister()318 int uncheckedArgumentsRegister() 320 319 { 321 320 if (!usesArguments()) 322 return VirtualRegister();321 return InvalidVirtualRegister; 323 322 return argumentsRegister(); 324 323 } 325 void setActivationRegister( VirtualRegisteractivationRegister)324 void setActivationRegister(int activationRegister) 326 325 { 327 326 m_activationRegister = activationRegister; 328 327 } 329 330 VirtualRegister activationRegister() const 328 int activationRegister() const 331 329 { 332 330 ASSERT(needsFullScopeChain()); 333 331 return m_activationRegister; 334 332 } 335 336 VirtualRegister uncheckedActivationRegister() 333 int uncheckedActivationRegister() 337 334 { 338 335 if (!needsFullScopeChain()) 339 return VirtualRegister();336 return InvalidVirtualRegister; 340 337 return activationRegister(); 341 338 } 342 343 bool usesArguments() const { return m_argumentsRegister.isValid(); } 339 bool usesArguments() const { return m_argumentsRegister != (int)InvalidVirtualRegister; } 344 340 345 341 bool needsActivation() const … … 348 344 } 349 345 350 bool isCaptured( VirtualRegisteroperand, InlineCallFrame* inlineCallFrame = 0) const351 { 352 if (operand .isArgument())353 return operand .toArgument() && usesArguments();346 bool isCaptured(int operand, InlineCallFrame* inlineCallFrame = 0) const 347 { 348 if (operandIsArgument(operand)) 349 return operandToArgument(operand) && usesArguments(); 354 350 355 351 if (inlineCallFrame) 356 return inlineCallFrame->capturedVars.get(operand .toLocal());352 return inlineCallFrame->capturedVars.get(operandToLocal(operand)); 357 353 358 354 // The activation object isn't in the captured region, but it's "captured" … … 373 369 return false; 374 370 375 return operand .offset()<= symbolTable()->captureStart()376 && operand .offset()> symbolTable()->captureEnd();371 return operand <= symbolTable()->captureStart() 372 && operand > symbolTable()->captureEnd(); 377 373 } 378 374 … … 396 392 void clearEvalCache(); 397 393 398 String nameForRegister( VirtualRegister);394 String nameForRegister(int registerNumber); 399 395 400 396 #if ENABLE(JIT) … … 1032 1028 1033 1029 RefCountedArray<Instruction> m_instructions; 1034 VirtualRegisterm_thisRegister;1035 VirtualRegisterm_argumentsRegister;1036 VirtualRegisterm_activationRegister;1030 int m_thisRegister; 1031 int m_argumentsRegister; 1032 int m_activationRegister; 1037 1033 1038 1034 bool m_isStrictMode; -
trunk/Source/JavaScriptCore/bytecode/Instruction.h
r156474 r156482 36 36 #include "Structure.h" 37 37 #include "StructureChain.h" 38 #include "VirtualRegister.h"39 38 #include <wtf/VectorTraits.h> 40 39 -
trunk/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h
r156474 r156482 47 47 LazyOperandValueProfileKey() 48 48 : m_bytecodeOffset(0) // 0 = empty value 49 , m_operand( VirtualRegister()) // not a valid operand index in our current scheme49 , m_operand(InvalidVirtualRegister) // not a valid operand index in our current scheme 50 50 { 51 51 } … … 53 53 LazyOperandValueProfileKey(WTF::HashTableDeletedValueType) 54 54 : m_bytecodeOffset(1) // 1 = deleted value 55 , m_operand( VirtualRegister()) // not a valid operand index in our current scheme55 , m_operand(InvalidVirtualRegister) // not a valid operand index in our current scheme 56 56 { 57 57 } 58 58 59 LazyOperandValueProfileKey(unsigned bytecodeOffset, VirtualRegisteroperand)59 LazyOperandValueProfileKey(unsigned bytecodeOffset, int operand) 60 60 : m_bytecodeOffset(bytecodeOffset) 61 61 , m_operand(operand) 62 62 { 63 ASSERT( m_operand.isValid());63 ASSERT(operand != InvalidVirtualRegister); 64 64 } 65 65 66 66 bool operator!() const 67 67 { 68 return !m_operand.isValid();68 return m_operand == InvalidVirtualRegister; 69 69 } 70 70 … … 77 77 unsigned hash() const 78 78 { 79 return WTF::intHash(m_bytecodeOffset) + m_operand .offset();79 return WTF::intHash(m_bytecodeOffset) + m_operand; 80 80 } 81 81 … … 85 85 return m_bytecodeOffset; 86 86 } 87 88 VirtualRegister operand() const 87 int operand() const 89 88 { 90 89 ASSERT(!!*this); … … 94 93 bool isHashTableDeletedValue() const 95 94 { 96 return !m_operand.isValid()&& m_bytecodeOffset;95 return m_operand == InvalidVirtualRegister && m_bytecodeOffset; 97 96 } 98 97 private: 99 98 unsigned m_bytecodeOffset; 100 VirtualRegisterm_operand;99 int m_operand; 101 100 }; 102 101 … … 131 130 LazyOperandValueProfile() 132 131 : MinimalValueProfile() 133 , m_operand( VirtualRegister())132 , m_operand(InvalidVirtualRegister) 134 133 { 135 134 } … … 146 145 } 147 146 148 VirtualRegisterm_operand;147 int m_operand; 149 148 150 149 typedef SegmentedVector<LazyOperandValueProfile, 8> List; -
trunk/Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.cpp
r156474 r156482 40 40 result.u.lazyOperand.codeBlock = codeBlock; 41 41 result.u.lazyOperand.bytecodeOffset = key.bytecodeOffset(); 42 result.u.lazyOperand.operand = key.operand() .offset();42 result.u.lazyOperand.operand = key.operand(); 43 43 return result; 44 44 } … … 54 54 55 55 case LazyOperand: { 56 LazyOperandValueProfileKey key(u.lazyOperand.bytecodeOffset, VirtualRegister(u.lazyOperand.operand));56 LazyOperandValueProfileKey key(u.lazyOperand.bytecodeOffset, u.lazyOperand.operand); 57 57 58 58 ConcurrentJITLocker locker(u.lazyOperand.codeBlock->m_lock); -
trunk/Source/JavaScriptCore/bytecode/Operands.h
r156474 r156482 29 29 #include "CallFrame.h" 30 30 #include "JSObject.h" 31 #include "VirtualRegister.h"32 33 31 #include <wtf/PrintStream.h> 34 32 #include <wtf/Vector.h> 35 33 36 34 namespace JSC { 35 36 inline int localToOperand(int local) { return -local; } 37 inline bool operandIsLocal(int operand) { return operand <= 0; } 38 inline int operandToLocal(int operand) { return -operand; } 39 40 // argument 0 is 'this'. 41 inline bool operandIsArgument(int operand) { return operand > 0; } 42 inline int operandToArgument(int operand) { return operand - CallFrame::thisArgumentOffset(); } 43 inline int argumentToOperand(int argument) { return argument + CallFrame::thisArgumentOffset(); } 37 44 38 45 template<typename T> struct OperandValueTraits; … … 137 144 { 138 145 if (operandIsArgument(operand)) { 139 int argument = VirtualRegister(operand).toArgument();146 int argument = operandToArgument(operand); 140 147 return m_arguments[argument]; 141 148 } 142 143 return m_locals[VirtualRegister(operand).toLocal()]; 144 } 145 146 T& operand(VirtualRegister virtualRegister) 147 { 148 return operand(virtualRegister.offset()); 149 } 150 149 150 return m_locals[operandToLocal(operand)]; 151 } 152 151 153 const T& operand(int operand) const { return const_cast<const T&>(const_cast<Operands*>(this)->operand(operand)); } 152 154 … … 155 157 if (operandIsArgument(operand)) 156 158 return true; 157 return static_cast<size_t>( VirtualRegister(operand).toLocal()) < numberOfLocals();159 return static_cast<size_t>(operandToLocal(operand)) < numberOfLocals(); 158 160 } 159 161 … … 161 163 { 162 164 if (operandIsArgument(operand)) { 163 int argument = VirtualRegister(operand).toArgument();165 int argument = operandToArgument(operand); 164 166 m_arguments[argument] = value; 165 167 return; 166 168 } 167 169 168 setLocal(VirtualRegister(operand).toLocal(), value); 169 } 170 171 void setOperand(VirtualRegister virtualRegister, const T& value) 172 { 173 setOperand(virtualRegister.offset(), value); 174 } 175 170 setLocal(operandToLocal(operand), value); 171 } 172 176 173 size_t size() const { return numberOfArguments() + numberOfLocals(); } 177 174 const T& at(size_t index) const … … 203 200 { 204 201 if (index < numberOfArguments()) 205 return virtualRegisterForArgument(index).offset();206 return virtualRegisterForLocal(index - numberOfArguments()).offset();202 return argumentToOperand(index); 203 return localToOperand(index - numberOfArguments()); 207 204 } 208 205 … … 210 207 { 211 208 if (operandIsArgument(operand)) { 212 setArgumentFirstTime( VirtualRegister(operand).toArgument(), value);209 setArgumentFirstTime(operandToArgument(operand), value); 213 210 return; 214 211 } 215 212 216 setLocalFirstTime( VirtualRegister(operand).toLocal(), value);213 setLocalFirstTime(operandToLocal(operand), value); 217 214 } 218 215 -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
r156474 r156482 195 195 , m_numParameters(0) 196 196 , m_vm(vm) 197 , m_argumentsRegister( VirtualRegister())198 , m_globalObjectRegister( VirtualRegister())197 , m_argumentsRegister((int)InvalidVirtualRegister) 198 , m_globalObjectRegister((int)InvalidVirtualRegister) 199 199 , m_needsFullScopeChain(info.m_needsActivation) 200 200 , m_usesEval(info.m_usesEval) -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
r156474 r156482 255 255 256 256 // Special registers 257 void setThisRegister( VirtualRegisterthisRegister) { m_thisRegister = thisRegister; }258 void setActivationRegister( VirtualRegisteractivationRegister) { m_activationRegister = activationRegister; }259 260 void setArgumentsRegister( VirtualRegisterargumentsRegister) { m_argumentsRegister = argumentsRegister; }261 bool usesArguments() const { return m_argumentsRegister .isValid(); }262 VirtualRegisterargumentsRegister() const { return m_argumentsRegister; }263 264 265 bool usesGlobalObject() const { return m_globalObjectRegister .isValid(); }266 void setGlobalObjectRegister( VirtualRegisterglobalObjectRegister) { m_globalObjectRegister = globalObjectRegister; }267 VirtualRegisterglobalObjectRegister() const { return m_globalObjectRegister; }257 void setThisRegister(int thisRegister) { m_thisRegister = thisRegister; } 258 void setActivationRegister(int activationRegister) { m_activationRegister = activationRegister; } 259 260 void setArgumentsRegister(int argumentsRegister) { m_argumentsRegister = argumentsRegister; } 261 bool usesArguments() const { return m_argumentsRegister != (int)InvalidVirtualRegister; } 262 int argumentsRegister() const { return m_argumentsRegister; } 263 264 265 bool usesGlobalObject() const { return m_globalObjectRegister != (int)InvalidVirtualRegister; } 266 void setGlobalObjectRegister(int globalObjectRegister) { m_globalObjectRegister = globalObjectRegister; } 267 int globalObjectRegister() const { return m_globalObjectRegister; } 268 268 269 269 // Parameter information … … 400 400 CodeType codeType() const { return m_codeType; } 401 401 402 VirtualRegisterthisRegister() const { return m_thisRegister; }403 VirtualRegisteractivationRegister() const { return m_activationRegister; }402 int thisRegister() const { return m_thisRegister; } 403 int activationRegister() const { return m_activationRegister; } 404 404 405 405 … … 480 480 VM* m_vm; 481 481 482 VirtualRegisterm_thisRegister;483 VirtualRegisterm_argumentsRegister;484 VirtualRegisterm_activationRegister;485 VirtualRegisterm_globalObjectRegister;482 int m_thisRegister; 483 int m_argumentsRegister; 484 int m_activationRegister; 485 int m_globalObjectRegister; 486 486 487 487 bool m_needsFullScopeChain : 1; -
trunk/Source/JavaScriptCore/bytecode/ValueRecovery.h
r156474 r156482 212 212 break; 213 213 } 214 result.m_source.virtualReg = virtualReg .offset();214 result.m_source.virtualReg = virtualReg; 215 215 return result; 216 216 } … … 295 295 { 296 296 ASSERT(m_technique == DisplacedInJSStack || m_technique == Int32DisplacedInJSStack || m_technique == DoubleDisplacedInJSStack || m_technique == CellDisplacedInJSStack || m_technique == BooleanDisplacedInJSStack || m_technique == Int52DisplacedInJSStack || m_technique == StrictInt52DisplacedInJSStack); 297 return VirtualRegister(m_source.virtualReg);297 return m_source.virtualReg; 298 298 } 299 299 … … 352 352 #endif 353 353 case DisplacedInJSStack: 354 out.printf("*%d", virtualRegister() .offset());354 out.printf("*%d", virtualRegister()); 355 355 return; 356 356 case Int32DisplacedInJSStack: 357 out.printf("*int32(%d)", virtualRegister() .offset());357 out.printf("*int32(%d)", virtualRegister()); 358 358 return; 359 359 case Int52DisplacedInJSStack: 360 out.printf("*int52(%d)", virtualRegister() .offset());360 out.printf("*int52(%d)", virtualRegister()); 361 361 return; 362 362 case StrictInt52DisplacedInJSStack: 363 out.printf("*strictInt52(%d)", virtualRegister() .offset());363 out.printf("*strictInt52(%d)", virtualRegister()); 364 364 return; 365 365 case DoubleDisplacedInJSStack: 366 out.printf("*double(%d)", virtualRegister() .offset());366 out.printf("*double(%d)", virtualRegister()); 367 367 return; 368 368 case CellDisplacedInJSStack: 369 out.printf("*cell(%d)", virtualRegister() .offset());369 out.printf("*cell(%d)", virtualRegister()); 370 370 return; 371 371 case BooleanDisplacedInJSStack: 372 out.printf("*bool(%d)", virtualRegister() .offset());372 out.printf("*bool(%d)", virtualRegister()); 373 373 return; 374 374 case ArgumentsThatWereNotCreated: … … 401 401 } pair; 402 402 #endif 403 intvirtualReg;403 VirtualRegister virtualReg; 404 404 EncodedJSValue constant; 405 405 } m_source; -
trunk/Source/JavaScriptCore/bytecode/VirtualRegister.h
r156474 r156482 27 27 #define VirtualRegister_h 28 28 29 #include "CallFrame.h"30 31 29 #include <wtf/Platform.h> 32 30 #include <wtf/PrintStream.h> … … 34 32 namespace JSC { 35 33 36 inline bool operandIsLocal(int operand) 37 { 38 return operand <= 0; 39 } 40 41 inline bool operandIsArgument(int operand) 42 { 43 return operand > 0; 44 } 45 46 47 class VirtualRegister { 48 public: 49 friend VirtualRegister virtualRegisterForLocal(int); 50 friend VirtualRegister virtualRegisterForArgument(int, int); 51 52 VirtualRegister() 53 : m_virtualRegister(s_invalidVirtualRegister) 54 { } 55 56 explicit VirtualRegister(int virtualRegister) 57 : m_virtualRegister(virtualRegister) 58 { } 59 60 bool isValid() const { return (m_virtualRegister != s_invalidVirtualRegister); } 61 bool isLocal() const { return operandIsLocal(m_virtualRegister); } 62 bool isArgument() const { return operandIsArgument(m_virtualRegister); } 63 bool isConstant() const { return m_virtualRegister >= s_firstConstantRegisterIndex; } 64 int toLocal() const { ASSERT(isLocal()); return operandToLocal(m_virtualRegister); } 65 int toArgument() const { ASSERT(isArgument()); return operandToArgument(m_virtualRegister); } 66 int toConstantIndex() const { ASSERT(isConstant()); return m_virtualRegister - s_firstConstantRegisterIndex; } 67 int offset() const { return m_virtualRegister; } 68 69 bool operator==(const VirtualRegister other) const { return m_virtualRegister == other.m_virtualRegister; } 70 bool operator!=(const VirtualRegister other) const { return m_virtualRegister != other.m_virtualRegister; } 71 72 private: 73 static const int s_invalidVirtualRegister = 0x3fffffff; 74 static const int s_firstConstantRegisterIndex = 0x40000000; 75 76 static int localToOperand(int local) { return -local; } 77 static int operandToLocal(int operand) { return -operand; } 78 static int operandToArgument(int operand) { return operand - CallFrame::thisArgumentOffset(); } 79 static int argumentToOperand(int argument) { return argument + CallFrame::thisArgumentOffset(); } 80 81 int m_virtualRegister; 82 }; 83 34 // Type for a virtual register number (spill location). 35 // Using an enum to make this type-checked at compile time, to avert programmer errors. 36 enum VirtualRegister { InvalidVirtualRegister = 0x3fffffff }; 84 37 COMPILE_ASSERT(sizeof(VirtualRegister) == sizeof(int), VirtualRegister_is_32bit); 85 86 inline VirtualRegister virtualRegisterForLocal(int local)87 {88 return VirtualRegister(VirtualRegister::localToOperand(local));89 }90 91 inline VirtualRegister virtualRegisterForArgument(int argument, int offset = 0)92 {93 return VirtualRegister(VirtualRegister::argumentToOperand(argument) + offset);94 }95 38 96 39 } // namespace JSC … … 100 43 inline void printInternal(PrintStream& out, JSC::VirtualRegister value) 101 44 { 102 out.print( value.offset());45 out.print(static_cast<int>(value)); 103 46 } 104 47 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r156474 r156482 61 61 SamplingRegion samplingRegion("Bytecode Generation"); 62 62 63 m_codeBlock->setThisRegister(m_thisRegister. virtualRegister());63 m_codeBlock->setThisRegister(m_thisRegister.index()); 64 64 65 65 m_scopeNode->emitBytecode(*this); … … 118 118 { 119 119 ConcurrentJITLocker locker(symbolTable().m_lock); 120 int index = virtualRegisterForLocal(m_calleeRegisters.size()).offset();120 int index = localToOperand(m_calleeRegisters.size()); 121 121 SymbolTableEntry newEntry(index, isConstant ? ReadOnly : 0); 122 122 SymbolTable::Map::AddResult result = symbolTable().add(locker, ident.impl(), newEntry); … … 231 231 m_activationRegister = addVar(); 232 232 emitInitLazyRegister(m_activationRegister); 233 m_codeBlock->setActivationRegister(m_activationRegister-> virtualRegister());234 } 235 236 m_symbolTable->setCaptureStart( virtualRegisterForLocal(m_codeBlock->m_numVars).offset());233 m_codeBlock->setActivationRegister(m_activationRegister->index()); 234 } 235 236 m_symbolTable->setCaptureStart(localToOperand(m_codeBlock->m_numVars)); 237 237 238 238 if (functionBody->usesArguments() || codeBlock->usesEval()) { // May reify arguments object. … … 243 243 // 'arguments' values are stored in consecutive registers, and storing 244 244 // only the index of the assignable one. 245 codeBlock->setArgumentsRegister(argumentsRegister-> virtualRegister());246 ASSERT_UNUSED(unmodifiedArgumentsRegister, unmodifiedArgumentsRegister-> virtualRegister() == JSC::unmodifiedArgumentsRegister(codeBlock->argumentsRegister()));245 codeBlock->setArgumentsRegister(argumentsRegister->index()); 246 ASSERT_UNUSED(unmodifiedArgumentsRegister, unmodifiedArgumentsRegister->index() == JSC::unmodifiedArgumentsRegister(codeBlock->argumentsRegister())); 247 247 248 248 emitInitLazyRegister(argumentsRegister); … … 325 325 } 326 326 327 m_symbolTable->setCaptureEnd( virtualRegisterForLocal(codeBlock->m_numVars).offset());327 m_symbolTable->setCaptureEnd(localToOperand(codeBlock->m_numVars)); 328 328 329 329 m_firstLazyFunction = codeBlock->m_numVars; … … 340 340 else { 341 341 emitInitLazyRegister(reg.get()); 342 m_lazyFunctions.set( reg->virtualRegister().toLocal(), function);342 m_lazyFunctions.set(localToOperand(reg->index()), function); 343 343 } 344 344 } … … 352 352 353 353 if (shouldCaptureAllTheThings) 354 m_symbolTable->setCaptureEnd( virtualRegisterForLocal(codeBlock->m_numVars).offset());354 m_symbolTable->setCaptureEnd(localToOperand(codeBlock->m_numVars)); 355 355 356 356 m_parameters.grow(parameters.size() + 1); // reserve space for "this" … … 534 534 RegisterID* BytecodeGenerator::createLazyRegisterIfNecessary(RegisterID* reg) 535 535 { 536 if (!reg->virtualRegister().isLocal()) 537 return reg; 538 539 int localVariableNumber = reg->virtualRegister().toLocal(); 540 536 int localVariableNumber = operandToLocal(reg->index()); 537 541 538 if (m_lastLazyFunction <= localVariableNumber || localVariableNumber < m_firstLazyFunction) 542 539 return reg; … … 547 544 RegisterID* BytecodeGenerator::newRegister() 548 545 { 549 m_calleeRegisters.append( virtualRegisterForLocal(m_calleeRegisters.size()));546 m_calleeRegisters.append(localToOperand(m_calleeRegisters.size())); 550 547 m_codeBlock->m_numCalleeRegisters = max<int>(m_codeBlock->m_numCalleeRegisters, m_calleeRegisters.size()); 551 548 return &m_calleeRegisters.last(); … … 1150 1147 m_codeBlock->addConstant(JSValue()); 1151 1148 m_globalObjectRegister = &m_constantPoolRegisters[index]; 1152 m_codeBlock->setGlobalObjectRegister( VirtualRegister(index));1149 m_codeBlock->setGlobalObjectRegister(index); 1153 1150 } 1154 1151 if (dst) … … 1294 1291 emitOpcode(op_get_arguments_length); 1295 1292 instructions().append(dst->index()); 1296 ASSERT(base-> virtualRegister() == m_codeBlock->argumentsRegister());1293 ASSERT(base->index() == m_codeBlock->argumentsRegister()); 1297 1294 instructions().append(base->index()); 1298 1295 instructions().append(addConstant(propertyNames().length)); … … 1369 1366 UnlinkedValueProfile profile = emitProfiledOpcode(op_get_argument_by_val); 1370 1367 instructions().append(kill(dst)); 1371 ASSERT(base-> virtualRegister() == m_codeBlock->argumentsRegister());1368 ASSERT(base->index() == m_codeBlock->argumentsRegister()); 1372 1369 instructions().append(base->index()); 1373 1370 instructions().append(property->index()); … … 1589 1586 1590 1587 emitOpcode(op_create_arguments); 1591 instructions().append(m_codeBlock->argumentsRegister() .offset());1588 instructions().append(m_codeBlock->argumentsRegister()); 1592 1589 } 1593 1590 … … 1774 1771 if (m_codeBlock->usesArguments() && m_codeBlock->numParameters() != 1 && !isStrictMode()) { 1775 1772 emitOpcode(op_tear_off_arguments); 1776 instructions().append(m_codeBlock->argumentsRegister() .offset());1773 instructions().append(m_codeBlock->argumentsRegister()); 1777 1774 instructions().append(m_activationRegister ? m_activationRegister->index() : emitLoad(0, JSValue())->index()); 1778 1775 } -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r156474 r156482 503 503 { 504 504 if (operandIsLocal(index)) 505 return m_calleeRegisters[ VirtualRegister(index).toLocal()];505 return m_calleeRegisters[operandToLocal(index)]; 506 506 507 507 if (index == JSStack::Callee) … … 509 509 510 510 ASSERT(m_parameters.size()); 511 return m_parameters[ VirtualRegister(index).toArgument()];511 return m_parameters[operandToArgument(index)]; 512 512 } 513 513 -
trunk/Source/JavaScriptCore/bytecompiler/RegisterID.h
r156474 r156482 30 30 #define RegisterID_h 31 31 32 #include "VirtualRegister.h"33 34 32 #include <wtf/Assertions.h> 35 33 #include <wtf/VectorTraits.h> … … 49 47 } 50 48 51 RegisterID(VirtualRegister virtualRegister)52 : m_refCount(0)53 , m_virtualRegister(virtualRegister)54 , m_isTemporary(false)55 #ifndef NDEBUG56 , m_didSetIndex(true)57 #endif58 {59 }60 61 49 explicit RegisterID(int index) 62 50 : m_refCount(0) 63 , m_ virtualRegister(VirtualRegister(index))51 , m_index(index) 64 52 , m_isTemporary(false) 65 53 #ifndef NDEBUG … … 75 63 m_didSetIndex = true; 76 64 #endif 77 m_ virtualRegister = VirtualRegister(index);65 m_index = index; 78 66 } 79 67 … … 86 74 { 87 75 ASSERT(m_didSetIndex); 88 return m_virtualRegister.offset(); 89 } 90 91 VirtualRegister virtualRegister() const 92 { 93 ASSERT(m_virtualRegister.isValid()); 94 return m_virtualRegister; 76 return m_index; 95 77 } 96 78 … … 119 101 120 102 int m_refCount; 121 VirtualRegister m_virtualRegister;103 int m_index; 122 104 bool m_isTemporary; 123 105 #ifndef NDEBUG -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
r156474 r156482 110 110 return 0; 111 111 112 JSValue thisValue = m_callFrame->uncheckedR(codeBlock->thisRegister() .offset()).jsValue();112 JSValue thisValue = m_callFrame->uncheckedR(codeBlock->thisRegister()).jsValue(); 113 113 if (!thisValue.isObject()) 114 114 return 0; -
trunk/Source/JavaScriptCore/dfg/DFGAbstractHeap.h
r156474 r156482 114 114 Payload(VirtualRegister operand) 115 115 : m_isTop(false) 116 , m_value( operand.offset())116 , m_value(static_cast<int>(operand)) 117 117 { 118 118 } -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r156474 r156482 143 143 ASSERT(m_graph.m_form == SSA); 144 144 VariableAccessData* variable = node->variableAccessData(); 145 AbstractValue& value = m_state.variables().operand(variable->local() .offset());145 AbstractValue& value = m_state.variables().operand(variable->local()); 146 146 ASSERT(value.isHeapTop()); 147 147 FiltrationResult result = … … 153 153 154 154 case ExtractOSREntryLocal: { 155 if (! (node->unlinkedLocal().isArgument())156 && m_graph.m_lazyVars.get( node->unlinkedLocal().toLocal())) {155 if (!operandIsArgument(node->unlinkedLocal()) 156 && m_graph.m_lazyVars.get(operandToLocal(node->unlinkedLocal()))) { 157 157 // This is kind of pessimistic - we could know in some cases that the 158 158 // DFG code at the point of the OSR had already initialized the lazy … … 172 172 break; 173 173 } 174 AbstractValue value = m_state.variables().operand(variableAccessData->local() .offset());174 AbstractValue value = m_state.variables().operand(variableAccessData->local()); 175 175 if (!variableAccessData->isCaptured()) { 176 176 if (value.isClear()) … … 184 184 185 185 case GetLocalUnlinked: { 186 AbstractValue value = m_state.variables().operand(node->unlinkedLocal() .offset());186 AbstractValue value = m_state.variables().operand(node->unlinkedLocal()); 187 187 if (value.value()) 188 188 m_state.setFoundConstants(true); … … 192 192 193 193 case SetLocal: { 194 m_state.variables().operand(node->local() .offset()) = forNode(node->child1());194 m_state.variables().operand(node->local()) = forNode(node->child1()); 195 195 break; 196 196 } … … 1134 1134 if (isEmptySpeculation( 1135 1135 m_state.variables().operand( 1136 m_graph.argumentsRegisterFor(node->codeOrigin) .offset()).m_type))1136 m_graph.argumentsRegisterFor(node->codeOrigin)).m_type)) 1137 1137 m_state.setFoundConstants(true); 1138 1138 else … … 1608 1608 } else { 1609 1609 for (size_t i = m_codeBlock->m_numVars; i--;) { 1610 if (m_codeBlock->isCaptured( virtualRegisterForLocal(i)))1610 if (m_codeBlock->isCaptured(localToOperand(i))) 1611 1611 m_state.variables().local(i).makeHeapTop(); 1612 1612 } … … 1614 1614 1615 1615 for (size_t i = m_state.variables().numberOfArguments(); i--;) { 1616 if (m_codeBlock->isCaptured( virtualRegisterForArgument(i)))1616 if (m_codeBlock->isCaptured(argumentToOperand(i))) 1617 1617 m_state.variables().argument(i).makeHeapTop(); 1618 1618 } -
trunk/Source/JavaScriptCore/dfg/DFGArgumentPosition.h
r156474 r156482 119 119 for (unsigned i = 0; i < m_variables.size(); ++i) { 120 120 VariableAccessData* variable = m_variables[i]->find(); 121 VirtualRegister operand = variable->local();121 int operand = variable->operand(); 122 122 123 123 if (i) 124 124 out.print(" "); 125 125 126 if (operand .isArgument())127 out.print("arg", operand .toArgument(), "(", VariableAccessDataDump(*graph, variable), ")");126 if (operandIsArgument(operand)) 127 out.print("arg", operandToArgument(operand), "(", VariableAccessDataDump(*graph, variable), ")"); 128 128 else 129 out.print("r", operand .toLocal(), "(", VariableAccessDataDump(*graph, variable), ")");129 out.print("r", operand, "(", VariableAccessDataDump(*graph, variable), ")"); 130 130 } 131 131 out.print("\n"); -
trunk/Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp
r156474 r156482 189 189 Node* source = node->child1().node(); 190 190 VariableAccessData* variableAccessData = node->variableAccessData(); 191 VirtualRegisterargumentsRegister =191 int argumentsRegister = 192 192 m_graph.uncheckedArgumentsRegisterFor(node->codeOrigin); 193 193 if (source->op() != CreateArguments && source->op() != PhantomArguments) { … … 217 217 break; 218 218 219 if (argumentsRegister .isValid()219 if (argumentsRegister != InvalidVirtualRegister 220 220 && (variableAccessData->local() == argumentsRegister 221 221 || variableAccessData->local() == unmodifiedArgumentsRegister(argumentsRegister))) { … … 235 235 break; 236 236 } 237 if (argumentsRegister .isValid()237 if (argumentsRegister != InvalidVirtualRegister 238 238 && (variableAccessData->local() == argumentsRegister 239 239 || variableAccessData->local() == unmodifiedArgumentsRegister(argumentsRegister))) { … … 620 620 621 621 node->convertToGetLocalUnlinked( 622 VirtualRegister(622 static_cast<VirtualRegister>( 623 623 node->codeOrigin.inlineCallFrame->stackOffset + 624 624 m_graph.baselineCodeBlockFor(node->codeOrigin)->argumentIndexAfterCapture(index))); … … 712 712 713 713 case GetLocal: { 714 VirtualRegisterargumentsRegister = m_graph.uncheckedArgumentsRegisterFor(node->codeOrigin);715 if (argumentsRegister .isValid()714 int argumentsRegister = m_graph.uncheckedArgumentsRegisterFor(node->codeOrigin); 715 if (argumentsRegister != InvalidVirtualRegister 716 716 && (node->local() == argumentsRegister 717 717 || node->local() == unmodifiedArgumentsRegister(argumentsRegister))) { … … 784 784 case GetLocal: { 785 785 VariableAccessData* variableAccessData = source->variableAccessData(); 786 VirtualRegisterargumentsRegister = m_graph.uncheckedArgumentsRegisterFor(source->codeOrigin);787 if ( !argumentsRegister.isValid())786 int argumentsRegister = m_graph.uncheckedArgumentsRegisterFor(source->codeOrigin); 787 if (argumentsRegister == InvalidVirtualRegister) 788 788 break; 789 789 if (argumentsRegister == variableAccessData->local()) -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r156474 r156482 192 192 void linkBlocks(Vector<UnlinkedBlock>& unlinkedBlocks, Vector<BasicBlock*>& possibleTargets); 193 193 194 VariableAccessData* newVariableAccessData( VirtualRegisteroperand, bool isCaptured)195 { 196 ASSERT( !operand.isConstant());197 198 m_graph.m_variableAccessData.append(VariableAccessData( operand, isCaptured));194 VariableAccessData* newVariableAccessData(int operand, bool isCaptured) 195 { 196 ASSERT(operand < FirstConstantRegisterIndex); 197 198 m_graph.m_variableAccessData.append(VariableAccessData(static_cast<VirtualRegister>(operand), isCaptured)); 199 199 return &m_graph.m_variableAccessData.last(); 200 200 } 201 201 202 202 // Get/Set the operands/result of a bytecode instruction. 203 Node* getDirect( VirtualRegisteroperand)203 Node* getDirect(int operand) 204 204 { 205 205 // Is this a constant? 206 if (operand .isConstant()) {207 unsigned constant = operand .toConstantIndex();206 if (operand >= FirstConstantRegisterIndex) { 207 unsigned constant = operand - FirstConstantRegisterIndex; 208 208 ASSERT(constant < m_constants.size()); 209 209 return getJSConstant(constant); 210 210 } 211 211 212 ASSERT(operand .offset()!= JSStack::Callee);212 ASSERT(operand != JSStack::Callee); 213 213 214 214 // Is this an argument? 215 if (operand .isArgument())215 if (operandIsArgument(operand)) 216 216 return getArgument(operand); 217 217 … … 220 220 } 221 221 222 Node* get( VirtualRegisteroperand)223 { 224 if (operand .offset()== JSStack::Callee) {222 Node* get(int operand) 223 { 224 if (operand == JSStack::Callee) { 225 225 if (inlineCallFrame() && inlineCallFrame()->callee) 226 226 return cellConstant(inlineCallFrame()->callee.get()); … … 231 231 return getDirect(m_inlineStackTop->remapOperand(operand)); 232 232 } 233 233 234 234 enum SetMode { NormalSet, SetOnEntry }; 235 void setDirect( VirtualRegisteroperand, Node* value, SetMode setMode = NormalSet)235 void setDirect(int operand, Node* value, SetMode setMode = NormalSet) 236 236 { 237 237 // Is this an argument? 238 if (operand .isArgument()) {238 if (operandIsArgument(operand)) { 239 239 setArgument(operand, value, setMode); 240 240 return; … … 245 245 } 246 246 247 void set( VirtualRegisteroperand, Node* value, SetMode setMode = NormalSet)247 void set(int operand, Node* value, SetMode setMode = NormalSet) 248 248 { 249 249 setDirect(m_inlineStackTop->remapOperand(operand), value, setMode); … … 265 265 266 266 // Used in implementing get/set, above, where the operand is a local variable. 267 Node* getLocal( VirtualRegisteroperand)268 { 269 unsigned local = operand .toLocal();267 Node* getLocal(int operand) 268 { 269 unsigned local = operandToLocal(operand); 270 270 Node* node = m_currentBlock->variablesAtTail.local(local); 271 271 bool isCaptured = m_codeBlock->isCaptured(operand, inlineCallFrame()); … … 303 303 } 304 304 305 void setLocal( VirtualRegisteroperand, Node* value, SetMode setMode = NormalSet)306 { 307 unsigned local = operand .toLocal();305 void setLocal(int operand, Node* value, SetMode setMode = NormalSet) 306 { 307 unsigned local = operandToLocal(operand); 308 308 bool isCaptured = m_codeBlock->isCaptured(operand, inlineCallFrame()); 309 309 … … 324 324 325 325 // Used in implementing get/set, above, where the operand is an argument. 326 Node* getArgument( VirtualRegisteroperand)327 { 328 unsigned argument = operand .toArgument();326 Node* getArgument(unsigned operand) 327 { 328 unsigned argument = operandToArgument(operand); 329 329 ASSERT(argument < m_numArguments); 330 330 … … 353 353 return node; 354 354 } 355 void setArgument( VirtualRegisteroperand, Node* value, SetMode setMode = NormalSet)356 { 357 unsigned argument = operand .toArgument();355 void setArgument(int operand, Node* value, SetMode setMode = NormalSet) 356 { 357 unsigned argument = operandToArgument(operand); 358 358 ASSERT(argument < m_numArguments); 359 359 … … 386 386 } 387 387 388 ArgumentPosition* findArgumentPositionForLocal( VirtualRegisteroperand)388 ArgumentPosition* findArgumentPositionForLocal(int operand) 389 389 { 390 390 for (InlineStackEntry* stack = m_inlineStackTop; ; stack = stack->m_caller) { … … 392 392 if (!inlineCallFrame) 393 393 break; 394 if (operand .offset()<= static_cast<int>(inlineCallFrame->stackOffset + JSStack::CallFrameHeaderSize))394 if (operand <= static_cast<int>(inlineCallFrame->stackOffset + JSStack::CallFrameHeaderSize)) 395 395 continue; 396 if (operand .offset()== inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset())396 if (operand == inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset()) 397 397 continue; 398 if (operand .offset()> static_cast<int>(inlineCallFrame->stackOffset + JSStack::CallFrameHeaderSize + inlineCallFrame->arguments.size()))398 if (operand > static_cast<int>(inlineCallFrame->stackOffset + JSStack::CallFrameHeaderSize + inlineCallFrame->arguments.size())) 399 399 continue; 400 int argument = VirtualRegister(operand.offset() - inlineCallFrame->stackOffset).toArgument();400 int argument = operandToArgument(operand - inlineCallFrame->stackOffset); 401 401 return stack->m_argumentPositions[argument]; 402 402 } … … 404 404 } 405 405 406 ArgumentPosition* findArgumentPosition( VirtualRegisteroperand)407 { 408 if (operand .isArgument())409 return findArgumentPositionForArgument(operand .toArgument());406 ArgumentPosition* findArgumentPosition(int operand) 407 { 408 if (operandIsArgument(operand)) 409 return findArgumentPositionForArgument(operandToArgument(operand)); 410 410 return findArgumentPositionForLocal(operand); 411 411 } … … 423 423 } 424 424 425 void flush( VirtualRegisteroperand)425 void flush(int operand) 426 426 { 427 427 flushDirect(m_inlineStackTop->remapOperand(operand)); 428 428 } 429 429 430 void flushDirect( VirtualRegisteroperand)430 void flushDirect(int operand) 431 431 { 432 432 flushDirect(operand, findArgumentPosition(operand)); 433 433 } 434 434 435 void flushDirect( VirtualRegisteroperand, ArgumentPosition* argumentPosition)435 void flushDirect(int operand, ArgumentPosition* argumentPosition) 436 436 { 437 437 bool isCaptured = m_codeBlock->isCaptured(operand, inlineCallFrame()); 438 438 439 ASSERT( !operand.isConstant());440 441 if ( operand.isLocal())442 m_preservedVars.set(operand .toLocal());439 ASSERT(operand < FirstConstantRegisterIndex); 440 441 if (!operandIsArgument(operand)) 442 m_preservedVars.set(operandToLocal(operand)); 443 443 444 444 Node* node = m_currentBlock->variablesAtTail.operand(operand); … … 466 466 numArguments = inlineStackEntry->m_codeBlock->numParameters(); 467 467 for (unsigned argument = numArguments; argument-- > 1;) 468 flushDirect(inlineStackEntry->remapOperand( virtualRegisterForArgument(argument)));468 flushDirect(inlineStackEntry->remapOperand(argumentToOperand(argument))); 469 469 for (int local = 0; local < inlineStackEntry->m_codeBlock->m_numVars; ++local) { 470 if (!inlineStackEntry->m_codeBlock->isCaptured( virtualRegisterForLocal(local)))470 if (!inlineStackEntry->m_codeBlock->isCaptured(localToOperand(local))) 471 471 continue; 472 flushDirect(inlineStackEntry->remapOperand( virtualRegisterForLocal(local)));472 flushDirect(inlineStackEntry->remapOperand(localToOperand(local))); 473 473 } 474 474 } … … 488 488 Node* getToInt32(int operand) 489 489 { 490 return toInt32(get( VirtualRegister(operand)));490 return toInt32(get(operand)); 491 491 } 492 492 … … 550 550 return get(m_inlineStackTop->m_codeBlock->thisRegister()); 551 551 } 552 553 552 void setThis(Node* value) 554 553 { … … 772 771 SpeculatedType prediction = getPrediction(); 773 772 774 addVarArgChild(get( VirtualRegister(currentInstruction[2].u.operand)));773 addVarArgChild(get(currentInstruction[2].u.operand)); 775 774 int argCount = currentInstruction[3].u.operand; 776 775 if (JSStack::CallFrameHeaderSize + (unsigned)argCount > m_parameterSlots) … … 780 779 int dummyThisArgument = op == Call ? 0 : 1; 781 780 for (int i = 0 + dummyThisArgument; i < argCount; ++i) 782 addVarArgChild(get( virtualRegisterForArgument(i, registerOffset)));781 addVarArgChild(get(registerOffset + argumentToOperand(i))); 783 782 784 783 Node* call = addToGraph(Node::VarArg, op, OpInfo(0), OpInfo(prediction)); 785 set( VirtualRegister(currentInstruction[1].u.operand), call);784 set(currentInstruction[1].u.operand, call); 786 785 return call; 787 786 } … … 1097 1096 } 1098 1097 1099 VirtualRegister remapOperand(VirtualRegisteroperand) const1098 int remapOperand(int operand) const 1100 1099 { 1101 1100 if (!m_inlineCallFrame) 1102 1101 return operand; 1103 1102 1104 if (operand .isConstant()) {1105 VirtualRegister result = VirtualRegister(m_constantRemap[operand.toConstantIndex()]);1106 ASSERT(result .isConstant());1103 if (operand >= FirstConstantRegisterIndex) { 1104 int result = m_constantRemap[operand - FirstConstantRegisterIndex]; 1105 ASSERT(result >= FirstConstantRegisterIndex); 1107 1106 return result; 1108 1107 } 1109 1108 1110 ASSERT(operand .offset()!= JSStack::Callee);1111 1112 return VirtualRegister(operand.offset() + m_inlineCallFrame->stackOffset);1109 ASSERT(operand != JSStack::Callee); 1110 1111 return operand + m_inlineCallFrame->stackOffset; 1113 1112 } 1114 1113 }; … … 1143 1142 ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_construct)); 1144 1143 1145 Node* callTarget = get( VirtualRegister(currentInstruction[2].u.operand));1144 Node* callTarget = get(currentInstruction[2].u.operand); 1146 1145 1147 1146 CallLinkStatus callLinkStatus; … … 1215 1214 Node* thisArgument; 1216 1215 if (kind == CodeForCall) 1217 thisArgument = get( virtualRegisterForArgument(0, registerOffset));1216 thisArgument = get(registerOffset + argumentToOperand(0)); 1218 1217 else 1219 1218 thisArgument = 0; … … 1240 1239 { 1241 1240 for (int i = kind == CodeForCall ? 0 : 1; i < argumentCountIncludingThis; ++i) 1242 addToGraph(Phantom, get( virtualRegisterForArgument(i, registerOffset)));1241 addToGraph(Phantom, get(registerOffset + argumentToOperand(i))); 1243 1242 } 1244 1243 … … 1294 1293 // FIXME: Don't flush constants! 1295 1294 1296 int inlineCallFrameStart = m_inlineStackTop->remapOperand( VirtualRegister(registerOffset)).offset() + JSStack::CallFrameHeaderSize;1295 int inlineCallFrameStart = m_inlineStackTop->remapOperand(registerOffset) + JSStack::CallFrameHeaderSize; 1297 1296 1298 1297 // Make sure that the area used by the call frame is reserved. 1299 for (int arg = VirtualRegister(inlineCallFrameStart).toLocal() + JSStack::CallFrameHeaderSize + codeBlock->m_numVars; arg-- > VirtualRegister(inlineCallFrameStart).toLocal();)1298 for (int arg = operandToLocal(inlineCallFrameStart) + JSStack::CallFrameHeaderSize + codeBlock->m_numVars; arg-- > operandToLocal(inlineCallFrameStart);) 1300 1299 m_preservedVars.set(arg); 1301 1300 1302 1301 // Make sure that we have enough locals. 1303 unsigned newNumLocals = VirtualRegister(inlineCallFrameStart).toLocal() + JSStack::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;1302 unsigned newNumLocals = operandToLocal(inlineCallFrameStart) + JSStack::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters; 1304 1303 if (newNumLocals > m_numLocals) { 1305 1304 m_numLocals = newNumLocals; … … 1312 1311 InlineStackEntry inlineStackEntry( 1313 1312 this, codeBlock, codeBlock, m_graph.lastBlock(), callLinkStatus.function(), 1314 m_inlineStackTop->remapOperand(VirtualRegister(resultOperand)),1313 (VirtualRegister)m_inlineStackTop->remapOperand(resultOperand), 1315 1314 (VirtualRegister)inlineCallFrameStart, argumentCountIncludingThis, kind); 1316 1315 … … 1429 1428 { 1430 1429 if (argumentCountIncludingThis == 1) { // Math.min() 1431 set( VirtualRegister(resultOperand), constantNaN());1430 set(resultOperand, constantNaN()); 1432 1431 return true; 1433 1432 } 1434 1433 1435 1434 if (argumentCountIncludingThis == 2) { // Math.min(x) 1436 Node* result = get( VirtualRegister(virtualRegisterForArgument(1, registerOffset)));1435 Node* result = get(registerOffset + argumentToOperand(1)); 1437 1436 addToGraph(Phantom, Edge(result, NumberUse)); 1438 set( VirtualRegister(resultOperand), result);1437 set(resultOperand, result); 1439 1438 return true; 1440 1439 } 1441 1440 1442 1441 if (argumentCountIncludingThis == 3) { // Math.min(x, y) 1443 set( VirtualRegister(resultOperand), addToGraph(op, get(virtualRegisterForArgument(1, registerOffset)), get(virtualRegisterForArgument(2, registerOffset))));1442 set(resultOperand, addToGraph(op, get(registerOffset + argumentToOperand(1)), get(registerOffset + argumentToOperand(2)))); 1444 1443 return true; 1445 1444 } … … 1456 1455 case AbsIntrinsic: { 1457 1456 if (argumentCountIncludingThis == 1) { // Math.abs() 1458 set( VirtualRegister(resultOperand), constantNaN());1457 set(resultOperand, constantNaN()); 1459 1458 return true; 1460 1459 } … … 1463 1462 return false; 1464 1463 1465 Node* node = addToGraph(ArithAbs, get( virtualRegisterForArgument(1, registerOffset)));1464 Node* node = addToGraph(ArithAbs, get(registerOffset + argumentToOperand(1))); 1466 1465 if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow)) 1467 1466 node->mergeFlags(NodeMayOverflow); 1468 set( VirtualRegister(resultOperand), node);1467 set(resultOperand, node); 1469 1468 return true; 1470 1469 } … … 1478 1477 case SqrtIntrinsic: { 1479 1478 if (argumentCountIncludingThis == 1) { // Math.sqrt() 1480 set( VirtualRegister(resultOperand), constantNaN());1479 set(resultOperand, constantNaN()); 1481 1480 return true; 1482 1481 } … … 1485 1484 return false; 1486 1485 1487 set( VirtualRegister(resultOperand), addToGraph(ArithSqrt, get(virtualRegisterForArgument(1, registerOffset))));1486 set(resultOperand, addToGraph(ArithSqrt, get(registerOffset + argumentToOperand(1)))); 1488 1487 return true; 1489 1488 } … … 1502 1501 case Array::Contiguous: 1503 1502 case Array::ArrayStorage: { 1504 Node* arrayPush = addToGraph(ArrayPush, OpInfo(arrayMode.asWord()), OpInfo(prediction), get( virtualRegisterForArgument(0, registerOffset)), get(virtualRegisterForArgument(1, registerOffset)));1505 set( VirtualRegister(resultOperand), arrayPush);1503 Node* arrayPush = addToGraph(ArrayPush, OpInfo(arrayMode.asWord()), OpInfo(prediction), get(registerOffset + argumentToOperand(0)), get(registerOffset + argumentToOperand(1))); 1504 set(resultOperand, arrayPush); 1506 1505 1507 1506 return true; … … 1525 1524 case Array::Contiguous: 1526 1525 case Array::ArrayStorage: { 1527 Node* arrayPop = addToGraph(ArrayPop, OpInfo(arrayMode.asWord()), OpInfo(prediction), get( virtualRegisterForArgument(0, registerOffset)));1528 set( VirtualRegister(resultOperand), arrayPop);1526 Node* arrayPop = addToGraph(ArrayPop, OpInfo(arrayMode.asWord()), OpInfo(prediction), get(registerOffset + argumentToOperand(0))); 1527 set(resultOperand, arrayPop); 1529 1528 return true; 1530 1529 } … … 1539 1538 return false; 1540 1539 1541 int thisOperand = virtualRegisterForArgument(0, registerOffset).offset();1542 int indexOperand = virtualRegisterForArgument(1, registerOffset).offset();1543 Node* charCode = addToGraph(StringCharCodeAt, OpInfo(ArrayMode(Array::String).asWord()), get( VirtualRegister(thisOperand)), getToInt32(indexOperand));1544 1545 set( VirtualRegister(resultOperand), charCode);1540 int thisOperand = registerOffset + argumentToOperand(0); 1541 int indexOperand = registerOffset + argumentToOperand(1); 1542 Node* charCode = addToGraph(StringCharCodeAt, OpInfo(ArrayMode(Array::String).asWord()), get(thisOperand), getToInt32(indexOperand)); 1543 1544 set(resultOperand, charCode); 1546 1545 return true; 1547 1546 } … … 1551 1550 return false; 1552 1551 1553 int thisOperand = virtualRegisterForArgument(0, registerOffset).offset();1554 int indexOperand = virtualRegisterForArgument(1, registerOffset).offset();1555 Node* charCode = addToGraph(StringCharAt, OpInfo(ArrayMode(Array::String).asWord()), get( VirtualRegister(thisOperand)), getToInt32(indexOperand));1556 1557 set( VirtualRegister(resultOperand), charCode);1552 int thisOperand = registerOffset + argumentToOperand(0); 1553 int indexOperand = registerOffset + argumentToOperand(1); 1554 Node* charCode = addToGraph(StringCharAt, OpInfo(ArrayMode(Array::String).asWord()), get(thisOperand), getToInt32(indexOperand)); 1555 1556 set(resultOperand, charCode); 1558 1557 return true; 1559 1558 } … … 1562 1561 return false; 1563 1562 1564 int indexOperand = virtualRegisterForArgument(1, registerOffset).offset();1563 int indexOperand = registerOffset + argumentToOperand(1); 1565 1564 Node* charCode = addToGraph(StringFromCharCode, getToInt32(indexOperand)); 1566 1565 1567 set( VirtualRegister(resultOperand), charCode);1566 set(resultOperand, charCode); 1568 1567 1569 1568 return true; … … 1574 1573 return false; 1575 1574 1576 Node* regExpExec = addToGraph(RegExpExec, OpInfo(0), OpInfo(prediction), get( virtualRegisterForArgument(0, registerOffset)), get(virtualRegisterForArgument(1, registerOffset)));1577 set( VirtualRegister(resultOperand), regExpExec);1575 Node* regExpExec = addToGraph(RegExpExec, OpInfo(0), OpInfo(prediction), get(registerOffset + argumentToOperand(0)), get(registerOffset + argumentToOperand(1))); 1576 set(resultOperand, regExpExec); 1578 1577 1579 1578 return true; … … 1584 1583 return false; 1585 1584 1586 Node* regExpExec = addToGraph(RegExpTest, OpInfo(0), OpInfo(prediction), get( virtualRegisterForArgument(0, registerOffset)), get(virtualRegisterForArgument(1, registerOffset)));1587 set( VirtualRegister(resultOperand), regExpExec);1585 Node* regExpExec = addToGraph(RegExpTest, OpInfo(0), OpInfo(prediction), get(registerOffset + argumentToOperand(0)), get(registerOffset + argumentToOperand(1))); 1586 set(resultOperand, regExpExec); 1588 1587 1589 1588 return true; … … 1593 1592 if (argumentCountIncludingThis != 3) 1594 1593 return false; 1595 int leftOperand = virtualRegisterForArgument(1, registerOffset).offset();1596 int rightOperand = virtualRegisterForArgument(2, registerOffset).offset();1594 int leftOperand = registerOffset + argumentToOperand(1); 1595 int rightOperand = registerOffset + argumentToOperand(2); 1597 1596 Node* left = getToInt32(leftOperand); 1598 1597 Node* right = getToInt32(rightOperand); 1599 set( VirtualRegister(resultOperand), addToGraph(ArithIMul, left, right));1598 set(resultOperand, addToGraph(ArithIMul, left, right)); 1600 1599 return true; 1601 1600 } … … 1653 1652 return false; 1654 1653 1655 set( VirtualRegister(resultOperand),1656 addToGraph(NewTypedArray, OpInfo(type), get( virtualRegisterForArgument(1, registerOffset))));1654 set(resultOperand, 1655 addToGraph(NewTypedArray, OpInfo(type), get(registerOffset + argumentToOperand(1)))); 1657 1656 return true; 1658 1657 } … … 1676 1675 1677 1676 if (argumentCountIncludingThis == 2) { 1678 set( VirtualRegister(resultOperand),1679 addToGraph(NewArrayWithSize, OpInfo(ArrayWithUndecided), get( virtualRegisterForArgument(1, registerOffset))));1677 set(resultOperand, 1678 addToGraph(NewArrayWithSize, OpInfo(ArrayWithUndecided), get(registerOffset + argumentToOperand(1)))); 1680 1679 return true; 1681 1680 } 1682 1681 1683 1682 for (int i = 1; i < argumentCountIncludingThis; ++i) 1684 addVarArgChild(get( virtualRegisterForArgument(i, registerOffset)));1685 set( VirtualRegister(resultOperand),1683 addVarArgChild(get(registerOffset + argumentToOperand(i))); 1684 set(resultOperand, 1686 1685 addToGraph(Node::VarArg, NewArray, OpInfo(ArrayWithUndecided), OpInfo(0))); 1687 1686 return true; … … 1694 1693 result = cellConstant(m_vm->smallStrings.emptyString()); 1695 1694 else 1696 result = addToGraph(ToString, get( virtualRegisterForArgument(1, registerOffset)));1695 result = addToGraph(ToString, get(registerOffset + argumentToOperand(1))); 1697 1696 1698 1697 if (kind == CodeForConstruct) 1699 1698 result = addToGraph(NewStringObject, OpInfo(function->globalObject()->stringObjectStructure()), result); 1700 1699 1701 set( VirtualRegister(resultOperand), result);1700 set(resultOperand, result); 1702 1701 return true; 1703 1702 } … … 1735 1734 PropertyOffset offset) 1736 1735 { 1737 set( VirtualRegister(destinationOperand), handleGetByOffset(prediction, base, identifierNumber, offset));1736 set(destinationOperand, handleGetByOffset(prediction, base, identifierNumber, offset)); 1738 1737 } 1739 1738 … … 1762 1761 || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache) 1763 1762 || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadWeakConstantCache)) { 1764 set( VirtualRegister(destinationOperand),1763 set(destinationOperand, 1765 1764 addToGraph( 1766 1765 getByIdStatus.makesCalls() ? GetByIdFlush : GetById, … … 1805 1804 ASSERT(getByIdStatus.specificValue().isCell()); 1806 1805 1807 set( VirtualRegister(destinationOperand), cellConstant(getByIdStatus.specificValue().asCell()));1806 set(destinationOperand, cellConstant(getByIdStatus.specificValue().asCell())); 1808 1807 return; 1809 1808 } … … 1852 1851 for (unsigned argument = 0; argument < m_numArguments; ++argument) { 1853 1852 VariableAccessData* variable = newVariableAccessData( 1854 virtualRegisterForArgument(argument), m_codeBlock->isCaptured(virtualRegisterForArgument(argument)));1853 argumentToOperand(argument), m_codeBlock->isCaptured(argumentToOperand(argument))); 1855 1854 variable->mergeStructureCheckHoistingFailed( 1856 1855 m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache)); … … 1901 1900 // Initialize all locals to undefined. 1902 1901 for (int i = 0; i < m_inlineStackTop->m_codeBlock->m_numVars; ++i) 1903 set( virtualRegisterForLocal(i), constantUndefined(), SetOnEntry);1902 set(localToOperand(i), constantUndefined(), SetOnEntry); 1904 1903 NEXT_OPCODE(op_enter); 1905 1904 … … 1925 1924 case op_create_this: { 1926 1925 int calleeOperand = currentInstruction[2].u.operand; 1927 Node* callee = get( VirtualRegister(calleeOperand));1926 Node* callee = get(calleeOperand); 1928 1927 bool alreadyEmitted = false; 1929 1928 if (callee->op() == WeakJSConstant) { … … 1937 1936 // The callee is still live up to this point. 1938 1937 addToGraph(Phantom, callee); 1939 set( VirtualRegister(currentInstruction[1].u.operand),1938 set(currentInstruction[1].u.operand, 1940 1939 addToGraph(NewObject, OpInfo(allocationProfile->structure()))); 1941 1940 alreadyEmitted = true; … … 1943 1942 } 1944 1943 if (!alreadyEmitted) 1945 set( VirtualRegister(currentInstruction[1].u.operand),1944 set(currentInstruction[1].u.operand, 1946 1945 addToGraph(CreateThis, OpInfo(currentInstruction[3].u.operand), callee)); 1947 1946 NEXT_OPCODE(op_create_this); … … 1949 1948 1950 1949 case op_new_object: { 1951 set( VirtualRegister(currentInstruction[1].u.operand),1950 set(currentInstruction[1].u.operand, 1952 1951 addToGraph(NewObject, 1953 1952 OpInfo(currentInstruction[3].u.objectAllocationProfile->structure()))); … … 1960 1959 ArrayAllocationProfile* profile = currentInstruction[4].u.arrayAllocationProfile; 1961 1960 for (int operandIdx = startOperand; operandIdx > startOperand - numOperands; --operandIdx) 1962 addVarArgChild(get( VirtualRegister(operandIdx)));1963 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(Node::VarArg, NewArray, OpInfo(profile->selectIndexingType()), OpInfo(0)));1961 addVarArgChild(get(operandIdx)); 1962 set(currentInstruction[1].u.operand, addToGraph(Node::VarArg, NewArray, OpInfo(profile->selectIndexingType()), OpInfo(0))); 1964 1963 NEXT_OPCODE(op_new_array); 1965 1964 } … … 1968 1967 int lengthOperand = currentInstruction[2].u.operand; 1969 1968 ArrayAllocationProfile* profile = currentInstruction[3].u.arrayAllocationProfile; 1970 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(NewArrayWithSize, OpInfo(profile->selectIndexingType()), get(VirtualRegister(lengthOperand))));1969 set(currentInstruction[1].u.operand, addToGraph(NewArrayWithSize, OpInfo(profile->selectIndexingType()), get(lengthOperand))); 1971 1970 NEXT_OPCODE(op_new_array_with_size); 1972 1971 } … … 1990 1989 1991 1990 m_graph.m_newArrayBufferData.append(data); 1992 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(NewArrayBuffer, OpInfo(&m_graph.m_newArrayBufferData.last())));1991 set(currentInstruction[1].u.operand, addToGraph(NewArrayBuffer, OpInfo(&m_graph.m_newArrayBufferData.last()))); 1993 1992 NEXT_OPCODE(op_new_array_buffer); 1994 1993 } 1995 1994 1996 1995 case op_new_regexp: { 1997 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(NewRegexp, OpInfo(currentInstruction[2].u.operand)));1996 set(currentInstruction[1].u.operand, addToGraph(NewRegexp, OpInfo(currentInstruction[2].u.operand))); 1998 1997 NEXT_OPCODE(op_new_regexp); 1999 1998 } … … 2004 2003 || m_inlineStackTop->m_profiledBlock->couldTakeSlowCase(m_currentIndex) 2005 2004 || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadFunction)) { 2006 set( VirtualRegister(currentInstruction[1].u.operand), get(VirtualRegister(JSStack::Callee)));2005 set(currentInstruction[1].u.operand, get(JSStack::Callee)); 2007 2006 } else { 2008 2007 ASSERT(cachedFunction->inherits(JSFunction::info())); 2009 Node* actualCallee = get( VirtualRegister(JSStack::Callee));2008 Node* actualCallee = get(JSStack::Callee); 2010 2009 addToGraph(CheckFunction, OpInfo(cachedFunction), actualCallee); 2011 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(WeakJSConstant, OpInfo(cachedFunction)));2010 set(currentInstruction[1].u.operand, addToGraph(WeakJSConstant, OpInfo(cachedFunction))); 2012 2011 } 2013 2012 NEXT_OPCODE(op_get_callee); … … 2019 2018 Node* op1 = getToInt32(currentInstruction[2].u.operand); 2020 2019 Node* op2 = getToInt32(currentInstruction[3].u.operand); 2021 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(BitAnd, op1, op2));2020 set(currentInstruction[1].u.operand, addToGraph(BitAnd, op1, op2)); 2022 2021 NEXT_OPCODE(op_bitand); 2023 2022 } … … 2026 2025 Node* op1 = getToInt32(currentInstruction[2].u.operand); 2027 2026 Node* op2 = getToInt32(currentInstruction[3].u.operand); 2028 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(BitOr, op1, op2));2027 set(currentInstruction[1].u.operand, addToGraph(BitOr, op1, op2)); 2029 2028 NEXT_OPCODE(op_bitor); 2030 2029 } … … 2033 2032 Node* op1 = getToInt32(currentInstruction[2].u.operand); 2034 2033 Node* op2 = getToInt32(currentInstruction[3].u.operand); 2035 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(BitXor, op1, op2));2034 set(currentInstruction[1].u.operand, addToGraph(BitXor, op1, op2)); 2036 2035 NEXT_OPCODE(op_bitxor); 2037 2036 } … … 2046 2045 else 2047 2046 result = addToGraph(BitRShift, op1, op2); 2048 set( VirtualRegister(currentInstruction[1].u.operand), result);2047 set(currentInstruction[1].u.operand, result); 2049 2048 NEXT_OPCODE(op_rshift); 2050 2049 } … … 2059 2058 else 2060 2059 result = addToGraph(BitLShift, op1, op2); 2061 set( VirtualRegister(currentInstruction[1].u.operand), result);2060 set(currentInstruction[1].u.operand, result); 2062 2061 NEXT_OPCODE(op_lshift); 2063 2062 } … … 2086 2085 result = makeSafe(addToGraph(UInt32ToNumber, result)); 2087 2086 } 2088 set( VirtualRegister(currentInstruction[1].u.operand), result);2087 set(currentInstruction[1].u.operand, result); 2089 2088 NEXT_OPCODE(op_urshift); 2090 2089 } … … 2094 2093 case op_inc: { 2095 2094 int srcDst = currentInstruction[1].u.operand; 2096 VirtualRegister srcDstVirtualRegister = VirtualRegister(srcDst); 2097 Node* op = get(srcDstVirtualRegister); 2098 set(srcDstVirtualRegister, makeSafe(addToGraph(ArithAdd, op, one()))); 2095 Node* op = get(srcDst); 2096 set(srcDst, makeSafe(addToGraph(ArithAdd, op, one()))); 2099 2097 NEXT_OPCODE(op_inc); 2100 2098 } … … 2102 2100 case op_dec: { 2103 2101 int srcDst = currentInstruction[1].u.operand; 2104 VirtualRegister srcDstVirtualRegister = VirtualRegister(srcDst); 2105 Node* op = get(srcDstVirtualRegister); 2106 set(srcDstVirtualRegister, makeSafe(addToGraph(ArithSub, op, one()))); 2102 Node* op = get(srcDst); 2103 set(srcDst, makeSafe(addToGraph(ArithSub, op, one()))); 2107 2104 NEXT_OPCODE(op_dec); 2108 2105 } … … 2111 2108 2112 2109 case op_add: { 2113 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2114 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2110 Node* op1 = get(currentInstruction[2].u.operand); 2111 Node* op2 = get(currentInstruction[3].u.operand); 2115 2112 if (op1->hasNumberResult() && op2->hasNumberResult()) 2116 set( VirtualRegister(currentInstruction[1].u.operand), makeSafe(addToGraph(ArithAdd, op1, op2)));2113 set(currentInstruction[1].u.operand, makeSafe(addToGraph(ArithAdd, op1, op2))); 2117 2114 else 2118 set( VirtualRegister(currentInstruction[1].u.operand), makeSafe(addToGraph(ValueAdd, op1, op2)));2115 set(currentInstruction[1].u.operand, makeSafe(addToGraph(ValueAdd, op1, op2))); 2119 2116 NEXT_OPCODE(op_add); 2120 2117 } 2121 2118 2122 2119 case op_sub: { 2123 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2124 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2125 set( VirtualRegister(currentInstruction[1].u.operand), makeSafe(addToGraph(ArithSub, op1, op2)));2120 Node* op1 = get(currentInstruction[2].u.operand); 2121 Node* op2 = get(currentInstruction[3].u.operand); 2122 set(currentInstruction[1].u.operand, makeSafe(addToGraph(ArithSub, op1, op2))); 2126 2123 NEXT_OPCODE(op_sub); 2127 2124 } 2128 2125 2129 2126 case op_negate: { 2130 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2131 set( VirtualRegister(currentInstruction[1].u.operand), makeSafe(addToGraph(ArithNegate, op1)));2127 Node* op1 = get(currentInstruction[2].u.operand); 2128 set(currentInstruction[1].u.operand, makeSafe(addToGraph(ArithNegate, op1))); 2132 2129 NEXT_OPCODE(op_negate); 2133 2130 } … … 2135 2132 case op_mul: { 2136 2133 // Multiply requires that the inputs are not truncated, unfortunately. 2137 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2138 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2139 set( VirtualRegister(currentInstruction[1].u.operand), makeSafe(addToGraph(ArithMul, op1, op2)));2134 Node* op1 = get(currentInstruction[2].u.operand); 2135 Node* op2 = get(currentInstruction[3].u.operand); 2136 set(currentInstruction[1].u.operand, makeSafe(addToGraph(ArithMul, op1, op2))); 2140 2137 NEXT_OPCODE(op_mul); 2141 2138 } 2142 2139 2143 2140 case op_mod: { 2144 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2145 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2146 set( VirtualRegister(currentInstruction[1].u.operand), makeSafe(addToGraph(ArithMod, op1, op2)));2141 Node* op1 = get(currentInstruction[2].u.operand); 2142 Node* op2 = get(currentInstruction[3].u.operand); 2143 set(currentInstruction[1].u.operand, makeSafe(addToGraph(ArithMod, op1, op2))); 2147 2144 NEXT_OPCODE(op_mod); 2148 2145 } 2149 2146 2150 2147 case op_div: { 2151 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2152 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2153 set( VirtualRegister(currentInstruction[1].u.operand), makeDivSafe(addToGraph(ArithDiv, op1, op2)));2148 Node* op1 = get(currentInstruction[2].u.operand); 2149 Node* op2 = get(currentInstruction[3].u.operand); 2150 set(currentInstruction[1].u.operand, makeDivSafe(addToGraph(ArithDiv, op1, op2))); 2154 2151 NEXT_OPCODE(op_div); 2155 2152 } … … 2163 2160 #endif 2164 2161 case op_mov: { 2165 Node* op = get( VirtualRegister(currentInstruction[2].u.operand));2166 set( VirtualRegister(currentInstruction[1].u.operand), op);2162 Node* op = get(currentInstruction[2].u.operand); 2163 set(currentInstruction[1].u.operand, op); 2167 2164 NEXT_OPCODE(op_mov); 2168 2165 } 2169 2166 2170 2167 case op_check_has_instance: 2171 addToGraph(CheckHasInstance, get( VirtualRegister(currentInstruction[3].u.operand)));2168 addToGraph(CheckHasInstance, get(currentInstruction[3].u.operand)); 2172 2169 NEXT_OPCODE(op_check_has_instance); 2173 2170 2174 2171 case op_instanceof: { 2175 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2176 Node* prototype = get( VirtualRegister(currentInstruction[3].u.operand));2177 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(InstanceOf, value, prototype));2172 Node* value = get(currentInstruction[2].u.operand); 2173 Node* prototype = get(currentInstruction[3].u.operand); 2174 set(currentInstruction[1].u.operand, addToGraph(InstanceOf, value, prototype)); 2178 2175 NEXT_OPCODE(op_instanceof); 2179 2176 } 2180 2177 2181 2178 case op_is_undefined: { 2182 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2183 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(IsUndefined, value));2179 Node* value = get(currentInstruction[2].u.operand); 2180 set(currentInstruction[1].u.operand, addToGraph(IsUndefined, value)); 2184 2181 NEXT_OPCODE(op_is_undefined); 2185 2182 } 2186 2183 2187 2184 case op_is_boolean: { 2188 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2189 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(IsBoolean, value));2185 Node* value = get(currentInstruction[2].u.operand); 2186 set(currentInstruction[1].u.operand, addToGraph(IsBoolean, value)); 2190 2187 NEXT_OPCODE(op_is_boolean); 2191 2188 } 2192 2189 2193 2190 case op_is_number: { 2194 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2195 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(IsNumber, value));2191 Node* value = get(currentInstruction[2].u.operand); 2192 set(currentInstruction[1].u.operand, addToGraph(IsNumber, value)); 2196 2193 NEXT_OPCODE(op_is_number); 2197 2194 } 2198 2195 2199 2196 case op_is_string: { 2200 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2201 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(IsString, value));2197 Node* value = get(currentInstruction[2].u.operand); 2198 set(currentInstruction[1].u.operand, addToGraph(IsString, value)); 2202 2199 NEXT_OPCODE(op_is_string); 2203 2200 } 2204 2201 2205 2202 case op_is_object: { 2206 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2207 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(IsObject, value));2203 Node* value = get(currentInstruction[2].u.operand); 2204 set(currentInstruction[1].u.operand, addToGraph(IsObject, value)); 2208 2205 NEXT_OPCODE(op_is_object); 2209 2206 } 2210 2207 2211 2208 case op_is_function: { 2212 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2213 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(IsFunction, value));2209 Node* value = get(currentInstruction[2].u.operand); 2210 set(currentInstruction[1].u.operand, addToGraph(IsFunction, value)); 2214 2211 NEXT_OPCODE(op_is_function); 2215 2212 } 2216 2213 2217 2214 case op_not: { 2218 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2219 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(LogicalNot, value));2215 Node* value = get(currentInstruction[2].u.operand); 2216 set(currentInstruction[1].u.operand, addToGraph(LogicalNot, value)); 2220 2217 NEXT_OPCODE(op_not); 2221 2218 } 2222 2219 2223 2220 case op_to_primitive: { 2224 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2225 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(ToPrimitive, value));2221 Node* value = get(currentInstruction[2].u.operand); 2222 set(currentInstruction[1].u.operand, addToGraph(ToPrimitive, value)); 2226 2223 NEXT_OPCODE(op_to_primitive); 2227 2224 } … … 2239 2236 auto toStringNodes = std::make_unique<Node*[]>(numOperands); 2240 2237 for (int i = 0; i < numOperands; i++) 2241 toStringNodes[i] = addToGraph(ToString, get( VirtualRegister(startOperand - i)));2238 toStringNodes[i] = addToGraph(ToString, get(startOperand - i)); 2242 2239 2243 2240 for (int i = 0; i < numOperands; i++) … … 2260 2257 operands[indexInOperands++] = toStringNodes[operandIdx]; 2261 2258 } 2262 set( VirtualRegister(currentInstruction[1].u.operand),2259 set(currentInstruction[1].u.operand, 2263 2260 addToGraph(MakeRope, operands[0], operands[1], operands[2])); 2264 2261 NEXT_OPCODE(op_strcat); … … 2266 2263 2267 2264 case op_less: { 2268 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2269 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2265 Node* op1 = get(currentInstruction[2].u.operand); 2266 Node* op2 = get(currentInstruction[3].u.operand); 2270 2267 if (canFold(op1) && canFold(op2)) { 2271 2268 JSValue a = valueOfJSConstant(op1); 2272 2269 JSValue b = valueOfJSConstant(op2); 2273 2270 if (a.isNumber() && b.isNumber()) { 2274 set( VirtualRegister(currentInstruction[1].u.operand),2271 set(currentInstruction[1].u.operand, 2275 2272 getJSConstantForValue(jsBoolean(a.asNumber() < b.asNumber()))); 2276 2273 NEXT_OPCODE(op_less); 2277 2274 } 2278 2275 } 2279 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(CompareLess, op1, op2));2276 set(currentInstruction[1].u.operand, addToGraph(CompareLess, op1, op2)); 2280 2277 NEXT_OPCODE(op_less); 2281 2278 } 2282 2279 2283 2280 case op_lesseq: { 2284 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2285 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2281 Node* op1 = get(currentInstruction[2].u.operand); 2282 Node* op2 = get(currentInstruction[3].u.operand); 2286 2283 if (canFold(op1) && canFold(op2)) { 2287 2284 JSValue a = valueOfJSConstant(op1); 2288 2285 JSValue b = valueOfJSConstant(op2); 2289 2286 if (a.isNumber() && b.isNumber()) { 2290 set( VirtualRegister(currentInstruction[1].u.operand),2287 set(currentInstruction[1].u.operand, 2291 2288 getJSConstantForValue(jsBoolean(a.asNumber() <= b.asNumber()))); 2292 2289 NEXT_OPCODE(op_lesseq); 2293 2290 } 2294 2291 } 2295 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(CompareLessEq, op1, op2));2292 set(currentInstruction[1].u.operand, addToGraph(CompareLessEq, op1, op2)); 2296 2293 NEXT_OPCODE(op_lesseq); 2297 2294 } 2298 2295 2299 2296 case op_greater: { 2300 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2301 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2297 Node* op1 = get(currentInstruction[2].u.operand); 2298 Node* op2 = get(currentInstruction[3].u.operand); 2302 2299 if (canFold(op1) && canFold(op2)) { 2303 2300 JSValue a = valueOfJSConstant(op1); 2304 2301 JSValue b = valueOfJSConstant(op2); 2305 2302 if (a.isNumber() && b.isNumber()) { 2306 set( VirtualRegister(currentInstruction[1].u.operand),2303 set(currentInstruction[1].u.operand, 2307 2304 getJSConstantForValue(jsBoolean(a.asNumber() > b.asNumber()))); 2308 2305 NEXT_OPCODE(op_greater); 2309 2306 } 2310 2307 } 2311 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(CompareGreater, op1, op2));2308 set(currentInstruction[1].u.operand, addToGraph(CompareGreater, op1, op2)); 2312 2309 NEXT_OPCODE(op_greater); 2313 2310 } 2314 2311 2315 2312 case op_greatereq: { 2316 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2317 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2313 Node* op1 = get(currentInstruction[2].u.operand); 2314 Node* op2 = get(currentInstruction[3].u.operand); 2318 2315 if (canFold(op1) && canFold(op2)) { 2319 2316 JSValue a = valueOfJSConstant(op1); 2320 2317 JSValue b = valueOfJSConstant(op2); 2321 2318 if (a.isNumber() && b.isNumber()) { 2322 set( VirtualRegister(currentInstruction[1].u.operand),2319 set(currentInstruction[1].u.operand, 2323 2320 getJSConstantForValue(jsBoolean(a.asNumber() >= b.asNumber()))); 2324 2321 NEXT_OPCODE(op_greatereq); 2325 2322 } 2326 2323 } 2327 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(CompareGreaterEq, op1, op2));2324 set(currentInstruction[1].u.operand, addToGraph(CompareGreaterEq, op1, op2)); 2328 2325 NEXT_OPCODE(op_greatereq); 2329 2326 } 2330 2327 2331 2328 case op_eq: { 2332 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2333 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2329 Node* op1 = get(currentInstruction[2].u.operand); 2330 Node* op2 = get(currentInstruction[3].u.operand); 2334 2331 if (canFold(op1) && canFold(op2)) { 2335 2332 JSValue a = valueOfJSConstant(op1); 2336 2333 JSValue b = valueOfJSConstant(op2); 2337 set( VirtualRegister(currentInstruction[1].u.operand),2334 set(currentInstruction[1].u.operand, 2338 2335 getJSConstantForValue(jsBoolean(JSValue::equal(m_codeBlock->globalObject()->globalExec(), a, b)))); 2339 2336 NEXT_OPCODE(op_eq); 2340 2337 } 2341 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(CompareEq, op1, op2));2338 set(currentInstruction[1].u.operand, addToGraph(CompareEq, op1, op2)); 2342 2339 NEXT_OPCODE(op_eq); 2343 2340 } 2344 2341 2345 2342 case op_eq_null: { 2346 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2347 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(CompareEqConstant, value, constantNull()));2343 Node* value = get(currentInstruction[2].u.operand); 2344 set(currentInstruction[1].u.operand, addToGraph(CompareEqConstant, value, constantNull())); 2348 2345 NEXT_OPCODE(op_eq_null); 2349 2346 } 2350 2347 2351 2348 case op_stricteq: { 2352 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2353 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2349 Node* op1 = get(currentInstruction[2].u.operand); 2350 Node* op2 = get(currentInstruction[3].u.operand); 2354 2351 if (canFold(op1) && canFold(op2)) { 2355 2352 JSValue a = valueOfJSConstant(op1); 2356 2353 JSValue b = valueOfJSConstant(op2); 2357 set( VirtualRegister(currentInstruction[1].u.operand),2354 set(currentInstruction[1].u.operand, 2358 2355 getJSConstantForValue(jsBoolean(JSValue::strictEqual(m_codeBlock->globalObject()->globalExec(), a, b)))); 2359 2356 NEXT_OPCODE(op_stricteq); 2360 2357 } 2361 2358 if (isConstantForCompareStrictEq(op1)) 2362 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(CompareStrictEqConstant, op2, op1));2359 set(currentInstruction[1].u.operand, addToGraph(CompareStrictEqConstant, op2, op1)); 2363 2360 else if (isConstantForCompareStrictEq(op2)) 2364 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(CompareStrictEqConstant, op1, op2));2361 set(currentInstruction[1].u.operand, addToGraph(CompareStrictEqConstant, op1, op2)); 2365 2362 else 2366 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(CompareStrictEq, op1, op2));2363 set(currentInstruction[1].u.operand, addToGraph(CompareStrictEq, op1, op2)); 2367 2364 NEXT_OPCODE(op_stricteq); 2368 2365 } 2369 2366 2370 2367 case op_neq: { 2371 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2372 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2368 Node* op1 = get(currentInstruction[2].u.operand); 2369 Node* op2 = get(currentInstruction[3].u.operand); 2373 2370 if (canFold(op1) && canFold(op2)) { 2374 2371 JSValue a = valueOfJSConstant(op1); 2375 2372 JSValue b = valueOfJSConstant(op2); 2376 set( VirtualRegister(currentInstruction[1].u.operand),2373 set(currentInstruction[1].u.operand, 2377 2374 getJSConstantForValue(jsBoolean(!JSValue::equal(m_codeBlock->globalObject()->globalExec(), a, b)))); 2378 2375 NEXT_OPCODE(op_neq); 2379 2376 } 2380 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(LogicalNot, addToGraph(CompareEq, op1, op2)));2377 set(currentInstruction[1].u.operand, addToGraph(LogicalNot, addToGraph(CompareEq, op1, op2))); 2381 2378 NEXT_OPCODE(op_neq); 2382 2379 } 2383 2380 2384 2381 case op_neq_null: { 2385 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2386 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(LogicalNot, addToGraph(CompareEqConstant, value, constantNull())));2382 Node* value = get(currentInstruction[2].u.operand); 2383 set(currentInstruction[1].u.operand, addToGraph(LogicalNot, addToGraph(CompareEqConstant, value, constantNull()))); 2387 2384 NEXT_OPCODE(op_neq_null); 2388 2385 } 2389 2386 2390 2387 case op_nstricteq: { 2391 Node* op1 = get( VirtualRegister(currentInstruction[2].u.operand));2392 Node* op2 = get( VirtualRegister(currentInstruction[3].u.operand));2388 Node* op1 = get(currentInstruction[2].u.operand); 2389 Node* op2 = get(currentInstruction[3].u.operand); 2393 2390 if (canFold(op1) && canFold(op2)) { 2394 2391 JSValue a = valueOfJSConstant(op1); 2395 2392 JSValue b = valueOfJSConstant(op2); 2396 set( VirtualRegister(currentInstruction[1].u.operand),2393 set(currentInstruction[1].u.operand, 2397 2394 getJSConstantForValue(jsBoolean(!JSValue::strictEqual(m_codeBlock->globalObject()->globalExec(), a, b)))); 2398 2395 NEXT_OPCODE(op_nstricteq); … … 2405 2402 else 2406 2403 invertedResult = addToGraph(CompareStrictEq, op1, op2); 2407 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(LogicalNot, invertedResult));2404 set(currentInstruction[1].u.operand, addToGraph(LogicalNot, invertedResult)); 2408 2405 NEXT_OPCODE(op_nstricteq); 2409 2406 } … … 2414 2411 SpeculatedType prediction = getPrediction(); 2415 2412 2416 Node* base = get( VirtualRegister(currentInstruction[2].u.operand));2413 Node* base = get(currentInstruction[2].u.operand); 2417 2414 ArrayMode arrayMode = getArrayModeConsideringSlowPath(currentInstruction[4].u.arrayProfile, Array::Read); 2418 Node* property = get( VirtualRegister(currentInstruction[3].u.operand));2415 Node* property = get(currentInstruction[3].u.operand); 2419 2416 Node* getByVal = addToGraph(GetByVal, OpInfo(arrayMode.asWord()), OpInfo(prediction), base, property); 2420 set( VirtualRegister(currentInstruction[1].u.operand), getByVal);2417 set(currentInstruction[1].u.operand, getByVal); 2421 2418 2422 2419 NEXT_OPCODE(op_get_by_val); … … 2424 2421 2425 2422 case op_put_by_val: { 2426 Node* base = get( VirtualRegister(currentInstruction[1].u.operand));2423 Node* base = get(currentInstruction[1].u.operand); 2427 2424 2428 2425 ArrayMode arrayMode = getArrayModeConsideringSlowPath(currentInstruction[4].u.arrayProfile, Array::Write); 2429 2426 2430 Node* property = get( VirtualRegister(currentInstruction[2].u.operand));2431 Node* value = get( VirtualRegister(currentInstruction[3].u.operand));2427 Node* property = get(currentInstruction[2].u.operand); 2428 Node* value = get(currentInstruction[3].u.operand); 2432 2429 2433 2430 addVarArgChild(base); … … 2445 2442 SpeculatedType prediction = getPrediction(); 2446 2443 2447 Node* base = get( VirtualRegister(currentInstruction[2].u.operand));2444 Node* base = get(currentInstruction[2].u.operand); 2448 2445 unsigned identifierNumber = m_inlineStackTop->m_identifierRemap[currentInstruction[3].u.operand]; 2449 2446 … … 2463 2460 case op_put_by_id_transition_direct_out_of_line: 2464 2461 case op_put_by_id_transition_normal_out_of_line: { 2465 Node* value = get( VirtualRegister(currentInstruction[3].u.operand));2466 Node* base = get( VirtualRegister(currentInstruction[1].u.operand));2462 Node* value = get(currentInstruction[3].u.operand); 2463 Node* base = get(currentInstruction[1].u.operand); 2467 2464 unsigned identifierNumber = m_inlineStackTop->m_identifierRemap[currentInstruction[2].u.operand]; 2468 2465 bool direct = currentInstruction[8].u.operand; … … 2570 2567 2571 2568 case op_init_global_const: { 2572 Node* value = get( VirtualRegister(currentInstruction[2].u.operand));2569 Node* value = get(currentInstruction[2].u.operand); 2573 2570 addToGraph( 2574 2571 PutGlobalVar, … … 2588 2585 case op_jtrue: { 2589 2586 unsigned relativeOffset = currentInstruction[2].u.operand; 2590 Node* condition = get( VirtualRegister(currentInstruction[1].u.operand));2587 Node* condition = get(currentInstruction[1].u.operand); 2591 2588 if (canFold(condition)) { 2592 2589 TriState state = valueOfJSConstant(condition).pureToBoolean(); … … 2607 2604 case op_jfalse: { 2608 2605 unsigned relativeOffset = currentInstruction[2].u.operand; 2609 Node* condition = get( VirtualRegister(currentInstruction[1].u.operand));2606 Node* condition = get(currentInstruction[1].u.operand); 2610 2607 if (canFold(condition)) { 2611 2608 TriState state = valueOfJSConstant(condition).pureToBoolean(); … … 2626 2623 case op_jeq_null: { 2627 2624 unsigned relativeOffset = currentInstruction[2].u.operand; 2628 Node* value = get( VirtualRegister(currentInstruction[1].u.operand));2625 Node* value = get(currentInstruction[1].u.operand); 2629 2626 Node* condition = addToGraph(CompareEqConstant, value, constantNull()); 2630 2627 addToGraph(Branch, OpInfo(m_currentIndex + relativeOffset), OpInfo(m_currentIndex + OPCODE_LENGTH(op_jeq_null)), condition); … … 2634 2631 case op_jneq_null: { 2635 2632 unsigned relativeOffset = currentInstruction[2].u.operand; 2636 Node* value = get( VirtualRegister(currentInstruction[1].u.operand));2633 Node* value = get(currentInstruction[1].u.operand); 2637 2634 Node* condition = addToGraph(CompareEqConstant, value, constantNull()); 2638 2635 addToGraph(Branch, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jneq_null)), OpInfo(m_currentIndex + relativeOffset), condition); … … 2642 2639 case op_jless: { 2643 2640 unsigned relativeOffset = currentInstruction[3].u.operand; 2644 Node* op1 = get( VirtualRegister(currentInstruction[1].u.operand));2645 Node* op2 = get( VirtualRegister(currentInstruction[2].u.operand));2641 Node* op1 = get(currentInstruction[1].u.operand); 2642 Node* op2 = get(currentInstruction[2].u.operand); 2646 2643 if (canFold(op1) && canFold(op2)) { 2647 2644 JSValue aValue = valueOfJSConstant(op1); … … 2668 2665 case op_jlesseq: { 2669 2666 unsigned relativeOffset = currentInstruction[3].u.operand; 2670 Node* op1 = get( VirtualRegister(currentInstruction[1].u.operand));2671 Node* op2 = get( VirtualRegister(currentInstruction[2].u.operand));2667 Node* op1 = get(currentInstruction[1].u.operand); 2668 Node* op2 = get(currentInstruction[2].u.operand); 2672 2669 if (canFold(op1) && canFold(op2)) { 2673 2670 JSValue aValue = valueOfJSConstant(op1); … … 2694 2691 case op_jgreater: { 2695 2692 unsigned relativeOffset = currentInstruction[3].u.operand; 2696 Node* op1 = get( VirtualRegister(currentInstruction[1].u.operand));2697 Node* op2 = get( VirtualRegister(currentInstruction[2].u.operand));2693 Node* op1 = get(currentInstruction[1].u.operand); 2694 Node* op2 = get(currentInstruction[2].u.operand); 2698 2695 if (canFold(op1) && canFold(op2)) { 2699 2696 JSValue aValue = valueOfJSConstant(op1); … … 2720 2717 case op_jgreatereq: { 2721 2718 unsigned relativeOffset = currentInstruction[3].u.operand; 2722 Node* op1 = get( VirtualRegister(currentInstruction[1].u.operand));2723 Node* op2 = get( VirtualRegister(currentInstruction[2].u.operand));2719 Node* op1 = get(currentInstruction[1].u.operand); 2720 Node* op2 = get(currentInstruction[2].u.operand); 2724 2721 if (canFold(op1) && canFold(op2)) { 2725 2722 JSValue aValue = valueOfJSConstant(op1); … … 2746 2743 case op_jnless: { 2747 2744 unsigned relativeOffset = currentInstruction[3].u.operand; 2748 Node* op1 = get( VirtualRegister(currentInstruction[1].u.operand));2749 Node* op2 = get( VirtualRegister(currentInstruction[2].u.operand));2745 Node* op1 = get(currentInstruction[1].u.operand); 2746 Node* op2 = get(currentInstruction[2].u.operand); 2750 2747 if (canFold(op1) && canFold(op2)) { 2751 2748 JSValue aValue = valueOfJSConstant(op1); … … 2772 2769 case op_jnlesseq: { 2773 2770 unsigned relativeOffset = currentInstruction[3].u.operand; 2774 Node* op1 = get( VirtualRegister(currentInstruction[1].u.operand));2775 Node* op2 = get( VirtualRegister(currentInstruction[2].u.operand));2771 Node* op1 = get(currentInstruction[1].u.operand); 2772 Node* op2 = get(currentInstruction[2].u.operand); 2776 2773 if (canFold(op1) && canFold(op2)) { 2777 2774 JSValue aValue = valueOfJSConstant(op1); … … 2798 2795 case op_jngreater: { 2799 2796 unsigned relativeOffset = currentInstruction[3].u.operand; 2800 Node* op1 = get( VirtualRegister(currentInstruction[1].u.operand));2801 Node* op2 = get( VirtualRegister(currentInstruction[2].u.operand));2797 Node* op1 = get(currentInstruction[1].u.operand); 2798 Node* op2 = get(currentInstruction[2].u.operand); 2802 2799 if (canFold(op1) && canFold(op2)) { 2803 2800 JSValue aValue = valueOfJSConstant(op1); … … 2824 2821 case op_jngreatereq: { 2825 2822 unsigned relativeOffset = currentInstruction[3].u.operand; 2826 Node* op1 = get( VirtualRegister(currentInstruction[1].u.operand));2827 Node* op2 = get( VirtualRegister(currentInstruction[2].u.operand));2823 Node* op1 = get(currentInstruction[1].u.operand); 2824 Node* op2 = get(currentInstruction[2].u.operand); 2828 2825 if (canFold(op1) && canFold(op2)) { 2829 2826 JSValue aValue = valueOfJSConstant(op1); … … 2863 2860 } 2864 2861 m_graph.m_switchData.append(data); 2865 addToGraph(Switch, OpInfo(&m_graph.m_switchData.last()), get( VirtualRegister(currentInstruction[3].u.operand)));2862 addToGraph(Switch, OpInfo(&m_graph.m_switchData.last()), get(currentInstruction[3].u.operand)); 2866 2863 LAST_OPCODE(op_switch_imm); 2867 2864 } … … 2883 2880 } 2884 2881 m_graph.m_switchData.append(data); 2885 addToGraph(Switch, OpInfo(&m_graph.m_switchData.last()), get( VirtualRegister(currentInstruction[3].u.operand)));2882 addToGraph(Switch, OpInfo(&m_graph.m_switchData.last()), get(currentInstruction[3].u.operand)); 2886 2883 LAST_OPCODE(op_switch_char); 2887 2884 } … … 2903 2900 } 2904 2901 m_graph.m_switchData.append(data); 2905 addToGraph(Switch, OpInfo(&m_graph.m_switchData.last()), get( VirtualRegister(currentInstruction[3].u.operand)));2902 addToGraph(Switch, OpInfo(&m_graph.m_switchData.last()), get(currentInstruction[3].u.operand)); 2906 2903 LAST_OPCODE(op_switch_string); 2907 2904 } … … 2910 2907 flushArgumentsAndCapturedVariables(); 2911 2908 if (inlineCallFrame()) { 2912 ASSERT(m_inlineStackTop->m_returnValue .isValid());2913 setDirect(m_inlineStackTop->m_returnValue, get( VirtualRegister(currentInstruction[1].u.operand)));2909 ASSERT(m_inlineStackTop->m_returnValue != InvalidVirtualRegister); 2910 setDirect(m_inlineStackTop->m_returnValue, get(currentInstruction[1].u.operand)); 2914 2911 m_inlineStackTop->m_didReturn = true; 2915 2912 if (m_inlineStackTop->m_unlinkedBlocks.isEmpty()) { … … 2932 2929 LAST_OPCODE(op_ret); 2933 2930 } 2934 addToGraph(Return, get( VirtualRegister(currentInstruction[1].u.operand)));2931 addToGraph(Return, get(currentInstruction[1].u.operand)); 2935 2932 LAST_OPCODE(op_ret); 2936 2933 … … 2938 2935 flushArgumentsAndCapturedVariables(); 2939 2936 ASSERT(!inlineCallFrame()); 2940 addToGraph(Return, get( VirtualRegister(currentInstruction[1].u.operand)));2937 addToGraph(Return, get(currentInstruction[1].u.operand)); 2941 2938 LAST_OPCODE(op_end); 2942 2939 2943 2940 case op_throw: 2944 addToGraph(Throw, get( VirtualRegister(currentInstruction[1].u.operand)));2941 addToGraph(Throw, get(currentInstruction[1].u.operand)); 2945 2942 flushAllArgumentsAndCapturedVariablesInInlineStack(); 2946 2943 addToGraph(Unreachable); … … 2963 2960 case op_call_varargs: { 2964 2961 ASSERT(inlineCallFrame()); 2965 ASSERT(currentInstruction[4].u.operand == m_inlineStackTop->m_codeBlock->argumentsRegister() .offset());2962 ASSERT(currentInstruction[4].u.operand == m_inlineStackTop->m_codeBlock->argumentsRegister()); 2966 2963 ASSERT(!m_inlineStackTop->m_codeBlock->symbolTable()->slowArguments()); 2967 2964 // It would be cool to funnel this into handleCall() so that it can handle … … 2978 2975 m_parameterSlots = JSStack::CallFrameHeaderSize + argCount; 2979 2976 2980 addVarArgChild(get( VirtualRegister(currentInstruction[2].u.operand))); // callee2981 addVarArgChild(get( VirtualRegister(currentInstruction[3].u.operand))); // this2977 addVarArgChild(get(currentInstruction[2].u.operand)); // callee 2978 addVarArgChild(get(currentInstruction[3].u.operand)); // this 2982 2979 for (unsigned argument = 1; argument < argCount; ++argument) 2983 addVarArgChild(get( virtualRegisterForArgument(argument)));2984 2985 set( VirtualRegister(currentInstruction[1].u.operand),2980 addVarArgChild(get(argumentToOperand(argument))); 2981 2982 set(currentInstruction[1].u.operand, 2986 2983 addToGraph(Node::VarArg, Call, OpInfo(0), OpInfo(prediction))); 2987 2984 … … 2997 2994 CheckFunction, 2998 2995 OpInfo(actualPointerFor(m_inlineStackTop->m_codeBlock, currentInstruction[2].u.specialPointer)), 2999 get( VirtualRegister(currentInstruction[1].u.operand)));2996 get(currentInstruction[1].u.operand)); 3000 2997 addToGraph(Jump, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jneq_ptr))); 3001 2998 LAST_OPCODE(op_jneq_ptr); … … 3015 3012 case GlobalPropertyWithVarInjectionChecks: 3016 3013 case GlobalVarWithVarInjectionChecks: 3017 set( VirtualRegister(dst), cellConstant(m_inlineStackTop->m_codeBlock->globalObject()));3014 set(dst, cellConstant(m_inlineStackTop->m_codeBlock->globalObject())); 3018 3015 break; 3019 3016 case ClosureVar: 3020 3017 case ClosureVarWithVarInjectionChecks: 3021 set( VirtualRegister(dst), getScope(m_inlineStackTop->m_codeBlock->needsActivation(), depth));3018 set(dst, getScope(m_inlineStackTop->m_codeBlock->needsActivation(), depth)); 3022 3019 break; 3023 3020 case Dynamic: … … 3051 3048 GetByIdStatus status = GetByIdStatus::computeFor(*m_vm, structure, uid); 3052 3049 if (status.takesSlowPath()) { 3053 set( VirtualRegister(dst), addToGraph(GetByIdFlush, OpInfo(identifierNumber), OpInfo(prediction), get(VirtualRegister(scope))));3050 set(dst, addToGraph(GetByIdFlush, OpInfo(identifierNumber), OpInfo(prediction), get(scope))); 3054 3051 break; 3055 3052 } 3056 3053 Node* base = cellConstantWithStructureCheck(globalObject, status.structureSet().singletonStructure()); 3057 3054 if (JSValue specificValue = status.specificValue()) 3058 set( VirtualRegister(dst), cellConstant(specificValue.asCell()));3055 set(dst, cellConstant(specificValue.asCell())); 3059 3056 else 3060 set( VirtualRegister(dst), handleGetByOffset(prediction, base, identifierNumber, operand));3057 set(dst, handleGetByOffset(prediction, base, identifierNumber, operand)); 3061 3058 break; 3062 3059 } … … 3065 3062 SymbolTableEntry entry = globalObject->symbolTable()->get(uid); 3066 3063 if (!entry.couldBeWatched() || !m_graph.watchpoints().isStillValid(entry.watchpointSet())) { 3067 set( VirtualRegister(dst), addToGraph(GetGlobalVar, OpInfo(operand), OpInfo(prediction)));3064 set(dst, addToGraph(GetGlobalVar, OpInfo(operand), OpInfo(prediction))); 3068 3065 break; 3069 3066 } … … 3071 3068 addToGraph(GlobalVarWatchpoint, OpInfo(operand), OpInfo(identifierNumber)); 3072 3069 JSValue specificValue = globalObject->registerAt(entry.getIndex()).get(); 3073 set( VirtualRegister(dst), cellConstant(specificValue.asCell()));3070 set(dst, cellConstant(specificValue.asCell())); 3074 3071 break; 3075 3072 } 3076 3073 case ClosureVar: 3077 3074 case ClosureVarWithVarInjectionChecks: 3078 set( VirtualRegister(dst),3075 set(dst, 3079 3076 addToGraph(GetClosureVar, OpInfo(operand), OpInfo(prediction), 3080 addToGraph(GetClosureRegisters, get( VirtualRegister(scope)))));3077 addToGraph(GetClosureRegisters, get(scope)))); 3081 3078 break; 3082 3079 case Dynamic: … … 3109 3106 PutByIdStatus status = PutByIdStatus::computeFor(*m_vm, globalObject, structure, uid, false); 3110 3107 if (!status.isSimpleReplace()) { 3111 addToGraph(PutById, OpInfo(identifierNumber), get( VirtualRegister(scope)), get(VirtualRegister(value)));3108 addToGraph(PutById, OpInfo(identifierNumber), get(scope), get(value)); 3112 3109 break; 3113 3110 } 3114 3111 Node* base = cellConstantWithStructureCheck(globalObject, status.oldStructure()); 3115 handlePutByOffset(base, identifierNumber, static_cast<PropertyOffset>(operand), get( VirtualRegister(value)));3112 handlePutByOffset(base, identifierNumber, static_cast<PropertyOffset>(operand), get(value)); 3116 3113 // Keep scope alive until after put. 3117 addToGraph(Phantom, get( VirtualRegister(scope)));3114 addToGraph(Phantom, get(scope)); 3118 3115 break; 3119 3116 } … … 3122 3119 SymbolTableEntry entry = globalObject->symbolTable()->get(uid); 3123 3120 ASSERT(!entry.couldBeWatched() || !m_graph.watchpoints().isStillValid(entry.watchpointSet())); 3124 addToGraph(PutGlobalVar, OpInfo(operand), get( VirtualRegister(value)));3121 addToGraph(PutGlobalVar, OpInfo(operand), get(value)); 3125 3122 // Keep scope alive until after put. 3126 addToGraph(Phantom, get( VirtualRegister(scope)));3123 addToGraph(Phantom, get(scope)); 3127 3124 break; 3128 3125 } 3129 3126 case ClosureVar: 3130 3127 case ClosureVarWithVarInjectionChecks: { 3131 Node* scopeNode = get( VirtualRegister(scope));3128 Node* scopeNode = get(scope); 3132 3129 Node* scopeRegisters = addToGraph(GetClosureRegisters, scopeNode); 3133 addToGraph(PutClosureVar, OpInfo(operand), scopeNode, scopeRegisters, get( VirtualRegister(value)));3130 addToGraph(PutClosureVar, OpInfo(operand), scopeNode, scopeRegisters, get(value)); 3134 3131 break; 3135 3132 } … … 3162 3159 3163 3160 case op_init_lazy_reg: { 3164 set( VirtualRegister(currentInstruction[1].u.operand), getJSConstantForValue(JSValue()));3161 set(currentInstruction[1].u.operand, getJSConstantForValue(JSValue())); 3165 3162 ASSERT(operandIsLocal(currentInstruction[1].u.operand)); 3166 m_graph.m_lazyVars.set( VirtualRegister(currentInstruction[1].u.operand).toLocal());3163 m_graph.m_lazyVars.set(operandToLocal(currentInstruction[1].u.operand)); 3167 3164 NEXT_OPCODE(op_init_lazy_reg); 3168 3165 } 3169 3166 3170 3167 case op_create_activation: { 3171 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(CreateActivation, get(VirtualRegister(currentInstruction[1].u.operand))));3168 set(currentInstruction[1].u.operand, addToGraph(CreateActivation, get(currentInstruction[1].u.operand))); 3172 3169 NEXT_OPCODE(op_create_activation); 3173 3170 } … … 3175 3172 case op_create_arguments: { 3176 3173 m_graph.m_hasArguments = true; 3177 Node* createArguments = addToGraph(CreateArguments, get( VirtualRegister(currentInstruction[1].u.operand)));3178 set( VirtualRegister(currentInstruction[1].u.operand), createArguments);3179 set(unmodifiedArgumentsRegister( VirtualRegister(currentInstruction[1].u.operand)), createArguments);3174 Node* createArguments = addToGraph(CreateArguments, get(currentInstruction[1].u.operand)); 3175 set(currentInstruction[1].u.operand, createArguments); 3176 set(unmodifiedArgumentsRegister(currentInstruction[1].u.operand), createArguments); 3180 3177 NEXT_OPCODE(op_create_arguments); 3181 3178 } 3182 3179 3183 3180 case op_tear_off_activation: { 3184 addToGraph(TearOffActivation, get( VirtualRegister(currentInstruction[1].u.operand)));3181 addToGraph(TearOffActivation, get(currentInstruction[1].u.operand)); 3185 3182 NEXT_OPCODE(op_tear_off_activation); 3186 3183 } … … 3188 3185 case op_tear_off_arguments: { 3189 3186 m_graph.m_hasArguments = true; 3190 addToGraph(TearOffArguments, get(unmodifiedArgumentsRegister( VirtualRegister(currentInstruction[1].u.operand))), get(VirtualRegister(currentInstruction[2].u.operand)));3187 addToGraph(TearOffArguments, get(unmodifiedArgumentsRegister(currentInstruction[1].u.operand)), get(currentInstruction[2].u.operand)); 3191 3188 NEXT_OPCODE(op_tear_off_arguments); 3192 3189 } … … 3194 3191 case op_get_arguments_length: { 3195 3192 m_graph.m_hasArguments = true; 3196 set( VirtualRegister(currentInstruction[1].u.operand), addToGraph(GetMyArgumentsLengthSafe));3193 set(currentInstruction[1].u.operand, addToGraph(GetMyArgumentsLengthSafe)); 3197 3194 NEXT_OPCODE(op_get_arguments_length); 3198 3195 } … … 3200 3197 case op_get_argument_by_val: { 3201 3198 m_graph.m_hasArguments = true; 3202 set( VirtualRegister(currentInstruction[1].u.operand),3199 set(currentInstruction[1].u.operand, 3203 3200 addToGraph( 3204 3201 GetMyArgumentByValSafe, OpInfo(0), OpInfo(getPrediction()), 3205 get( VirtualRegister(currentInstruction[3].u.operand))));3202 get(currentInstruction[3].u.operand))); 3206 3203 NEXT_OPCODE(op_get_argument_by_val); 3207 3204 } … … 3209 3206 case op_new_func: { 3210 3207 if (!currentInstruction[3].u.operand) { 3211 set( VirtualRegister(currentInstruction[1].u.operand),3208 set(currentInstruction[1].u.operand, 3212 3209 addToGraph(NewFunctionNoCheck, OpInfo(currentInstruction[2].u.operand))); 3213 3210 } else { 3214 set( VirtualRegister(currentInstruction[1].u.operand),3211 set(currentInstruction[1].u.operand, 3215 3212 addToGraph( 3216 3213 NewFunction, 3217 3214 OpInfo(currentInstruction[2].u.operand), 3218 get( VirtualRegister(currentInstruction[1].u.operand))));3215 get(currentInstruction[1].u.operand))); 3219 3216 } 3220 3217 NEXT_OPCODE(op_new_func); … … 3222 3219 3223 3220 case op_new_func_exp: { 3224 set( VirtualRegister(currentInstruction[1].u.operand),3221 set(currentInstruction[1].u.operand, 3225 3222 addToGraph(NewFunctionExpression, OpInfo(currentInstruction[2].u.operand))); 3226 3223 NEXT_OPCODE(op_new_func_exp); … … 3228 3225 3229 3226 case op_typeof: { 3230 set( VirtualRegister(currentInstruction[1].u.operand),3231 addToGraph(TypeOf, get( VirtualRegister(currentInstruction[2].u.operand))));3227 set(currentInstruction[1].u.operand, 3228 addToGraph(TypeOf, get(currentInstruction[2].u.operand))); 3232 3229 NEXT_OPCODE(op_typeof); 3233 3230 } 3234 3231 3235 3232 case op_to_number: { 3236 set( VirtualRegister(currentInstruction[1].u.operand),3237 addToGraph(Identity, Edge(get( VirtualRegister(currentInstruction[2].u.operand)), NumberUse)));3233 set(currentInstruction[1].u.operand, 3234 addToGraph(Identity, Edge(get(currentInstruction[2].u.operand), NumberUse))); 3238 3235 NEXT_OPCODE(op_to_number); 3239 3236 } 3240 3237 3241 3238 case op_in: { 3242 set( VirtualRegister(currentInstruction[1].u.operand),3243 addToGraph(In, get( VirtualRegister(currentInstruction[2].u.operand)), get(VirtualRegister(currentInstruction[3].u.operand))));3239 set(currentInstruction[1].u.operand, 3240 addToGraph(In, get(currentInstruction[2].u.operand), get(currentInstruction[3].u.operand))); 3244 3241 NEXT_OPCODE(op_in); 3245 3242 } … … 3364 3361 // Inline case. 3365 3362 ASSERT(codeBlock != byteCodeParser->m_codeBlock); 3366 ASSERT(inlineCallFrameStart .isValid());3363 ASSERT(inlineCallFrameStart != InvalidVirtualRegister); 3367 3364 ASSERT(callsiteBlockHead); 3368 3365 … … 3375 3372 byteCodeParser->m_codeBlock->ownerExecutable(), 3376 3373 codeBlock->ownerExecutable()); 3377 m_inlineCallFrame->stackOffset = inlineCallFrameStart .offset()- JSStack::CallFrameHeaderSize;3374 m_inlineCallFrame->stackOffset = inlineCallFrameStart - JSStack::CallFrameHeaderSize; 3378 3375 if (callee) { 3379 3376 initializeLazyWriteBarrierForInlineCallFrameCallee( … … 3393 3390 else { 3394 3391 for (int i = byteCodeParser->m_codeBlock->m_numVars; i--;) { 3395 if (byteCodeParser->m_codeBlock->isCaptured( virtualRegisterForLocal(i)))3392 if (byteCodeParser->m_codeBlock->isCaptured(localToOperand(i))) 3396 3393 m_inlineCallFrame->capturedVars.set(i); 3397 3394 } … … 3399 3396 3400 3397 for (int i = argumentCountIncludingThis; i--;) { 3401 VirtualRegister argument = virtualRegisterForArgument(i); 3402 if (codeBlock->isCaptured(argument)) 3403 m_inlineCallFrame->capturedVars.set(VirtualRegister(argument.offset() + m_inlineCallFrame->stackOffset).toLocal()); 3398 if (codeBlock->isCaptured(argumentToOperand(i))) 3399 m_inlineCallFrame->capturedVars.set(operandToLocal(argumentToOperand(i) + m_inlineCallFrame->stackOffset)); 3404 3400 } 3405 3401 for (size_t i = codeBlock->m_numVars; i--;) { 3406 VirtualRegister local = virtualRegisterForLocal(i);3407 if (codeBlock->isCaptured(local ))3408 m_inlineCallFrame->capturedVars.set( VirtualRegister(local.offset() + m_inlineCallFrame->stackOffset).toLocal());3402 int localOperand = localToOperand(i); 3403 if (codeBlock->isCaptured(localOperand)) 3404 m_inlineCallFrame->capturedVars.set(operandToLocal(localOperand + m_inlineCallFrame->stackOffset)); 3409 3405 } 3410 3406 … … 3470 3466 ASSERT(codeBlock == byteCodeParser->m_codeBlock); 3471 3467 ASSERT(!callee); 3472 ASSERT( !returnValueVR.isValid());3473 ASSERT( !inlineCallFrameStart.isValid());3468 ASSERT(returnValueVR == InvalidVirtualRegister); 3469 ASSERT(inlineCallFrameStart == InvalidVirtualRegister); 3474 3470 ASSERT(!callsiteBlockHead); 3475 3471 … … 3624 3620 3625 3621 InlineStackEntry inlineStackEntry( 3626 this, m_codeBlock, m_profiledBlock, 0, 0, VirtualRegister(), VirtualRegister(),3622 this, m_codeBlock, m_profiledBlock, 0, 0, InvalidVirtualRegister, InvalidVirtualRegister, 3627 3623 m_codeBlock->numParameters(), CodeForCall); 3628 3624 -
trunk/Source/JavaScriptCore/dfg/DFGCFGSimplificationPhase.cpp
r156474 r156482 312 312 } 313 313 314 void keepOperandAlive(BasicBlock* block, BasicBlock* jettisonedBlock, CodeOrigin codeOrigin, VirtualRegisteroperand)314 void keepOperandAlive(BasicBlock* block, BasicBlock* jettisonedBlock, CodeOrigin codeOrigin, int operand) 315 315 { 316 316 Node* livenessNode = jettisonedBlock->variablesAtHead.operand(operand); … … 327 327 { 328 328 for (size_t i = 0; i < jettisonedBlock->variablesAtHead.numberOfArguments(); ++i) 329 keepOperandAlive(block, jettisonedBlock, boundaryCodeOrigin, virtualRegisterForArgument(i));329 keepOperandAlive(block, jettisonedBlock, boundaryCodeOrigin, argumentToOperand(i)); 330 330 for (size_t i = 0; i < jettisonedBlock->variablesAtHead.numberOfLocals(); ++i) 331 keepOperandAlive(block, jettisonedBlock, boundaryCodeOrigin, virtualRegisterForLocal(i));331 keepOperandAlive(block, jettisonedBlock, boundaryCodeOrigin, localToOperand(i)); 332 332 333 333 fixJettisonedPredecessors(block, jettisonedBlock); … … 381 381 382 382 for (size_t i = 0; i < jettisonedBlock->variablesAtHead.numberOfArguments(); ++i) 383 keepOperandAlive(firstBlock, jettisonedBlock, boundaryCodeOrigin, virtualRegisterForArgument(i));383 keepOperandAlive(firstBlock, jettisonedBlock, boundaryCodeOrigin, argumentToOperand(i)); 384 384 for (size_t i = 0; i < jettisonedBlock->variablesAtHead.numberOfLocals(); ++i) 385 keepOperandAlive(firstBlock, jettisonedBlock, boundaryCodeOrigin, virtualRegisterForLocal(i));385 keepOperandAlive(firstBlock, jettisonedBlock, boundaryCodeOrigin, localToOperand(i)); 386 386 } 387 387 -
trunk/Source/JavaScriptCore/dfg/DFGCPSRethreadingPhase.cpp
r156474 r156482 218 218 { 219 219 VariableAccessData* variable = node->variableAccessData(); 220 if ( variable->local().isArgument())221 canonicalizeGetLocalFor<ArgumentOperand>(node, variable, variable->local().toArgument());220 if (operandIsArgument(variable->local())) 221 canonicalizeGetLocalFor<ArgumentOperand>(node, variable, operandToArgument(variable->local())); 222 222 else 223 canonicalizeGetLocalFor<LocalOperand>(node, variable, variable->local().toLocal());223 canonicalizeGetLocalFor<LocalOperand>(node, variable, operandToLocal(variable->local())); 224 224 } 225 225 … … 286 286 { 287 287 VariableAccessData* variable = node->variableAccessData(); 288 if ( variable->local().isArgument())289 canonicalizeFlushOrPhantomLocalFor<nodeType, ArgumentOperand>(node, variable, variable->local().toArgument());288 if (operandIsArgument(variable->local())) 289 canonicalizeFlushOrPhantomLocalFor<nodeType, ArgumentOperand>(node, variable, operandToArgument(variable->local())); 290 290 else 291 canonicalizeFlushOrPhantomLocalFor<nodeType, LocalOperand>(node, variable, variable->local().toLocal());291 canonicalizeFlushOrPhantomLocalFor<nodeType, LocalOperand>(node, variable, operandToLocal(variable->local())); 292 292 } 293 293 294 294 void canonicalizeSetArgument(Node* node) 295 295 { 296 VirtualRegisterlocal = node->local();297 ASSERT( local.isArgument());298 int argument = local.toArgument();296 int local = node->local(); 297 ASSERT(operandIsArgument(local)); 298 int argument = operandToArgument(local); 299 299 m_block->variablesAtHead.setArgumentFirstTime(argument, node); 300 300 m_block->variablesAtTail.setArgumentFirstTime(argument, node); -
trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp
r156474 r156482 191 191 192 192 case op_call_varargs: 193 if (codeBlock->usesArguments() && pc[4].u.operand == codeBlock->argumentsRegister() .offset())193 if (codeBlock->usesArguments() && pc[4].u.operand == codeBlock->argumentsRegister()) 194 194 return CanInline; 195 195 return CannotCompile; -
trunk/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp
r156474 r156482 386 386 return changed; 387 387 } 388 388 389 #if !ASSERT_DISABLED 390 bool isCapturedAtOrAfter(BasicBlock* block, unsigned indexInBlock, int operand) 391 { 392 for (; indexInBlock < block->size(); ++indexInBlock) { 393 Node* node = block->at(indexInBlock); 394 if (!node->hasLocal(m_graph)) 395 continue; 396 if (node->local() != operand) 397 continue; 398 if (node->variableAccessData()->isCaptured()) 399 return true; 400 } 401 return false; 402 } 403 #endif // !ASSERT_DISABLED 404 389 405 void addStructureTransitionCheck(CodeOrigin codeOrigin, unsigned indexInBlock, JSCell* cell) 390 406 { -
trunk/Source/JavaScriptCore/dfg/DFGFlushLivenessAnalysisPhase.cpp
r156474 r156482 168 168 } 169 169 170 void setForNode(Node* node, VirtualRegisteroperand, FlushFormat nodeFormat, FlushFormat newFormat)170 void setForNode(Node* node, int operand, FlushFormat nodeFormat, FlushFormat newFormat) 171 171 { 172 172 FlushFormat& currentFormat = m_live.operand(operand); -
trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp
r156474 r156482 235 235 if (node->hasVariableAccessData(*this)) { 236 236 VariableAccessData* variableAccessData = node->variableAccessData(); 237 VirtualRegister operand = variableAccessData->local();238 if (operand .isArgument())239 out.print(comma, "arg", operand .toArgument(), "(", VariableAccessDataDump(*this, variableAccessData), ")");237 int operand = variableAccessData->operand(); 238 if (operandIsArgument(operand)) 239 out.print(comma, "arg", operandToArgument(operand), "(", VariableAccessDataDump(*this, variableAccessData), ")"); 240 240 else 241 out.print(comma, "loc", operand .toLocal(), "(", VariableAccessDataDump(*this, variableAccessData), ")");241 out.print(comma, "loc", operandToLocal(operand), "(", VariableAccessDataDump(*this, variableAccessData), ")"); 242 242 } 243 243 if (node->hasUnlinkedLocal()) { 244 VirtualRegisteroperand = node->unlinkedLocal();245 if (operand .isArgument())246 out.print(comma, "arg", operand .toArgument());244 int operand = node->unlinkedLocal(); 245 if (operandIsArgument(operand)) 246 out.print(comma, "arg", operandToArgument(operand)); 247 247 else 248 out.print(comma, "loc", operand .toLocal());248 out.print(comma, "loc", operandToLocal(operand)); 249 249 } 250 250 if (node->hasConstantBuffer()) { -
trunk/Source/JavaScriptCore/dfg/DFGGraph.h
r156474 r156482 430 430 } 431 431 432 VirtualRegisterargumentsRegisterFor(const CodeOrigin& codeOrigin)432 int argumentsRegisterFor(const CodeOrigin& codeOrigin) 433 433 { 434 434 if (!codeOrigin.inlineCallFrame) 435 435 return m_codeBlock->argumentsRegister(); 436 436 437 return VirtualRegister(baselineCodeBlockForInlineCallFrame(438 codeOrigin.inlineCallFrame)->argumentsRegister() .offset()+439 codeOrigin.inlineCallFrame->stackOffset );440 } 441 442 VirtualRegisteruncheckedArgumentsRegisterFor(const CodeOrigin& codeOrigin)437 return baselineCodeBlockForInlineCallFrame( 438 codeOrigin.inlineCallFrame)->argumentsRegister() + 439 codeOrigin.inlineCallFrame->stackOffset; 440 } 441 442 int uncheckedArgumentsRegisterFor(const CodeOrigin& codeOrigin) 443 443 { 444 444 if (!codeOrigin.inlineCallFrame) … … 448 448 codeOrigin.inlineCallFrame); 449 449 if (!codeBlock->usesArguments()) 450 return VirtualRegister();451 452 return VirtualRegister(codeBlock->argumentsRegister().offset() +453 codeOrigin.inlineCallFrame->stackOffset );454 } 455 456 VirtualRegisteruncheckedActivationRegisterFor(const CodeOrigin&)450 return InvalidVirtualRegister; 451 452 return codeBlock->argumentsRegister() + 453 codeOrigin.inlineCallFrame->stackOffset; 454 } 455 456 int uncheckedActivationRegisterFor(const CodeOrigin&) 457 457 { 458 458 // This will ignore CodeOrigin because we don't inline code that uses activations. … … 473 473 474 474 if (node->op() == GetArgument) 475 return profiledBlock->valueProfileForArgument( node->local().toArgument());475 return profiledBlock->valueProfileForArgument(operandToArgument(node->local())); 476 476 477 477 if (node->hasLocal(*this)) { 478 478 if (m_form == SSA) 479 479 return 0; 480 if (! node->local().isArgument())480 if (!operandIsArgument(node->local())) 481 481 return 0; 482 int argument = node->local().toArgument();482 int argument = operandToArgument(node->local()); 483 483 if (node->variableAccessData() != m_arguments[argument]->variableAccessData()) 484 484 return 0; -
trunk/Source/JavaScriptCore/dfg/DFGJITCode.cpp
r156474 r156482 82 82 83 83 if (operandIsArgument(operand) 84 && ! VirtualRegister(operand).toArgument()84 && !operandToArgument(operand) 85 85 && codeBlock->codeType() == FunctionCode 86 86 && codeBlock->specializationKind() == CodeForConstruct) { -
trunk/Source/JavaScriptCore/dfg/DFGNode.h
r156474 r156482 165 165 , codeOriginForExitTarget(codeOrigin) 166 166 , children(children) 167 , m_virtualRegister( VirtualRegister())167 , m_virtualRegister(InvalidVirtualRegister) 168 168 , m_refCount(1) 169 169 , m_prediction(SpecNone) … … 178 178 , codeOriginForExitTarget(codeOrigin) 179 179 , children(AdjacencyList::Fixed, child1, child2, child3) 180 , m_virtualRegister( VirtualRegister())180 , m_virtualRegister(InvalidVirtualRegister) 181 181 , m_refCount(1) 182 182 , m_prediction(SpecNone) … … 192 192 , codeOriginForExitTarget(codeOrigin) 193 193 , children(AdjacencyList::Fixed, child1, child2, child3) 194 , m_virtualRegister( VirtualRegister())194 , m_virtualRegister(InvalidVirtualRegister) 195 195 , m_refCount(1) 196 196 , m_prediction(SpecNone) … … 207 207 , codeOriginForExitTarget(codeOrigin) 208 208 , children(AdjacencyList::Fixed, child1, child2, child3) 209 , m_virtualRegister( VirtualRegister())209 , m_virtualRegister(InvalidVirtualRegister) 210 210 , m_refCount(1) 211 211 , m_prediction(SpecNone) … … 223 223 , codeOriginForExitTarget(codeOrigin) 224 224 , children(AdjacencyList::Variable, firstChild, numChildren) 225 , m_virtualRegister( VirtualRegister())225 , m_virtualRegister(InvalidVirtualRegister) 226 226 , m_refCount(1) 227 227 , m_prediction(SpecNone) … … 391 391 m_op = GetLocalUnlinked; 392 392 m_flags &= ~(NodeMustGenerate | NodeMightClobber | NodeClobbersWorld); 393 m_opInfo = local .offset();393 m_opInfo = local; 394 394 children.reset(); 395 395 } … … 1058 1058 bool hasVirtualRegister() 1059 1059 { 1060 return m_virtualRegister .isValid();1060 return m_virtualRegister != InvalidVirtualRegister; 1061 1061 } 1062 1062 … … 1064 1064 { 1065 1065 ASSERT(hasResult()); 1066 ASSERT(m_virtualRegister .isValid());1066 ASSERT(m_virtualRegister != InvalidVirtualRegister); 1067 1067 return m_virtualRegister; 1068 1068 } … … 1071 1071 { 1072 1072 ASSERT(hasResult()); 1073 ASSERT( !m_virtualRegister.isValid());1073 ASSERT(m_virtualRegister == InvalidVirtualRegister); 1074 1074 m_virtualRegister = virtualRegister; 1075 1075 } -
trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp
r156474 r156482 139 139 140 140 for (size_t local = 0; local < entry->m_expectedValues.numberOfLocals(); ++local) { 141 int localOffset = virtualRegisterForLocal(local).offset();142 141 if (entry->m_localsForcedDouble.get(local)) { 143 if (!exec->registers()[local Offset].jsValue().isNumber()) {142 if (!exec->registers()[localToOperand(local)].jsValue().isNumber()) { 144 143 if (Options::verboseOSR()) { 145 144 dataLog( 146 " OSR failed because variable ", local Offset, " is ",147 exec->registers()[local Offset].jsValue(), ", expected number.\n");145 " OSR failed because variable ", localToOperand(local), " is ", 146 exec->registers()[localToOperand(local)].jsValue(), ", expected number.\n"); 148 147 } 149 148 return 0; … … 152 151 } 153 152 if (entry->m_localsForcedMachineInt.get(local)) { 154 if (!exec->registers()[local Offset].jsValue().isMachineInt()) {153 if (!exec->registers()[localToOperand(local)].jsValue().isMachineInt()) { 155 154 if (Options::verboseOSR()) { 156 155 dataLog( 157 " OSR failed because variable ", local Offset, " is ",158 exec->registers()[local Offset].jsValue(), ", expected ",156 " OSR failed because variable ", localToOperand(local), " is ", 157 exec->registers()[localToOperand(local)].jsValue(), ", expected ", 159 158 "machine int.\n"); 160 159 } … … 163 162 continue; 164 163 } 165 if (!entry->m_expectedValues.local(local).validate(exec->registers()[local Offset].jsValue())) {164 if (!entry->m_expectedValues.local(local).validate(exec->registers()[localToOperand(local)].jsValue())) { 166 165 if (Options::verboseOSR()) { 167 166 dataLog( 168 " OSR failed because variable ", local Offset, " is ",169 exec->registers()[local Offset].jsValue(), ", expected ",167 " OSR failed because variable ", localToOperand(local), " is ", 168 exec->registers()[localToOperand(local)].jsValue(), ", expected ", 170 169 entry->m_expectedValues.local(local), ".\n"); 171 170 } … … 181 180 // would have otherwise just kept running albeit less quickly. 182 181 183 if (!vm->interpreter->stack().grow(&exec->registers()[ virtualRegisterForLocal(codeBlock->m_numCalleeRegisters).offset()])) {182 if (!vm->interpreter->stack().grow(&exec->registers()[localToOperand(codeBlock->m_numCalleeRegisters)])) { 184 183 if (Options::verboseOSR()) 185 184 dataLogF(" OSR failed because stack growth failed.\n"); … … 193 192 for (size_t local = 0; local < entry->m_expectedValues.numberOfLocals(); ++local) { 194 193 if (entry->m_localsForcedDouble.get(local)) 195 *bitwise_cast<double*>(exec->registers() + virtualRegisterForLocal(local).offset()) = exec->registers()[virtualRegisterForLocal(local).offset()].jsValue().asNumber();194 *bitwise_cast<double*>(exec->registers() + localToOperand(local)) = exec->registers()[localToOperand(local)].jsValue().asNumber(); 196 195 if (entry->m_localsForcedMachineInt.get(local)) 197 *bitwise_cast<int64_t*>(exec->registers() + virtualRegisterForLocal(local).offset()) = exec->registers()[virtualRegisterForLocal(local).offset()].jsValue().asMachineInt() << JSValue::int52ShiftAmount;196 *bitwise_cast<int64_t*>(exec->registers() + localToOperand(local)) = exec->registers()[localToOperand(local)].jsValue().asMachineInt() << JSValue::int52ShiftAmount; 198 197 } 199 198 -
trunk/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp
r156474 r156482 102 102 Node* node = newRoot->appendNode( 103 103 m_graph, variable->prediction(), ExtractOSREntryLocal, codeOrigin, 104 OpInfo(variable->local() .offset()));104 OpInfo(variable->local())); 105 105 newRoot->appendNode( 106 106 m_graph, SpecNone, SetLocal, codeOrigin, OpInfo(variable), Edge(node)); -
trunk/Source/JavaScriptCore/dfg/DFGOSRExit.h
r156474 r156482 107 107 108 108 unsigned m_streamIndex; 109 VirtualRegisterm_lastSetOperand;109 int m_lastSetOperand; 110 110 111 111 RefPtr<ValueRecoveryOverride> m_valueRecoveryOverride; -
trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler32_64.cpp
r156474 r156482 202 202 case BooleanDisplacedInJSStack: { 203 203 numberOfDisplacedVirtualRegisters++; 204 ASSERT( recovery.virtualRegister().isLocal());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 int local = recovery.virtualRegister().toLocal();213 int local = operandToLocal(recovery.virtualRegister()); 214 214 if (local < (int)operands.numberOfLocals()) { 215 215 switch (operands.local(local).technique()) { … … 536 536 537 537 if (numberOfPoisonedVirtualRegisters) { 538 for (int localIndex = 0; localIndex < (int)operands.numberOfLocals(); ++localIndex) {539 if (!poisonedVirtualRegisters[ localIndex])538 for (int virtualRegister = 0; virtualRegister < (int)operands.numberOfLocals(); ++virtualRegister) { 539 if (!poisonedVirtualRegisters[virtualRegister]) 540 540 continue; 541 541 542 VirtualRegister virtualRegister = virtualRegisterForLocal(localIndex); 543 544 const ValueRecovery& recovery = operands.local(localIndex); 542 const ValueRecovery& recovery = operands.local(virtualRegister); 545 543 switch (recovery.technique()) { 546 544 case InGPR: 547 545 case UnboxedInt32InGPR: 548 546 case UnboxedBooleanInGPR: { 549 m_jit.load32(reinterpret_cast<char*>(scratchDataBuffer + poisonIndex( localIndex)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload), GPRInfo::regT0);550 m_jit.store32(GPRInfo::regT0, AssemblyHelpers::payloadFor( virtualRegister));547 m_jit.load32(reinterpret_cast<char*>(scratchDataBuffer + poisonIndex(virtualRegister)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload), GPRInfo::regT0); 548 m_jit.store32(GPRInfo::regT0, AssemblyHelpers::payloadFor((VirtualRegister)localToOperand(virtualRegister))); 551 549 uint32_t tag = JSValue::EmptyValueTag; 552 550 if (recovery.technique() == InGPR) … … 556 554 else 557 555 tag = JSValue::BooleanTag; 558 m_jit.store32(AssemblyHelpers::TrustedImm32(tag), AssemblyHelpers::tagFor( virtualRegister));556 m_jit.store32(AssemblyHelpers::TrustedImm32(tag), AssemblyHelpers::tagFor((VirtualRegister)localToOperand(virtualRegister))); 559 557 break; 560 558 } … … 563 561 case InPair: 564 562 case UInt32InGPR: 565 m_jit.load32(reinterpret_cast<char*>(scratchDataBuffer + poisonIndex( localIndex)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload), GPRInfo::regT0);566 m_jit.load32(reinterpret_cast<char*>(scratchDataBuffer + poisonIndex( localIndex)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag), GPRInfo::regT1);567 m_jit.store32(GPRInfo::regT0, AssemblyHelpers::payloadFor( virtualRegister));568 m_jit.store32(GPRInfo::regT1, AssemblyHelpers::tagFor( virtualRegister));563 m_jit.load32(reinterpret_cast<char*>(scratchDataBuffer + poisonIndex(virtualRegister)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload), GPRInfo::regT0); 564 m_jit.load32(reinterpret_cast<char*>(scratchDataBuffer + poisonIndex(virtualRegister)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag), GPRInfo::regT1); 565 m_jit.store32(GPRInfo::regT0, AssemblyHelpers::payloadFor((VirtualRegister)localToOperand(virtualRegister))); 566 m_jit.store32(GPRInfo::regT1, AssemblyHelpers::tagFor((VirtualRegister)localToOperand(virtualRegister))); 569 567 break; 570 568 … … 709 707 // 15) Load the result of the last bytecode operation into regT0. 710 708 711 if (exit.m_lastSetOperand .isValid()) {712 m_jit.load32(AssemblyHelpers::payloadFor( exit.m_lastSetOperand), GPRInfo::cachedResultRegister);713 m_jit.load32(AssemblyHelpers::tagFor( exit.m_lastSetOperand), GPRInfo::cachedResultRegister2);709 if (exit.m_lastSetOperand != std::numeric_limits<int>::max()) { 710 m_jit.load32(AssemblyHelpers::payloadFor((VirtualRegister)exit.m_lastSetOperand), GPRInfo::cachedResultRegister); 711 m_jit.load32(AssemblyHelpers::tagFor((VirtualRegister)exit.m_lastSetOperand), GPRInfo::cachedResultRegister2); 714 712 } 715 713 -
trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler64.cpp
r156474 r156482 32 32 #include "DFGOSRExitCompilerCommon.h" 33 33 #include "Operations.h" 34 #include "VirtualRegister.h"35 36 34 #include <wtf/DataLog.h> 37 35 … … 397 395 if (!m_jit.baselineCodeBlockFor(inlineCallFrame)->usesArguments()) 398 396 continue; 399 VirtualRegisterargumentsRegister = m_jit.argumentsRegisterFor(inlineCallFrame);397 int argumentsRegister = m_jit.argumentsRegisterFor(inlineCallFrame); 400 398 if (didCreateArgumentsObject.add(inlineCallFrame).isNewEntry) { 401 399 // We know this call frame optimized out an arguments object that … … 425 423 // 10) Load the result of the last bytecode operation into regT0. 426 424 427 if (exit.m_lastSetOperand .isValid())425 if (exit.m_lastSetOperand != std::numeric_limits<int>::max()) 428 426 m_jit.load64(AssemblyHelpers::addressFor(exit.m_lastSetOperand), GPRInfo::cachedResultRegister); 429 427 -
trunk/Source/JavaScriptCore/dfg/DFGRegisterBank.h
r156474 r156482 86 86 RegID tryAllocate() 87 87 { 88 VirtualRegister ignored = VirtualRegister();88 VirtualRegister ignored; 89 89 90 90 for (uint32_t i = 0; i < NUM_REGS; ++i) { 91 if (!m_data[i].lockCount && !m_data[i].name.isValid())91 if (!m_data[i].lockCount && m_data[i].name == InvalidVirtualRegister) 92 92 return allocateInternal(i, ignored); 93 93 } … … 148 148 ++m_data[index].lockCount; 149 149 VirtualRegister name = nameAtIndex(index); 150 if (name .isValid())150 if (name != InvalidVirtualRegister) 151 151 releaseAtIndex(index); 152 152 … … 166 166 ASSERT(m_data[index].lockCount); 167 167 // 'index' should not currently be named, the new name must be valid. 168 ASSERT( !m_data[index].name.isValid());169 ASSERT(name .isValid());168 ASSERT(m_data[index].name == InvalidVirtualRegister); 169 ASSERT(name != InvalidVirtualRegister); 170 170 // 'index' should not currently have a spillOrder. 171 171 ASSERT(m_data[index].spillOrder == SpillHintInvalid); … … 202 202 203 203 // Get the name (VirtualRegister) associated with the 204 // given register (or default VirtualRegister()for none).204 // given register (or InvalidVirtualRegister for none). 205 205 VirtualRegister name(RegID reg) const 206 206 { … … 210 210 bool isInUse(RegID reg) const 211 211 { 212 return isLocked(reg) || name(reg) .isValid();212 return isLocked(reg) || name(reg) != InvalidVirtualRegister; 213 213 } 214 214 … … 218 218 // For each register, print the VirtualRegister 'name'. 219 219 for (uint32_t i =0; i < NUM_REGS; ++i) { 220 if (m_data[i].name .isValid())221 dataLogF("[%02d]", m_data[i].name .offset());220 if (m_data[i].name != InvalidVirtualRegister) 221 dataLogF("[%02d]", m_data[i].name); 222 222 else 223 223 dataLogF("[--]"); … … 313 313 ASSERT(index < NUM_REGS); 314 314 // 'index' should currently be named. 315 ASSERT(m_data[index].name .isValid());315 ASSERT(m_data[index].name != InvalidVirtualRegister); 316 316 // 'index' should currently have a valid spill order. 317 317 ASSERT(m_data[index].spillOrder != SpillHintInvalid); 318 318 319 m_data[index].name = VirtualRegister();319 m_data[index].name = InvalidVirtualRegister; 320 320 m_data[index].spillOrder = SpillHintInvalid; 321 321 } … … 328 328 329 329 // Return the VirtualRegister of the named value currently stored in 330 // the register being returned - or default VirtualRegister()if none.330 // the register being returned - or InvalidVirtualRegister if none. 331 331 spillMe = m_data[i].name; 332 332 … … 346 346 struct MapEntry { 347 347 MapEntry() 348 : name( VirtualRegister())348 : name(InvalidVirtualRegister) 349 349 , spillOrder(SpillHintInvalid) 350 350 , lockCount(0) -
trunk/Source/JavaScriptCore/dfg/DFGScoreBoard.h
r156474 r156482 90 90 ASSERT(!m_used[index]); 91 91 m_highWatermark = std::max(m_highWatermark, static_cast<unsigned>(index) + 1); 92 return virtualRegisterForLocal(index);92 return (VirtualRegister)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 virtualRegisterForLocal(next);99 return (VirtualRegister)localToOperand(next); 100 100 } 101 101 … … 108 108 109 109 // Find the virtual register number for this child, increment its use count. 110 uint32_t index = child->virtualRegister().toLocal();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
r156474 r156482 49 49 , m_arguments(jit.codeBlock()->numParameters()) 50 50 , m_variables(jit.graph().m_localVars) 51 , m_lastSetOperand( VirtualRegister())51 , m_lastSetOperand(std::numeric_limits<int>::max()) 52 52 , m_state(m_jit.graph()) 53 53 , m_interpreter(m_jit.graph(), m_state) … … 1184 1184 for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) { 1185 1185 VirtualRegister virtualRegister = iter.name(); 1186 if ( !virtualRegister.isValid())1186 if (virtualRegister == InvalidVirtualRegister) 1187 1187 continue; 1188 1188 … … 1210 1210 for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) { 1211 1211 VirtualRegister virtualRegister = iter.name(); 1212 if ( !virtualRegister.isValid())1212 if (virtualRegister == InvalidVirtualRegister) 1213 1213 continue; 1214 1214 … … 1539 1539 noticeOSRBirth(child->child1().node()); 1540 1540 1541 m_stream->appendAndLog(VariableEvent::movHint(MinifiedID(child), node->local() .offset()));1541 m_stream->appendAndLog(VariableEvent::movHint(MinifiedID(child), node->local())); 1542 1542 } 1543 1543 … … 1557 1557 for (int i = 0; i < argumentCountIncludingThis; ++i) { 1558 1558 ValueRecovery recovery; 1559 if (codeBlock->isCaptured( virtualRegisterForArgument(i)))1559 if (codeBlock->isCaptured(argumentToOperand(i))) 1560 1560 recovery = ValueRecovery::alreadyInJSStack(); 1561 1561 else { … … 1640 1640 ValueSource valueSource = ValueSource(ValueInJSStack); 1641 1641 m_arguments[i] = valueSource; 1642 m_stream->appendAndLog(VariableEvent::setLocal( virtualRegisterForArgument(i), valueSource.dataFormat()));1642 m_stream->appendAndLog(VariableEvent::setLocal(argumentToOperand(i), valueSource.dataFormat())); 1643 1643 } 1644 1644 … … 1660 1660 m_variables[i] = valueSource; 1661 1661 // FIXME: Don't emit SetLocal(Dead). https://bugs.webkit.org/show_bug.cgi?id=108019 1662 m_stream->appendAndLog(VariableEvent::setLocal( virtualRegisterForLocal(i), valueSource.dataFormat()));1663 } 1664 1665 m_lastSetOperand = VirtualRegister();1662 m_stream->appendAndLog(VariableEvent::setLocal(localToOperand(i), valueSource.dataFormat())); 1663 } 1664 1665 m_lastSetOperand = std::numeric_limits<int>::max(); 1666 1666 m_codeOriginForExitTarget = CodeOrigin(); 1667 1667 m_codeOriginForExitProfile = CodeOrigin(); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r156474 r156482 42 42 #include "MarkedAllocator.h" 43 43 #include "ValueRecovery.h" 44 #include "VirtualRegister.h"45 44 46 45 namespace JSC { namespace DFG { … … 186 185 VirtualRegister spillMe; 187 186 GPRReg gpr = m_gprs.allocate(spillMe); 188 if (spillMe .isValid()) {187 if (spillMe != InvalidVirtualRegister) { 189 188 #if USE(JSVALUE32_64) 190 189 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe); … … 203 202 #endif 204 203 VirtualRegister spillMe = m_gprs.allocateSpecific(specific); 205 if (spillMe .isValid()) {204 if (spillMe != InvalidVirtualRegister) { 206 205 #if USE(JSVALUE32_64) 207 206 GenerationInfo& info = generationInfoFromVirtualRegister(spillMe); … … 225 224 VirtualRegister spillMe; 226 225 FPRReg fpr = m_fprs.allocate(spillMe); 227 if (spillMe .isValid())226 if (spillMe != InvalidVirtualRegister) 228 227 spill(spillMe); 229 228 return fpr; … … 362 361 for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) { 363 362 GPRReg gpr = iter.regID(); 364 if (iter.name() .isValid()&& gpr != exclude && gpr != exclude2) {363 if (iter.name() != InvalidVirtualRegister && gpr != exclude && gpr != exclude2) { 365 364 SilentRegisterSavePlan plan = silentSavePlanForGPR(iter.name(), gpr); 366 365 if (doSpill) … … 370 369 } 371 370 for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) { 372 if (iter.name() .isValid()&& iter.regID() != fprExclude) {371 if (iter.name() != InvalidVirtualRegister && iter.regID() != fprExclude) { 373 372 SilentRegisterSavePlan plan = silentSavePlanForFPR(iter.name(), iter.regID()); 374 373 if (doSpill) … … 603 602 { 604 603 for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) { 605 if (iter.name() .isValid()) {604 if (iter.name() != InvalidVirtualRegister) { 606 605 spill(iter.name()); 607 606 iter.release(); … … 609 608 } 610 609 for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) { 611 if (iter.name() .isValid()) {610 if (iter.name() != InvalidVirtualRegister) { 612 611 spill(iter.name()); 613 612 iter.release(); … … 622 621 { 623 622 for (gpr_iterator iter = m_gprs.begin(); iter != m_gprs.end(); ++iter) { 624 if (iter.name() .isValid())623 if (iter.name() != InvalidVirtualRegister) 625 624 return false; 626 625 } 627 626 for (fpr_iterator iter = m_fprs.begin(); iter != m_fprs.end(); ++iter) { 628 if (iter.name() .isValid())627 if (iter.name() != InvalidVirtualRegister) 629 628 return false; 630 629 } … … 761 760 MacroAssembler::Address argumentSlot(int argument) 762 761 { 763 return MacroAssembler::Address(GPRInfo::callFrameRegister, (-m_jit.codeBlock()->m_numCalleeRegisters + virtualRegisterForArgument(argument).offset()) * static_cast<int>(sizeof(Register)));762 return MacroAssembler::Address(GPRInfo::callFrameRegister, (-m_jit.codeBlock()->m_numCalleeRegisters + argumentToOperand(argument)) * static_cast<int>(sizeof(Register))); 764 763 } 765 764 … … 776 775 MacroAssembler::Address argumentTagSlot(int argument) 777 776 { 778 return MacroAssembler::Address(GPRInfo::callFrameRegister, (-m_jit.codeBlock()->m_numCalleeRegisters + virtualRegisterForArgument(argument).offset()) * static_cast<int>(sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));777 return MacroAssembler::Address(GPRInfo::callFrameRegister, (-m_jit.codeBlock()->m_numCalleeRegisters + argumentToOperand(argument)) * static_cast<int>(sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)); 779 778 } 780 779 781 780 MacroAssembler::Address argumentPayloadSlot(int argument) 782 781 { 783 return MacroAssembler::Address(GPRInfo::callFrameRegister, (-m_jit.codeBlock()->m_numCalleeRegisters + virtualRegisterForArgument(argument).offset()) * static_cast<int>(sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));782 return MacroAssembler::Address(GPRInfo::callFrameRegister, (-m_jit.codeBlock()->m_numCalleeRegisters + argumentToOperand(argument)) * static_cast<int>(sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)); 784 783 } 785 784 … … 2190 2189 // operand-indexed variables. 2191 2190 2192 ValueSource valueSourceForOperand( VirtualRegisteroperand)2191 ValueSource valueSourceForOperand(int operand) 2193 2192 { 2194 2193 return valueSourceReferenceForOperand(operand); 2195 2194 } 2196 2195 2197 void setNodeForOperand(Node* node, VirtualRegisteroperand)2196 void setNodeForOperand(Node* node, int operand) 2198 2197 { 2199 2198 valueSourceReferenceForOperand(operand) = ValueSource(MinifiedID(node)); … … 2204 2203 // twice and then perform operands on both references, since the one from 2205 2204 // the first call may no longer be valid. 2206 ValueSource& valueSourceReferenceForOperand( VirtualRegisteroperand)2207 { 2208 if (operand .isArgument()) {2209 int argument = operand .toArgument();2205 ValueSource& valueSourceReferenceForOperand(int operand) 2206 { 2207 if (operandIsArgument(operand)) { 2208 int argument = operandToArgument(operand); 2210 2209 return m_arguments[argument]; 2211 2210 } 2212 2211 2213 int local = operand .toLocal();2212 int local = operandToLocal(operand); 2214 2213 if ((unsigned)local >= m_variables.size()) 2215 2214 m_variables.resize(local + 1); … … 2218 2217 } 2219 2218 2220 void recordSetLocal( VirtualRegisteroperand, ValueSource valueSource)2219 void recordSetLocal(int operand, ValueSource valueSource) 2221 2220 { 2222 2221 valueSourceReferenceForOperand(operand) = valueSource; … … 2226 2225 GenerationInfo& generationInfoFromVirtualRegister(VirtualRegister virtualRegister) 2227 2226 { 2228 return m_generationInfo[ virtualRegister.toLocal()];2227 return m_generationInfo[operandToLocal(virtualRegister)]; 2229 2228 } 2230 2229 … … 2269 2268 Vector<ValueSource, 0> m_arguments; 2270 2269 Vector<ValueSource, 0> m_variables; 2271 VirtualRegisterm_lastSetOperand;2270 int m_lastSetOperand; 2272 2271 CodeOrigin m_codeOriginForExitTarget; 2273 2272 CodeOrigin m_codeOriginForExitProfile; … … 2288 2287 ValueRecovery computeValueRecoveryFor(int operand) 2289 2288 { 2290 return computeValueRecoveryFor(valueSourceForOperand( VirtualRegister(operand)));2289 return computeValueRecoveryFor(valueSourceForOperand(operand)); 2291 2290 } 2292 2291 }; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r156474 r156482 4781 4781 slowPathCall( 4782 4782 created, this, operationGetArgumentsLength, resultGPR, 4783 m_jit.argumentsRegisterFor(node->codeOrigin) .offset()));4783 m_jit.argumentsRegisterFor(node->codeOrigin))); 4784 4784 4785 4785 jsValueResult(resultGPR, node); … … 4920 4920 slowPathCall( 4921 4921 slowPath, this, operationGetInlinedArgumentByVal, resultGPR, 4922 m_jit.argumentsRegisterFor(node->codeOrigin) .offset(),4922 m_jit.argumentsRegisterFor(node->codeOrigin), 4923 4923 node->codeOrigin.inlineCallFrame, 4924 4924 indexGPR)); … … 4927 4927 slowPathCall( 4928 4928 slowPath, this, operationGetArgumentByVal, resultGPR, 4929 m_jit.argumentsRegisterFor(node->codeOrigin) .offset(),4929 m_jit.argumentsRegisterFor(node->codeOrigin), 4930 4930 indexGPR)); 4931 4931 } -
trunk/Source/JavaScriptCore/dfg/DFGValidate.cpp
r156474 r156482 79 79 BasicBlock* root = m_graph.block(0); 80 80 for (unsigned i = 0; i < root->variablesAtHead.numberOfLocals(); ++i) 81 V_EQUAL(( virtualRegisterForLocal(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. … … 318 318 319 319 for (size_t i = 0; i < block->variablesAtHead.numberOfArguments(); ++i) { 320 VALIDATE(( virtualRegisterForArgument(i), block), !block->variablesAtHead.argument(i) || block->variablesAtHead.argument(i)->hasVariableAccessData(m_graph));320 VALIDATE((static_cast<VirtualRegister>(argumentToOperand(i)), block), !block->variablesAtHead.argument(i) || block->variablesAtHead.argument(i)->hasVariableAccessData(m_graph)); 321 321 if (m_graph.m_form == ThreadedCPS) 322 VALIDATE(( virtualRegisterForArgument(i), block), !block->variablesAtTail.argument(i) || block->variablesAtTail.argument(i)->hasVariableAccessData(m_graph));322 VALIDATE((static_cast<VirtualRegister>(argumentToOperand(i)), block), !block->variablesAtTail.argument(i) || block->variablesAtTail.argument(i)->hasVariableAccessData(m_graph)); 323 323 324 324 getLocalPositions.argument(i) = notSet; … … 326 326 } 327 327 for (size_t i = 0; i < block->variablesAtHead.numberOfLocals(); ++i) { 328 VALIDATE(( virtualRegisterForLocal(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(( virtualRegisterForLocal(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; … … 390 390 for (size_t i = 0; i < block->variablesAtHead.numberOfArguments(); ++i) { 391 391 checkOperand( 392 block, getLocalPositions, setLocalPositions, virtualRegisterForArgument(i));392 block, getLocalPositions, setLocalPositions, argumentToOperand(i)); 393 393 } 394 394 for (size_t i = 0; i < block->variablesAtHead.numberOfLocals(); ++i) { 395 395 checkOperand( 396 block, getLocalPositions, setLocalPositions, virtualRegisterForLocal(i));396 block, getLocalPositions, setLocalPositions, localToOperand(i)); 397 397 } 398 398 } … … 401 401 void checkOperand( 402 402 BasicBlock* block, Operands<size_t>& getLocalPositions, 403 Operands<size_t>& setLocalPositions, VirtualRegisteroperand)403 Operands<size_t>& setLocalPositions, int operand) 404 404 { 405 405 if (getLocalPositions.operand(operand) == notSet) … … 433 433 { 434 434 if (!block) { 435 dataLog("r", local, " in null Block ");435 dataLog("r", static_cast<int>(local), " in null Block "); 436 436 return; 437 437 } 438 438 439 dataLog("r", local, " in Block ", *block);439 dataLog("r", static_cast<int>(local), " in Block ", *block); 440 440 } 441 441 … … 443 443 VirtualRegister local, BasicBlock* sourceBlock, BasicBlock* destinationBlock) 444 444 { 445 dataLog("r", local, " in Block ", *sourceBlock, " -> ", *destinationBlock);445 dataLog("r", static_cast<int>(local), " in Block ", *sourceBlock, " -> ", *destinationBlock); 446 446 } 447 447 … … 449 449 VirtualRegister local, BasicBlock* sourceBlock, Node* prevNode) 450 450 { 451 dataLog(prevNode, " for r", local, " in Block ", *sourceBlock);451 dataLog(prevNode, " for r", static_cast<int>(local), " in Block ", *sourceBlock); 452 452 } 453 453 -
trunk/Source/JavaScriptCore/dfg/DFGValueRecoveryOverride.h
r156474 r156482 40 40 ValueRecoveryOverride() { } 41 41 42 ValueRecoveryOverride( VirtualRegisteroperand, const ValueRecovery& recovery)42 ValueRecoveryOverride(int operand, const ValueRecovery& recovery) 43 43 : operand(operand) 44 44 , recovery(recovery) … … 46 46 } 47 47 48 VirtualRegisteroperand;48 int operand; 49 49 ValueRecovery recovery; 50 50 }; -
trunk/Source/JavaScriptCore/dfg/DFGVariableAccessData.h
r156474 r156482 81 81 return m_local; 82 82 } 83 83 84 int operand() 85 { 86 return static_cast<int>(local()); 87 } 88 84 89 bool mergeIsCaptured(bool isCaptured) 85 90 { … … 226 231 // We don't support this facility for arguments, yet. 227 232 // FIXME: make this work for arguments. 228 if ( local().isArgument())233 if (operandIsArgument(operand())) 229 234 return false; 230 235 … … 274 279 ASSERT(isRoot()); 275 280 276 if ( local().isArgument() || shouldNeverUnbox())281 if (operandIsArgument(local()) || shouldNeverUnbox()) 277 282 return DFG::mergeDoubleFormatState(m_doubleFormatState, NotUsingDoubleFormat); 278 283 … … 329 334 return FlushedInt32; 330 335 331 if (enableInt52() && ! m_local.isArgument() && isMachineIntSpeculation(prediction))336 if (enableInt52() && !operandIsArgument(m_local) && isMachineIntSpeculation(prediction)) 332 337 return FlushedInt52; 333 338 -
trunk/Source/JavaScriptCore/dfg/DFGVariableEvent.h
r156474 r156482 142 142 VariableEvent event; 143 143 event.m_id = id; 144 event.u.virtualReg = virtualRegister .offset();144 event.u.virtualReg = virtualRegister; 145 145 event.m_kind = kind; 146 146 event.m_dataFormat = format; … … 156 156 } 157 157 158 static VariableEvent setLocal( VirtualRegister virtualRegister, DataFormat format)159 { 160 VariableEvent event; 161 event.u.virtualReg = virtualRegister.offset();158 static VariableEvent setLocal(int operand, DataFormat format) 159 { 160 VariableEvent event; 161 event.u.virtualReg = operand; 162 162 event.m_kind = SetLocalEvent; 163 163 event.m_dataFormat = format; -
trunk/Source/JavaScriptCore/dfg/DFGVariableEventStream.cpp
r156474 r156482 116 116 unsigned numVariables; 117 117 if (codeOrigin.inlineCallFrame) 118 numVariables = baselineCodeBlockForInlineCallFrame(codeOrigin.inlineCallFrame)->m_numCalleeRegisters + VirtualRegister(codeOrigin.inlineCallFrame->stackOffset).toLocal();118 numVariables = baselineCodeBlockForInlineCallFrame(codeOrigin.inlineCallFrame)->m_numCalleeRegisters + operandToLocal(codeOrigin.inlineCallFrame->stackOffset); 119 119 else 120 120 numVariables = baselineCodeBlock->m_numCalleeRegisters; … … 284 284 for (InlineCallFrame* inlineCallFrame = codeOrigin.inlineCallFrame; inlineCallFrame; inlineCallFrame = inlineCallFrame->caller.inlineCallFrame) { 285 285 for (unsigned i = JSStack::CallFrameHeaderSize; i--;) 286 valueRecoveries.setLocal( VirtualRegister(inlineCallFrame->stackOffset).toLocal() - i - 1, ValueRecovery::alreadyInJSStack());286 valueRecoveries.setLocal(operandToLocal(inlineCallFrame->stackOffset) - i - 1, ValueRecovery::alreadyInJSStack()); 287 287 } 288 288 } -
trunk/Source/JavaScriptCore/dfg/DFGVirtualRegisterAllocationPhase.cpp
r156474 r156482 127 127 InlineCallFrame* inlineCallFrame = m_graph.m_inlineCallFrames->at(i); 128 128 CodeBlock* codeBlock = baselineCodeBlockForInlineCallFrame(inlineCallFrame); 129 unsigned requiredCalleeRegisters = VirtualRegister(inlineCallFrame->stackOffset).toLocal() + codeBlock->m_numCalleeRegisters;129 unsigned requiredCalleeRegisters = operandToLocal(inlineCallFrame->stackOffset) + codeBlock->m_numCalleeRegisters; 130 130 if (requiredCalleeRegisters > calleeRegisters) 131 131 calleeRegisters = requiredCalleeRegisters; -
trunk/Source/JavaScriptCore/ftl/FTLExitArgumentForOperand.h
r156474 r156482 39 39 public: 40 40 ExitArgumentForOperand() 41 : m_operand( VirtualRegister())41 : m_operand(InvalidVirtualRegister) 42 42 { 43 43 } 44 44 45 ExitArgumentForOperand(ExitArgument exitArgument, VirtualRegisteroperand)45 ExitArgumentForOperand(ExitArgument exitArgument, int operand) 46 46 : m_exitArgument(exitArgument) 47 47 , m_operand(operand) … … 52 52 53 53 const ExitArgument& exitArgument() const { return m_exitArgument; } 54 VirtualRegisteroperand() const { return m_operand; }54 int operand() const { return m_operand; } 55 55 56 56 void dump(PrintStream&) const; … … 58 58 private: 59 59 ExitArgument m_exitArgument; 60 VirtualRegisterm_operand;60 int m_operand; 61 61 }; 62 62 -
trunk/Source/JavaScriptCore/ftl/FTLLink.cpp
r156474 r156482 36 36 #include "JITStubs.h" 37 37 #include "LinkBuffer.h" 38 #include "VirtualRegister.h"39 38 #include <wtf/LLVMHeaders.h> 40 39 … … 77 76 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=56291 78 77 jit.addPtr( 79 CCallHelpers::TrustedImm32( virtualRegisterForLocal(codeBlock->m_numCalleeRegisters).offset() * sizeof(Register)),78 CCallHelpers::TrustedImm32(localToOperand(codeBlock->m_numCalleeRegisters) * sizeof(Register)), 80 79 GPRInfo::callFrameRegister, GPRInfo::regT1); 81 80 CCallHelpers::Jump stackCheck = jit.branchPtr( -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp
r156474 r156482 43 43 #include "OperandsInlines.h" 44 44 #include "Operations.h" 45 #include "VirtualRegister.h"46 47 45 #include <wtf/ProcessID.h> 48 46 … … 72 70 , m_out(state.context) 73 71 , m_valueSources(OperandsLike, state.graph.block(0)->variablesAtHead) 74 , m_lastSetOperand( VirtualRegister())72 , m_lastSetOperand(std::numeric_limits<int>::max()) 75 73 , m_exitThunkGenerator(state) 76 74 , m_state(state.graph) … … 527 525 { 528 526 VariableAccessData* variable = m_node->variableAccessData(); 529 VirtualRegister operand = variable->local();527 int operand = variable->operand(); 530 528 531 529 LValue jsValue = m_out.load64(addressFor(operand)); … … 557 555 EncodedJSValue* buffer = static_cast<EncodedJSValue*>( 558 556 m_ftlState.jitCode->ftlForOSREntry()->entryBuffer()->dataBuffer()); 559 setJSValue(m_out.load64(m_out.absolute(buffer + m_node->unlinkedLocal().toLocal())));557 setJSValue(m_out.load64(m_out.absolute(buffer + operandToLocal(m_node->unlinkedLocal())))); 560 558 } 561 559 … … 2006 2004 LValue calleeFrame = m_out.add( 2007 2005 m_callFrame, 2008 m_out.constIntPtr(sizeof(Register) * virtualRegisterForLocal(codeBlock()->m_numCalleeRegisters).offset()));2006 m_out.constIntPtr(sizeof(Register) * localToOperand(codeBlock()->m_numCalleeRegisters))); 2009 2007 2010 2008 m_out.store32( … … 2019 2017 m_out.store64( 2020 2018 lowJSValue(m_graph.varArgChild(m_node, 1 + i)), 2021 addressFor(calleeFrame, virtualRegisterForArgument(i + dummyThisArgument).offset()));2019 addressFor(calleeFrame, argumentToOperand(i + dummyThisArgument))); 2022 2020 } 2023 2021 … … 3354 3352 m_ftlState.jitCode->osrExit.append(OSRExit( 3355 3353 kind, lowValue.format(), m_graph.methodOfGettingAValueProfileFor(highValue), 3356 m_codeOriginForExitTarget, m_codeOriginForExitProfile, m_lastSetOperand .offset(),3354 m_codeOriginForExitTarget, m_codeOriginForExitProfile, m_lastSetOperand, 3357 3355 m_valueSources.numberOfArguments(), m_valueSources.numberOfLocals())); 3358 3356 m_ftlState.osrExit.append(OSRExitCompilationInfo()); … … 3629 3627 ASSERT(node->op() != ZombieHint); 3630 3628 3631 VirtualRegisteroperand = node->local();3629 int operand = node->local(); 3632 3630 3633 3631 m_lastSetOperand = operand; … … 3747 3745 return addressFor(m_callFrame, operand); 3748 3746 } 3749 TypedPointer addressFor(VirtualRegister operand)3750 {3751 return addressFor(m_callFrame, operand.offset());3752 }3753 3747 TypedPointer payloadFor(int operand) 3754 3748 { 3755 3749 return payloadFor(m_callFrame, operand); 3756 3750 } 3757 TypedPointer payloadFor(VirtualRegister operand)3758 {3759 return payloadFor(m_callFrame, operand.offset());3760 }3761 3751 TypedPointer tagFor(int operand) 3762 3752 { 3763 3753 return tagFor(m_callFrame, operand); 3764 }3765 TypedPointer tagFor(VirtualRegister operand)3766 {3767 return tagFor(m_callFrame, operand.offset());3768 3754 } 3769 3755 … … 3796 3782 3797 3783 Operands<ValueSource> m_valueSources; 3798 VirtualRegisterm_lastSetOperand;3784 int m_lastSetOperand; 3799 3785 ExitThunkGenerator m_exitThunkGenerator; 3800 3786 -
trunk/Source/JavaScriptCore/ftl/FTLOSREntry.cpp
r156474 r156482 66 66 for (int argument = values.numberOfArguments(); argument--;) { 67 67 RELEASE_ASSERT( 68 exec->r( virtualRegisterForArgument(argument).offset()).jsValue() == values.argument(argument));68 exec->r(argumentToOperand(argument)).jsValue() == values.argument(argument)); 69 69 } 70 70 … … 79 79 80 80 int stackFrameSize = entryCodeBlock->m_numCalleeRegisters; 81 if (!vm.interpreter->stack().grow(&exec->registers()[ virtualRegisterForLocal(stackFrameSize).offset()])) {81 if (!vm.interpreter->stack().grow(&exec->registers()[localToOperand(stackFrameSize)])) { 82 82 if (Options::verboseOSR()) 83 83 dataLog(" OSR failed bcause stack growth failed.\n"); -
trunk/Source/JavaScriptCore/ftl/FTLOSRExit.cpp
r156474 r156482 79 79 return; 80 80 81 VirtualRegisteroverriddenOperand = lastMovHint->local();81 int overriddenOperand = lastMovHint->local(); 82 82 m_lastSetOperand = overriddenOperand; 83 83 … … 85 85 // it something else? If it's an argument already, then replace that argument; 86 86 // otherwise add another argument. 87 if (m_values[overriddenOperand .offset()].isArgument()) {88 ExitArgument exitArgument = m_values[overriddenOperand .offset()].exitArgument();87 if (m_values[overriddenOperand].isArgument()) { 88 ExitArgument exitArgument = m_values[overriddenOperand].exitArgument(); 89 89 arguments[exitArgument.argument()] = value.value(); 90 m_values[overriddenOperand .offset()] = ExitValue::exitArgument(90 m_values[overriddenOperand] = ExitValue::exitArgument( 91 91 exitArgument.withFormat(value.format())); 92 92 return; … … 95 95 unsigned argument = arguments.size(); 96 96 arguments.append(value.value()); 97 m_values[m_lastSetOperand .offset()] = ExitValue::exitArgument(97 m_values[m_lastSetOperand] = ExitValue::exitArgument( 98 98 ExitArgument(value.format(), argument)); 99 99 } -
trunk/Source/JavaScriptCore/ftl/FTLOSRExit.h
r156474 r156482 41 41 #include "Operands.h" 42 42 #include "ValueProfile.h" 43 #include "VirtualRegister.h"44 43 45 44 namespace JSC { namespace FTL { … … 162 161 unsigned m_patchableCodeOffset; 163 162 164 VirtualRegisterm_lastSetOperand;163 int m_lastSetOperand; 165 164 166 165 Operands<ExitValue> m_values; -
trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
r156474 r156482 94 94 continue; 95 95 96 sortedArguments.append(ExitArgumentForOperand(value.exitArgument(), VirtualRegister(operand)));96 sortedArguments.append(ExitArgumentForOperand(value.exitArgument(), operand)); 97 97 } 98 98 std::sort(sortedArguments.begin(), sortedArguments.end(), lesserArgumentIndex); … … 159 159 jit.pop(GPRInfo::nonArgGPR0); // ignore the result. 160 160 161 if (exit.m_lastSetOperand .isValid()) {161 if (exit.m_lastSetOperand != std::numeric_limits<int>::max()) { 162 162 jit.load64( 163 163 AssemblyHelpers::addressFor(exit.m_lastSetOperand), GPRInfo::cachedResultRegister); -
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r156474 r156482 219 219 // Read a register from the codeframe (or constant from the CodeBlock). 220 220 Register& r(int); 221 // Read a register for a non-constant 221 // Read a register for a non-constant 222 222 Register& uncheckedR(int); 223 223 -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r156474 r156482 68 68 #include "StrongInlines.h" 69 69 #include "VMStackBounds.h" 70 #include "VirtualRegister.h"71 72 70 #include <limits.h> 73 71 #include <stdio.h> … … 321 319 JSValue v = it->jsValue(); 322 320 int registerNumber = it - callFrame->registers(); 323 String name = codeBlock->nameForRegister( VirtualRegister(registerNumber));321 String name = codeBlock->nameForRegister(registerNumber); 324 322 dataLogF("[r% 3d %14s] | %10p | %-16s 0x%lld \n", registerNumber, name.ascii().data(), it, toCString(v).data(), (long long)JSValue::encode(v)); 325 323 it++; … … 355 353 JSValue v = it->jsValue(); 356 354 int registerNumber = it - callFrame->registers(); 357 String name = codeBlock->nameForRegister( VirtualRegister(registerNumber));355 String name = codeBlock->nameForRegister(registerNumber); 358 356 dataLogF("[r% 3d %14s] | %10p | %-16s 0x%lld \n", registerNumber, name.ascii().data(), it, toCString(v).data(), (long long)JSValue::encode(v)); 359 357 --it; … … 411 409 RELEASE_ASSERT(!visitor->isInlinedFrame()); 412 410 #endif 413 activation = callFrame->uncheckedR(oldCodeBlock->activationRegister() .offset()).jsValue();411 activation = callFrame->uncheckedR(oldCodeBlock->activationRegister()).jsValue(); 414 412 if (activation) 415 413 jsCast<JSActivation*>(activation)->tearOff(*scope->vm()); … … 417 415 418 416 if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->usesArguments()) { 419 if (JSValue arguments = visitor->r(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister()) .offset()).jsValue()) {417 if (JSValue arguments = visitor->r(unmodifiedArgumentsRegister(oldCodeBlock->argumentsRegister())).jsValue()) { 420 418 if (activation) 421 419 jsCast<Arguments*>(arguments)->didTearOffActivation(callFrame, jsCast<JSActivation*>(activation)); … … 692 690 // Unwind the scope chain within the exception handler's call frame. 693 691 int targetScopeDepth = handler->scopeDepth; 694 if (codeBlock->needsActivation() && callFrame->uncheckedR(codeBlock->activationRegister() .offset()).jsValue())692 if (codeBlock->needsActivation() && callFrame->uncheckedR(codeBlock->activationRegister()).jsValue()) 695 693 ++targetScopeDepth; 696 694 -
trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h
r156474 r156482 157 157 static Address addressFor(VirtualRegister virtualRegister) 158 158 { 159 return Address(GPRInfo::callFrameRegister, virtualRegister .offset()* sizeof(Register));159 return Address(GPRInfo::callFrameRegister, virtualRegister * sizeof(Register)); 160 160 } 161 161 static Address addressFor(int operand) … … 166 166 static Address tagFor(VirtualRegister virtualRegister) 167 167 { 168 return Address(GPRInfo::callFrameRegister, virtualRegister .offset()* sizeof(Register) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));168 return Address(GPRInfo::callFrameRegister, virtualRegister * sizeof(Register) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)); 169 169 } 170 170 static Address tagFor(int operand) … … 175 175 static Address payloadFor(VirtualRegister virtualRegister) 176 176 { 177 return Address(GPRInfo::callFrameRegister, virtualRegister .offset()* sizeof(Register) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));177 return Address(GPRInfo::callFrameRegister, virtualRegister * sizeof(Register) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)); 178 178 } 179 179 static Address payloadFor(int operand) … … 381 381 } 382 382 383 VirtualRegisterargumentsRegisterFor(InlineCallFrame* inlineCallFrame)383 int argumentsRegisterFor(InlineCallFrame* inlineCallFrame) 384 384 { 385 385 if (!inlineCallFrame) 386 386 return codeBlock()->argumentsRegister(); 387 387 388 return VirtualRegister(baselineCodeBlockForInlineCallFrame(389 inlineCallFrame)->argumentsRegister() .offset() + inlineCallFrame->stackOffset);390 } 391 392 VirtualRegisterargumentsRegisterFor(const CodeOrigin& codeOrigin)388 return baselineCodeBlockForInlineCallFrame( 389 inlineCallFrame)->argumentsRegister() + inlineCallFrame->stackOffset; 390 } 391 392 int argumentsRegisterFor(const CodeOrigin& codeOrigin) 393 393 { 394 394 return argumentsRegisterFor(codeOrigin.inlineCallFrame); -
trunk/Source/JavaScriptCore/jit/JIT.h
r156474 r156482 584 584 585 585 void emitGetVirtualRegister(int src, RegisterID dst); 586 void emitGetVirtualRegister(VirtualRegister src, RegisterID dst);587 586 void emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2); 588 void emitGetVirtualRegisters(VirtualRegister src1, RegisterID dst1, VirtualRegister src2, RegisterID dst2);589 587 void emitPutVirtualRegister(int dst, RegisterID from = regT0); 590 void emitPutVirtualRegister(VirtualRegister dst, RegisterID from = regT0);591 588 void emitStoreCell(int dst, RegisterID payload, bool /* only used in JSValue32_64 */ = false) 592 589 { -
trunk/Source/JavaScriptCore/jit/JITCall.cpp
r156474 r156482 77 77 JumpList end; 78 78 bool canOptimize = m_codeBlock->usesArguments() 79 && arguments == m_codeBlock->argumentsRegister() .offset()79 && arguments == m_codeBlock->argumentsRegister() 80 80 && !m_codeBlock->symbolTable()->slowArguments(); 81 81 -
trunk/Source/JavaScriptCore/jit/JITInlines.h
r156474 r156482 759 759 } 760 760 761 if (src == m_lastResultBytecodeRegister && operandIsLocal(src) && m_codeBlock->isTemporaryRegisterIndex(VirtualRegister(src).toLocal()) && !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) … … 769 769 load64(Address(callFrameRegister, src * sizeof(Register)), dst); 770 770 killLastResultRegister(); 771 }772 773 ALWAYS_INLINE void JIT::emitGetVirtualRegister(VirtualRegister src, RegisterID dst)774 {775 emitGetVirtualRegister(src.offset(), dst);776 771 } 777 772 … … 787 782 } 788 783 789 ALWAYS_INLINE void JIT::emitGetVirtualRegisters(VirtualRegister src1, RegisterID dst1, VirtualRegister src2, RegisterID dst2)790 {791 emitGetVirtualRegisters(src1.offset(), dst1, src2.offset(), dst2);792 }793 794 784 ALWAYS_INLINE int32_t JIT::getConstantOperandImmediateInt(int src) 795 785 { … … 806 796 store64(from, Address(callFrameRegister, dst * sizeof(Register))); 807 797 m_lastResultBytecodeRegister = (from == cachedResultRegister) ? dst : std::numeric_limits<int>::max(); 808 }809 810 ALWAYS_INLINE void JIT::emitPutVirtualRegister(VirtualRegister dst, RegisterID from)811 {812 emitPutVirtualRegister(dst.offset(), from);813 798 } 814 799 -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r156474 r156482 40 40 #include "LinkBuffer.h" 41 41 #include "SlowPathCall.h" 42 #include "VirtualRegister.h"43 42 44 43 namespace JSC { … … 259 258 int activation = currentInstruction[2].u.operand; 260 259 261 Jump argsNotCreated = branchTest64(Zero, Address(callFrameRegister, sizeof(Register) * (unmodifiedArgumentsRegister( VirtualRegister(arguments)).offset())));260 Jump argsNotCreated = branchTest64(Zero, Address(callFrameRegister, sizeof(Register) * (unmodifiedArgumentsRegister(arguments)))); 262 261 JITStubCall stubCall(this, cti_op_tear_off_arguments); 263 stubCall.addArgument(unmodifiedArgumentsRegister( VirtualRegister(arguments)).offset(), regT2);262 stubCall.addArgument(unmodifiedArgumentsRegister(arguments), regT2); 264 263 stubCall.addArgument(activation, regT2); 265 264 stubCall.call(); … … 509 508 if (!m_codeBlock->isKnownNotImmediate(base)) 510 509 isNotObject.append(emitJumpIfNotJSCell(regT0)); 511 if (base != m_codeBlock->thisRegister() .offset()|| m_codeBlock->isStrictMode()) {510 if (base != m_codeBlock->thisRegister() || m_codeBlock->isStrictMode()) { 512 511 loadPtr(Address(regT0, JSCell::structureOffset()), regT2); 513 512 isNotObject.append(emitJumpIfNotObject(regT2)); … … 835 834 size_t count = m_codeBlock->m_numVars; 836 835 for (size_t j = 0; j < count; ++j) 837 emitInitRegister( virtualRegisterForLocal(j).offset());836 emitInitRegister(localToOperand(j)); 838 837 } 839 838 … … 854 853 JITStubCall(this, cti_op_create_arguments).call(); 855 854 emitPutVirtualRegister(dst); 856 emitPutVirtualRegister(unmodifiedArgumentsRegister( VirtualRegister(dst)));855 emitPutVirtualRegister(unmodifiedArgumentsRegister(dst)); 857 856 argsCreated.link(this); 858 857 } … … 1147 1146 JITStubCall(this, cti_op_create_arguments).call(); 1148 1147 emitPutVirtualRegister(arguments); 1149 emitPutVirtualRegister(unmodifiedArgumentsRegister( VirtualRegister(arguments)));1148 emitPutVirtualRegister(unmodifiedArgumentsRegister(arguments)); 1150 1149 1151 1150 skipArgumentsCreation.link(this); -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r156474 r156482 40 40 #include "LinkBuffer.h" 41 41 #include "SlowPathCall.h" 42 #include "VirtualRegister.h"43 42 44 43 namespace JSC { … … 1098 1097 // object lifetime and increasing GC pressure. 1099 1098 for (int i = 0; i < m_codeBlock->m_numVars; ++i) 1100 emitStore( virtualRegisterForLocal(i).offset(), jsUndefined());1099 emitStore(localToOperand(i), jsUndefined()); 1101 1100 } 1102 1101 -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r156474 r156482 1048 1048 int operand = mustHandleValues.operandForIndex(i); 1049 1049 if (operandIsArgument(operand) 1050 && ! VirtualRegister(operand).toArgument()1050 && !operandToArgument(operand) 1051 1051 && codeBlock->codeType() == FunctionCode 1052 1052 && codeBlock->specializationKind() == CodeForConstruct) { … … 1155 1155 STUB_INIT_STACK_FRAME(stackFrame); 1156 1156 1157 ASSERT(stackFrame.callFrame->codeBlock()->codeType() != FunctionCode || !stackFrame.callFrame->codeBlock()->needsFullScopeChain() || stackFrame.callFrame->uncheckedR(stackFrame.callFrame->codeBlock()->activationRegister() .offset()).jsValue());1157 ASSERT(stackFrame.callFrame->codeBlock()->codeType() != FunctionCode || !stackFrame.callFrame->codeBlock()->needsFullScopeChain() || stackFrame.callFrame->uncheckedR(stackFrame.callFrame->codeBlock()->activationRegister()).jsValue()); 1158 1158 return JSFunction::create(stackFrame.callFrame, stackFrame.args[0].function(), stackFrame.callFrame->scope()); 1159 1159 } … … 1932 1932 FunctionExecutable* function = stackFrame.args[0].function(); 1933 1933 JSFunction* func = JSFunction::create(callFrame, function, callFrame->scope()); 1934 ASSERT(callFrame->codeBlock()->codeType() != FunctionCode || !callFrame->codeBlock()->needsFullScopeChain() || callFrame->uncheckedR(callFrame->codeBlock()->activationRegister() .offset()).jsValue());1934 ASSERT(callFrame->codeBlock()->codeType() != FunctionCode || !callFrame->codeBlock()->needsFullScopeChain() || callFrame->uncheckedR(callFrame->codeBlock()->activationRegister()).jsValue()); 1935 1935 1936 1936 return func; … … 1960 1960 ASSERT(callFrame->callerFrame()->codeBlock()->codeType() != FunctionCode 1961 1961 || !callFrame->callerFrame()->codeBlock()->needsFullScopeChain() 1962 || callFrame->callerFrame()->uncheckedR(callFrame->callerFrame()->codeBlock()->activationRegister() .offset()).jsValue());1962 || callFrame->callerFrame()->uncheckedR(callFrame->callerFrame()->codeBlock()->activationRegister()).jsValue()); 1963 1963 1964 1964 callFrame->setScope(callerFrame->scope()); -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r156474 r156482 698 698 LLINT_CHECK_EXCEPTION(); 699 699 LLINT_OP(2) = arguments; 700 exec->uncheckedR(unmodifiedArgumentsRegister( VirtualRegister(pc[2].u.operand)).offset()) = arguments;700 exec->uncheckedR(unmodifiedArgumentsRegister(pc[2].u.operand)) = arguments; 701 701 } 702 702 … … 918 918 ASSERT(codeBlock->codeType() != FunctionCode 919 919 || !codeBlock->needsFullScopeChain() 920 || exec->uncheckedR(codeBlock->activationRegister() .offset()).jsValue());920 || exec->uncheckedR(codeBlock->activationRegister()).jsValue()); 921 921 #if LLINT_SLOW_PATH_TRACING 922 922 dataLogF("Creating function!\n"); … … 1129 1129 LLINT_BEGIN(); 1130 1130 ASSERT(exec->codeBlock()->usesArguments()); 1131 Arguments* arguments = jsCast<Arguments*>(exec->uncheckedR(unmodifiedArgumentsRegister( VirtualRegister(pc[1].u.operand)).offset()).jsValue());1131 Arguments* arguments = jsCast<Arguments*>(exec->uncheckedR(unmodifiedArgumentsRegister(pc[1].u.operand)).jsValue()); 1132 1132 if (JSValue activationValue = LLINT_OP_C(2).jsValue()) 1133 1133 arguments->didTearOffActivation(exec, jsCast<JSActivation*>(activationValue)); -
trunk/Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp
r156474 r156482 46 46 continue; 47 47 out.reset(); 48 out.print("arg", i, " (r", virtualRegisterForArgument(i).offset(), "): ", description);48 out.print("arg", i, " (r", argumentToOperand(i), "): ", description); 49 49 m_header.append(out.toCString()); 50 50 } -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r156474 r156482 208 208 CHECK_EXCEPTION(); 209 209 exec->uncheckedR(pc[1].u.operand) = arguments; 210 exec->uncheckedR(unmodifiedArgumentsRegister( VirtualRegister(pc[1].u.operand)).offset()) = arguments;210 exec->uncheckedR(unmodifiedArgumentsRegister(pc[1].u.operand)) = arguments; 211 211 END(); 212 212 } -
trunk/Source/JavaScriptCore/runtime/JSActivation.cpp
r156474 r156482 219 219 return jsUndefined(); 220 220 221 VirtualRegisterargumentsRegister = callFrame->codeBlock()->argumentsRegister();222 if (JSValue arguments = callFrame->uncheckedR(argumentsRegister .offset()).jsValue())221 int argumentsRegister = callFrame->codeBlock()->argumentsRegister(); 222 if (JSValue arguments = callFrame->uncheckedR(argumentsRegister).jsValue()) 223 223 return arguments; 224 int realArgumentsRegister = unmodifiedArgumentsRegister(argumentsRegister) .offset();224 int realArgumentsRegister = unmodifiedArgumentsRegister(argumentsRegister); 225 225 226 226 JSValue arguments = JSValue(Arguments::create(callFrame->vm(), callFrame)); 227 callFrame->uncheckedR(argumentsRegister .offset()) = arguments;227 callFrame->uncheckedR(argumentsRegister) = arguments; 228 228 callFrame->uncheckedR(realArgumentsRegister) = arguments; 229 229
Note: See TracChangeset
for help on using the changeset viewer.