Changeset 209725 in webkit for trunk/Source/JavaScriptCore/jit/JITCall.cpp
- Timestamp:
- Dec 12, 2016, 1:46:45 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/JITCall.cpp
r209678 r209725 92 92 93 93 addPtr(TrustedImm32(sizeof(CallerFrameAndPC)), regT1, stackPointerRegister); 94 incrementCounter(this, VM::BaselineCaller); 95 incrementCounter(this, VM::CallVarargs); 94 96 } 95 97 … … 99 101 storePtr(callFrameRegister, Address(regT1, CallFrame::callerFrameOffset())); 100 102 103 incrementCounter(this, VM::BaselineCaller); 104 incrementCounter(this, VM::CallEval); 105 101 106 addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister); 102 107 checkStackPointerAlignment(); … … 114 119 { 115 120 CallLinkInfo* info = m_codeBlock->addCallLinkInfo(); 116 info->setUpCall(CallLinkInfo::Call, CodeOrigin(m_bytecodeOffset), regT0);121 info->setUpCall(CallLinkInfo::Call, StackArgs, CodeOrigin(m_bytecodeOffset), regT0); 117 122 118 123 linkSlowCase(iter); … … 155 160 156 161 CallLinkInfo* info = nullptr; 162 ArgumentsLocation argumentsLocation = StackArgs; 163 157 164 if (opcodeID != op_call_eval) 158 165 info = m_codeBlock->addCallLinkInfo(); … … 160 167 compileSetupVarargsFrame(opcodeID, instruction, info); 161 168 else { 162 int argCount = instruction[3].u.operand;169 unsigned argCount = instruction[3].u.unsignedValue; 163 170 int registerOffset = -instruction[4].u.operand; 164 171 … … 172 179 173 180 addPtr(TrustedImm32(registerOffset * sizeof(Register) + sizeof(CallerFrameAndPC)), callFrameRegister, stackPointerRegister); 181 if (argumentsLocation != StackArgs) { 182 move(TrustedImm32(argCount), argumentRegisterForArgumentCount()); 183 unsigned registerArgs = std::min(argCount, NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS); 184 for (unsigned arg = 0; arg < registerArgs; arg++) 185 load64(Address(stackPointerRegister, (CallFrameSlot::thisArgument + arg) * static_cast<int>(sizeof(Register)) - sizeof(CallerFrameAndPC)), argumentRegisterForFunctionArgument(arg)); 186 } 174 187 store32(TrustedImm32(argCount), Address(stackPointerRegister, CallFrameSlot::argumentCount * static_cast<int>(sizeof(Register)) + PayloadOffset - sizeof(CallerFrameAndPC))); 175 188 } // SP holds newCallFrame + sizeof(CallerFrameAndPC), with ArgumentCount initialized. 189 190 incrementCounter(this, VM::BaselineCaller); 176 191 177 192 uint32_t bytecodeOffset = instruction - m_codeBlock->instructions().begin(); … … 179 194 store32(TrustedImm32(locationBits), Address(callFrameRegister, CallFrameSlot::argumentCount * static_cast<int>(sizeof(Register)) + TagOffset)); 180 195 181 emitGetVirtualRegister(callee, regT0); // regT0 holds callee. 182 store64(regT0, Address(stackPointerRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register)) - sizeof(CallerFrameAndPC))); 196 GPRReg calleeRegister = argumentRegisterForCallee(); 197 198 emitGetVirtualRegister(callee, calleeRegister); 199 store64(calleeRegister, Address(stackPointerRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register)) - sizeof(CallerFrameAndPC))); 183 200 184 201 if (opcodeID == op_call_eval) { … … 188 205 189 206 DataLabelPtr addressOfLinkedFunctionCheck; 190 Jump slowCase = branchPtrWithPatch(NotEqual, regT0, addressOfLinkedFunctionCheck, TrustedImmPtr(0));207 Jump slowCase = branchPtrWithPatch(NotEqual, calleeRegister, addressOfLinkedFunctionCheck, TrustedImmPtr(0)); 191 208 addSlowCase(slowCase); 192 209 193 210 ASSERT(m_callCompilationInfo.size() == callLinkInfoIndex); 194 info->setUpCall(CallLinkInfo::callTypeFor(opcodeID), CodeOrigin(m_bytecodeOffset), regT0);211 info->setUpCall(CallLinkInfo::callTypeFor(opcodeID), argumentsLocation, CodeOrigin(m_bytecodeOffset), calleeRegister); 195 212 m_callCompilationInfo.append(CallCompilationInfo()); 196 213 m_callCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck; … … 198 215 199 216 if (opcodeID == op_tail_call) { 217 incrementCounter(this, VM::TailCall); 218 200 219 CallFrameShuffleData shuffleData; 201 220 shuffleData.tagTypeNumber = GPRInfo::tagTypeNumberRegister; … … 210 229 } 211 230 shuffleData.callee = 212 ValueRecovery::inGPR( regT0, DataFormatJS);231 ValueRecovery::inGPR(calleeRegister, DataFormatJS); 213 232 shuffleData.setupCalleeSaveRegisters(m_codeBlock); 214 233 info->setFrameShuffleData(shuffleData); … … 247 266 emitRestoreCalleeSaves(); 248 267 249 move(TrustedImmPtr(m_callCompilationInfo[callLinkInfoIndex].callLinkInfo), regT2); 250 251 m_callCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(m_vm->getCTIStub(linkCallThunkGenerator).code()); 268 CallLinkInfo* callLinkInfo = m_callCompilationInfo[callLinkInfoIndex].callLinkInfo; 269 move(TrustedImmPtr(callLinkInfo), nonArgGPR0); 270 271 m_callCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(m_vm->getJITCallThunkEntryStub(linkCallThunkGenerator).entryFor(callLinkInfo->argumentsLocation())); 252 272 253 273 if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs) {
Note:
See TracChangeset
for help on using the changeset viewer.