Changeset 58902 in webkit for trunk/JavaScriptCore/jit/JITArithmetic.cpp
- Timestamp:
- May 6, 2010, 12:39:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JITArithmetic.cpp
r58562 r58902 311 311 // - int immediate to int immediate 312 312 313 if (isOperandConstantImmediateChar(op1)) { 314 emitGetVirtualRegister(op2, regT0); 315 addSlowCase(emitJumpIfNotJSCell(regT0)); 316 JumpList failures; 317 emitLoadCharacterString(regT0, regT0, failures); 318 addSlowCase(failures); 319 addJump(branch32(LessThanOrEqual, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target); 320 return; 321 } 322 if (isOperandConstantImmediateChar(op2)) { 323 emitGetVirtualRegister(op1, regT0); 324 addSlowCase(emitJumpIfNotJSCell(regT0)); 325 JumpList failures; 326 emitLoadCharacterString(regT0, regT0, failures); 327 addSlowCase(failures); 328 addJump(branch32(GreaterThanOrEqual, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target); 329 return; 330 } 313 331 if (isOperandConstantImmediateInt(op2)) { 314 332 emitGetVirtualRegister(op1, regT0); … … 348 366 // - constant int immediate to floating-point number 349 367 // - floating-point number to floating-point number. 368 if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) { 369 linkSlowCase(iter); 370 linkSlowCase(iter); 371 linkSlowCase(iter); 372 linkSlowCase(iter); 373 JITStubCall stubCall(this, cti_op_jlesseq); 374 stubCall.addArgument(op1, regT0); 375 stubCall.addArgument(op2, regT1); 376 stubCall.call(); 377 emitJumpSlowToHot(branchTest32(Zero, regT0), target); 378 return; 379 } 350 380 351 381 if (isOperandConstantImmediateInt(op2)) { … … 496 526 // - int immediate to int immediate 497 527 528 if (isOperandConstantImmediateChar(op1)) { 529 emitGetVirtualRegister(op2, regT0); 530 addSlowCase(emitJumpIfNotJSCell(regT0)); 531 JumpList failures; 532 emitLoadCharacterString(regT0, regT0, failures); 533 addSlowCase(failures); 534 addJump(branch32(GreaterThan, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target); 535 return; 536 } 537 if (isOperandConstantImmediateChar(op2)) { 538 emitGetVirtualRegister(op1, regT0); 539 addSlowCase(emitJumpIfNotJSCell(regT0)); 540 JumpList failures; 541 emitLoadCharacterString(regT0, regT0, failures); 542 addSlowCase(failures); 543 addJump(branch32(LessThan, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target); 544 return; 545 } 498 546 if (isOperandConstantImmediateInt(op2)) { 499 547 emitGetVirtualRegister(op1, regT0); … … 533 581 // - constant int immediate to floating-point number 534 582 // - floating-point number to floating-point number. 583 if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) { 584 linkSlowCase(iter); 585 linkSlowCase(iter); 586 linkSlowCase(iter); 587 linkSlowCase(iter); 588 JITStubCall stubCall(this, cti_op_jlesseq); 589 stubCall.addArgument(op1, regT0); 590 stubCall.addArgument(op2, regT1); 591 stubCall.call(); 592 emitJumpSlowToHot(branchTest32(NonZero, regT0), target); 593 return; 594 } 535 595 536 596 if (isOperandConstantImmediateInt(op2)) { … … 670 730 } 671 731 672 void JIT::emit_op_j nlesseq(Instruction* currentInstruction)732 void JIT::emit_op_jlesseq(Instruction* currentInstruction, bool invert) 673 733 { 674 734 unsigned op1 = currentInstruction[1].u.operand; … … 681 741 // - int immediate to int immediate 682 742 743 if (isOperandConstantImmediateChar(op1)) { 744 emitGetVirtualRegister(op2, regT0); 745 addSlowCase(emitJumpIfNotJSCell(regT0)); 746 JumpList failures; 747 emitLoadCharacterString(regT0, regT0, failures); 748 addSlowCase(failures); 749 addJump(branch32(invert ? LessThan : GreaterThanOrEqual, regT0, Imm32(asString(getConstantOperand(op1))->tryGetValue()[0])), target); 750 return; 751 } 752 if (isOperandConstantImmediateChar(op2)) { 753 emitGetVirtualRegister(op1, regT0); 754 addSlowCase(emitJumpIfNotJSCell(regT0)); 755 JumpList failures; 756 emitLoadCharacterString(regT0, regT0, failures); 757 addSlowCase(failures); 758 addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, Imm32(asString(getConstantOperand(op2))->tryGetValue()[0])), target); 759 return; 760 } 683 761 if (isOperandConstantImmediateInt(op2)) { 684 762 emitGetVirtualRegister(op1, regT0); … … 689 767 int32_t op2imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op2))); 690 768 #endif 691 addJump(branch32( GreaterThan, regT0, Imm32(op2imm)), target);769 addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, Imm32(op2imm)), target); 692 770 } else if (isOperandConstantImmediateInt(op1)) { 693 771 emitGetVirtualRegister(op2, regT1); … … 698 776 int32_t op1imm = static_cast<int32_t>(JSImmediate::rawValue(getConstantOperand(op1))); 699 777 #endif 700 addJump(branch32( LessThan, regT1, Imm32(op1imm)), target);778 addJump(branch32(invert ? LessThan : GreaterThanOrEqual, regT1, Imm32(op1imm)), target); 701 779 } else { 702 780 emitGetVirtualRegisters(op1, regT0, op2, regT1); … … 704 782 emitJumpSlowCaseIfNotImmediateInteger(regT1); 705 783 706 addJump(branch32( GreaterThan, regT0, regT1), target);707 } 708 } 709 710 void JIT::emitSlow_op_j nlesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)784 addJump(branch32(invert ? GreaterThan : LessThanOrEqual, regT0, regT1), target); 785 } 786 } 787 788 void JIT::emitSlow_op_jlesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter, bool invert) 711 789 { 712 790 unsigned op1 = currentInstruction[1].u.operand; … … 719 797 // - floating-point number to floating-point number. 720 798 799 if (isOperandConstantImmediateChar(op1) || isOperandConstantImmediateChar(op2)) { 800 linkSlowCase(iter); 801 linkSlowCase(iter); 802 linkSlowCase(iter); 803 linkSlowCase(iter); 804 JITStubCall stubCall(this, cti_op_jlesseq); 805 stubCall.addArgument(op1, regT0); 806 stubCall.addArgument(op2, regT1); 807 stubCall.call(); 808 emitJumpSlowToHot(branchTest32(invert ? Zero : NonZero, regT0), target); 809 return; 810 } 811 721 812 if (isOperandConstantImmediateInt(op2)) { 722 813 linkSlowCase(iter); … … 741 832 convertInt32ToDouble(regT1, fpRegT1); 742 833 743 emitJumpSlowToHot(branchDouble( DoubleLessThanOrUnordered, fpRegT1, fpRegT0), target);834 emitJumpSlowToHot(branchDouble(invert ? DoubleLessThanOrUnordered : DoubleGreaterThanOrEqual, fpRegT1, fpRegT0), target); 744 835 745 836 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq)); … … 758 849 stubCall.addArgument(op2, regT2); 759 850 stubCall.call(); 760 emitJumpSlowToHot(branchTest32( Zero, regT0), target);851 emitJumpSlowToHot(branchTest32(invert ? Zero : NonZero, regT0), target); 761 852 762 853 } else if (isOperandConstantImmediateInt(op1)) { … … 782 873 convertInt32ToDouble(regT0, fpRegT0); 783 874 784 emitJumpSlowToHot(branchDouble( DoubleLessThanOrUnordered, fpRegT1, fpRegT0), target);875 emitJumpSlowToHot(branchDouble(invert ? DoubleLessThanOrUnordered : DoubleGreaterThanOrEqual, fpRegT1, fpRegT0), target); 785 876 786 877 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq)); … … 799 890 stubCall.addArgument(regT1); 800 891 stubCall.call(); 801 emitJumpSlowToHot(branchTest32( Zero, regT0), target);892 emitJumpSlowToHot(branchTest32(invert ? Zero : NonZero, regT0), target); 802 893 803 894 } else { … … 828 919 #endif 829 920 830 emitJumpSlowToHot(branchDouble( DoubleLessThanOrUnordered, fpRegT1, fpRegT0), target);921 emitJumpSlowToHot(branchDouble(invert ? DoubleLessThanOrUnordered : DoubleGreaterThanOrEqual, fpRegT1, fpRegT0), target); 831 922 832 923 emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_jnlesseq)); … … 851 942 stubCall.addArgument(regT1); 852 943 stubCall.call(); 853 emitJumpSlowToHot(branchTest32(Zero, regT0), target); 854 } 944 emitJumpSlowToHot(branchTest32(invert ? Zero : NonZero, regT0), target); 945 } 946 } 947 948 void JIT::emit_op_jnlesseq(Instruction* currentInstruction) 949 { 950 emit_op_jlesseq(currentInstruction, true); 951 } 952 953 void JIT::emitSlow_op_jnlesseq(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 954 { 955 emitSlow_op_jlesseq(currentInstruction, iter, true); 855 956 } 856 957
Note:
See TracChangeset
for help on using the changeset viewer.