Changeset 153222 in webkit for trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp
- Timestamp:
- Jul 24, 2013, 9:02:44 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp
r149247 r153222 39 39 #include "ResultType.h" 40 40 #include "SamplingTool.h" 41 #include "SlowPathCall.h" 41 42 42 43 #ifndef NDEBUG … … 220 221 void JIT::emitSlow_op_negate(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 221 222 { 222 unsigned dst = currentInstruction[1].u.operand;223 unsigned result = currentInstruction[1].u.operand; 223 224 224 225 linkSlowCase(iter); // 0x7fffffff check 225 226 linkSlowCase(iter); // double check 226 227 227 JITS tubCall stubCall(this, cti_op_negate);228 s tubCall.addArgument(regT0);229 stubCall.call(dst);228 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_negate); 229 slowPathCall.call(); 230 emitGetVirtualRegister(result, regT0); 230 231 } 231 232 … … 250 251 { 251 252 unsigned result = currentInstruction[1].u.operand; 252 unsigned op1 = currentInstruction[2].u.operand; 253 unsigned op2 = currentInstruction[3].u.operand; 254 255 UNUSED_PARAM(op1); 256 UNUSED_PARAM(op2); 257 linkSlowCase(iter); 258 linkSlowCase(iter); 259 JITStubCall stubCall(this, cti_op_lshift); 260 stubCall.addArgument(regT0); 261 stubCall.addArgument(regT2); 262 stubCall.call(result); 253 254 linkSlowCase(iter); 255 linkSlowCase(iter); 256 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_lshift); 257 slowPathCall.call(); 258 emitGetVirtualRegister(result, regT0); 263 259 } 264 260 … … 304 300 unsigned op2 = currentInstruction[3].u.operand; 305 301 306 JITStubCall stubCall(this, cti_op_rshift);307 308 if (isOperandConstantImmediateInt(op2)) {302 UNUSED_PARAM(op1); 303 304 if (isOperandConstantImmediateInt(op2)) 309 305 linkSlowCase(iter); 310 stubCall.addArgument(regT0); 311 stubCall.addArgument(op2, regT2); 312 } else { 306 307 else { 313 308 if (supportsFloatingPointTruncate()) { 314 309 linkSlowCase(iter); 315 310 linkSlowCase(iter); 316 311 linkSlowCase(iter); 317 // We're reloading op1 to regT0 as we can no longer guarantee that318 // we have not munged the operand. It may have already been shifted319 // correctly, but it still will not have been tagged.320 stubCall.addArgument(op1, regT0);321 stubCall.addArgument(regT2);322 312 } else { 323 313 linkSlowCase(iter); 324 314 linkSlowCase(iter); 325 stubCall.addArgument(regT0);326 stubCall.addArgument(regT2);327 315 } 328 316 } 329 317 330 stubCall.call(result); 318 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_rshift); 319 slowPathCall.call(); 320 emitGetVirtualRegister(result, regT0); 331 321 } 332 322 … … 419 409 } 420 410 421 JITStubCall stubCall(this, cti_op_urshift); 422 stubCall.addArgument(op1, regT0); 423 stubCall.addArgument(op2, regT1); 424 stubCall.call(dst); 411 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_urshift); 412 slowPathCall.call(); 413 emitGetVirtualRegister(dst, regT0); 425 414 } 426 415 … … 608 597 { 609 598 unsigned result = currentInstruction[1].u.operand; 610 unsigned op1 = currentInstruction[2].u.operand; 611 unsigned op2 = currentInstruction[3].u.operand; 612 613 linkSlowCase(iter); 614 if (isOperandConstantImmediateInt(op1)) { 615 JITStubCall stubCall(this, cti_op_bitand); 616 stubCall.addArgument(op1, regT2); 617 stubCall.addArgument(regT0); 618 stubCall.call(result); 619 } else if (isOperandConstantImmediateInt(op2)) { 620 JITStubCall stubCall(this, cti_op_bitand); 621 stubCall.addArgument(regT0); 622 stubCall.addArgument(op2, regT2); 623 stubCall.call(result); 624 } else { 625 JITStubCall stubCall(this, cti_op_bitand); 626 stubCall.addArgument(op1, regT2); 627 stubCall.addArgument(regT1); 628 stubCall.call(result); 629 } 599 600 linkSlowCase(iter); 601 602 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_bitand); 603 slowPathCall.call(); 604 emitGetVirtualRegister(result, regT0); 630 605 } 631 606 … … 645 620 unsigned srcDst = currentInstruction[1].u.operand; 646 621 647 Jump notImm = getSlowCase(iter); 648 linkSlowCase(iter); 622 linkSlowCase(iter); 623 linkSlowCase(iter); 624 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_inc); 625 slowPathCall.call(); 649 626 emitGetVirtualRegister(srcDst, regT0); 650 notImm.link(this);651 JITStubCall stubCall(this, cti_op_inc);652 stubCall.addArgument(regT0);653 stubCall.call(srcDst);654 627 } 655 628 … … 669 642 unsigned srcDst = currentInstruction[1].u.operand; 670 643 671 Jump notImm = getSlowCase(iter); 672 linkSlowCase(iter); 644 linkSlowCase(iter); 645 linkSlowCase(iter); 646 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_dec); 647 slowPathCall.call(); 673 648 emitGetVirtualRegister(srcDst, regT0); 674 notImm.link(this);675 JITStubCall stubCall(this, cti_op_dec);676 stubCall.addArgument(regT0);677 stubCall.call(srcDst);678 649 } 679 650 … … 720 691 linkSlowCase(iter); 721 692 linkSlowCase(iter); 722 JITStubCall stubCall(this, cti_op_mod); 723 stubCall.addArgument(regT3); 724 stubCall.addArgument(regT2); 725 stubCall.call(result); 693 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_mod); 694 slowPathCall.call(); 695 emitGetVirtualRegister(result, regT0); 726 696 } 727 697 … … 734 704 unsigned op2 = currentInstruction[3].u.operand; 735 705 736 JITStubCall stubCall(this, cti_op_mod); 737 stubCall.addArgument(op1, regT2); 738 stubCall.addArgument(op2, regT2); 739 stubCall.call(result); 706 UNUSED_PARAM(op1); 707 UNUSED_PARAM(op2); 708 709 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_mod); 710 slowPathCall.call(); 711 emitGetVirtualRegister(result, regT0); 740 712 } 741 713 … … 797 769 } 798 770 799 void JIT::compileBinaryArithOpSlowCase( OpcodeID opcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned result, unsigned op1, unsigned op2, OperandTypes types, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase)771 void JIT::compileBinaryArithOpSlowCase(Instruction* currentInstruction, OpcodeID opcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned result, unsigned op1, unsigned op2, OperandTypes types, bool op1HasImmediateIntFastCase, bool op2HasImmediateIntFastCase) 800 772 { 801 773 // We assume that subtracting TagTypeNumber is equivalent to adding DoubleEncodeOffset. … … 816 788 if (opcodeID == op_mul && !op1HasImmediateIntFastCase && !op2HasImmediateIntFastCase) // op_mul has an extra slow case to handle 0 * negative number. 817 789 linkSlowCase(iter); 818 emitGetVirtualRegister(op1, regT0);819 790 820 791 Label stubFunctionCall(this); 821 JITStubCall stubCall(this, opcodeID == op_add ? cti_op_add : opcodeID == op_sub ? cti_op_sub : cti_op_mul); 822 if (op1HasImmediateIntFastCase || op2HasImmediateIntFastCase) { 823 emitGetVirtualRegister(op1, regT0); 824 emitGetVirtualRegister(op2, regT1); 825 } 826 stubCall.addArgument(regT0); 827 stubCall.addArgument(regT1); 828 stubCall.call(result); 792 793 JITSlowPathCall slowPathCall(this, currentInstruction, opcodeID == op_add ? slow_path_add : opcodeID == op_sub ? slow_path_sub : slow_path_mul); 794 slowPathCall.call(); 795 emitGetVirtualRegister(result, regT0); 829 796 Jump end = jump(); 830 797 … … 895 862 if (!types.first().mightBeNumber() || !types.second().mightBeNumber()) { 896 863 addSlowCase(); 897 JITStubCall stubCall(this, cti_op_add); 898 stubCall.addArgument(op1, regT2); 899 stubCall.addArgument(op2, regT2); 900 stubCall.call(result); 864 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_add); 865 slowPathCall.call(); 901 866 return; 902 867 } … … 932 897 bool op1HasImmediateIntFastCase = isOperandConstantImmediateInt(op1); 933 898 bool op2HasImmediateIntFastCase = !op1HasImmediateIntFastCase && isOperandConstantImmediateInt(op2); 934 compileBinaryArithOpSlowCase( op_add, iter, result, op1, op2, types, op1HasImmediateIntFastCase, op2HasImmediateIntFastCase);899 compileBinaryArithOpSlowCase(currentInstruction, op_add, iter, result, op1, op2, types, op1HasImmediateIntFastCase, op2HasImmediateIntFastCase); 935 900 } 936 901 … … 977 942 bool op1HasImmediateIntFastCase = isOperandConstantImmediateInt(op1) && getConstantOperandImmediateInt(op1) > 0; 978 943 bool op2HasImmediateIntFastCase = !op1HasImmediateIntFastCase && isOperandConstantImmediateInt(op2) && getConstantOperandImmediateInt(op2) > 0; 979 compileBinaryArithOpSlowCase( op_mul, iter, result, op1, op2, types, op1HasImmediateIntFastCase, op2HasImmediateIntFastCase);944 compileBinaryArithOpSlowCase(currentInstruction, op_mul, iter, result, op1, op2, types, op1HasImmediateIntFastCase, op2HasImmediateIntFastCase); 980 945 } 981 946 … … 1083 1048 } 1084 1049 // There is an extra slow case for (op1 * -N) or (-N * op2), to check for 0 since this should produce a result of -0. 1085 JITStubCall stubCall(this, cti_op_div); 1086 stubCall.addArgument(op1, regT2); 1087 stubCall.addArgument(op2, regT2); 1088 stubCall.call(result); 1050 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_div); 1051 slowPathCall.call(); 1052 emitGetVirtualRegister(result, regT0); 1089 1053 } 1090 1054 … … 1107 1071 OperandTypes types = OperandTypes::fromInt(currentInstruction[4].u.operand); 1108 1072 1109 compileBinaryArithOpSlowCase( op_sub, iter, result, op1, op2, types, false, false);1073 compileBinaryArithOpSlowCase(currentInstruction, op_sub, iter, result, op1, op2, types, false, false); 1110 1074 } 1111 1075
Note:
See TracChangeset
for help on using the changeset viewer.