Changeset 39266 in webkit for trunk/JavaScriptCore/jit/JITInlineMethods.h
- Timestamp:
- Dec 12, 2008, 7:18:10 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JITInlineMethods.h
r39261 r39266 57 57 58 58 // get arg puts an arg from the SF register array into a h/w register 59 ALWAYS_INLINE void JIT::emitGetVirtualRegister(int src, RegisterID dst, unsigned currentInstructionIndex) 60 { 59 ALWAYS_INLINE void JIT::emitGetVirtualRegister(int src, RegisterID dst) 60 { 61 ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set. 62 61 63 // TODO: we want to reuse values that are already in registers if we can - add a register allocator! 62 64 if (m_codeBlock->isConstantRegisterIndex(src)) { … … 69 71 if (src == m_lastResultBytecodeRegister && m_codeBlock->isTemporaryRegisterIndex(src)) { 70 72 bool atJumpTarget = false; 71 while (m_jumpTargetsPosition < m_codeBlock->numberOfJumpTargets() && m_codeBlock->jumpTarget(m_jumpTargetsPosition) <= currentInstructionIndex) {72 if (m_codeBlock->jumpTarget(m_jumpTargetsPosition) == currentInstructionIndex)73 while (m_jumpTargetsPosition < m_codeBlock->numberOfJumpTargets() && m_codeBlock->jumpTarget(m_jumpTargetsPosition) <= m_bytecodeIndex) { 74 if (m_codeBlock->jumpTarget(m_jumpTargetsPosition) == m_bytecodeIndex) 73 75 atJumpTarget = true; 74 76 ++m_jumpTargetsPosition; … … 88 90 } 89 91 90 ALWAYS_INLINE void JIT::emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2 , unsigned i)92 ALWAYS_INLINE void JIT::emitGetVirtualRegisters(int src1, RegisterID dst1, int src2, RegisterID dst2) 91 93 { 92 94 if (src2 == m_lastResultBytecodeRegister) { 93 emitGetVirtualRegister(src2, dst2 , i);94 emitGetVirtualRegister(src1, dst1 , i);95 emitGetVirtualRegister(src2, dst2); 96 emitGetVirtualRegister(src1, dst1); 95 97 } else { 96 emitGetVirtualRegister(src1, dst1 , i);97 emitGetVirtualRegister(src2, dst2 , i);98 emitGetVirtualRegister(src1, dst1); 99 emitGetVirtualRegister(src2, dst2); 98 100 } 99 101 } … … 188 190 } 189 191 190 ALWAYS_INLINE JmpSrc JIT::emitNakedCall(unsigned bytecodeIndex, X86::RegisterID r) 191 { 192 ALWAYS_INLINE JmpSrc JIT::emitNakedCall(X86::RegisterID r) 193 { 194 ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set. 195 192 196 JmpSrc nakedCall = call(r); 193 m_calls.append(CallRecord(nakedCall, bytecodeIndex));197 m_calls.append(CallRecord(nakedCall, m_bytecodeIndex)); 194 198 return nakedCall; 195 199 } 196 200 197 ALWAYS_INLINE JmpSrc JIT::emitNakedCall(unsigned bytecodeIndex, void* function) 198 { 201 ALWAYS_INLINE JmpSrc JIT::emitNakedCall(void* function) 202 { 203 ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set. 204 199 205 JmpSrc nakedCall = call(); 200 m_calls.append(CallRecord(nakedCall, reinterpret_cast<CTIHelper_v>(function), bytecodeIndex));206 m_calls.append(CallRecord(nakedCall, m_bytecodeIndex, function)); 201 207 return nakedCall; 202 208 } 203 209 204 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_j helper) 205 { 210 ALWAYS_INLINE JmpSrc JIT::emitCTICall_internal(void* helper) 211 { 212 ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set. 213 206 214 #if ENABLE(OPCODE_SAMPLING) 207 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());215 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + m_bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot()); 208 216 #endif 209 217 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 210 218 JmpSrc ctiCall = call(); 211 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));219 m_calls.append(CallRecord(ctiCall, m_bytecodeIndex, helper)); 212 220 #if ENABLE(OPCODE_SAMPLING) 213 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());221 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + m_bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot()); 214 222 #endif 215 223 killLastResultRegister(); … … 218 226 } 219 227 220 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_o helper)221 {222 #if ENABLE(OPCODE_SAMPLING)223 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());224 #endif225 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);226 JmpSrc ctiCall = call();227 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));228 #if ENABLE(OPCODE_SAMPLING)229 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());230 #endif231 killLastResultRegister();232 233 return ctiCall;234 }235 236 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_p helper)237 {238 #if ENABLE(OPCODE_SAMPLING)239 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());240 #endif241 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);242 JmpSrc ctiCall = call();243 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));244 #if ENABLE(OPCODE_SAMPLING)245 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());246 #endif247 killLastResultRegister();248 249 return ctiCall;250 }251 252 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_b helper)253 {254 #if ENABLE(OPCODE_SAMPLING)255 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());256 #endif257 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);258 JmpSrc ctiCall = call();259 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));260 #if ENABLE(OPCODE_SAMPLING)261 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());262 #endif263 killLastResultRegister();264 265 return ctiCall;266 }267 268 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_v helper)269 {270 #if ENABLE(OPCODE_SAMPLING)271 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());272 #endif273 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);274 JmpSrc ctiCall = call();275 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));276 #if ENABLE(OPCODE_SAMPLING)277 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());278 #endif279 killLastResultRegister();280 281 return ctiCall;282 }283 284 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_s helper)285 {286 #if ENABLE(OPCODE_SAMPLING)287 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());288 #endif289 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);290 JmpSrc ctiCall = call();291 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));292 #if ENABLE(OPCODE_SAMPLING)293 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());294 #endif295 killLastResultRegister();296 297 return ctiCall;298 }299 300 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_2 helper)301 {302 #if ENABLE(OPCODE_SAMPLING)303 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());304 #endif305 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);306 JmpSrc ctiCall = call();307 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));308 #if ENABLE(OPCODE_SAMPLING)309 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());310 #endif311 killLastResultRegister();312 313 return ctiCall;314 }315 316 228 ALWAYS_INLINE JmpSrc JIT::checkStructure(RegisterID reg, Structure* structure) 317 229 { … … 324 236 } 325 237 326 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfJSCell(RegisterID reg , unsigned bytecodeIndex)327 { 328 m_slowCases.append(SlowCaseEntry(emitJumpIfJSCell(reg), bytecodeIndex));238 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfJSCell(RegisterID reg) 239 { 240 addSlowCase(emitJumpIfJSCell(reg)); 329 241 } 330 242 … … 334 246 } 335 247 336 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotJSCell(RegisterID reg , unsigned bytecodeIndex)337 { 338 m_slowCases.append(SlowCaseEntry(emitJumpIfNotJSCell(reg), bytecodeIndex));339 } 340 341 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotJSCell(RegisterID reg, unsigned bytecodeIndex,int vReg)248 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotJSCell(RegisterID reg) 249 { 250 addSlowCase(emitJumpIfNotJSCell(reg)); 251 } 252 253 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotJSCell(RegisterID reg, int vReg) 342 254 { 343 255 if (!m_codeBlock->isKnownNotImmediate(vReg)) 344 emitJumpSlowCaseIfNotJSCell(reg , bytecodeIndex);256 emitJumpSlowCaseIfNotJSCell(reg); 345 257 } 346 258 … … 351 263 } 352 264 353 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmNum(RegisterID reg , unsigned bytecodeIndex)354 { 355 m_slowCases.append(SlowCaseEntry(jz32(reg, Imm32(JSImmediate::TagBitTypeInteger)), bytecodeIndex));356 } 357 358 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmNums(RegisterID reg1, RegisterID reg2, RegisterID scratch , unsigned bytecodeIndex)265 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmNum(RegisterID reg) 266 { 267 addSlowCase(jz32(reg, Imm32(JSImmediate::TagBitTypeInteger))); 268 } 269 270 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotImmNums(RegisterID reg1, RegisterID reg2, RegisterID scratch) 359 271 { 360 272 move(reg1, scratch); 361 273 and32(reg2, scratch); 362 emitJumpSlowCaseIfNotImmNum(scratch , bytecodeIndex);274 emitJumpSlowCaseIfNotImmNum(scratch); 363 275 } 364 276 … … 394 306 } 395 307 396 ALWAYS_INLINE void JIT::emitFastArithIntToImmOrSlowCase(RegisterID reg , unsigned bytecodeIndex)397 { 398 m_slowCases.append(SlowCaseEntry(joAdd32(reg, reg), bytecodeIndex));308 ALWAYS_INLINE void JIT::emitFastArithIntToImmOrSlowCase(RegisterID reg) 309 { 310 addSlowCase(joAdd32(reg, reg)); 399 311 emitFastArithReTagImmediate(reg); 400 312 } … … 412 324 } 413 325 326 ALWAYS_INLINE void JIT::addSlowCase(JmpSrc jump) 327 { 328 ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set. 329 330 m_slowCases.append(SlowCaseEntry(jump, m_bytecodeIndex)); 331 } 332 333 ALWAYS_INLINE void JIT::addJump(JmpSrc jump, int relativeOffset) 334 { 335 ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set. 336 337 m_jmpTable.append(JmpTable(jump, m_bytecodeIndex + relativeOffset)); 338 } 339 340 ALWAYS_INLINE void JIT::emitJumpSlowToHot(JmpSrc jump, int relativeOffset) 341 { 342 ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set. 343 344 __ link(jump, m_labels[m_bytecodeIndex + relativeOffset]); 345 } 346 414 347 } 415 348
Note:
See TracChangeset
for help on using the changeset viewer.