| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 __ b(ne, not_number); | 628 __ b(ne, not_number); |
| 629 __ ConvertToInt32(object, | 629 __ ConvertToInt32(object, |
| 630 dst, | 630 dst, |
| 631 scratch1, | 631 scratch1, |
| 632 scratch2, | 632 scratch2, |
| 633 double_scratch, | 633 double_scratch, |
| 634 ¬_in_int32_range); | 634 ¬_in_int32_range); |
| 635 __ jmp(&done); | 635 __ jmp(&done); |
| 636 | 636 |
| 637 __ bind(¬_in_int32_range); | 637 __ bind(¬_in_int32_range); |
| 638 __ ldr(scratch2, FieldMemOperand(object, HeapNumber::kExponentOffset)); | 638 __ ldr(scratch1, FieldMemOperand(object, HeapNumber::kExponentOffset)); |
| 639 __ ldr(scratch1, FieldMemOperand(object, HeapNumber::kMantissaOffset)); | 639 __ ldr(scratch2, FieldMemOperand(object, HeapNumber::kMantissaOffset)); |
| 640 | 640 |
| 641 // Register scratch1 contains mantissa word, scratch2 contains | 641 __ EmitOutOfInt32RangeTruncate(dst, |
| 642 // sign, exponent and mantissa. Extract biased exponent into dst. | 642 scratch1, |
| 643 __ Ubfx(dst, | 643 scratch2, |
| 644 scratch2, | 644 scratch3); |
| 645 HeapNumber::kExponentShift, | |
| 646 HeapNumber::kExponentBits); | |
| 647 | |
| 648 // Express exponent as delta to 31. | |
| 649 __ sub(dst, dst, Operand(HeapNumber::kExponentBias + 31)); | |
| 650 | |
| 651 Label normal_exponent; | |
| 652 // If the delta is larger than kMantissaBits plus one, all bits | |
| 653 // would be shifted away, which means that we can return 0. | |
| 654 __ cmp(dst, Operand(HeapNumber::kMantissaBits + 1)); | |
| 655 __ b(&normal_exponent, lt); | |
| 656 __ mov(dst, Operand(0)); | |
| 657 __ jmp(&done); | |
| 658 | |
| 659 __ bind(&normal_exponent); | |
| 660 const int kShiftBase = HeapNumber::kNonMantissaBitsInTopWord - 1; | |
| 661 // Calculate shift. | |
| 662 __ add(scratch3, dst, Operand(kShiftBase)); | |
| 663 | |
| 664 // Put implicit 1 before the mantissa part in scratch2. | |
| 665 __ orr(scratch2, | |
| 666 scratch2, | |
| 667 Operand(1 << HeapNumber::kMantissaBitsInTopWord)); | |
| 668 | |
| 669 // Save sign. | |
| 670 Register sign = dst; | |
| 671 __ and_(sign, scratch2, Operand(HeapNumber::kSignMask)); | |
| 672 | |
| 673 // Shift mantisssa bits the correct position in high word. | |
| 674 __ mov(scratch2, Operand(scratch2, LSL, scratch3)); | |
| 675 | |
| 676 // Replace the shifted bits with bits from the lower mantissa word. | |
| 677 Label pos_shift, shift_done; | |
| 678 __ rsb(scratch3, scratch3, Operand(32), SetCC); | |
| 679 __ b(&pos_shift, ge); | |
| 680 | |
| 681 // Negate scratch3. | |
| 682 __ rsb(scratch3, scratch3, Operand(0)); | |
| 683 __ mov(scratch1, Operand(scratch1, LSL, scratch3)); | |
| 684 __ jmp(&shift_done); | |
| 685 | |
| 686 __ bind(&pos_shift); | |
| 687 __ mov(scratch1, Operand(scratch1, LSR, scratch3)); | |
| 688 | |
| 689 __ bind(&shift_done); | |
| 690 __ orr(scratch2, scratch2, Operand(scratch1)); | |
| 691 | |
| 692 // Restore sign if necessary. | |
| 693 __ cmp(sign, Operand(0)); | |
| 694 __ rsb(dst, scratch2, Operand(0), LeaveCC, ne); | |
| 695 __ mov(dst, scratch2, LeaveCC, eq); | |
| 696 __ jmp(&done); | 645 __ jmp(&done); |
| 697 | 646 |
| 698 __ bind(&is_smi); | 647 __ bind(&is_smi); |
| 699 __ SmiUntag(dst, object); | 648 __ SmiUntag(dst, object); |
| 700 __ bind(&done); | 649 __ bind(&done); |
| 701 } | 650 } |
| 702 | 651 |
| 703 | 652 |
| 704 void FloatingPointHelper::LoadNumberAsInt32Double(MacroAssembler* masm, | 653 void FloatingPointHelper::LoadNumberAsInt32Double(MacroAssembler* masm, |
| 705 Register object, | 654 Register object, |
| (...skipping 6192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6898 __ str(pc, MemOperand(sp, 0)); | 6847 __ str(pc, MemOperand(sp, 0)); |
| 6899 __ Jump(target); // Call the C++ function. | 6848 __ Jump(target); // Call the C++ function. |
| 6900 } | 6849 } |
| 6901 | 6850 |
| 6902 | 6851 |
| 6903 #undef __ | 6852 #undef __ |
| 6904 | 6853 |
| 6905 } } // namespace v8::internal | 6854 } } // namespace v8::internal |
| 6906 | 6855 |
| 6907 #endif // V8_TARGET_ARCH_ARM | 6856 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |