Changeset 39058 in webkit for trunk/JavaScriptCore
- Timestamp:
- Dec 5, 2008, 5:36:16 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r39057 r39058 1 2008-12-05 Gavin Barraclough <[email protected]> 2 3 Reviewed by Geoff Garen. 4 5 Second tranche of porting JIT.cpp to MacroAssembler interface. 6 7 * assembler/MacroAssembler.h: 8 (JSC::MacroAssembler::mul32): 9 (JSC::MacroAssembler::jl32): 10 (JSC::MacroAssembler::jnzSub32): 11 (JSC::MacroAssembler::joAdd32): 12 (JSC::MacroAssembler::joMul32): 13 (JSC::MacroAssembler::jzSub32): 14 * jit/JIT.cpp: 15 (JSC::JIT::emitSlowScriptCheck): 16 (JSC::JIT::privateCompileMainPass): 17 (JSC::JIT::privateCompileSlowCases): 18 (JSC::JIT::privateCompileCTIMachineTrampolines): 19 * jit/JIT.h: 20 * jit/JITInlineMethods.h: 21 (JSC::JIT::emitJumpIfNotJSCell): 22 (JSC::JIT::emitJumpSlowCaseIfNotJSCell): 23 1 24 2008-12-05 David Kilzer <[email protected]> 2 25 -
trunk/JavaScriptCore/assembler/MacroAssembler.h
r39043 r39058 298 298 } 299 299 300 void mul32(Imm32 imm, RegisterID src, RegisterID dest) 301 { 302 m_assembler.imull_i32r(src, imm.m_value, dest); 303 } 304 300 305 void or32(Imm32 imm, RegisterID dest) 301 306 { … … 607 612 return Jump(m_assembler.jge()); 608 613 } 614 615 Jump jl32(RegisterID left, RegisterID right) 616 { 617 m_assembler.cmpl_rr(right, left); 618 return Jump(m_assembler.jl()); 619 } 609 620 610 621 Jump jl32(RegisterID left, Imm32 right) … … 738 749 // operation caused an overflow to occur. 739 750 751 Jump jnzSub32(Imm32 imm, RegisterID dest) 752 { 753 sub32(imm, dest); 754 return Jump(m_assembler.jne()); 755 } 756 757 Jump joAdd32(RegisterID src, RegisterID dest) 758 { 759 add32(src, dest); 760 return Jump(m_assembler.jo()); 761 } 762 763 Jump joAdd32(Imm32 imm, RegisterID dest) 764 { 765 add32(imm, dest); 766 return Jump(m_assembler.jo()); 767 } 768 769 Jump joMul32(Imm32 imm, RegisterID src, RegisterID dest) 770 { 771 mul32(imm, src, dest); 772 return Jump(m_assembler.jo()); 773 } 774 740 775 Jump jzSub32(Imm32 imm, RegisterID dest) 741 776 { 742 if (CAN_SIGN_EXTEND_8_32(imm.m_value)) 743 m_assembler.subl_i8r(imm.m_value, dest); 744 else 745 m_assembler.subl_i32r(imm.m_value, dest); 777 sub32(imm, dest); 746 778 return Jump(m_assembler.je()); 747 779 } 748 780 749 Jump joAdd32(RegisterID src, RegisterID dest)750 {751 m_assembler.addl_rr(src, dest);752 return Jump(m_assembler.jo());753 }754 755 781 756 782 // Miscellaneous operations: -
trunk/JavaScriptCore/jit/JIT.cpp
r39055 r39058 256 256 void JIT::emitSlowScriptCheck(unsigned bytecodeIndex) 257 257 { 258 __ subl_i8r(1, X86::esi); 259 JmpSrc skipTimeout = __ jne(); 258 Jump skipTimeout = jnzSub32(Imm32(1), X86::esi); 260 259 emitCTICall(bytecodeIndex, Interpreter::cti_timeout_check); 261 __ movl_rr(X86::eax, X86::esi);262 __ link(skipTimeout, __ label());260 move(X86::eax, X86::esi); 261 skipTimeout.link(this); 263 262 264 263 killLastResultRegister(); … … 278 277 #if ENABLE(OPCODE_SAMPLING) 279 278 if (i > 0) // Avoid the overhead of sampling op_enter twice. 280 __ movl_i32m(m_interpreter->sampler()->encodeSample(instruction + i), m_interpreter->sampler()->sampleSlot());279 store32(m_interpreter->sampler()->encodeSample(instruction + i), m_interpreter->sampler()->sampleSlot()); 281 280 #endif 282 281 … … 285 284 switch (opcodeID) { 286 285 case op_mov: { 287 unsigned src = instruction[i + 2].u.operand; 288 if (m_codeBlock->isConstantRegisterIndex(src)) 289 __ movl_i32r(asInteger(m_codeBlock->getConstant(src)), X86::eax); 290 else 291 emitGetVirtualRegister(src, X86::eax, i); 286 emitGetVirtualRegister(instruction[i + 2].u.operand, X86::eax, i); 292 287 emitPutVirtualRegister(instruction[i + 1].u.operand); 293 288 i += 3; … … 302 297 emitGetVirtualRegister(src2, X86::eax, i); 303 298 emitJumpSlowCaseIfNotImmNum(X86::eax, i); 304 __ addl_i32r(getDeTaggedConstantImmediate(value), X86::eax); 305 m_slowCases.append(SlowCaseEntry(__ jo(), i)); 299 m_slowCases.append(SlowCaseEntry(joAdd32(Imm32(getDeTaggedConstantImmediate(value)), X86::eax), i)); 306 300 emitPutVirtualRegister(dst); 307 301 } else if (JSValue* value = getConstantImmediateNumericArg(src2)) { 308 302 emitGetVirtualRegister(src1, X86::eax, i); 309 303 emitJumpSlowCaseIfNotImmNum(X86::eax, i); 310 __ addl_i32r(getDeTaggedConstantImmediate(value), X86::eax); 311 m_slowCases.append(SlowCaseEntry(__ jo(), i)); 304 m_slowCases.append(SlowCaseEntry(joAdd32(Imm32(getDeTaggedConstantImmediate(value)), X86::eax), i)); 312 305 emitPutVirtualRegister(dst); 313 306 } else { … … 337 330 case op_jmp: { 338 331 unsigned target = instruction[i + 1].u.operand; 339 m_jmpTable.append(JmpTable( __ jmp(), i + 1 + target));332 m_jmpTable.append(JmpTable(jump(), i + 1 + target)); 340 333 i += 2; 341 334 break; … … 345 338 emitGetVirtualRegister(srcDst, X86::eax, i); 346 339 emitJumpSlowCaseIfNotImmNum(X86::eax, i); 347 __ addl_i8r(getDeTaggedConstantImmediate(JSImmediate::oneImmediate()), X86::eax); 348 m_slowCases.append(SlowCaseEntry(__ jo(), i)); 340 m_slowCases.append(SlowCaseEntry(joAdd32(Imm32(getDeTaggedConstantImmediate(JSImmediate::oneImmediate())), X86::eax), i)); 349 341 emitPutVirtualRegister(srcDst); 350 342 i += 2; … … 355 347 356 348 unsigned target = instruction[i + 1].u.operand; 357 m_jmpTable.append(JmpTable( __ jmp(), i + 1 + target));349 m_jmpTable.append(JmpTable(jump(), i + 1 + target)); 358 350 i += 2; 359 351 break; … … 365 357 JSValue* src2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand); 366 358 if (src2imm) { 367 emitGetVirtualRegister(instruction[i + 1].u.operand, X86::edx, i); 368 emitJumpSlowCaseIfNotImmNum(X86::edx, i); 369 __ cmpl_i32r(asInteger(src2imm), X86::edx); 370 m_jmpTable.append(JmpTable(__ jl(), i + 3 + target)); 359 emitGetVirtualRegister(instruction[i + 1].u.operand, X86::eax, i); 360 emitJumpSlowCaseIfNotImmNum(X86::eax, i); 361 m_jmpTable.append(JmpTable(jl32(X86::eax, Imm32(asInteger(src2imm))), i + 3 + target)); 371 362 } else { 372 363 emitGetVirtualRegisters(instruction[i + 1].u.operand, X86::eax, instruction[i + 2].u.operand, X86::edx, i); 373 364 emitJumpSlowCaseIfNotImmNum(X86::eax, i); 374 365 emitJumpSlowCaseIfNotImmNum(X86::edx, i); 375 __ cmpl_rr(X86::edx, X86::eax); 376 m_jmpTable.append(JmpTable(__ jl(), i + 3 + target)); 366 m_jmpTable.append(JmpTable(jl32(X86::eax, X86::edx), i + 3 + target)); 377 367 } 378 368 i += 4; … … 385 375 JSValue* src2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand); 386 376 if (src2imm) { 387 emitGetVirtualRegister(instruction[i + 1].u.operand, X86::edx, i); 388 emitJumpSlowCaseIfNotImmNum(X86::edx, i); 389 __ cmpl_i32r(asInteger(src2imm), X86::edx); 390 m_jmpTable.append(JmpTable(__ jle(), i + 3 + target)); 377 emitGetVirtualRegister(instruction[i + 1].u.operand, X86::eax, i); 378 emitJumpSlowCaseIfNotImmNum(X86::eax, i); 379 m_jmpTable.append(JmpTable(jle32(X86::eax, Imm32(asInteger(src2imm))), i + 3 + target)); 391 380 } else { 392 381 emitGetVirtualRegisters(instruction[i + 1].u.operand, X86::eax, instruction[i + 2].u.operand, X86::edx, i); 393 382 emitJumpSlowCaseIfNotImmNum(X86::eax, i); 394 383 emitJumpSlowCaseIfNotImmNum(X86::edx, i); 395 __ cmpl_rr(X86::edx, X86::eax); 396 m_jmpTable.append(JmpTable(__ jle(), i + 3 + target)); 384 m_jmpTable.append(JmpTable(jle32(X86::eax, X86::edx), i + 3 + target)); 397 385 } 398 386 i += 4; … … 423 411 __ orl_rr(X86::eax, X86::ecx); 424 412 __ orl_rr(X86::edx, X86::ecx); 425 __ testl_i32r(JSImmediate::TagMask, X86::ecx); 426 427 m_slowCases.append(SlowCaseEntry(__ jnz(), i)); 413 emitJumpSlowCaseIfNotJSCell(X86::ecx, i); 428 414 429 415 // check that all are object type - this is a bit of a bithack to avoid excess branching; … … 498 484 emitJumpSlowCaseIfNotImmNum(X86::eax, i); 499 485 emitFastArithDeTagImmediate(X86::eax); 500 __ imull_i32r(X86::eax, value, X86::eax); 501 m_slowCases.append(SlowCaseEntry(__ jo(), i)); 486 m_slowCases.append(SlowCaseEntry(joMul32(Imm32(value), X86::eax, X86::eax), i)); 502 487 emitFastArithReTagImmediate(X86::eax); 503 488 emitPutVirtualRegister(dst); … … 506 491 emitJumpSlowCaseIfNotImmNum(X86::eax, i); 507 492 emitFastArithDeTagImmediate(X86::eax); 508 __ imull_i32r(X86::eax, value, X86::eax); 509 m_slowCases.append(SlowCaseEntry(__ jo(), i)); 493 m_slowCases.append(SlowCaseEntry(joMul32(Imm32(value), X86::eax, X86::eax), i)); 510 494 emitFastArithReTagImmediate(X86::eax); 511 495 emitPutVirtualRegister(dst); … … 533 517 case op_get_global_var: { 534 518 JSVariableObject* globalObject = static_cast<JSVariableObject*>(instruction[i + 2].u.jsCell); 535 __ movl_i32r(asInteger(globalObject), X86::eax);519 move(globalObject, X86::eax); 536 520 emitGetVariableObjectRegister(X86::eax, instruction[i + 3].u.operand, X86::eax); 537 521 emitPutVirtualRegister(instruction[i + 1].u.operand); … … 542 526 emitGetVirtualRegister(instruction[i + 3].u.operand, X86::edx, i); 543 527 JSVariableObject* globalObject = static_cast<JSVariableObject*>(instruction[i + 1].u.jsCell); 544 __ movl_i32r(asInteger(globalObject), X86::eax);528 move(globalObject, X86::eax); 545 529 emitPutVariableObjectRegister(X86::edx, X86::eax, instruction[i + 2].u.operand); 546 530 i += 4; … … 552 536 emitGetFromCallFrameHeader(RegisterFile::ScopeChain, X86::eax); 553 537 while (skip--) 554 __ movl_mr(FIELD_OFFSET(ScopeChainNode, next), X86::eax, X86::eax);555 556 __ movl_mr(FIELD_OFFSET(ScopeChainNode, object), X86::eax, X86::eax);538 loadPtr(Address(X86::eax, FIELD_OFFSET(ScopeChainNode, next)), X86::eax); 539 540 loadPtr(Address(X86::eax, FIELD_OFFSET(ScopeChainNode, object)), X86::eax); 557 541 emitGetVariableObjectRegister(X86::eax, instruction[i + 2].u.operand, X86::eax); 558 542 emitPutVirtualRegister(instruction[i + 1].u.operand); … … 566 550 emitGetVirtualRegister(instruction[i + 3].u.operand, X86::eax, i); 567 551 while (skip--) 568 __ movl_mr(FIELD_OFFSET(ScopeChainNode, next), X86::edx, X86::edx);569 570 __ movl_mr(FIELD_OFFSET(ScopeChainNode, object), X86::edx, X86::edx);552 loadPtr(Address(X86::edx, FIELD_OFFSET(ScopeChainNode, next)), X86::edx); 553 554 loadPtr(Address(X86::edx, FIELD_OFFSET(ScopeChainNode, object)), X86::edx); 571 555 emitPutVariableObjectRegister(X86::eax, X86::edx, instruction[i + 1].u.operand); 572 556 i += 4; … … 625 609 emitGetVirtualRegister(instruction[i + 1].u.operand, X86::eax, i); 626 610 627 __ testl_i32r(JSImmediate::TagMask, X86::eax); 628 JmpSrc isImmediate = __ jne(); 611 JmpSrc isImmediate = emitJumpIfNotJSCell(X86::eax); 629 612 __ movl_mr(FIELD_OFFSET(JSCell, m_structure), X86::eax, X86::ecx); 630 613 __ cmpl_i32m(ObjectType, FIELD_OFFSET(Structure, m_typeInfo) + FIELD_OFFSET(TypeInfo, m_type), X86::ecx); … … 643 626 emitJumpSlowCaseIfNotImmNum(X86::edx, i); 644 627 emitFastArithImmToInt(X86::edx); 645 __ testl_i32r(JSImmediate::TagMask, X86::eax); 646 m_slowCases.append(SlowCaseEntry(__ jne(), i)); 628 emitJumpSlowCaseIfNotJSCell(X86::eax, i); 647 629 __ cmpl_i32m(reinterpret_cast<unsigned>(m_interpreter->m_jsArrayVptr), X86::eax); 648 630 m_slowCases.append(SlowCaseEntry(__ jne(), i)); … … 677 659 emitJumpSlowCaseIfNotImmNum(X86::edx, i); 678 660 emitFastArithImmToInt(X86::edx); 679 __ testl_i32r(JSImmediate::TagMask, X86::eax); 680 m_slowCases.append(SlowCaseEntry(__ jne(), i)); 661 emitJumpSlowCaseIfNotJSCell(X86::eax, i); 681 662 __ cmpl_i32m(reinterpret_cast<unsigned>(m_interpreter->m_jsArrayVptr), X86::eax); 682 663 m_slowCases.append(SlowCaseEntry(__ jne(), i)); … … 840 821 841 822 emitGetVirtualRegister(src, X86::eax, i); 842 __ testl_i32r(JSImmediate::TagMask, X86::eax); 843 JmpSrc isImmediate = __ jnz(); 823 JmpSrc isImmediate = emitJumpIfNotJSCell(X86::eax); 844 824 845 825 __ movl_mr(FIELD_OFFSET(JSCell, m_structure), X86::eax, X86::ecx); … … 870 850 871 851 emitGetVirtualRegister(src, X86::eax, i); 872 __ testl_i32r(JSImmediate::TagMask, X86::eax); 873 JmpSrc isImmediate = __ jnz(); 852 JmpSrc isImmediate = emitJumpIfNotJSCell(X86::eax); 874 853 875 854 __ movl_mr(FIELD_OFFSET(JSCell, m_structure), X86::eax, X86::ecx); … … 1323 1302 1324 1303 emitGetVirtualRegister(src1, X86::eax, i); 1325 __ testl_i32r(JSImmediate::TagMask, X86::eax); 1326 JmpSrc isImmediate = __ jnz(); 1304 JmpSrc isImmediate = emitJumpIfNotJSCell(X86::eax); 1327 1305 1328 1306 __ movl_mr(FIELD_OFFSET(JSCell, m_structure), X86::eax, X86::ecx); … … 1353 1331 1354 1332 emitGetVirtualRegister(src1, X86::eax, i); 1355 __ testl_i32r(JSImmediate::TagMask, X86::eax); 1356 JmpSrc isImmediate = __ jnz(); 1333 JmpSrc isImmediate = emitJumpIfNotJSCell(X86::eax); 1357 1334 1358 1335 __ movl_mr(FIELD_OFFSET(JSCell, m_structure), X86::eax, X86::ecx); … … 1610 1587 if (src2imm) { 1611 1588 __ link(iter->from, __ label()); 1612 emitPutCTIArg(X86::e dx, 0);1589 emitPutCTIArg(X86::eax, 0); 1613 1590 emitPutCTIArgFromVirtualRegister(instruction[i + 2].u.operand, 4, X86::ecx); 1614 1591 emitCTICall(i, Interpreter::cti_op_loop_if_less); … … 1642 1619 if (src2imm) { 1643 1620 __ link(iter->from, __ label()); 1644 emitPutCTIArg(X86::e dx, 0);1621 emitPutCTIArg(X86::eax, 0); 1645 1622 emitPutCTIArgFromVirtualRegister(instruction[i + 2].u.operand, 4, X86::ecx); 1646 1623 emitCTICall(i, Interpreter::cti_op_loop_if_lesseq); … … 2078 2055 2079 2056 // Check eax is an array 2080 __ testl_i32r(JSImmediate::TagMask, X86::eax); 2081 JmpSrc array_failureCases1 = __ jne(); 2057 JmpSrc array_failureCases1 = emitJumpIfNotJSCell(X86::eax); 2082 2058 __ cmpl_i32m(reinterpret_cast<unsigned>(m_interpreter->m_jsArrayVptr), X86::eax); 2083 2059 JmpSrc array_failureCases2 = __ jne(); … … 2100 2076 2101 2077 // Check eax is a string 2102 __ testl_i32r(JSImmediate::TagMask, X86::eax); 2103 JmpSrc string_failureCases1 = __ jne(); 2078 JmpSrc string_failureCases1 = emitJumpIfNotJSCell(X86::eax); 2104 2079 __ cmpl_i32m(reinterpret_cast<unsigned>(m_interpreter->m_jsStringVptr), X86::eax); 2105 2080 JmpSrc string_failureCases2 = __ jne(); -
trunk/JavaScriptCore/jit/JIT.h
r39053 r39058 438 438 unsigned getDeTaggedConstantImmediate(JSValue* imm); 439 439 440 Jump emitJumpIfJSCell(RegisterID reg); 441 void emitJumpSlowCaseIfJSCell(RegisterID reg, unsigned bytecodeIndex); 440 Jump emitJumpIfJSCell(RegisterID); 441 void emitJumpSlowCaseIfJSCell(RegisterID, unsigned bytecodeIndex); 442 Jump emitJumpIfNotJSCell(RegisterID); 442 443 void emitJumpSlowCaseIfNotJSCell(RegisterID, unsigned bytecodeIndex); 443 444 void emitJumpSlowCaseIfNotJSCell(RegisterID, unsigned bytecodeIndex, int VReg); -
trunk/JavaScriptCore/jit/JITInlineMethods.h
r39053 r39058 356 356 } 357 357 358 ALWAYS_INLINE JIT::Jump JIT::emitJumpIfNotJSCell(RegisterID reg) 359 { 360 return jset32(Imm32(JSImmediate::TagMask), reg); 361 } 362 358 363 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotJSCell(RegisterID reg, unsigned bytecodeIndex) 359 364 { 360 m_slowCases.append(SlowCaseEntry( jset32(Imm32(JSImmediate::TagMask),reg), bytecodeIndex));365 m_slowCases.append(SlowCaseEntry(emitJumpIfNotJSCell(reg), bytecodeIndex)); 361 366 } 362 367
Note:
See TracChangeset
for help on using the changeset viewer.