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

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

Issue 6366010: X64 Crankshaft: Added a bunch of operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build-x64
Patch Set: Address review comments. Created 9 years, 11 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/x64/assembler-x64.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } else { 293 } else {
294 // Need no displacement. 294 // Need no displacement.
295 buf_[0] = (modrm & 0x3f); // Mode 0. 295 buf_[0] = (modrm & 0x3f); // Mode 0.
296 len_ = disp_offset; 296 len_ = disp_offset;
297 } 297 }
298 if (has_sib) { 298 if (has_sib) {
299 buf_[1] = operand.buf_[1]; 299 buf_[1] = operand.buf_[1];
300 } 300 }
301 } 301 }
302 302
303
304 bool Operand::AddressUsesRegister(Register reg) const {
305 int code = reg.code();
306 ASSERT((buf_[0] & 0xC0) != 0xC0); // Always a memory operand.
307 // Start with only low three bits of base register. Initial decoding doesn't
308 // distinguish on the REX.B bit.
309 int base_code = buf_[0] & 0x07;
310 if (base_code == rsp.code()) {
311 // SIB byte present in buf_[1].
312 // Check the index register from the SIB byte + REX.X prefix.
313 int index_code = ((buf_[1] >> 3) & 0x07) | ((rex_ & 0x02) << 2);
314 // Index code (including REX.X) of 0x04 (rsp) means no index register.
315 if (index_code != rsp.code() && index_code == code) return true;
316 // Add REX.B to get the full base register code.
317 base_code = (buf_[1] & 0x07) | ((rex_ & 0x01) << 3);
318 // A base register of 0x05 (rbp) with mod = 0 means no base register.
319 if (base_code == rbp.code() && ((buf_[0] & 0xC0) == 0)) return false;
320 return code == base_code;
321 } else {
322 // A base register with low bits of 0x05 (rbp or r13) and mod = 0 means
323 // no base register.
324 if (base_code == rbp.code() && ((buf_[0] & 0xC0) == 0)) return false;
325 base_code |= ((rex_ & 0x01) << 3);
326 return code == base_code;
327 }
328 }
329
330
303 // ----------------------------------------------------------------------------- 331 // -----------------------------------------------------------------------------
304 // Implementation of Assembler. 332 // Implementation of Assembler.
305 333
306 #ifdef GENERATED_CODE_COVERAGE 334 #ifdef GENERATED_CODE_COVERAGE
307 static void InitCoverageLog(); 335 static void InitCoverageLog();
308 #endif 336 #endif
309 337
310 byte* Assembler::spare_buffer_ = NULL; 338 byte* Assembler::spare_buffer_ = NULL;
311 339
312 Assembler::Assembler(void* buffer, int buffer_size) 340 Assembler::Assembler(void* buffer, int buffer_size)
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after
2654 EnsureSpace ensure_space(this); 2682 EnsureSpace ensure_space(this);
2655 last_pc_ = pc_; 2683 last_pc_ = pc_;
2656 emit(0x66); 2684 emit(0x66);
2657 emit_rex_64(src, dst); 2685 emit_rex_64(src, dst);
2658 emit(0x0F); 2686 emit(0x0F);
2659 emit(0x7E); 2687 emit(0x7E);
2660 emit_sse_operand(src, dst); 2688 emit_sse_operand(src, dst);
2661 } 2689 }
2662 2690
2663 2691
2692 void Assembler::movdqa(const Operand& dst, XMMRegister src) {
2693 ASSERT(CpuFeatures::IsEnabled(SSE2));
2694 EnsureSpace ensure_space(this);
2695 last_pc_ = pc_;
2696 emit(0x66);
2697 emit_rex_64(src, dst);
2698 emit(0x0F);
2699 emit(0x7F);
2700 emit_sse_operand(src, dst);
2701 }
2702
2703
2704 void Assembler::movdqa(XMMRegister dst, const Operand& src) {
2705 ASSERT(CpuFeatures::IsEnabled(SSE2));
2706 EnsureSpace ensure_space(this);
2707 last_pc_ = pc_;
2708 emit(0x66);
2709 emit_rex_64(dst, src);
2710 emit(0x0F);
2711 emit(0x6F);
2712 emit_sse_operand(dst, src);
2713 }
2714
2715
2664 void Assembler::extractps(Register dst, XMMRegister src, byte imm8) { 2716 void Assembler::extractps(Register dst, XMMRegister src, byte imm8) {
2665 ASSERT(is_uint2(imm8)); 2717 ASSERT(is_uint2(imm8));
2666 EnsureSpace ensure_space(this); 2718 EnsureSpace ensure_space(this);
2667 last_pc_ = pc_; 2719 last_pc_ = pc_;
2668 emit(0x66); 2720 emit(0x66);
2669 emit_optional_rex_32(dst, src); 2721 emit_optional_rex_32(dst, src);
2670 emit(0x0F); 2722 emit(0x0F);
2671 emit(0x3A); 2723 emit(0x3A);
2672 emit(0x17); 2724 emit(0x17);
2673 emit_sse_operand(dst, src); 2725 emit_sse_operand(dst, src);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 // specially coded on x64 means that it is a relative 32 bit address, as used 3101 // specially coded on x64 means that it is a relative 32 bit address, as used
3050 // by branch instructions. 3102 // by branch instructions.
3051 return (1 << rmode_) & kApplyMask; 3103 return (1 << rmode_) & kApplyMask;
3052 } 3104 }
3053 3105
3054 3106
3055 3107
3056 } } // namespace v8::internal 3108 } } // namespace v8::internal
3057 3109
3058 #endif // V8_TARGET_ARCH_X64 3110 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698