Changeset 39738 in webkit for trunk/JavaScriptCore/jit/JIT.cpp
- Timestamp:
- Jan 9, 2009, 12:11:00 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JIT.cpp
r39737 r39738 349 349 emitGetVirtualRegister(op1, X86::eax); 350 350 emitJumpSlowCaseIfNotImmNum(X86::eax); 351 addJump(jlPtr(X86::eax, ImmPtr(JSValuePtr::encode(getConstantOperand(op2)))), target + 3); 351 #if USE(ALTERNATE_JSIMMEDIATE) 352 int32_t op2imm = JSImmediate::intValue(getConstantOperand(op2)); 353 #else 354 int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2))); 355 #endif 356 addJump(jl32(X86::eax, Imm32(op2imm)), target + 3); 352 357 } else { 353 358 emitGetVirtualRegisters(op1, X86::eax, op2, X86::edx); 354 359 emitJumpSlowCaseIfNotImmNum(X86::eax); 355 360 emitJumpSlowCaseIfNotImmNum(X86::edx); 356 addJump(jl Ptr(X86::eax, X86::edx), target + 3);361 addJump(jl32(X86::eax, X86::edx), target + 3); 357 362 } 358 363 NEXT_OPCODE(op_loop_if_less); … … 367 372 emitGetVirtualRegister(op1, X86::eax); 368 373 emitJumpSlowCaseIfNotImmNum(X86::eax); 369 addJump(jlePtr(X86::eax, ImmPtr(JSValuePtr::encode(getConstantOperand(op2)))), target + 3); 374 #if USE(ALTERNATE_JSIMMEDIATE) 375 int32_t op2imm = JSImmediate::intValue(getConstantOperand(op2)); 376 #else 377 int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2))); 378 #endif 379 addJump(jle32(X86::eax, Imm32(op2imm)), target + 3); 370 380 } else { 371 381 emitGetVirtualRegisters(op1, X86::eax, op2, X86::edx); 372 382 emitJumpSlowCaseIfNotImmNum(X86::eax); 373 383 emitJumpSlowCaseIfNotImmNum(X86::edx); 374 addJump(jle Ptr(X86::eax, X86::edx), target + 3);384 addJump(jle32(X86::eax, X86::edx), target + 3); 375 385 } 376 386 NEXT_OPCODE(op_loop_if_less); … … 396 406 // check if any are immediates 397 407 move(X86::eax, X86::ebx); 398 or 32(X86::ecx, X86::ebx);399 or 32(X86::edx, X86::ebx);408 orPtr(X86::ecx, X86::ebx); 409 orPtr(X86::edx, X86::ebx); 400 410 emitJumpSlowCaseIfNotJSCell(X86::ebx); 401 411 … … 564 574 emitGetVirtualRegisters(currentInstruction[2].u.operand, X86::eax, currentInstruction[3].u.operand, X86::edx); 565 575 emitJumpSlowCaseIfNotImmNum(X86::edx); 576 #if USE(ALTERNATE_JSIMMEDIATE) 577 // This is technically incorrect - we're zero-extending an int32. On the hot path this doesn't matter. 578 // We check the value as if it was a uint32 against the m_fastAccessCutoff - which will always fail if 579 // number was signed since m_fastAccessCutoff is always less than intmax (since the total allocation 580 // size is always less than 4Gb). As such zero extending wil have been correct (and extending the value 581 // to 64-bits is necessary since it's used in the address calculation. We zero extend rather than sign 582 // extending since it makes it easier to re-tag the value in the slow case. 583 zeroExtend32ToPtr(X86::edx, X86::edx); 584 #else 566 585 emitFastArithImmToInt(X86::edx); 586 #endif 567 587 emitJumpSlowCaseIfNotJSCell(X86::eax); 568 588 addSlowCase(jnePtr(Address(X86::eax), ImmPtr(m_interpreter->m_jsArrayVptr))); … … 592 612 emitGetVirtualRegisters(currentInstruction[1].u.operand, X86::eax, currentInstruction[2].u.operand, X86::edx); 593 613 emitJumpSlowCaseIfNotImmNum(X86::edx); 614 #if USE(ALTERNATE_JSIMMEDIATE) 615 // See comment in op_get_by_val. 616 zeroExtend32ToPtr(X86::edx, X86::edx); 617 #else 594 618 emitFastArithImmToInt(X86::edx); 619 #endif 595 620 emitJumpSlowCaseIfNotJSCell(X86::eax); 596 621 addSlowCase(jnePtr(Address(X86::eax), ImmPtr(m_interpreter->m_jsArrayVptr))); … … 620 645 621 646 Jump isZero = jePtr(X86::eax, ImmPtr(JSValuePtr::encode(JSImmediate::zeroImmediate()))); 622 addJump( jnz32(X86::eax, Imm32(JSImmediate::TagBitTypeInteger)), target + 2);647 addJump(emitJumpIfImmNum(X86::eax), target + 2); 623 648 624 649 addJump(jePtr(X86::eax, ImmPtr(JSValuePtr::encode(jsBoolean(true)))), target + 2); … … 692 717 emitGetVirtualRegister(op1, X86::eax); 693 718 emitJumpSlowCaseIfNotImmNum(X86::eax); 694 addJump(jgePtr(X86::eax, ImmPtr(JSValuePtr::encode(getConstantOperand(op2)))), target + 3); 719 #if USE(ALTERNATE_JSIMMEDIATE) 720 int32_t op2imm = JSImmediate::intValue(getConstantOperand(op2)); 721 #else 722 int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2))); 723 #endif 724 addJump(jge32(X86::eax, Imm32(op2imm)), target + 3); 695 725 } else { 696 726 emitGetVirtualRegisters(op1, X86::eax, op2, X86::edx); 697 727 emitJumpSlowCaseIfNotImmNum(X86::eax); 698 728 emitJumpSlowCaseIfNotImmNum(X86::edx); 699 addJump(jge Ptr(X86::eax, X86::edx), target + 3);729 addJump(jge32(X86::eax, X86::edx), target + 3); 700 730 } 701 731 NEXT_OPCODE(op_jnless); … … 703 733 case op_not: { 704 734 emitGetVirtualRegister(currentInstruction[2].u.operand, X86::eax); 705 xorPtr(Imm32( JSImmediate::FullTagTypeBool), X86::eax);706 addSlowCase(jnz 32(X86::eax, Imm32(JSImmediate::FullTagTypeMask)));707 xorPtr(Imm32( JSImmediate::FullTagTypeBool | JSImmediate::ExtendedPayloadBitBoolValue), X86::eax);735 xorPtr(Imm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool)), X86::eax); 736 addSlowCase(jnzPtr(X86::eax, Imm32(static_cast<int32_t>(~JSImmediate::ExtendedPayloadBitBoolValue)))); 737 xorPtr(Imm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool | JSImmediate::ExtendedPayloadBitBoolValue)), X86::eax); 708 738 emitPutVirtualRegister(currentInstruction[1].u.operand); 709 739 NEXT_OPCODE(op_not); … … 714 744 715 745 addJump(jePtr(X86::eax, ImmPtr(JSValuePtr::encode(JSImmediate::zeroImmediate()))), target + 2); 716 Jump isNonZero = jnz32(X86::eax, Imm32(JSImmediate::TagBitTypeInteger));746 Jump isNonZero = emitJumpIfImmNum(X86::eax); 717 747 718 748 addJump(jePtr(X86::eax, ImmPtr(JSValuePtr::encode(jsBoolean(false)))), target + 2); … … 807 837 emitGetVirtualRegister(currentInstruction[2].u.operand, X86::eax); 808 838 emitJumpSlowCaseIfNotImmNum(X86::eax); 809 xorPtr(Imm32(~JSImmediate::TagBitTypeInteger), X86::eax); 839 #if USE(ALTERNATE_JSIMMEDIATE) 840 not32(X86::eax); 841 emitFastArithIntToImmNoCheck(X86::eax, X86::eax); 842 #else 843 xorPtr(Imm32(~JSImmediate::TagTypeInteger), X86::eax); 844 #endif 810 845 emitPutVirtualRegister(currentInstruction[1].u.operand); 811 846 NEXT_OPCODE(op_bitnot); … … 835 870 836 871 Jump isZero = jePtr(X86::eax, ImmPtr(JSValuePtr::encode(JSImmediate::zeroImmediate()))); 837 addJump( jnz32(X86::eax, Imm32(JSImmediate::TagBitTypeInteger)), target + 2);872 addJump(emitJumpIfImmNum(X86::eax), target + 2); 838 873 839 874 addJump(jePtr(X86::eax, ImmPtr(JSValuePtr::encode(jsBoolean(true)))), target + 2); … … 863 898 emitJumpSlowCaseIfNotImmNums(X86::eax, X86::edx, X86::ecx); 864 899 xorPtr(X86::edx, X86::eax); 865 emitFastArithReTagImmediate(X86::eax );900 emitFastArithReTagImmediate(X86::eax, X86::eax); 866 901 emitPutVirtualRegister(currentInstruction[1].u.operand); 867 902 NEXT_OPCODE(op_bitxor); … … 946 981 emitGetVirtualRegister(srcVReg, X86::eax); 947 982 948 Jump wasImmediate = jnz32(X86::eax, Imm32(JSImmediate::TagBitTypeInteger));983 Jump wasImmediate = emitJumpIfImmNum(X86::eax); 949 984 950 985 emitJumpSlowCaseIfNotJSCell(X86::eax, srcVReg); … … 1254 1289 linkSlowCase(iter); 1255 1290 linkSlowCase(iter); 1256 emitFastArithIntToImmNoCheck(X86::edx );1291 emitFastArithIntToImmNoCheck(X86::edx, X86::edx); 1257 1292 notImm.link(this); 1258 1293 emitPutJITStubArg(X86::eax, 1); … … 1343 1378 linkSlowCase(iter); 1344 1379 linkSlowCase(iter); 1345 emitFastArithIntToImmNoCheck(X86::edx );1380 emitFastArithIntToImmNoCheck(X86::edx, X86::edx); 1346 1381 notImm.link(this); 1347 1382 emitGetVirtualRegister(currentInstruction[3].u.operand, X86::ecx); … … 1396 1431 case op_not: { 1397 1432 linkSlowCase(iter); 1398 xorPtr(Imm32( JSImmediate::FullTagTypeBool), X86::eax);1433 xorPtr(Imm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool)), X86::eax); 1399 1434 emitPutJITStubArg(X86::eax, 1); 1400 1435 emitCTICall(Interpreter::cti_op_not); … … 1690 1725 Jump array_failureCases3 = ja32(X86::eax, Imm32(JSImmediate::maxImmediateInt)); 1691 1726 1692 // X86::eax contains a 64 bit value (is signed, is zero extended) so we don't need sign extend here.1693 emitFastArithIntToImmNoCheck(X86::eax );1727 // X86::eax contains a 64 bit value (is positive, is zero extended) so we don't need sign extend here. 1728 emitFastArithIntToImmNoCheck(X86::eax, X86::eax); 1694 1729 1695 1730 ret(); … … 1708 1743 Jump string_failureCases3 = ja32(X86::eax, Imm32(JSImmediate::maxImmediateInt)); 1709 1744 1710 // X86::eax contains a 64 bit value (is signed, is zero extended) so we don't need sign extend here.1711 emitFastArithIntToImmNoCheck(X86::eax );1745 // X86::eax contains a 64 bit value (is positive, is zero extended) so we don't need sign extend here. 1746 emitFastArithIntToImmNoCheck(X86::eax, X86::eax); 1712 1747 1713 1748 ret();
Note:
See TracChangeset
for help on using the changeset viewer.