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

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

Issue 119035: X64: Added implementations of Set(..., Immediate) to macro assembler. (Closed)
Patch Set: Created 11 years, 6 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 pc_ += sizeof(uint32_t); 48 pc_ += sizeof(uint32_t);
49 } 49 }
50 50
51 51
52 void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) { 52 void Assembler::emitq(uint64_t x, RelocInfo::Mode rmode) {
53 Memory::uint64_at(pc_) = x; 53 Memory::uint64_at(pc_) = x;
54 RecordRelocInfo(rmode, x); 54 RecordRelocInfo(rmode, x);
55 } 55 }
56 56
57 57
58 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B.
59 // REX.W is set. REX.X is cleared.
60 void Assembler::emit_rex_64(Register reg, Register rm_reg) { 58 void Assembler::emit_rex_64(Register reg, Register rm_reg) {
61 emit(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); 59 emit(0x48 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3);
62 } 60 }
63 61
64 62
65 // The high bit of reg is used for REX.R, the high bit of op's base
66 // register is used for REX.B, and the high bit of op's index register
67 // is used for REX.X. REX.W is set.
68 void Assembler::emit_rex_64(Register reg, const Operand& op) { 63 void Assembler::emit_rex_64(Register reg, const Operand& op) {
69 emit(0x48 | (reg.code() & 0x8) >> 1 | op.rex_); 64 emit(0x48 | (reg.code() & 0x8) >> 1 | op.rex_);
70 } 65 }
71 66
72 67
73 // The high bit of the register is used for REX.B.
74 // REX.W is set and REX.R and REX.X are clear.
75 void Assembler::emit_rex_64(Register rm_reg) { 68 void Assembler::emit_rex_64(Register rm_reg) {
76 ASSERT_EQ(rm_reg.code() & 0x0f, rm_reg.code()); 69 ASSERT_EQ(rm_reg.code() & 0xf, rm_reg.code());
77 emit(0x48 | (rm_reg.code() >> 3)); 70 emit(0x48 | (rm_reg.code() >> 3));
78 } 71 }
79 72
80 73
81 // The high bit of op's base register is used for REX.B, and the high
82 // bit of op's index register is used for REX.X. REX.W is set and REX.R clear.
83 void Assembler::emit_rex_64(const Operand& op) { 74 void Assembler::emit_rex_64(const Operand& op) {
84 emit(0x48 | op.rex_); 75 emit(0x48 | op.rex_);
85 } 76 }
86 77
87 78
88 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B.
89 // REX.W and REX.X are clear.
90 void Assembler::emit_rex_32(Register reg, Register rm_reg) { 79 void Assembler::emit_rex_32(Register reg, Register rm_reg) {
91 emit(0x40 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3); 80 emit(0x40 | (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3);
92 } 81 }
93 82
94 83
95 // The high bit of reg is used for REX.R, the high bit of op's base
96 // register is used for REX.B, and the high bit of op's index register
97 // is used for REX.X. REX.W is cleared.
98 void Assembler::emit_rex_32(Register reg, const Operand& op) { 84 void Assembler::emit_rex_32(Register reg, const Operand& op) {
99 emit(0x40 | (reg.code() & 0x8) >> 1 | op.rex_); 85 emit(0x40 | (reg.code() & 0x8) >> 1 | op.rex_);
100 } 86 }
101 87
102 88
103 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. 89 void Assembler::emit_rex_32(Register rm_reg) {
104 // REX.W and REX.X are cleared. If no REX bits are set, no byte is emitted. 90 emit(0x40 | (rm_reg.code() & 0x8) >> 3);
105 void Assembler::emit_optional_rex_32(Register reg, Register rm_reg) {
106 byte rex_bits = (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3;
107 if (rex_bits) emit(0x40 | rex_bits);
108 } 91 }
109 92
110 93
111 // The high bit of reg is used for REX.R, the high bit of op's base 94 void Assembler::emit_rex_32(const Operand& op) {
112 // register is used for REX.B, and the high bit of op's index register 95 emit(0x40 | op.rex_);
113 // is used for REX.X. REX.W is cleared. If no REX bits are set, nothing 96 }
114 // is emitted. 97
98
99 void Assembler::emit_optional_rex_32(Register reg, Register rm_reg) {
100 byte rex_bits = (reg.code() & 0x8) >> 1 | rm_reg.code() >> 3;
101 if (rex_bits != 0) emit(0x40 | rex_bits);
102 }
103
104
115 void Assembler::emit_optional_rex_32(Register reg, const Operand& op) { 105 void Assembler::emit_optional_rex_32(Register reg, const Operand& op) {
116 byte rex_bits = (reg.code() & 0x8) >> 1 | op.rex_; 106 byte rex_bits = (reg.code() & 0x8) >> 1 | op.rex_;
117 if (rex_bits) emit(0x40 | rex_bits); 107 if (rex_bits != 0) emit(0x40 | rex_bits);
118 } 108 }
119 109
120 110
111 void Assembler::emit_optional_rex_32(Register rm_reg) {
112 if (rm_reg.code() & 0x8 != 0) emit(0x41);
113 }
114
115
116 void Assembler::emit_optional_rex_32(const Operand& op) {
117 if (op.rex_ != 0) emit(0x40 | op.rex_);
118 }
119
120
121
121 void Assembler::set_target_address_at(byte* location, byte* value) { 122 void Assembler::set_target_address_at(byte* location, byte* value) {
122 UNIMPLEMENTED(); 123 UNIMPLEMENTED();
123 } 124 }
124 125
125 126
126 byte* Assembler::target_address_at(byte* location) { 127 byte* Assembler::target_address_at(byte* location) {
127 UNIMPLEMENTED(); 128 UNIMPLEMENTED();
128 return NULL; 129 return NULL;
129 } 130 }
130 131
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 ASSERT(len_ == 1 || len_ == 2); 282 ASSERT(len_ == 1 || len_ == 2);
282 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); 283 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]);
283 *p = disp; 284 *p = disp;
284 len_ += sizeof(int32_t); 285 len_ += sizeof(int32_t);
285 } 286 }
286 287
287 288
288 } } // namespace v8::internal 289 } } // namespace v8::internal
289 290
290 #endif // V8_X64_ASSEMBLER_X64_INL_H_ 291 #endif // V8_X64_ASSEMBLER_X64_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698