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

Side by Side Diff: runtime/vm/assembler_x64.h

Issue 10990028: Add code for CPU feature detection and use it to detect SSE3 and SSE 4.1. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: simplified, because there is no code in snapshots Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_ASSEMBLER_X64_H_ 5 #ifndef VM_ASSEMBLER_X64_H_
6 #define VM_ASSEMBLER_X64_H_ 6 #define VM_ASSEMBLER_X64_H_
7 7
8 #ifndef VM_ASSEMBLER_H_ 8 #ifndef VM_ASSEMBLER_H_
9 #error Do not include assembler_x64.h directly; use assembler.h instead. 9 #error Do not include assembler_x64.h directly; use assembler.h instead.
10 #endif 10 #endif
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 int position_; 266 int position_;
267 int unresolved_; 267 int unresolved_;
268 int unresolved_near_positions_[kMaxUnresolvedBranches]; 268 int unresolved_near_positions_[kMaxUnresolvedBranches];
269 269
270 friend class Assembler; 270 friend class Assembler;
271 DISALLOW_COPY_AND_ASSIGN(Label); 271 DISALLOW_COPY_AND_ASSIGN(Label);
272 }; 272 };
273 273
274 274
275 class CPUFeatures : public AllStatic {
276 public:
277 static void InitOnce();
278 static bool sse3_supported();
279 static bool sse4_1_supported();
280
281 private:
282 static const uint64_t kSSE3BitMask = static_cast<uint64_t>(1) << 32;
283 static const uint64_t kSSE4_1BitMask = static_cast<uint64_t>(1) << 51;
284
285 static bool sse3_supported_;
286 static bool sse4_1_supported_;
287 static bool initialized_;
srdjan 2012/09/25 17:12:25 in #ifdef DEBUG as on ia32?
Florian Schneider 2012/09/26 09:03:16 Done.
288 };
289
290
275 class Assembler : public ValueObject { 291 class Assembler : public ValueObject {
276 public: 292 public:
277 Assembler() : buffer_(), prolog_offset_(-1), comments_() { } 293 Assembler() : buffer_(), prolog_offset_(-1), comments_() { }
278 ~Assembler() { } 294 ~Assembler() { }
279 295
280 static const bool kNearJump = true; 296 static const bool kNearJump = true;
281 static const bool kFarJump = false; 297 static const bool kFarJump = false;
282 298
283 /* 299 /*
284 * Emit Machine Instructions. 300 * Emit Machine Instructions.
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 lock(); 506 lock();
491 cmpxchgl(address, reg); 507 cmpxchgl(address, reg);
492 } 508 }
493 509
494 void cmpxchgq(const Address& address, Register reg); 510 void cmpxchgq(const Address& address, Register reg);
495 void lock_cmpxchgq(const Address& address, Register reg) { 511 void lock_cmpxchgq(const Address& address, Register reg) {
496 lock(); 512 lock();
497 cmpxchgq(address, reg); 513 cmpxchgq(address, reg);
498 } 514 }
499 515
516 void cpuid();
517
500 // Issue memory to memory move through a TMP register. 518 // Issue memory to memory move through a TMP register.
501 void MoveMemoryToMemory(const Address& dst, const Address& src) { 519 void MoveMemoryToMemory(const Address& dst, const Address& src) {
502 movq(TMP, src); 520 movq(TMP, src);
503 movq(dst, TMP); 521 movq(dst, TMP);
504 } 522 }
505 523
506 void Exchange(Register reg, const Address& mem) { 524 void Exchange(Register reg, const Address& mem) {
507 movq(TMP, mem); 525 movq(TMP, mem);
508 movq(mem, reg); 526 movq(mem, reg);
509 movq(reg, TMP); 527 movq(reg, TMP);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 } 725 }
708 726
709 727
710 inline void Assembler::EmitOperandSizeOverride() { 728 inline void Assembler::EmitOperandSizeOverride() {
711 EmitUint8(0x66); 729 EmitUint8(0x66);
712 } 730 }
713 731
714 } // namespace dart 732 } // namespace dart
715 733
716 #endif // VM_ASSEMBLER_X64_H_ 734 #endif // VM_ASSEMBLER_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698