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

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

Issue 660095: Merge revision 3813 to 3930 from bleeding_edge to partial snapshots branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: '' Created 10 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/virtual-frame.cc ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // in modR/M, SIB, and opcode bytes. 111 // in modR/M, SIB, and opcode bytes.
112 int low_bits() const { 112 int low_bits() const {
113 return code_ & 0x7; 113 return code_ & 0x7;
114 } 114 }
115 115
116 // Unfortunately we can't make this private in a struct when initializing 116 // Unfortunately we can't make this private in a struct when initializing
117 // by assignment. 117 // by assignment.
118 int code_; 118 int code_;
119 }; 119 };
120 120
121 extern Register rax; 121 const Register rax = { 0 };
122 extern Register rcx; 122 const Register rcx = { 1 };
123 extern Register rdx; 123 const Register rdx = { 2 };
124 extern Register rbx; 124 const Register rbx = { 3 };
125 extern Register rsp; 125 const Register rsp = { 4 };
126 extern Register rbp; 126 const Register rbp = { 5 };
127 extern Register rsi; 127 const Register rsi = { 6 };
128 extern Register rdi; 128 const Register rdi = { 7 };
129 extern Register r8; 129 const Register r8 = { 8 };
130 extern Register r9; 130 const Register r9 = { 9 };
131 extern Register r10; 131 const Register r10 = { 10 };
132 extern Register r11; 132 const Register r11 = { 11 };
133 extern Register r12; 133 const Register r12 = { 12 };
134 extern Register r13; 134 const Register r13 = { 13 };
135 extern Register r14; 135 const Register r14 = { 14 };
136 extern Register r15; 136 const Register r15 = { 15 };
137 extern Register no_reg; 137 const Register no_reg = { -1 };
138
139
140 struct MMXRegister {
141 bool is_valid() const { return 0 <= code_ && code_ < 2; }
142 int code() const {
143 ASSERT(is_valid());
144 return code_;
145 }
146
147 int code_;
148 };
149
150 extern MMXRegister mm0;
151 extern MMXRegister mm1;
152 extern MMXRegister mm2;
153 extern MMXRegister mm3;
154 extern MMXRegister mm4;
155 extern MMXRegister mm5;
156 extern MMXRegister mm6;
157 extern MMXRegister mm7;
158 extern MMXRegister mm8;
159 extern MMXRegister mm9;
160 extern MMXRegister mm10;
161 extern MMXRegister mm11;
162 extern MMXRegister mm12;
163 extern MMXRegister mm13;
164 extern MMXRegister mm14;
165 extern MMXRegister mm15;
166 138
167 139
168 struct XMMRegister { 140 struct XMMRegister {
169 bool is_valid() const { return 0 <= code_ && code_ < 16; } 141 bool is_valid() const { return 0 <= code_ && code_ < 16; }
170 int code() const { 142 int code() const {
171 ASSERT(is_valid()); 143 ASSERT(is_valid());
172 return code_; 144 return code_;
173 } 145 }
174 146
175 // Return the high bit of the register code as a 0 or 1. Used often 147 // Return the high bit of the register code as a 0 or 1. Used often
176 // when constructing the REX prefix byte. 148 // when constructing the REX prefix byte.
177 int high_bit() const { 149 int high_bit() const {
178 return code_ >> 3; 150 return code_ >> 3;
179 } 151 }
180 // Return the 3 low bits of the register code. Used when encoding registers 152 // Return the 3 low bits of the register code. Used when encoding registers
181 // in modR/M, SIB, and opcode bytes. 153 // in modR/M, SIB, and opcode bytes.
182 int low_bits() const { 154 int low_bits() const {
183 return code_ & 0x7; 155 return code_ & 0x7;
184 } 156 }
185 157
186 int code_; 158 int code_;
187 }; 159 };
188 160
189 extern XMMRegister xmm0; 161 const XMMRegister xmm0 = { 0 };
190 extern XMMRegister xmm1; 162 const XMMRegister xmm1 = { 1 };
191 extern XMMRegister xmm2; 163 const XMMRegister xmm2 = { 2 };
192 extern XMMRegister xmm3; 164 const XMMRegister xmm3 = { 3 };
193 extern XMMRegister xmm4; 165 const XMMRegister xmm4 = { 4 };
194 extern XMMRegister xmm5; 166 const XMMRegister xmm5 = { 5 };
195 extern XMMRegister xmm6; 167 const XMMRegister xmm6 = { 6 };
196 extern XMMRegister xmm7; 168 const XMMRegister xmm7 = { 7 };
197 extern XMMRegister xmm8; 169 const XMMRegister xmm8 = { 8 };
198 extern XMMRegister xmm9; 170 const XMMRegister xmm9 = { 9 };
199 extern XMMRegister xmm10; 171 const XMMRegister xmm10 = { 10 };
200 extern XMMRegister xmm11; 172 const XMMRegister xmm11 = { 11 };
201 extern XMMRegister xmm12; 173 const XMMRegister xmm12 = { 12 };
202 extern XMMRegister xmm13; 174 const XMMRegister xmm13 = { 13 };
203 extern XMMRegister xmm14; 175 const XMMRegister xmm14 = { 14 };
204 extern XMMRegister xmm15; 176 const XMMRegister xmm15 = { 15 };
205 177
206 enum Condition { 178 enum Condition {
207 // any value < 0 is considered no_condition 179 // any value < 0 is considered no_condition
208 no_condition = -1, 180 no_condition = -1,
209 181
210 overflow = 0, 182 overflow = 0,
211 no_overflow = 1, 183 no_overflow = 1,
212 below = 2, 184 below = 2,
213 above_equal = 3, 185 above_equal = 3,
214 equal = 4, 186 equal = 4,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 273
302 // ----------------------------------------------------------------------------- 274 // -----------------------------------------------------------------------------
303 // Machine instruction Operands 275 // Machine instruction Operands
304 276
305 enum ScaleFactor { 277 enum ScaleFactor {
306 times_1 = 0, 278 times_1 = 0,
307 times_2 = 1, 279 times_2 = 1,
308 times_4 = 2, 280 times_4 = 2,
309 times_8 = 3, 281 times_8 = 3,
310 times_int_size = times_4, 282 times_int_size = times_4,
311 times_half_pointer_size = times_4,
312 times_pointer_size = times_8 283 times_pointer_size = times_8
313 }; 284 };
314 285
315 286
316 class Operand BASE_EMBEDDED { 287 class Operand BASE_EMBEDDED {
317 public: 288 public:
318 // [base + disp/r] 289 // [base + disp/r]
319 Operand(Register base, int32_t disp); 290 Operand(Register base, int32_t disp);
320 291
321 // [base + index*scale + disp/r] 292 // [base + index*scale + disp/r]
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 void cvtlsi2sd(XMMRegister dst, const Operand& src); 1086 void cvtlsi2sd(XMMRegister dst, const Operand& src);
1116 void cvtlsi2sd(XMMRegister dst, Register src); 1087 void cvtlsi2sd(XMMRegister dst, Register src);
1117 void cvtqsi2sd(XMMRegister dst, const Operand& src); 1088 void cvtqsi2sd(XMMRegister dst, const Operand& src);
1118 void cvtqsi2sd(XMMRegister dst, Register src); 1089 void cvtqsi2sd(XMMRegister dst, Register src);
1119 1090
1120 void addsd(XMMRegister dst, XMMRegister src); 1091 void addsd(XMMRegister dst, XMMRegister src);
1121 void subsd(XMMRegister dst, XMMRegister src); 1092 void subsd(XMMRegister dst, XMMRegister src);
1122 void mulsd(XMMRegister dst, XMMRegister src); 1093 void mulsd(XMMRegister dst, XMMRegister src);
1123 void divsd(XMMRegister dst, XMMRegister src); 1094 void divsd(XMMRegister dst, XMMRegister src);
1124 1095
1096 void xorpd(XMMRegister dst, XMMRegister src);
1097
1098 void comisd(XMMRegister dst, XMMRegister src);
1099 void ucomisd(XMMRegister dst, XMMRegister src);
1125 1100
1126 void emit_sse_operand(XMMRegister dst, XMMRegister src); 1101 void emit_sse_operand(XMMRegister dst, XMMRegister src);
1127 void emit_sse_operand(XMMRegister reg, const Operand& adr); 1102 void emit_sse_operand(XMMRegister reg, const Operand& adr);
1128 void emit_sse_operand(XMMRegister dst, Register src); 1103 void emit_sse_operand(XMMRegister dst, Register src);
1129 1104
1130 // Use either movsd or movlpd. 1105 // Use either movsd or movlpd.
1131 // void movdbl(XMMRegister dst, const Operand& src); 1106 // void movdbl(XMMRegister dst, const Operand& src);
1132 // void movdbl(const Operand& dst, XMMRegister src); 1107 // void movdbl(const Operand& dst, XMMRegister src);
1133 1108
1134 // Debugging 1109 // Debugging
(...skipping 26 matching lines...) Expand all
1161 1136
1162 // Get the number of bytes available in the buffer. 1137 // Get the number of bytes available in the buffer.
1163 inline int available_space() const { 1138 inline int available_space() const {
1164 return static_cast<int>(reloc_info_writer.pos() - pc_); 1139 return static_cast<int>(reloc_info_writer.pos() - pc_);
1165 } 1140 }
1166 1141
1167 // Avoid overflows for displacements etc. 1142 // Avoid overflows for displacements etc.
1168 static const int kMaximalBufferSize = 512*MB; 1143 static const int kMaximalBufferSize = 512*MB;
1169 static const int kMinimalBufferSize = 4*KB; 1144 static const int kMinimalBufferSize = 4*KB;
1170 1145
1171 protected:
1172 // void movsd(XMMRegister dst, const Operand& src);
1173 // void movsd(const Operand& dst, XMMRegister src);
1174
1175 // void emit_sse_operand(XMMRegister reg, const Operand& adr);
1176 // void emit_sse_operand(XMMRegister dst, XMMRegister src);
1177
1178
1179 private: 1146 private:
1180 byte* addr_at(int pos) { return buffer_ + pos; } 1147 byte* addr_at(int pos) { return buffer_ + pos; }
1181 byte byte_at(int pos) { return buffer_[pos]; } 1148 byte byte_at(int pos) { return buffer_[pos]; }
1182 uint32_t long_at(int pos) { 1149 uint32_t long_at(int pos) {
1183 return *reinterpret_cast<uint32_t*>(addr_at(pos)); 1150 return *reinterpret_cast<uint32_t*>(addr_at(pos));
1184 } 1151 }
1185 void long_at_put(int pos, uint32_t x) { 1152 void long_at_put(int pos, uint32_t x) {
1186 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; 1153 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x;
1187 } 1154 }
1188 1155
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 private: 1373 private:
1407 Assembler* assembler_; 1374 Assembler* assembler_;
1408 #ifdef DEBUG 1375 #ifdef DEBUG
1409 int space_before_; 1376 int space_before_;
1410 #endif 1377 #endif
1411 }; 1378 };
1412 1379
1413 } } // namespace v8::internal 1380 } } // namespace v8::internal
1414 1381
1415 #endif // V8_X64_ASSEMBLER_X64_H_ 1382 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/virtual-frame.cc ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698