Changeset 39540 in webkit for trunk/JavaScriptCore/jit/JIT.cpp
- Timestamp:
- Jan 1, 2009, 7:06:10 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JIT.cpp
r39524 r39540 228 228 229 229 // They are equal - set the result to true. (Or false, if negated). 230 move(Imm 32(asInteger(jsBoolean(!negated))), X86::eax);230 move(ImmPtr(jsBoolean(!negated)), X86::eax); 231 231 Jump bothWereImmediatesAndEqual = jump(); 232 232 … … 236 236 firstNotImmediate.link(this); 237 237 emitJumpSlowCaseIfJSCell(X86::edx); 238 addSlowCase(je 32(X86::edx, Imm32(asInteger(JSImmediate::zeroImmediate()))));238 addSlowCase(jePtr(X86::edx, ImmPtr(JSImmediate::zeroImmediate()))); 239 239 Jump firstWasNotImmediate = jump(); 240 240 … … 242 242 // If eax is 0 jump to a slow case, otherwise these values are not equal. 243 243 secondNotImmediate.link(this); 244 addSlowCase(je 32(X86::eax, Imm32(asInteger(JSImmediate::zeroImmediate()))));244 addSlowCase(jePtr(X86::eax, ImmPtr(JSImmediate::zeroImmediate()))); 245 245 246 246 // We get here if the two values are different immediates, or one is 0 and the other is a JSCell. … … 248 248 bothWereImmediatesButNotEqual.link(this); 249 249 firstWasNotImmediate.link(this); 250 move(Imm 32(asInteger(jsBoolean(negated))), X86::eax);250 move(ImmPtr(jsBoolean(negated)), X86::eax); 251 251 252 252 bothWereImmediatesAndEqual.link(this); … … 313 313 } 314 314 case op_add: { 315 unsigned dst = currentInstruction[1].u.operand; 316 unsigned src1 = currentInstruction[2].u.operand; 317 unsigned src2 = currentInstruction[3].u.operand; 318 319 if (JSValue* value = getConstantImmediateNumericArg(src1)) { 320 emitGetVirtualRegister(src2, X86::eax); 321 emitJumpSlowCaseIfNotImmNum(X86::eax); 322 addSlowCase(joAdd32(Imm32(getDeTaggedConstantImmediate(value)), X86::eax)); 323 signExtend32ToPtr(X86::eax, X86::eax); 324 emitPutVirtualRegister(dst); 325 } else if (JSValue* value = getConstantImmediateNumericArg(src2)) { 326 emitGetVirtualRegister(src1, X86::eax); 327 emitJumpSlowCaseIfNotImmNum(X86::eax); 328 addSlowCase(joAdd32(Imm32(getDeTaggedConstantImmediate(value)), X86::eax)); 329 signExtend32ToPtr(X86::eax, X86::eax); 330 emitPutVirtualRegister(dst); 331 } else { 332 OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); 333 if (types.first().mightBeNumber() && types.second().mightBeNumber()) 334 compileBinaryArithOp(op_add, currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand, OperandTypes::fromInt(currentInstruction[4].u.operand)); 335 else { 336 emitPutJITStubArgFromVirtualRegister(currentInstruction[2].u.operand, 1, X86::ecx); 337 emitPutJITStubArgFromVirtualRegister(currentInstruction[3].u.operand, 2, X86::ecx); 338 emitCTICall(Interpreter::cti_op_add); 339 emitPutVirtualRegister(currentInstruction[1].u.operand); 340 } 341 } 315 compileFastArith_op_add(currentInstruction); 342 316 NEXT_OPCODE(op_add); 343 317 } … … 356 330 } 357 331 case op_pre_inc: { 358 int srcDst = currentInstruction[1].u.operand; 359 emitGetVirtualRegister(srcDst, X86::eax); 360 emitJumpSlowCaseIfNotImmNum(X86::eax); 361 addSlowCase(joAdd32(Imm32(getDeTaggedConstantImmediate(JSImmediate::oneImmediate())), X86::eax)); 362 signExtend32ToPtr(X86::eax, X86::eax); 363 emitPutVirtualRegister(srcDst); 332 compileFastArith_op_pre_inc(currentInstruction[1].u.operand); 364 333 NEXT_OPCODE(op_pre_inc); 365 334 } … … 374 343 emitSlowScriptCheck(); 375 344 345 unsigned op1 = currentInstruction[1].u.operand; 346 unsigned op2 = currentInstruction[2].u.operand; 376 347 unsigned target = currentInstruction[3].u.operand; 377 JSValue* src2imm = getConstantImmediateNumericArg(currentInstruction[2].u.operand); 378 if (src2imm) { 379 emitGetVirtualRegister(currentInstruction[1].u.operand, X86::eax); 348 if (isOperandConstantImmediateInt(op2)) { 349 emitGetVirtualRegister(op1, X86::eax); 380 350 emitJumpSlowCaseIfNotImmNum(X86::eax); 381 addJump(jl 32(X86::eax, Imm32(asInteger(src2imm))), target + 3);351 addJump(jlPtr(X86::eax, ImmPtr(getConstantOperand(op2))), target + 3); 382 352 } else { 383 emitGetVirtualRegisters( currentInstruction[1].u.operand, X86::eax, currentInstruction[2].u.operand, X86::edx);353 emitGetVirtualRegisters(op1, X86::eax, op2, X86::edx); 384 354 emitJumpSlowCaseIfNotImmNum(X86::eax); 385 355 emitJumpSlowCaseIfNotImmNum(X86::edx); 386 addJump(jl 32(X86::eax, X86::edx), target + 3);356 addJump(jlPtr(X86::eax, X86::edx), target + 3); 387 357 } 388 358 NEXT_OPCODE(op_loop_if_less); … … 391 361 emitSlowScriptCheck(); 392 362 363 unsigned op1 = currentInstruction[1].u.operand; 364 unsigned op2 = currentInstruction[2].u.operand; 393 365 unsigned target = currentInstruction[3].u.operand; 394 JSValue* src2imm = getConstantImmediateNumericArg(currentInstruction[2].u.operand); 395 if (src2imm) { 396 emitGetVirtualRegister(currentInstruction[1].u.operand, X86::eax); 366 if (isOperandConstantImmediateInt(op2)) { 367 emitGetVirtualRegister(op1, X86::eax); 397 368 emitJumpSlowCaseIfNotImmNum(X86::eax); 398 addJump(jle 32(X86::eax, Imm32(asInteger(src2imm))), target + 3);369 addJump(jlePtr(X86::eax, ImmPtr(getConstantOperand(op2))), target + 3); 399 370 } else { 400 emitGetVirtualRegisters( currentInstruction[1].u.operand, X86::eax, currentInstruction[2].u.operand, X86::edx);371 emitGetVirtualRegisters(op1, X86::eax, op2, X86::edx); 401 372 emitJumpSlowCaseIfNotImmNum(X86::eax); 402 373 emitJumpSlowCaseIfNotImmNum(X86::edx); 403 addJump(jle 32(X86::eax, X86::edx), target + 3);374 addJump(jlePtr(X86::eax, X86::edx), target + 3); 404 375 } 405 NEXT_OPCODE(op_loop_if_less eq);376 NEXT_OPCODE(op_loop_if_less); 406 377 } 407 378 case op_new_object: { … … 449 420 450 421 // optimistically load true result 451 move(Imm 32(asInteger(jsBoolean(true))), X86::eax);422 move(ImmPtr(jsBoolean(true)), X86::eax); 452 423 453 424 Label loop(this); … … 459 430 Jump exit = jePtr(X86::ecx, X86::edx); 460 431 461 jne 32(X86::ecx, Imm32(asInteger(jsNull())), loop);462 463 move(Imm 32(asInteger(jsBoolean(false))), X86::eax);432 jnePtr(X86::ecx, ImmPtr(jsNull()), loop); 433 434 move(ImmPtr(jsBoolean(false)), X86::eax); 464 435 465 436 exit.link(this); … … 478 449 } 479 450 case op_mul: { 480 unsigned dst = currentInstruction[1].u.operand; 481 unsigned src1 = currentInstruction[2].u.operand; 482 unsigned src2 = currentInstruction[3].u.operand; 483 484 // For now, only plant a fast int case if the constant operand is greater than zero. 485 JSValue* src1Value = getConstantImmediateNumericArg(src1); 486 JSValue* src2Value = getConstantImmediateNumericArg(src2); 487 int32_t value; 488 if (src1Value && ((value = JSImmediate::intValue(src1Value)) > 0)) { 489 emitGetVirtualRegister(src2, X86::eax); 490 emitJumpSlowCaseIfNotImmNum(X86::eax); 491 emitFastArithDeTagImmediate(X86::eax); 492 addSlowCase(joMul32(Imm32(value), X86::eax, X86::eax)); 493 emitFastArithReTagImmediate(X86::eax); 494 emitPutVirtualRegister(dst); 495 } else if (src2Value && ((value = JSImmediate::intValue(src2Value)) > 0)) { 496 emitGetVirtualRegister(src1, X86::eax); 497 emitJumpSlowCaseIfNotImmNum(X86::eax); 498 emitFastArithDeTagImmediate(X86::eax); 499 addSlowCase(joMul32(Imm32(value), X86::eax, X86::eax)); 500 emitFastArithReTagImmediate(X86::eax); 501 emitPutVirtualRegister(dst); 502 } else 503 compileBinaryArithOp(op_mul, currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand, OperandTypes::fromInt(currentInstruction[4].u.operand)); 504 451 compileFastArith_op_mul(currentInstruction); 505 452 NEXT_OPCODE(op_mul); 506 453 } … … 672 619 emitGetVirtualRegister(currentInstruction[1].u.operand, X86::eax); 673 620 674 Jump isZero = je 32(X86::eax, Imm32(asInteger(JSImmediate::zeroImmediate())));621 Jump isZero = jePtr(X86::eax, ImmPtr(JSImmediate::zeroImmediate())); 675 622 addJump(jnz32(X86::eax, Imm32(JSImmediate::TagBitTypeInteger)), target + 2); 676 623 677 addJump(je 32(X86::eax, Imm32(asInteger(JSImmediate::trueImmediate()))), target + 2);678 addSlowCase(jne 32(X86::eax, Imm32(asInteger(JSImmediate::falseImmediate()))));624 addJump(jePtr(X86::eax, ImmPtr(jsBoolean(true))), target + 2); 625 addSlowCase(jnePtr(X86::eax, ImmPtr(jsBoolean(false)))); 679 626 680 627 isZero.link(this); … … 735 682 CTI_COMPILE_BINARY_OP(op_div) 736 683 case op_pre_dec: { 737 int srcDst = currentInstruction[1].u.operand; 738 emitGetVirtualRegister(srcDst, X86::eax); 739 emitJumpSlowCaseIfNotImmNum(X86::eax); 740 addSlowCase(joSub32(Imm32(getDeTaggedConstantImmediate(JSImmediate::oneImmediate())), X86::eax)); 741 signExtend32ToPtr(X86::eax, X86::eax); 742 emitPutVirtualRegister(srcDst); 684 compileFastArith_op_pre_dec(currentInstruction[1].u.operand); 743 685 NEXT_OPCODE(op_pre_dec); 744 686 } 745 687 case op_jnless: { 688 unsigned op1 = currentInstruction[1].u.operand; 689 unsigned op2 = currentInstruction[2].u.operand; 746 690 unsigned target = currentInstruction[3].u.operand; 747 JSValue* src2imm = getConstantImmediateNumericArg(currentInstruction[2].u.operand); 748 if (src2imm) { 749 emitGetVirtualRegister(currentInstruction[1].u.operand, X86::edx); 750 emitJumpSlowCaseIfNotImmNum(X86::edx); 751 addJump(jge32(X86::edx, Imm32(asInteger(src2imm))), target + 3); 691 if (isOperandConstantImmediateInt(op2)) { 692 emitGetVirtualRegister(op1, X86::eax); 693 emitJumpSlowCaseIfNotImmNum(X86::eax); 694 addJump(jgePtr(X86::eax, ImmPtr(getConstantOperand(op2))), target + 3); 752 695 } else { 753 emitGetVirtualRegisters( currentInstruction[1].u.operand, X86::eax, currentInstruction[2].u.operand, X86::edx);696 emitGetVirtualRegisters(op1, X86::eax, op2, X86::edx); 754 697 emitJumpSlowCaseIfNotImmNum(X86::eax); 755 698 emitJumpSlowCaseIfNotImmNum(X86::edx); 756 addJump(jge 32(X86::eax, X86::edx), target + 3);699 addJump(jgePtr(X86::eax, X86::edx), target + 3); 757 700 } 758 701 NEXT_OPCODE(op_jnless); … … 770 713 emitGetVirtualRegister(currentInstruction[1].u.operand, X86::eax); 771 714 772 addJump(je 32(X86::eax, Imm32(asInteger(JSImmediate::zeroImmediate()))), target + 2);715 addJump(jePtr(X86::eax, ImmPtr(JSImmediate::zeroImmediate())), target + 2); 773 716 Jump isNonZero = jnz32(X86::eax, Imm32(JSImmediate::TagBitTypeInteger)); 774 717 775 addJump(je 32(X86::eax, Imm32(asInteger(JSImmediate::falseImmediate()))), target + 2);776 addSlowCase(jne 32(X86::eax, Imm32(asInteger(JSImmediate::trueImmediate()))));718 addJump(jePtr(X86::eax, ImmPtr(jsBoolean(false))), target + 2); 719 addSlowCase(jnePtr(X86::eax, ImmPtr(jsBoolean(true)))); 777 720 778 721 isNonZero.link(this); … … 794 737 isImmediate.link(this); 795 738 and32(Imm32(~JSImmediate::ExtendedTagBitUndefined), X86::eax); 796 addJump(je 32(X86::eax, Imm32(asInteger(jsNull()))), target + 2);739 addJump(jePtr(X86::eax, ImmPtr(jsNull())), target + 2); 797 740 798 741 wasNotImmediate.link(this); … … 814 757 isImmediate.link(this); 815 758 and32(Imm32(~JSImmediate::ExtendedTagBitUndefined), X86::eax); 816 addJump(jne 32(X86::eax, Imm32(asInteger(jsNull()))), target + 2);759 addJump(jnePtr(X86::eax, ImmPtr(jsNull())), target + 2); 817 760 818 761 wasNotImmediate.link(this); … … 820 763 } 821 764 case op_post_inc: { 822 int srcDst = currentInstruction[2].u.operand; 823 emitGetVirtualRegister(srcDst, X86::eax); 824 move(X86::eax, X86::edx); 825 emitJumpSlowCaseIfNotImmNum(X86::eax); 826 addSlowCase(joAdd32(Imm32(getDeTaggedConstantImmediate(JSImmediate::oneImmediate())), X86::edx)); 827 signExtend32ToPtr(X86::edx, X86::edx); 828 emitPutVirtualRegister(srcDst, X86::edx); 829 emitPutVirtualRegister(currentInstruction[1].u.operand); 765 compileFastArith_op_post_inc(currentInstruction[1].u.operand, currentInstruction[2].u.operand); 830 766 NEXT_OPCODE(op_post_inc); 831 767 } … … 857 793 } 858 794 case op_lshift: { 859 emitGetVirtualRegisters(currentInstruction[2].u.operand, X86::eax, currentInstruction[3].u.operand, X86::ecx); 860 emitJumpSlowCaseIfNotImmNum(X86::eax); 861 emitJumpSlowCaseIfNotImmNum(X86::ecx); 862 emitFastArithImmToInt(X86::eax); 863 emitFastArithImmToInt(X86::ecx); 864 lshift32(X86::ecx, X86::eax); 865 emitFastArithIntToImmOrSlowCase(X86::eax); 866 emitPutVirtualRegister(currentInstruction[1].u.operand); 795 compileFastArith_op_lshift(currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand); 867 796 NEXT_OPCODE(op_lshift); 868 797 } 869 798 case op_bitand: { 870 unsigned src1 = currentInstruction[2].u.operand; 871 unsigned src2 = currentInstruction[3].u.operand; 872 unsigned dst = currentInstruction[1].u.operand; 873 if (JSValue* value = getConstantImmediateNumericArg(src1)) { 874 emitGetVirtualRegister(src2, X86::eax); 875 emitJumpSlowCaseIfNotImmNum(X86::eax); 876 andPtr(Imm32(asInteger(value)), X86::eax); // FIXME: make it more obvious this is relying on the format of JSImmediate 877 emitPutVirtualRegister(dst); 878 } else if (JSValue* value = getConstantImmediateNumericArg(src2)) { 879 emitGetVirtualRegister(src1, X86::eax); 880 emitJumpSlowCaseIfNotImmNum(X86::eax); 881 andPtr(Imm32(asInteger(value)), X86::eax); 882 emitPutVirtualRegister(dst); 883 } else { 884 emitGetVirtualRegisters(src1, X86::eax, src2, X86::edx); 885 andPtr(X86::edx, X86::eax); 886 emitJumpSlowCaseIfNotImmNum(X86::eax); 887 emitPutVirtualRegister(dst); 888 } 799 compileFastArith_op_bitand(currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand); 889 800 NEXT_OPCODE(op_bitand); 890 801 } 891 802 case op_rshift: { 892 unsigned src1 = currentInstruction[2].u.operand; 893 unsigned src2 = currentInstruction[3].u.operand; 894 if (JSValue* value = getConstantImmediateNumericArg(src2)) { 895 emitGetVirtualRegister(src1, X86::eax); 896 emitJumpSlowCaseIfNotImmNum(X86::eax); 897 // Mask with 0x1f as per ecma-262 11.7.2 step 7. 898 rshift32(Imm32(JSImmediate::getTruncatedUInt32(value) & 0x1f), X86::eax); 899 } else { 900 emitGetVirtualRegisters(src1, X86::eax, src2, X86::ecx); 901 emitJumpSlowCaseIfNotImmNum(X86::eax); 902 emitJumpSlowCaseIfNotImmNum(X86::ecx); 903 emitFastArithImmToInt(X86::ecx); 904 rshift32(X86::ecx, X86::eax); 905 } 906 emitFastArithPotentiallyReTagImmediate(X86::eax); 907 emitPutVirtualRegister(currentInstruction[1].u.operand); 803 compileFastArith_op_rshift(currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand); 908 804 NEXT_OPCODE(op_rshift); 909 805 } … … 931 827 } 932 828 case op_mod: { 933 emitGetVirtualRegisters(currentInstruction[2].u.operand, X86::eax, currentInstruction[3].u.operand, X86::ecx); 934 emitJumpSlowCaseIfNotImmNum(X86::eax); 935 emitJumpSlowCaseIfNotImmNum(X86::ecx); 936 emitFastArithDeTagImmediate(X86::eax); 937 addSlowCase(emitFastArithDeTagImmediateJumpIfZero(X86::ecx)); 938 mod32(X86::ecx, X86::eax, X86::edx); 939 emitFastArithReTagImmediate(X86::edx); 940 move(X86::edx, X86::eax); 941 emitPutVirtualRegister(currentInstruction[1].u.operand); 829 compileFastArith_op_mod(currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand); 942 830 NEXT_OPCODE(op_mod); 943 831 } … … 946 834 emitGetVirtualRegister(currentInstruction[1].u.operand, X86::eax); 947 835 948 Jump isZero = je 32(X86::eax, Imm32(asInteger(JSImmediate::zeroImmediate())));836 Jump isZero = jePtr(X86::eax, ImmPtr(JSImmediate::zeroImmediate())); 949 837 addJump(jnz32(X86::eax, Imm32(JSImmediate::TagBitTypeInteger)), target + 2); 950 838 951 addJump(je 32(X86::eax, Imm32(asInteger(JSImmediate::trueImmediate()))), target + 2);952 addSlowCase(jne 32(X86::eax, Imm32(asInteger(JSImmediate::falseImmediate()))));839 addJump(jePtr(X86::eax, ImmPtr(jsBoolean(true))), target + 2); 840 addSlowCase(jnePtr(X86::eax, ImmPtr(jsBoolean(false)))); 953 841 954 842 isZero.link(this); … … 967 855 } 968 856 case op_post_dec: { 969 int srcDst = currentInstruction[2].u.operand; 970 emitGetVirtualRegister(srcDst, X86::eax); 971 move(X86::eax, X86::edx); 972 emitJumpSlowCaseIfNotImmNum(X86::eax); 973 addSlowCase(joSub32(Imm32(getDeTaggedConstantImmediate(JSImmediate::oneImmediate())), X86::edx)); 974 signExtend32ToPtr(X86::edx, X86::edx); 975 emitPutVirtualRegister(srcDst, X86::edx); 976 emitPutVirtualRegister(currentInstruction[1].u.operand); 857 compileFastArith_op_post_dec(currentInstruction[1].u.operand, currentInstruction[2].u.operand); 977 858 NEXT_OPCODE(op_post_dec); 978 859 } … … 981 862 emitGetVirtualRegisters(currentInstruction[2].u.operand, X86::eax, currentInstruction[3].u.operand, X86::edx); 982 863 emitJumpSlowCaseIfNotImmNums(X86::eax, X86::edx, X86::ecx); 983 xor 32(X86::edx, X86::eax);864 xorPtr(X86::edx, X86::eax); 984 865 emitFastArithReTagImmediate(X86::eax); 985 866 emitPutVirtualRegister(currentInstruction[1].u.operand); … … 1355 1236 } 1356 1237 case op_add: { 1357 unsigned dst = currentInstruction[1].u.operand; 1358 unsigned src1 = currentInstruction[2].u.operand; 1359 unsigned src2 = currentInstruction[3].u.operand; 1360 if (JSValue* value = getConstantImmediateNumericArg(src1)) { 1361 Jump notImm = getSlowCase(iter); 1362 linkSlowCase(iter); 1363 sub32(Imm32(getDeTaggedConstantImmediate(value)), X86::eax); 1364 notImm.link(this); 1365 emitPutJITStubArgFromVirtualRegister(src1, 1, X86::ecx); 1366 emitPutJITStubArg(X86::eax, 2); 1367 emitCTICall(Interpreter::cti_op_add); 1368 emitPutVirtualRegister(dst); 1369 } else if (JSValue* value = getConstantImmediateNumericArg(src2)) { 1370 Jump notImm = getSlowCase(iter); 1371 linkSlowCase(iter); 1372 sub32(Imm32(getDeTaggedConstantImmediate(value)), X86::eax); 1373 notImm.link(this); 1374 emitPutJITStubArg(X86::eax, 1); 1375 emitPutJITStubArgFromVirtualRegister(src2, 2, X86::ecx); 1376 emitCTICall(Interpreter::cti_op_add); 1377 emitPutVirtualRegister(dst); 1378 } else { 1379 OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); 1380 ASSERT(types.first().mightBeNumber() && types.second().mightBeNumber()); 1381 compileBinaryArithOpSlowCase(op_add, iter, dst, src1, src2, types); 1382 } 1383 1238 compileFastArithSlow_op_add(currentInstruction, iter); 1384 1239 NEXT_OPCODE(op_add); 1385 1240 } … … 1426 1281 } 1427 1282 case op_rshift: { 1428 unsigned src2 = currentInstruction[3].u.operand; 1429 linkSlowCase(iter); 1430 if (getConstantImmediateNumericArg(src2)) 1431 emitPutJITStubArgFromVirtualRegister(src2, 2, X86::ecx); 1432 else { 1433 linkSlowCase(iter); 1434 emitPutJITStubArg(X86::ecx, 2); 1435 } 1436 1437 emitPutJITStubArg(X86::eax, 1); 1438 emitCTICall(Interpreter::cti_op_rshift); 1439 emitPutVirtualRegister(currentInstruction[1].u.operand); 1283 compileFastArithSlow_op_rshift(currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand, iter); 1440 1284 NEXT_OPCODE(op_rshift); 1441 1285 } 1442 1286 case op_lshift: { 1443 Jump notImm1 = getSlowCase(iter); 1444 Jump notImm2 = getSlowCase(iter); 1445 linkSlowCase(iter); 1446 emitGetVirtualRegisters(currentInstruction[2].u.operand, X86::eax, currentInstruction[3].u.operand, X86::ecx); 1447 notImm1.link(this); 1448 notImm2.link(this); 1449 emitPutJITStubArg(X86::eax, 1); 1450 emitPutJITStubArg(X86::ecx, 2); 1451 emitCTICall(Interpreter::cti_op_lshift); 1452 emitPutVirtualRegister(currentInstruction[1].u.operand); 1287 compileFastArithSlow_op_lshift(currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand, iter); 1453 1288 NEXT_OPCODE(op_lshift); 1454 1289 } … … 1500 1335 } 1501 1336 case op_pre_inc: { 1502 unsigned srcDst = currentInstruction[1].u.operand; 1503 Jump notImm = getSlowCase(iter); 1504 linkSlowCase(iter); 1505 sub32(Imm32(getDeTaggedConstantImmediate(JSImmediate::oneImmediate())), X86::eax); 1506 notImm.link(this); 1507 emitPutJITStubArg(X86::eax, 1); 1508 emitCTICall(Interpreter::cti_op_pre_inc); 1509 emitPutVirtualRegister(srcDst); 1337 compileFastArithSlow_op_pre_inc(currentInstruction[1].u.operand, iter); 1510 1338 NEXT_OPCODE(op_pre_inc); 1511 1339 } … … 1544 1372 } 1545 1373 case op_pre_dec: { 1546 unsigned srcDst = currentInstruction[1].u.operand; 1547 Jump notImm = getSlowCase(iter); 1548 linkSlowCase(iter); 1549 add32(Imm32(getDeTaggedConstantImmediate(JSImmediate::oneImmediate())), X86::eax); 1550 notImm.link(this); 1551 emitPutJITStubArg(X86::eax, 1); 1552 emitCTICall(Interpreter::cti_op_pre_dec); 1553 emitPutVirtualRegister(srcDst); 1374 compileFastArithSlow_op_pre_dec(currentInstruction[1].u.operand, iter); 1554 1375 NEXT_OPCODE(op_pre_dec); 1555 1376 } … … 1559 1380 if (src2imm) { 1560 1381 linkSlowCase(iter); 1561 emitPutJITStubArg(X86::e dx, 1);1382 emitPutJITStubArg(X86::eax, 1); 1562 1383 emitPutJITStubArgFromVirtualRegister(currentInstruction[2].u.operand, 2, X86::ecx); 1563 1384 emitCTICall(Interpreter::cti_op_jless); … … 1590 1411 } 1591 1412 case op_post_inc: { 1592 unsigned srcDst = currentInstruction[2].u.operand; 1593 linkSlowCase(iter); 1594 linkSlowCase(iter); 1595 emitPutJITStubArg(X86::eax, 1); 1596 emitCTICall(Interpreter::cti_op_post_inc); 1597 emitPutVirtualRegister(srcDst, X86::edx); 1598 emitPutVirtualRegister(currentInstruction[1].u.operand); 1413 compileFastArithSlow_op_post_inc(currentInstruction[1].u.operand, currentInstruction[2].u.operand, iter); 1599 1414 NEXT_OPCODE(op_post_inc); 1600 1415 } … … 1607 1422 } 1608 1423 case op_bitand: { 1609 linkSlowCase(iter); 1610 unsigned src1 = currentInstruction[2].u.operand; 1611 unsigned src2 = currentInstruction[3].u.operand; 1612 unsigned dst = currentInstruction[1].u.operand; 1613 if (getConstantImmediateNumericArg(src1)) { 1614 emitPutJITStubArgFromVirtualRegister(src1, 1, X86::ecx); 1615 emitPutJITStubArg(X86::eax, 2); 1616 emitCTICall(Interpreter::cti_op_bitand); 1617 emitPutVirtualRegister(dst); 1618 } else if (getConstantImmediateNumericArg(src2)) { 1619 emitPutJITStubArg(X86::eax, 1); 1620 emitPutJITStubArgFromVirtualRegister(src2, 2, X86::ecx); 1621 emitCTICall(Interpreter::cti_op_bitand); 1622 emitPutVirtualRegister(dst); 1623 } else { 1624 emitPutJITStubArgFromVirtualRegister(src1, 1, X86::ecx); 1625 emitPutJITStubArg(X86::edx, 2); 1626 emitCTICall(Interpreter::cti_op_bitand); 1627 emitPutVirtualRegister(dst); 1628 } 1424 compileFastArithSlow_op_bitand(currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand, iter); 1629 1425 NEXT_OPCODE(op_bitand); 1630 1426 } … … 1638 1434 } 1639 1435 case op_post_dec: { 1640 unsigned srcDst = currentInstruction[2].u.operand; 1641 linkSlowCase(iter); 1642 linkSlowCase(iter); 1643 emitPutJITStubArg(X86::eax, 1); 1644 emitCTICall(Interpreter::cti_op_post_dec); 1645 emitPutVirtualRegister(srcDst, X86::edx); 1646 emitPutVirtualRegister(currentInstruction[1].u.operand); 1436 compileFastArithSlow_op_post_dec(currentInstruction[1].u.operand, currentInstruction[2].u.operand, iter); 1647 1437 NEXT_OPCODE(op_post_dec); 1648 1438 } … … 1711 1501 } 1712 1502 case op_mod: { 1713 Jump notImm1 = getSlowCase(iter); 1714 Jump notImm2 = getSlowCase(iter); 1715 linkSlowCase(iter); 1716 emitFastArithReTagImmediate(X86::eax); 1717 emitFastArithReTagImmediate(X86::ecx); 1718 notImm1.link(this); 1719 notImm2.link(this); 1720 emitPutJITStubArg(X86::eax, 1); 1721 emitPutJITStubArg(X86::ecx, 2); 1722 emitCTICall(Interpreter::cti_op_mod); 1723 emitPutVirtualRegister(currentInstruction[1].u.operand); 1503 compileFastArithSlow_op_mod(currentInstruction[1].u.operand, currentInstruction[2].u.operand, currentInstruction[3].u.operand, iter); 1724 1504 NEXT_OPCODE(op_mod); 1725 1505 } 1726 1506 case op_mul: { 1727 int dst = currentInstruction[1].u.operand; 1728 int src1 = currentInstruction[2].u.operand; 1729 int src2 = currentInstruction[3].u.operand; 1730 JSValue* src1Value = getConstantImmediateNumericArg(src1); 1731 JSValue* src2Value = getConstantImmediateNumericArg(src2); 1732 int32_t value; 1733 if (src1Value && ((value = JSImmediate::intValue(src1Value)) > 0)) { 1734 linkSlowCase(iter); 1735 linkSlowCase(iter); 1736 // There is an extra slow case for (op1 * -N) or (-N * op2), to check for 0 since this should produce a result of -0. 1737 emitPutJITStubArgFromVirtualRegister(src1, 1, X86::ecx); 1738 emitPutJITStubArgFromVirtualRegister(src2, 2, X86::ecx); 1739 emitCTICall(Interpreter::cti_op_mul); 1740 emitPutVirtualRegister(dst); 1741 } else if (src2Value && ((value = JSImmediate::intValue(src2Value)) > 0)) { 1742 linkSlowCase(iter); 1743 linkSlowCase(iter); 1744 // There is an extra slow case for (op1 * -N) or (-N * op2), to check for 0 since this should produce a result of -0. 1745 emitPutJITStubArgFromVirtualRegister(src1, 1, X86::ecx); 1746 emitPutJITStubArgFromVirtualRegister(src2, 2, X86::ecx); 1747 emitCTICall(Interpreter::cti_op_mul); 1748 emitPutVirtualRegister(dst); 1749 } else 1750 compileBinaryArithOpSlowCase(op_mul, iter, dst, src1, src2, OperandTypes::fromInt(currentInstruction[4].u.operand)); 1507 compileFastArithSlow_op_mul(currentInstruction, iter); 1751 1508 NEXT_OPCODE(op_mul); 1752 1509 } … … 1933 1690 Jump array_failureCases3 = ja32(X86::eax, Imm32(JSImmediate::maxImmediateInt)); 1934 1691 1935 add32(X86::eax, X86::eax);1936 add32(Imm32(1),X86::eax);1937 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); 1694 1938 1695 ret(); 1939 1696 … … 1951 1708 Jump string_failureCases3 = ja32(X86::eax, Imm32(JSImmediate::maxImmediateInt)); 1952 1709 1953 add32(X86::eax, X86::eax);1954 add32(Imm32(1),X86::eax);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); 1955 1712 1956 1713 ret();
Note:
See TracChangeset
for help on using the changeset viewer.