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

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

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/x64/assembler-x64.h ('k') | src/x64/builtins-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 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 16 matching lines...) Expand all
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "macro-assembler.h" 30 #include "macro-assembler.h"
31 #include "serialize.h" 31 #include "serialize.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 // ----------------------------------------------------------------------------- 36 // -----------------------------------------------------------------------------
37 // Implementation of Register
38
39 Register rax = { 0 };
40 Register rcx = { 1 };
41 Register rdx = { 2 };
42 Register rbx = { 3 };
43 Register rsp = { 4 };
44 Register rbp = { 5 };
45 Register rsi = { 6 };
46 Register rdi = { 7 };
47 Register r8 = { 8 };
48 Register r9 = { 9 };
49 Register r10 = { 10 };
50 Register r11 = { 11 };
51 Register r12 = { 12 };
52 Register r13 = { 13 };
53 Register r14 = { 14 };
54 Register r15 = { 15 };
55
56 Register no_reg = { -1 };
57
58 XMMRegister xmm0 = { 0 };
59 XMMRegister xmm1 = { 1 };
60 XMMRegister xmm2 = { 2 };
61 XMMRegister xmm3 = { 3 };
62 XMMRegister xmm4 = { 4 };
63 XMMRegister xmm5 = { 5 };
64 XMMRegister xmm6 = { 6 };
65 XMMRegister xmm7 = { 7 };
66 XMMRegister xmm8 = { 8 };
67 XMMRegister xmm9 = { 9 };
68 XMMRegister xmm10 = { 10 };
69 XMMRegister xmm11 = { 11 };
70 XMMRegister xmm12 = { 12 };
71 XMMRegister xmm13 = { 13 };
72 XMMRegister xmm14 = { 14 };
73 XMMRegister xmm15 = { 15 };
74
75
76 // -----------------------------------------------------------------------------
77 // Implementation of CpuFeatures 37 // Implementation of CpuFeatures
78 38
79 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1): 39 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1):
80 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall 40 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall
81 uint64_t CpuFeatures::supported_ = kDefaultCpuFeatures; 41 uint64_t CpuFeatures::supported_ = kDefaultCpuFeatures;
82 uint64_t CpuFeatures::enabled_ = 0; 42 uint64_t CpuFeatures::enabled_ = 0;
83 uint64_t CpuFeatures::found_by_runtime_probing_ = 0; 43 uint64_t CpuFeatures::found_by_runtime_probing_ = 0;
84 44
85 void CpuFeatures::Probe() { 45 void CpuFeatures::Probe() {
86 ASSERT(Heap::HasBeenSetup()); 46 ASSERT(Heap::HasBeenSetup());
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 *(pc_ + i) = *(instructions + i); 177 *(pc_ + i) = *(instructions + i);
218 } 178 }
219 179
220 // Indicate that code has changed. 180 // Indicate that code has changed.
221 CPU::FlushICache(pc_, instruction_count); 181 CPU::FlushICache(pc_, instruction_count);
222 } 182 }
223 183
224 // ----------------------------------------------------------------------------- 184 // -----------------------------------------------------------------------------
225 // Implementation of Operand 185 // Implementation of Operand
226 186
227 Operand::Operand(Register base, int32_t disp): rex_(0) { 187 Operand::Operand(Register base, int32_t disp) : rex_(0) {
228 len_ = 1; 188 len_ = 1;
229 if (base.is(rsp) || base.is(r12)) { 189 if (base.is(rsp) || base.is(r12)) {
230 // SIB byte is needed to encode (rsp + offset) or (r12 + offset). 190 // SIB byte is needed to encode (rsp + offset) or (r12 + offset).
231 set_sib(times_1, rsp, base); 191 set_sib(times_1, rsp, base);
232 } 192 }
233 193
234 if (disp == 0 && !base.is(rbp) && !base.is(r13)) { 194 if (disp == 0 && !base.is(rbp) && !base.is(r13)) {
235 set_modrm(0, base); 195 set_modrm(0, base);
236 } else if (is_int8(disp)) { 196 } else if (is_int8(disp)) {
237 set_modrm(1, base); 197 set_modrm(1, base);
238 set_disp8(disp); 198 set_disp8(disp);
239 } else { 199 } else {
240 set_modrm(2, base); 200 set_modrm(2, base);
241 set_disp32(disp); 201 set_disp32(disp);
242 } 202 }
243 } 203 }
244 204
245 205
246 Operand::Operand(Register base, 206 Operand::Operand(Register base,
247 Register index, 207 Register index,
248 ScaleFactor scale, 208 ScaleFactor scale,
249 int32_t disp): rex_(0) { 209 int32_t disp) : rex_(0) {
250 ASSERT(!index.is(rsp)); 210 ASSERT(!index.is(rsp));
251 len_ = 1; 211 len_ = 1;
252 set_sib(scale, index, base); 212 set_sib(scale, index, base);
253 if (disp == 0 && !base.is(rbp) && !base.is(r13)) { 213 if (disp == 0 && !base.is(rbp) && !base.is(r13)) {
254 // This call to set_modrm doesn't overwrite the REX.B (or REX.X) bits 214 // This call to set_modrm doesn't overwrite the REX.B (or REX.X) bits
255 // possibly set by set_sib. 215 // possibly set by set_sib.
256 set_modrm(0, rsp); 216 set_modrm(0, rsp);
257 } else if (is_int8(disp)) { 217 } else if (is_int8(disp)) {
258 set_modrm(1, rsp); 218 set_modrm(1, rsp);
259 set_disp8(disp); 219 set_disp8(disp);
260 } else { 220 } else {
261 set_modrm(2, rsp); 221 set_modrm(2, rsp);
262 set_disp32(disp); 222 set_disp32(disp);
263 } 223 }
264 } 224 }
265 225
266 226
227 Operand::Operand(Register index,
228 ScaleFactor scale,
229 int32_t disp) : rex_(0) {
230 ASSERT(!index.is(rsp));
231 len_ = 1;
232 set_modrm(0, rsp);
233 set_sib(scale, index, rbp);
234 set_disp32(disp);
235 }
236
237
267 // ----------------------------------------------------------------------------- 238 // -----------------------------------------------------------------------------
268 // Implementation of Assembler. 239 // Implementation of Assembler.
269 240
270 #ifdef GENERATED_CODE_COVERAGE 241 #ifdef GENERATED_CODE_COVERAGE
271 static void InitCoverageLog(); 242 static void InitCoverageLog();
272 #endif 243 #endif
273 244
274 byte* Assembler::spare_buffer_ = NULL; 245 byte* Assembler::spare_buffer_ = NULL;
275 246
276 Assembler::Assembler(void* buffer, int buffer_size) 247 Assembler::Assembler(void* buffer, int buffer_size)
(...skipping 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 EnsureSpace ensure_space(this); 2472 EnsureSpace ensure_space(this);
2502 last_pc_ = pc_; 2473 last_pc_ = pc_;
2503 emit(0xF2); 2474 emit(0xF2);
2504 emit_optional_rex_32(dst, src); 2475 emit_optional_rex_32(dst, src);
2505 emit(0x0F); 2476 emit(0x0F);
2506 emit(0x5E); 2477 emit(0x5E);
2507 emit_sse_operand(dst, src); 2478 emit_sse_operand(dst, src);
2508 } 2479 }
2509 2480
2510 2481
2482 void Assembler::xorpd(XMMRegister dst, XMMRegister src) {
2483 EnsureSpace ensure_space(this);
2484 last_pc_ = pc_;
2485 emit(0x66);
2486 emit_optional_rex_32(dst, src);
2487 emit(0x0f);
2488 emit(0x57);
2489 emit_sse_operand(dst, src);
2490 }
2491
2492
2493 void Assembler::comisd(XMMRegister dst, XMMRegister src) {
2494 EnsureSpace ensure_space(this);
2495 last_pc_ = pc_;
2496 emit(0x66);
2497 emit_optional_rex_32(dst, src);
2498 emit(0x0f);
2499 emit(0x2f);
2500 emit_sse_operand(dst, src);
2501 }
2502
2503
2504 void Assembler::ucomisd(XMMRegister dst, XMMRegister src) {
2505 EnsureSpace ensure_space(this);
2506 last_pc_ = pc_;
2507 emit(0x66);
2508 emit_optional_rex_32(dst, src);
2509 emit(0x0f);
2510 emit(0x2e);
2511 emit_sse_operand(dst, src);
2512 }
2513
2511 2514
2512 void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) { 2515 void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) {
2513 Register ireg = { reg.code() }; 2516 Register ireg = { reg.code() };
2514 emit_operand(ireg, adr); 2517 emit_operand(ireg, adr);
2515 } 2518 }
2516 2519
2517 2520
2518 void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) { 2521 void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) {
2519 emit(0xC0 | (dst.low_bits() << 3) | src.low_bits()); 2522 emit(0xC0 | (dst.low_bits() << 3) | src.low_bits());
2520 } 2523 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 written_position_ = current_position_; 2588 written_position_ = current_position_;
2586 } 2589 }
2587 } 2590 }
2588 2591
2589 2592
2590 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | 2593 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask |
2591 1 << RelocInfo::INTERNAL_REFERENCE | 2594 1 << RelocInfo::INTERNAL_REFERENCE |
2592 1 << RelocInfo::JS_RETURN; 2595 1 << RelocInfo::JS_RETURN;
2593 2596
2594 } } // namespace v8::internal 2597 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698