Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: src/x64/codegen-x64.h

Issue 1992011: Make X64 double-to-int32 conversion use the 64-bit version of cvttsd2si. (Closed)
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 GenericBinaryFlags flags, 704 GenericBinaryFlags flags,
705 TypeInfo operands_type = TypeInfo::Unknown()) 705 TypeInfo operands_type = TypeInfo::Unknown())
706 : op_(op), 706 : op_(op),
707 mode_(mode), 707 mode_(mode),
708 flags_(flags), 708 flags_(flags),
709 args_in_registers_(false), 709 args_in_registers_(false),
710 args_reversed_(false), 710 args_reversed_(false),
711 static_operands_type_(operands_type), 711 static_operands_type_(operands_type),
712 runtime_operands_type_(BinaryOpIC::DEFAULT), 712 runtime_operands_type_(BinaryOpIC::DEFAULT),
713 name_(NULL) { 713 name_(NULL) {
714 use_sse3_ = CpuFeatures::IsSupported(SSE3);
715 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); 714 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
716 } 715 }
717 716
718 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) 717 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info)
719 : op_(OpBits::decode(key)), 718 : op_(OpBits::decode(key)),
720 mode_(ModeBits::decode(key)), 719 mode_(ModeBits::decode(key)),
721 flags_(FlagBits::decode(key)), 720 flags_(FlagBits::decode(key)),
722 args_in_registers_(ArgsInRegistersBits::decode(key)), 721 args_in_registers_(ArgsInRegistersBits::decode(key)),
723 args_reversed_(ArgsReversedBits::decode(key)), 722 args_reversed_(ArgsReversedBits::decode(key)),
724 use_sse3_(SSE3Bits::decode(key)),
725 static_operands_type_(TypeInfo::ExpandedRepresentation( 723 static_operands_type_(TypeInfo::ExpandedRepresentation(
726 StaticTypeInfoBits::decode(key))), 724 StaticTypeInfoBits::decode(key))),
727 runtime_operands_type_(type_info), 725 runtime_operands_type_(type_info),
728 name_(NULL) { 726 name_(NULL) {
729 } 727 }
730 728
731 // Generate code to call the stub with the supplied arguments. This will add 729 // Generate code to call the stub with the supplied arguments. This will add
732 // code at the call site to prepare arguments either in registers or on the 730 // code at the call site to prepare arguments either in registers or on the
733 // stack together with the actual call. 731 // stack together with the actual call.
734 void GenerateCall(MacroAssembler* masm, Register left, Register right); 732 void GenerateCall(MacroAssembler* masm, Register left, Register right);
735 void GenerateCall(MacroAssembler* masm, Register left, Smi* right); 733 void GenerateCall(MacroAssembler* masm, Register left, Smi* right);
736 void GenerateCall(MacroAssembler* masm, Smi* left, Register right); 734 void GenerateCall(MacroAssembler* masm, Smi* left, Register right);
737 735
738 Result GenerateCall(MacroAssembler* masm, 736 Result GenerateCall(MacroAssembler* masm,
739 VirtualFrame* frame, 737 VirtualFrame* frame,
740 Result* left, 738 Result* left,
741 Result* right); 739 Result* right);
742 740
743 private: 741 private:
744 Token::Value op_; 742 Token::Value op_;
745 OverwriteMode mode_; 743 OverwriteMode mode_;
746 GenericBinaryFlags flags_; 744 GenericBinaryFlags flags_;
747 bool args_in_registers_; // Arguments passed in registers not on the stack. 745 bool args_in_registers_; // Arguments passed in registers not on the stack.
748 bool args_reversed_; // Left and right argument are swapped. 746 bool args_reversed_; // Left and right argument are swapped.
749 bool use_sse3_;
750 747
751 // Number type information of operands, determined by code generator. 748 // Number type information of operands, determined by code generator.
752 TypeInfo static_operands_type_; 749 TypeInfo static_operands_type_;
753 750
754 // Operand type information determined at runtime. 751 // Operand type information determined at runtime.
755 BinaryOpIC::TypeInfo runtime_operands_type_; 752 BinaryOpIC::TypeInfo runtime_operands_type_;
756 753
757 char* name_; 754 char* name_;
758 755
759 const char* GetName(); 756 const char* GetName();
760 757
761 #ifdef DEBUG 758 #ifdef DEBUG
762 void Print() { 759 void Print() {
763 PrintF("GenericBinaryOpStub %d (op %s), " 760 PrintF("GenericBinaryOpStub %d (op %s), "
764 "(mode %d, flags %d, registers %d, reversed %d, only_numbers %s)\n", 761 "(mode %d, flags %d, registers %d, reversed %d, only_numbers %s)\n",
765 MinorKey(), 762 MinorKey(),
766 Token::String(op_), 763 Token::String(op_),
767 static_cast<int>(mode_), 764 static_cast<int>(mode_),
768 static_cast<int>(flags_), 765 static_cast<int>(flags_),
769 static_cast<int>(args_in_registers_), 766 static_cast<int>(args_in_registers_),
770 static_cast<int>(args_reversed_), 767 static_cast<int>(args_reversed_),
771 static_operands_type_.ToString()); 768 static_operands_type_.ToString());
772 } 769 }
773 #endif 770 #endif
774 771
775 // Minor key encoding in 18 bits TTNNNFRASOOOOOOOMM. 772 // Minor key encoding in 18 bits TTNNNFRASOOOOOOOMM.
776 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; 773 class ModeBits: public BitField<OverwriteMode, 0, 2> {};
777 class OpBits: public BitField<Token::Value, 2, 7> {}; 774 class OpBits: public BitField<Token::Value, 2, 7> {};
778 class SSE3Bits: public BitField<bool, 9, 1> {}; 775 // One bit free here (removed SSE3 bit)
779 class ArgsInRegistersBits: public BitField<bool, 10, 1> {}; 776 class ArgsInRegistersBits: public BitField<bool, 10, 1> {};
780 class ArgsReversedBits: public BitField<bool, 11, 1> {}; 777 class ArgsReversedBits: public BitField<bool, 11, 1> {};
781 class FlagBits: public BitField<GenericBinaryFlags, 12, 1> {}; 778 class FlagBits: public BitField<GenericBinaryFlags, 12, 1> {};
782 class StaticTypeInfoBits: public BitField<int, 13, 3> {}; 779 class StaticTypeInfoBits: public BitField<int, 13, 3> {};
783 class RuntimeTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 16, 2> {}; 780 class RuntimeTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 16, 2> {};
784 781
785 Major MajorKey() { return GenericBinaryOp; } 782 Major MajorKey() { return GenericBinaryOp; }
786 int MinorKey() { 783 int MinorKey() {
787 // Encode the parameters in a unique 18 bit value. 784 // Encode the parameters in a unique 18 bit value.
788 return OpBits::encode(op_) 785 return OpBits::encode(op_)
789 | ModeBits::encode(mode_) 786 | ModeBits::encode(mode_)
790 | FlagBits::encode(flags_) 787 | FlagBits::encode(flags_)
791 | SSE3Bits::encode(use_sse3_)
792 | ArgsInRegistersBits::encode(args_in_registers_) 788 | ArgsInRegistersBits::encode(args_in_registers_)
793 | ArgsReversedBits::encode(args_reversed_) 789 | ArgsReversedBits::encode(args_reversed_)
794 | StaticTypeInfoBits::encode( 790 | StaticTypeInfoBits::encode(
795 static_operands_type_.ThreeBitRepresentation()) 791 static_operands_type_.ThreeBitRepresentation())
796 | RuntimeTypeInfoBits::encode(runtime_operands_type_); 792 | RuntimeTypeInfoBits::encode(runtime_operands_type_);
797 } 793 }
798 794
799 void Generate(MacroAssembler* masm); 795 void Generate(MacroAssembler* masm);
800 void GenerateSmiCode(MacroAssembler* masm, Label* slow); 796 void GenerateSmiCode(MacroAssembler* masm, Label* slow);
801 void GenerateLoadArguments(MacroAssembler* masm); 797 void GenerateLoadArguments(MacroAssembler* masm);
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 return ObjectBits::encode(object_.code()) | 1042 return ObjectBits::encode(object_.code()) |
1047 AddressBits::encode(addr_.code()) | 1043 AddressBits::encode(addr_.code()) |
1048 ScratchBits::encode(scratch_.code()); 1044 ScratchBits::encode(scratch_.code());
1049 } 1045 }
1050 }; 1046 };
1051 1047
1052 1048
1053 } } // namespace v8::internal 1049 } } // namespace v8::internal
1054 1050
1055 #endif // V8_X64_CODEGEN_X64_H_ 1051 #endif // V8_X64_CODEGEN_X64_H_
OLDNEW
« src/ia32/codegen-ia32.cc ('K') | « src/x64/assembler-x64.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698