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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 Register src, | 655 Register src, |
656 int shift_value, | 656 int shift_value, |
657 Label* on_not_smi_result, | 657 Label* on_not_smi_result, |
658 Label::Distance near_jump = Label::kFar); | 658 Label::Distance near_jump = Label::kFar); |
659 void SmiShiftArithmeticRightConstant(Register dst, | 659 void SmiShiftArithmeticRightConstant(Register dst, |
660 Register src, | 660 Register src, |
661 int shift_value); | 661 int shift_value); |
662 | 662 |
663 // Shifts a smi value to the left, and returns the result if that is a smi. | 663 // Shifts a smi value to the left, and returns the result if that is a smi. |
664 // Uses and clobbers rcx, so dst may not be rcx. | 664 // Uses and clobbers rcx, so dst may not be rcx. |
| 665 #ifndef V8_TARGET_ARCH_X32 |
665 void SmiShiftLeft(Register dst, | 666 void SmiShiftLeft(Register dst, |
666 Register src1, | 667 Register src1, |
667 Register src2); | 668 Register src2); |
| 669 #else |
| 670 void SmiShiftLeft(Register dst, |
| 671 Register src1, |
| 672 Register src2, |
| 673 Label* on_not_smi_result); |
| 674 #endif |
668 // Shifts a smi value to the right, shifting in zero bits at the top, and | 675 // Shifts a smi value to the right, shifting in zero bits at the top, and |
669 // returns the unsigned intepretation of the result if that is a smi. | 676 // returns the unsigned intepretation of the result if that is a smi. |
670 // Uses and clobbers rcx, so dst may not be rcx. | 677 // Uses and clobbers rcx, so dst may not be rcx. |
671 void SmiShiftLogicalRight(Register dst, | 678 void SmiShiftLogicalRight(Register dst, |
672 Register src1, | 679 Register src1, |
673 Register src2, | 680 Register src2, |
674 Label* on_not_smi_result, | 681 Label* on_not_smi_result, |
675 Label::Distance near_jump = Label::kFar); | 682 Label::Distance near_jump = Label::kFar); |
676 // Shifts a smi value to the right, sign extending the top, and | 683 // Shifts a smi value to the right, sign extending the top, and |
677 // returns the signed intepretation of the result. That will always | 684 // returns the signed intepretation of the result. That will always |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 // Basic Smi operations. | 719 // Basic Smi operations. |
713 void Move(Register dst, Smi* source) { | 720 void Move(Register dst, Smi* source) { |
714 LoadSmiConstant(dst, source); | 721 LoadSmiConstant(dst, source); |
715 } | 722 } |
716 | 723 |
717 void Move(const Operand& dst, Smi* source) { | 724 void Move(const Operand& dst, Smi* source) { |
718 Register constant = GetSmiConstant(source); | 725 Register constant = GetSmiConstant(source); |
719 movq(dst, constant); | 726 movq(dst, constant); |
720 } | 727 } |
721 | 728 |
| 729 #ifdef V8_TARGET_ARCH_X32 |
| 730 void Push(Immediate value); |
| 731 void Push_imm32(int32_t imm32); |
| 732 void Push(Register src); |
| 733 void Push(const Operand& src); |
| 734 void Pop(Register dst); |
| 735 void Pop(const Operand& dst); |
| 736 #endif |
| 737 |
722 void Push(Smi* smi); | 738 void Push(Smi* smi); |
723 void Test(const Operand& dst, Smi* source); | 739 void Test(const Operand& dst, Smi* source); |
724 | 740 |
725 | 741 |
726 // --------------------------------------------------------------------------- | 742 // --------------------------------------------------------------------------- |
727 // String macros. | 743 // String macros. |
728 | 744 |
729 // If object is a string, its map is loaded into object_map. | 745 // If object is a string, its map is loaded into object_map. |
730 void JumpIfNotString(Register object, | 746 void JumpIfNotString(Register object, |
731 Register object_map, | 747 Register object_map, |
(...skipping 30 matching lines...) Expand all Loading... |
762 void JumpIfNotUniqueName(Register reg, Label* not_unique_name, | 778 void JumpIfNotUniqueName(Register reg, Label* not_unique_name, |
763 Label::Distance distance = Label::kFar); | 779 Label::Distance distance = Label::kFar); |
764 void JumpIfNotUniqueName(Operand operand, Label* not_unique_name, | 780 void JumpIfNotUniqueName(Operand operand, Label* not_unique_name, |
765 Label::Distance distance = Label::kFar); | 781 Label::Distance distance = Label::kFar); |
766 | 782 |
767 // --------------------------------------------------------------------------- | 783 // --------------------------------------------------------------------------- |
768 // Macro instructions. | 784 // Macro instructions. |
769 | 785 |
770 // Load a register with a long value as efficiently as possible. | 786 // Load a register with a long value as efficiently as possible. |
771 void Set(Register dst, int64_t x); | 787 void Set(Register dst, int64_t x); |
| 788 #ifndef V8_TARGET_ARCH_X32 |
772 void Set(const Operand& dst, int64_t x); | 789 void Set(const Operand& dst, int64_t x); |
| 790 #else |
| 791 void Set(const Operand& dst, int32_t x); |
| 792 #endif |
773 | 793 |
774 // Move if the registers are not identical. | 794 // Move if the registers are not identical. |
775 void Move(Register target, Register source); | 795 void Move(Register target, Register source); |
776 | 796 |
777 // Support for constant splitting. | 797 // Support for constant splitting. |
778 bool IsUnsafeInt(const int x); | 798 bool IsUnsafeInt(const int x); |
779 void SafeMove(Register dst, Smi* src); | 799 void SafeMove(Register dst, Smi* src); |
780 void SafePush(Smi* src); | 800 void SafePush(Smi* src); |
781 | 801 |
782 // Bit-field support. | 802 // Bit-field support. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 | 840 |
821 // Emit code to discard a non-negative number of pointer-sized elements | 841 // Emit code to discard a non-negative number of pointer-sized elements |
822 // from the stack, clobbering only the rsp register. | 842 // from the stack, clobbering only the rsp register. |
823 void Drop(int stack_elements); | 843 void Drop(int stack_elements); |
824 | 844 |
825 void Call(Label* target) { call(target); } | 845 void Call(Label* target) { call(target); } |
826 | 846 |
827 // Control Flow | 847 // Control Flow |
828 void Jump(Address destination, RelocInfo::Mode rmode); | 848 void Jump(Address destination, RelocInfo::Mode rmode); |
829 void Jump(ExternalReference ext); | 849 void Jump(ExternalReference ext); |
| 850 #ifdef V8_TARGET_ARCH_X32 |
| 851 void Jump(const Operand& src); |
| 852 #endif |
830 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode); | 853 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode); |
831 | 854 |
832 void Call(Address destination, RelocInfo::Mode rmode); | 855 void Call(Address destination, RelocInfo::Mode rmode); |
833 void Call(ExternalReference ext); | 856 void Call(ExternalReference ext); |
| 857 #ifdef V8_TARGET_ARCH_X32 |
| 858 void Call(const Operand& op); |
| 859 #endif |
834 void Call(Handle<Code> code_object, | 860 void Call(Handle<Code> code_object, |
835 RelocInfo::Mode rmode, | 861 RelocInfo::Mode rmode, |
836 TypeFeedbackId ast_id = TypeFeedbackId::None()); | 862 TypeFeedbackId ast_id = TypeFeedbackId::None()); |
837 | 863 |
838 // The size of the code generated for different call instructions. | 864 // The size of the code generated for different call instructions. |
839 int CallSize(Address destination, RelocInfo::Mode rmode) { | 865 int CallSize(Address destination, RelocInfo::Mode rmode) { |
840 return kCallInstructionLength; | 866 return kCallInstructionLength; |
841 } | 867 } |
842 int CallSize(ExternalReference ext); | 868 int CallSize(ExternalReference ext); |
843 int CallSize(Handle<Code> code_object) { | 869 int CallSize(Handle<Code> code_object) { |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 | 1398 |
1373 bool generating_stub_; | 1399 bool generating_stub_; |
1374 bool allow_stub_calls_; | 1400 bool allow_stub_calls_; |
1375 bool has_frame_; | 1401 bool has_frame_; |
1376 bool root_array_available_; | 1402 bool root_array_available_; |
1377 | 1403 |
1378 // Returns a register holding the smi value. The register MUST NOT be | 1404 // Returns a register holding the smi value. The register MUST NOT be |
1379 // modified. It may be the "smi 1 constant" register. | 1405 // modified. It may be the "smi 1 constant" register. |
1380 Register GetSmiConstant(Smi* value); | 1406 Register GetSmiConstant(Smi* value); |
1381 | 1407 |
1382 intptr_t RootRegisterDelta(ExternalReference other); | 1408 int64_t RootRegisterDelta(ExternalReference other); |
1383 | 1409 |
1384 // Moves the smi value to the destination register. | 1410 // Moves the smi value to the destination register. |
1385 void LoadSmiConstant(Register dst, Smi* value); | 1411 void LoadSmiConstant(Register dst, Smi* value); |
1386 | 1412 |
1387 // This handle will be patched with the code object on installation. | 1413 // This handle will be patched with the code object on installation. |
1388 Handle<Object> code_object_; | 1414 Handle<Object> code_object_; |
1389 | 1415 |
1390 // Helper functions for generating invokes. | 1416 // Helper functions for generating invokes. |
1391 void InvokePrologue(const ParameterCount& expected, | 1417 void InvokePrologue(const ParameterCount& expected, |
1392 const ParameterCount& actual, | 1418 const ParameterCount& actual, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 masm->popfq(); \ | 1561 masm->popfq(); \ |
1536 } \ | 1562 } \ |
1537 masm-> | 1563 masm-> |
1538 #else | 1564 #else |
1539 #define ACCESS_MASM(masm) masm-> | 1565 #define ACCESS_MASM(masm) masm-> |
1540 #endif | 1566 #endif |
1541 | 1567 |
1542 } } // namespace v8::internal | 1568 } } // namespace v8::internal |
1543 | 1569 |
1544 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1570 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |