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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 155087: X64: Disassembler updated to using REX, extended registers and some X64 opcodes. (Closed)
Patch Set: Addressed review comments. Added few more features. Major lint check. Created 11 years, 5 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
« src/x64/disasm-x64.cc ('K') | « src/x64/disasm-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 int builtins_offset = 201 int builtins_offset =
202 JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize); 202 JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize);
203 movq(rdi, FieldOperand(rdx, builtins_offset)); 203 movq(rdi, FieldOperand(rdx, builtins_offset));
204 204
205 205
206 return Builtins::GetCode(id, resolved); 206 return Builtins::GetCode(id, resolved);
207 } 207 }
208 208
209 209
210 void MacroAssembler::Set(Register dst, int64_t x) { 210 void MacroAssembler::Set(Register dst, int64_t x) {
211 if (is_int32(x)) { 211 if (x == 0) {
212 xor_(dst, dst);
213 } else if (is_int32(x)) {
212 movq(dst, Immediate(x)); 214 movq(dst, Immediate(x));
213 } else if (is_uint32(x)) { 215 } else if (is_uint32(x)) {
214 movl(dst, Immediate(x)); 216 movl(dst, Immediate(x));
215 } else { 217 } else {
216 movq(dst, x, RelocInfo::NONE); 218 movq(dst, x, RelocInfo::NONE);
217 } 219 }
218 } 220 }
219 221
220 222
221 void MacroAssembler::Set(const Operand& dst, int64_t x) { 223 void MacroAssembler::Set(const Operand& dst, int64_t x) {
222 if (is_int32(x)) { 224 if (x == 0) {
223 movq(kScratchRegister, Immediate(x)); 225 xor_(kScratchRegister, kScratchRegister);
226 movq(dst, kScratchRegister);
227 } else if (is_int32(x)) {
228 movq(dst, Immediate(x));
224 } else if (is_uint32(x)) { 229 } else if (is_uint32(x)) {
225 movl(kScratchRegister, Immediate(x)); 230 movl(dst, Immediate(x));
226 } else { 231 } else {
227 movq(kScratchRegister, x, RelocInfo::NONE); 232 movq(kScratchRegister, x, RelocInfo::NONE);
233 movq(dst, kScratchRegister);
228 } 234 }
229 movq(dst, kScratchRegister);
230 } 235 }
231 236
232 237
233 bool MacroAssembler::IsUnsafeSmi(Smi* value) { 238 bool MacroAssembler::IsUnsafeSmi(Smi* value) {
234 return false; 239 return false;
235 } 240 }
236 241
237 void MacroAssembler::LoadUnsafeSmi(Register dst, Smi* source) { 242 void MacroAssembler::LoadUnsafeSmi(Register dst, Smi* source) {
238 UNIMPLEMENTED(); 243 UNIMPLEMENTED();
239 } 244 }
240 245
241 246
242 void MacroAssembler::Move(Register dst, Handle<Object> source) { 247 void MacroAssembler::Move(Register dst, Handle<Object> source) {
248 ASSERT(!source->IsFailure());
243 if (source->IsSmi()) { 249 if (source->IsSmi()) {
244 if (IsUnsafeSmi(source)) { 250 if (IsUnsafeSmi(source)) {
245 LoadUnsafeSmi(dst, source); 251 LoadUnsafeSmi(dst, source);
246 } else { 252 } else {
247 movq(dst, source, RelocInfo::NONE); 253 int32_t smi = static_cast<int32_t>(reinterpret_cast<intptr_t>(*source));
254 movq(dst, Immediate(smi));
248 } 255 }
249 } else { 256 } else {
250 movq(dst, source, RelocInfo::EMBEDDED_OBJECT); 257 movq(dst, source, RelocInfo::EMBEDDED_OBJECT);
251 } 258 }
252 } 259 }
253 260
254 261
255 void MacroAssembler::Move(const Operand& dst, Handle<Object> source) { 262 void MacroAssembler::Move(const Operand& dst, Handle<Object> source) {
256 Move(kScratchRegister, source); 263 if (source->IsSmi()) {
257 movq(dst, kScratchRegister); 264 int32_t smi = static_cast<int32_t>(reinterpret_cast<intptr_t>(*source));
265 movq(dst, Immediate(smi));
266 } else {
267 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT);
268 movq(dst, kScratchRegister);
269 }
258 } 270 }
259 271
260 272
261 void MacroAssembler::Cmp(Register dst, Handle<Object> source) { 273 void MacroAssembler::Cmp(Register dst, Handle<Object> source) {
262 Move(kScratchRegister, source); 274 Move(kScratchRegister, source);
263 cmpq(dst, kScratchRegister); 275 cmpq(dst, kScratchRegister);
264 } 276 }
265 277
266 278
267 void MacroAssembler::Cmp(const Operand& dst, Handle<Object> source) { 279 void MacroAssembler::Cmp(const Operand& dst, Handle<Object> source) {
268 Move(kScratchRegister, source); 280 if (source->IsSmi()) {
269 cmpq(dst, kScratchRegister); 281 if (IsUnsafeSmi(source)) {
282 LoadUnsafeSmi(kScratchRegister, source);
283 cmpl(dst, kScratchRegister);
284 } else {
285 // For smi-comparison, it suffices to compare the low 32 bits.
286 int32_t smi = static_cast<int32_t>(reinterpret_cast<intptr_t>(*source));
287 cmpl(dst, Immediate(smi));
288 }
289 } else {
290 ASSERT(source->IsHeapObject());
291 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT);
292 cmpq(dst, kScratchRegister);
293 }
270 } 294 }
271 295
272 296
273 void MacroAssembler::Push(Handle<Object> source) { 297 void MacroAssembler::Push(Handle<Object> source) {
274 Move(kScratchRegister, source); 298 if (source->IsSmi()) {
275 push(kScratchRegister); 299 if (IsUnsafeSmi(source)) {
300 LoadUnsafeSmi(kScratchRegister, source);
301 push(kScratchRegister);
302 } else {
303 int32_t smi = static_cast<int32_t>(reinterpret_cast<intptr_t>(*source));
304 push(Immediate(smi));
305 }
306 } else {
307 ASSERT(source->IsHeapObject());
308 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT);
309 push(kScratchRegister);
310 }
276 } 311 }
277 312
278 313
279 void MacroAssembler::Jump(ExternalReference ext) { 314 void MacroAssembler::Jump(ExternalReference ext) {
280 movq(kScratchRegister, ext); 315 movq(kScratchRegister, ext);
281 jmp(kScratchRegister); 316 jmp(kScratchRegister);
282 } 317 }
283 318
284 319
285 void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) { 320 void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) {
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 push(rcx); 876 push(rcx);
842 877
843 // Clear the top frame. 878 // Clear the top frame.
844 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address); 879 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address);
845 movq(kScratchRegister, c_entry_fp_address); 880 movq(kScratchRegister, c_entry_fp_address);
846 movq(Operand(kScratchRegister, 0), Immediate(0)); 881 movq(Operand(kScratchRegister, 0), Immediate(0));
847 } 882 }
848 883
849 884
850 } } // namespace v8::internal 885 } } // namespace v8::internal
OLDNEW
« src/x64/disasm-x64.cc ('K') | « src/x64/disasm-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698