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

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

Issue 196077: X64: Extract all smi operations into MacroAssembler macros. (Closed)
Patch Set: Created 11 years, 3 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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 void incq(const Operand& dst); 714 void incq(const Operand& dst);
715 void incl(const Operand& dst); 715 void incl(const Operand& dst);
716 716
717 void lea(Register dst, const Operand& src); 717 void lea(Register dst, const Operand& src);
718 718
719 // Multiply rax by src, put the result in rdx:rax. 719 // Multiply rax by src, put the result in rdx:rax.
720 void mul(Register src); 720 void mul(Register src);
721 721
722 void neg(Register dst); 722 void neg(Register dst);
723 void neg(const Operand& dst); 723 void neg(const Operand& dst);
724 void negl(Register dst);
724 725
725 void not_(Register dst); 726 void not_(Register dst);
726 void not_(const Operand& dst); 727 void not_(const Operand& dst);
727 728
728 void or_(Register dst, Register src) { 729 void or_(Register dst, Register src) {
729 arithmetic_op(0x0B, dst, src); 730 arithmetic_op(0x0B, dst, src);
730 } 731 }
731 732
733 void orl(Register dst, Register src) {
734 arithmetic_op_32(0x0B, dst, src);
735 }
736
732 void or_(Register dst, const Operand& src) { 737 void or_(Register dst, const Operand& src) {
733 arithmetic_op(0x0B, dst, src); 738 arithmetic_op(0x0B, dst, src);
734 } 739 }
735 740
736 void or_(const Operand& dst, Register src) { 741 void or_(const Operand& dst, Register src) {
737 arithmetic_op(0x09, src, dst); 742 arithmetic_op(0x09, src, dst);
738 } 743 }
739 744
740 void or_(Register dst, Immediate src) { 745 void or_(Register dst, Immediate src) {
741 immediate_arithmetic_op(0x1, dst, src); 746 immediate_arithmetic_op(0x1, dst, src);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 void testl(Register reg, Immediate mask); 858 void testl(Register reg, Immediate mask);
854 void testl(const Operand& op, Immediate mask); 859 void testl(const Operand& op, Immediate mask);
855 void testq(const Operand& op, Register reg); 860 void testq(const Operand& op, Register reg);
856 void testq(Register dst, Register src); 861 void testq(Register dst, Register src);
857 void testq(Register dst, Immediate mask); 862 void testq(Register dst, Immediate mask);
858 863
859 void xor_(Register dst, Register src) { 864 void xor_(Register dst, Register src) {
860 arithmetic_op(0x33, dst, src); 865 arithmetic_op(0x33, dst, src);
861 } 866 }
862 867
868 void xorl(Register dst, Register src) {
869 arithmetic_op_32(0x33, dst, src);
870 }
871
863 void xor_(Register dst, const Operand& src) { 872 void xor_(Register dst, const Operand& src) {
864 arithmetic_op(0x33, dst, src); 873 arithmetic_op(0x33, dst, src);
865 } 874 }
866 875
867 void xor_(const Operand& dst, Register src) { 876 void xor_(const Operand& dst, Register src) {
868 arithmetic_op(0x31, src, dst); 877 arithmetic_op(0x31, src, dst);
869 } 878 }
870 879
871 void xor_(Register dst, Immediate src) { 880 void xor_(Register dst, Immediate src) {
872 immediate_arithmetic_op(0x6, dst, src); 881 immediate_arithmetic_op(0x6, dst, src);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 // Used for inline tables, e.g., jump-tables. 1051 // Used for inline tables, e.g., jump-tables.
1043 // void dd(uint64_t data, RelocInfo::Mode reloc_info); 1052 // void dd(uint64_t data, RelocInfo::Mode reloc_info);
1044 1053
1045 int pc_offset() const { return pc_ - buffer_; } 1054 int pc_offset() const { return pc_ - buffer_; }
1046 int current_statement_position() const { return current_statement_position_; } 1055 int current_statement_position() const { return current_statement_position_; }
1047 int current_position() const { return current_position_; } 1056 int current_position() const { return current_position_; }
1048 1057
1049 // Check if there is less than kGap bytes available in the buffer. 1058 // Check if there is less than kGap bytes available in the buffer.
1050 // If this is the case, we need to grow the buffer before emitting 1059 // If this is the case, we need to grow the buffer before emitting
1051 // an instruction or relocation information. 1060 // an instruction or relocation information.
1052 inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } 1061 inline bool buffer_overflow() const {
1062 return pc_ >= reloc_info_writer.pos() - kGap;
1063 }
1053 1064
1054 // Get the number of bytes available in the buffer. 1065 // Get the number of bytes available in the buffer.
1055 inline int available_space() const { return reloc_info_writer.pos() - pc_; } 1066 inline int available_space() const { return reloc_info_writer.pos() - pc_; }
1056 1067
1057 // Avoid overflows for displacements etc. 1068 // Avoid overflows for displacements etc.
1058 static const int kMaximalBufferSize = 512*MB; 1069 static const int kMaximalBufferSize = 512*MB;
1059 static const int kMinimalBufferSize = 4*KB; 1070 static const int kMinimalBufferSize = 4*KB;
1060 1071
1061 protected: 1072 protected:
1062 // void movsd(XMMRegister dst, const Operand& src); 1073 // void movsd(XMMRegister dst, const Operand& src);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 }; 1283 };
1273 1284
1274 1285
1275 // Helper class that ensures that there is enough space for generating 1286 // Helper class that ensures that there is enough space for generating
1276 // instructions and relocation information. The constructor makes 1287 // instructions and relocation information. The constructor makes
1277 // sure that there is enough space and (in debug mode) the destructor 1288 // sure that there is enough space and (in debug mode) the destructor
1278 // checks that we did not generate too much. 1289 // checks that we did not generate too much.
1279 class EnsureSpace BASE_EMBEDDED { 1290 class EnsureSpace BASE_EMBEDDED {
1280 public: 1291 public:
1281 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) { 1292 explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) {
1282 if (assembler_->overflow()) assembler_->GrowBuffer(); 1293 if (assembler_->buffer_overflow()) assembler_->GrowBuffer();
1283 #ifdef DEBUG 1294 #ifdef DEBUG
1284 space_before_ = assembler_->available_space(); 1295 space_before_ = assembler_->available_space();
1285 #endif 1296 #endif
1286 } 1297 }
1287 1298
1288 #ifdef DEBUG 1299 #ifdef DEBUG
1289 ~EnsureSpace() { 1300 ~EnsureSpace() {
1290 int bytes_generated = space_before_ - assembler_->available_space(); 1301 int bytes_generated = space_before_ - assembler_->available_space();
1291 ASSERT(bytes_generated < assembler_->kGap); 1302 ASSERT(bytes_generated < assembler_->kGap);
1292 } 1303 }
1293 #endif 1304 #endif
1294 1305
1295 private: 1306 private:
1296 Assembler* assembler_; 1307 Assembler* assembler_;
1297 #ifdef DEBUG 1308 #ifdef DEBUG
1298 int space_before_; 1309 int space_before_;
1299 #endif 1310 #endif
1300 }; 1311 };
1301 1312
1302 } } // namespace v8::internal 1313 } } // namespace v8::internal
1303 1314
1304 #endif // V8_X64_ASSEMBLER_X64_H_ 1315 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.h ('k') | src/x64/assembler-x64.cc » ('j') | src/x64/builtins-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698