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

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

Issue 115568: Add the REX prefix to 64-bit assembly operands. Move some inline functions. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/assembler-ia32-inl.h ('k') | src/x64/assembler-x64-inl.h » ('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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 // These constructors have been moved to MemOperand, and should 258 // These constructors have been moved to MemOperand, and should
259 // be removed from Operand as soon as all their uses use MemOperands instead. 259 // be removed from Operand as soon as all their uses use MemOperands instead.
260 // [disp/r] 260 // [disp/r]
261 INLINE(explicit Operand(intptr_t disp, RelocInfo::Mode rmode)) { 261 INLINE(explicit Operand(intptr_t disp, RelocInfo::Mode rmode)) {
262 UNIMPLEMENTED(); 262 UNIMPLEMENTED();
263 } 263 }
264 // disp only must always be relocated 264 // disp only must always be relocated
265 265
266 // [base + disp/r] 266 // [base + disp/r]
267 explicit Operand(Register base, intptr_t disp, 267 explicit Operand(Register base, int32_t disp,
268 RelocInfo::Mode rmode = RelocInfo::NONE); 268 RelocInfo::Mode rmode = RelocInfo::NONE);
269 269
270 // [base + index*scale + disp/r] 270 // [base + index*scale + disp/r]
271 explicit Operand(Register base, 271 explicit Operand(Register base,
272 Register index, 272 Register index,
273 ScaleFactor scale, 273 ScaleFactor scale,
274 intptr_t disp, 274 int32_t disp,
275 RelocInfo::Mode rmode = RelocInfo::NONE); 275 RelocInfo::Mode rmode = RelocInfo::NONE);
276 276
277 // [index*scale + disp/r] 277 // [index*scale + disp/r]
278 explicit Operand(Register index, 278 explicit Operand(Register index,
279 ScaleFactor scale, 279 ScaleFactor scale,
280 intptr_t disp, 280 int32_t disp,
281 RelocInfo::Mode rmode = RelocInfo::NONE); 281 RelocInfo::Mode rmode = RelocInfo::NONE);
282 282
283 static Operand StaticVariable(const ExternalReference& ext) {
284 return Operand(reinterpret_cast<intptr_t>(ext.address()),
285 RelocInfo::EXTERNAL_REFERENCE);
286 }
287
288 static Operand StaticArray(Register index,
289 ScaleFactor scale,
290 const ExternalReference& arr) {
291 return Operand(index, scale, reinterpret_cast<intptr_t>(arr.address()),
292 RelocInfo::EXTERNAL_REFERENCE);
293 }
294
295 // End of constructors and methods that have been moved to MemOperand. 283 // End of constructors and methods that have been moved to MemOperand.
296 284
297 private: 285 private:
298 byte rex_; 286 byte rex_;
299 byte buf_[10]; 287 byte buf_[10];
300 // The number of bytes in buf_. 288 // The number of bytes in buf_.
301 unsigned int len_; 289 unsigned int len_;
302 // Only valid if len_ > 4. 290 // Only valid if len_ > 4.
303 RelocInfo::Mode rmode_; 291 RelocInfo::Mode rmode_;
304 292
305 // Set the ModRM byte without an encoded 'reg' register. The 293 // Set the ModRM byte without an encoded 'reg' register. The
306 // register is encoded later as part of the emit_operand operation. 294 // register is encoded later as part of the emit_operand operation.
307 inline void set_modrm(int mod, Register rm); 295 inline void set_modrm(int mod, Register rm);
308 296
309 inline void set_sib(ScaleFactor scale, Register index, Register base); 297 inline void set_sib(ScaleFactor scale, Register index, Register base);
310 inline void set_disp8(int8_t disp); 298 inline void set_disp8(int8_t disp);
311 inline void set_disp32(int32_t disp); 299 inline void set_disp32(int32_t disp);
312 inline void set_dispr(intptr_t disp, RelocInfo::Mode rmode); 300 inline void set_dispr(intptr_t disp, RelocInfo::Mode rmode);
313 301
314 friend class Assembler; 302 friend class Assembler;
315 }; 303 };
316 304
317 class MemOperand : public Operand { 305 class MemOperand : public Operand {
318 public: 306 public:
319 // [disp/r] 307 // [disp/r]
320 INLINE(explicit MemOperand(intptr_t disp, RelocInfo::Mode rmode)) : 308 INLINE(explicit MemOperand(int32_t disp, RelocInfo::Mode rmode)) :
321 Operand() { 309 Operand() {
322 UNIMPLEMENTED(); 310 UNIMPLEMENTED();
323 } 311 }
324 // disp only must always be relocated 312 // disp only must always be relocated
325 313
326 // [base + disp/r] 314 // [base + disp/r]
327 explicit MemOperand(Register base, intptr_t disp, 315 explicit MemOperand(Register base, int32_t disp,
328 RelocInfo::Mode rmode = RelocInfo::NONE); 316 RelocInfo::Mode rmode = RelocInfo::NONE);
329 317
330 // [base + index*scale + disp/r] 318 // [base + index*scale + disp/r]
331 explicit MemOperand(Register base, 319 explicit MemOperand(Register base,
332 Register index, 320 Register index,
333 ScaleFactor scale, 321 ScaleFactor scale,
334 intptr_t disp, 322 int32_t disp,
335 RelocInfo::Mode rmode = RelocInfo::NONE); 323 RelocInfo::Mode rmode = RelocInfo::NONE);
336 324
337 // [index*scale + disp/r] 325 // [index*scale + disp/r]
338 explicit MemOperand(Register index, 326 explicit MemOperand(Register index,
339 ScaleFactor scale, 327 ScaleFactor scale,
340 intptr_t disp, 328 int32_t disp,
341 RelocInfo::Mode rmode = RelocInfo::NONE); 329 RelocInfo::Mode rmode = RelocInfo::NONE);
342
343 static MemOperand StaticVariable(const ExternalReference& ext) {
344 return MemOperand(reinterpret_cast<intptr_t>(ext.address()),
345 RelocInfo::EXTERNAL_REFERENCE);
346 }
347
348 static MemOperand StaticArray(Register index,
349 ScaleFactor scale,
350 const ExternalReference& arr) {
351 return MemOperand(index, scale, reinterpret_cast<intptr_t>(arr.address()),
352 RelocInfo::EXTERNAL_REFERENCE);
353 }
354 }; 330 };
355 331
356 // ----------------------------------------------------------------------------- 332 // -----------------------------------------------------------------------------
357 // A Displacement describes the 32bit immediate field of an instruction which 333 // A Displacement describes the 32bit immediate field of an instruction which
358 // may be used together with a Label in order to refer to a yet unknown code 334 // may be used together with a Label in order to refer to a yet unknown code
359 // position. Displacements stored in the instruction stream are used to describe 335 // position. Displacements stored in the instruction stream are used to describe
360 // the instruction and to chain a list of instructions using the same Label. 336 // the instruction and to chain a list of instructions using the same Label.
361 // A Displacement contains 2 different fields: 337 // A Displacement contains 2 different fields:
362 // 338 //
363 // next field: position of next displacement in the chain (0 = end of list) 339 // next field: position of next displacement in the chain (0 = end of list)
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 private: 894 private:
919 Assembler* assembler_; 895 Assembler* assembler_;
920 #ifdef DEBUG 896 #ifdef DEBUG
921 int space_before_; 897 int space_before_;
922 #endif 898 #endif
923 }; 899 };
924 900
925 } } // namespace v8::internal 901 } } // namespace v8::internal
926 902
927 #endif // V8_X64_ASSEMBLER_X64_H_ 903 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32-inl.h ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698