| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 void GenerateCall(MacroAssembler* masm, Register target); | 601 void GenerateCall(MacroAssembler* masm, Register target); |
| 602 | 602 |
| 603 private: | 603 private: |
| 604 Major MajorKey() { return DirectCEntry; } | 604 Major MajorKey() { return DirectCEntry; } |
| 605 int MinorKey() { return 0; } | 605 int MinorKey() { return 0; } |
| 606 | 606 |
| 607 bool NeedsImmovableCode() { return true; } | 607 bool NeedsImmovableCode() { return true; } |
| 608 }; | 608 }; |
| 609 | 609 |
| 610 | 610 |
| 611 class FloatingPointHelper : public AllStatic { | |
| 612 public: | |
| 613 enum Destination { | |
| 614 kVFPRegisters, | |
| 615 kCoreRegisters | |
| 616 }; | |
| 617 | |
| 618 | |
| 619 // Loads smis from r0 and r1 (right and left in binary operations) into | |
| 620 // floating point registers. Depending on the destination the values ends up | |
| 621 // either d7 and d6 or in r2/r3 and r0/r1 respectively. If the destination is | |
| 622 // floating point registers VFP3 must be supported. If core registers are | |
| 623 // requested when VFP3 is supported d6 and d7 will be scratched. | |
| 624 static void LoadSmis(MacroAssembler* masm, | |
| 625 Destination destination, | |
| 626 Register scratch1, | |
| 627 Register scratch2); | |
| 628 | |
| 629 // Convert the smi or heap number in object to an int32 using the rules | |
| 630 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated | |
| 631 // and brought into the range -2^31 .. +2^31 - 1. | |
| 632 static void ConvertNumberToInt32(MacroAssembler* masm, | |
| 633 Register object, | |
| 634 Register dst, | |
| 635 Register heap_number_map, | |
| 636 Register scratch1, | |
| 637 Register scratch2, | |
| 638 Register scratch3, | |
| 639 DwVfpRegister double_scratch1, | |
| 640 DwVfpRegister double_scratch2, | |
| 641 Label* not_int32); | |
| 642 | |
| 643 // Converts the integer (untagged smi) in |int_scratch| to a double, storing | |
| 644 // the result either in |double_dst| or |dst2:dst1|, depending on | |
| 645 // |destination|. | |
| 646 // Warning: The value in |int_scratch| will be changed in the process! | |
| 647 static void ConvertIntToDouble(MacroAssembler* masm, | |
| 648 Register int_scratch, | |
| 649 Destination destination, | |
| 650 DwVfpRegister double_dst, | |
| 651 Register dst1, | |
| 652 Register dst2, | |
| 653 Register scratch2, | |
| 654 SwVfpRegister single_scratch); | |
| 655 | |
| 656 // Load the number from object into double_dst in the double format. | |
| 657 // Control will jump to not_int32 if the value cannot be exactly represented | |
| 658 // by a 32-bit integer. | |
| 659 // Floating point value in the 32-bit integer range that are not exact integer | |
| 660 // won't be loaded. | |
| 661 static void LoadNumberAsInt32Double(MacroAssembler* masm, | |
| 662 Register object, | |
| 663 Destination destination, | |
| 664 DwVfpRegister double_dst, | |
| 665 DwVfpRegister double_scratch, | |
| 666 Register dst1, | |
| 667 Register dst2, | |
| 668 Register heap_number_map, | |
| 669 Register scratch1, | |
| 670 Register scratch2, | |
| 671 SwVfpRegister single_scratch, | |
| 672 Label* not_int32); | |
| 673 | |
| 674 // Loads the number from object into dst as a 32-bit integer. | |
| 675 // Control will jump to not_int32 if the object cannot be exactly represented | |
| 676 // by a 32-bit integer. | |
| 677 // Floating point value in the 32-bit integer range that are not exact integer | |
| 678 // won't be converted. | |
| 679 // scratch3 is not used when VFP3 is supported. | |
| 680 static void LoadNumberAsInt32(MacroAssembler* masm, | |
| 681 Register object, | |
| 682 Register dst, | |
| 683 Register heap_number_map, | |
| 684 Register scratch1, | |
| 685 Register scratch2, | |
| 686 Register scratch3, | |
| 687 DwVfpRegister double_scratch0, | |
| 688 DwVfpRegister double_scratch1, | |
| 689 Label* not_int32); | |
| 690 | |
| 691 // Generate non VFP3 code to check if a double can be exactly represented by a | |
| 692 // 32-bit integer. This does not check for 0 or -0, which need | |
| 693 // to be checked for separately. | |
| 694 // Control jumps to not_int32 if the value is not a 32-bit integer, and falls | |
| 695 // through otherwise. | |
| 696 // src1 and src2 will be cloberred. | |
| 697 // | |
| 698 // Expected input: | |
| 699 // - src1: higher (exponent) part of the double value. | |
| 700 // - src2: lower (mantissa) part of the double value. | |
| 701 // Output status: | |
| 702 // - dst: 32 higher bits of the mantissa. (mantissa[51:20]) | |
| 703 // - src2: contains 1. | |
| 704 // - other registers are clobbered. | |
| 705 static void DoubleIs32BitInteger(MacroAssembler* masm, | |
| 706 Register src1, | |
| 707 Register src2, | |
| 708 Register dst, | |
| 709 Register scratch, | |
| 710 Label* not_int32); | |
| 711 | |
| 712 // Generates code to call a C function to do a double operation using core | |
| 713 // registers. (Used when VFP3 is not supported.) | |
| 714 // This code never falls through, but returns with a heap number containing | |
| 715 // the result in r0. | |
| 716 // Register heapnumber_result must be a heap number in which the | |
| 717 // result of the operation will be stored. | |
| 718 // Requires the following layout on entry: | |
| 719 // r0: Left value (least significant part of mantissa). | |
| 720 // r1: Left value (sign, exponent, top of mantissa). | |
| 721 // r2: Right value (least significant part of mantissa). | |
| 722 // r3: Right value (sign, exponent, top of mantissa). | |
| 723 static void CallCCodeForDoubleOperation(MacroAssembler* masm, | |
| 724 Token::Value op, | |
| 725 Register heap_number_result, | |
| 726 Register scratch); | |
| 727 | |
| 728 // Loads the objects from |object| into floating point registers. | |
| 729 // Depending on |destination| the value ends up either in |dst| or | |
| 730 // in |dst1|/|dst2|. If |destination| is kVFPRegisters, then VFP3 | |
| 731 // must be supported. If kCoreRegisters are requested and VFP3 is | |
| 732 // supported, |dst| will be scratched. If |object| is neither smi nor | |
| 733 // heap number, |not_number| is jumped to with |object| still intact. | |
| 734 static void LoadNumber(MacroAssembler* masm, | |
| 735 FloatingPointHelper::Destination destination, | |
| 736 Register object, | |
| 737 DwVfpRegister dst, | |
| 738 Register dst1, | |
| 739 Register dst2, | |
| 740 Register heap_number_map, | |
| 741 Register scratch1, | |
| 742 Register scratch2, | |
| 743 Label* not_number); | |
| 744 }; | |
| 745 | |
| 746 | |
| 747 class NameDictionaryLookupStub: public PlatformCodeStub { | 611 class NameDictionaryLookupStub: public PlatformCodeStub { |
| 748 public: | 612 public: |
| 749 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; | 613 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; |
| 750 | 614 |
| 751 explicit NameDictionaryLookupStub(LookupMode mode) : mode_(mode) { } | 615 explicit NameDictionaryLookupStub(LookupMode mode) : mode_(mode) { } |
| 752 | 616 |
| 753 void Generate(MacroAssembler* masm); | 617 void Generate(MacroAssembler* masm); |
| 754 | 618 |
| 755 static void GenerateNegativeLookup(MacroAssembler* masm, | 619 static void GenerateNegativeLookup(MacroAssembler* masm, |
| 756 Label* miss, | 620 Label* miss, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 654 |
| 791 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; | 655 class LookupModeBits: public BitField<LookupMode, 0, 1> {}; |
| 792 | 656 |
| 793 LookupMode mode_; | 657 LookupMode mode_; |
| 794 }; | 658 }; |
| 795 | 659 |
| 796 | 660 |
| 797 } } // namespace v8::internal | 661 } } // namespace v8::internal |
| 798 | 662 |
| 799 #endif // V8_ARM_CODE_STUBS_ARM_H_ | 663 #endif // V8_ARM_CODE_STUBS_ARM_H_ |
| OLD | NEW |