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

Side by Side Diff: runtime/vm/assembler_ia32.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: addressed comments 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
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/assembler_ia32.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 (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_IA32_H_ 5 #ifndef VM_ASSEMBLER_IA32_H_
6 #define VM_ASSEMBLER_IA32_H_ 6 #define VM_ASSEMBLER_IA32_H_
7 7
8 #ifndef VM_ASSEMBLER_H_ 8 #ifndef VM_ASSEMBLER_H_
9 #error Do not include assembler_ia32.h directly; use assembler.h instead. 9 #error Do not include assembler_ia32.h directly; use assembler.h instead.
10 #endif 10 #endif
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 int position_; 249 int position_;
250 int unresolved_; 250 int unresolved_;
251 int unresolved_near_positions_[kMaxUnresolvedBranches]; 251 int unresolved_near_positions_[kMaxUnresolvedBranches];
252 252
253 friend class Assembler; 253 friend class Assembler;
254 DISALLOW_COPY_AND_ASSIGN(Label); 254 DISALLOW_COPY_AND_ASSIGN(Label);
255 }; 255 };
256 256
257 257
258 class CPUFeatures : public AllStatic {
259 public:
260 static void InitOnce();
261 static bool sse3_supported();
262 static bool sse4_1_supported();
263
264 private:
265 static const uint64_t kSSE3BitMask = static_cast<uint64_t>(1) << 32;
266 static const uint64_t kSSE4_1BitMask = static_cast<uint64_t>(1) << 51;
267
268 static bool sse3_supported_;
269 static bool sse4_1_supported_;
270 #ifdef DEBUG
271 static bool initialized_;
272 #endif
273 };
274
275
258 class Assembler : public ValueObject { 276 class Assembler : public ValueObject {
259 public: 277 public:
260 Assembler() : buffer_(), prolog_offset_(-1), comments_() { } 278 Assembler() : buffer_(), prolog_offset_(-1), comments_() { }
261 ~Assembler() { } 279 ~Assembler() { }
262 280
263 static const bool kNearJump = true; 281 static const bool kNearJump = true;
264 static const bool kFarJump = false; 282 static const bool kFarJump = false;
265 283
266 /* 284 /*
267 * Emit Machine Instructions. 285 * Emit Machine Instructions.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 void j(Condition condition, Label* label, bool near = kFarJump); 494 void j(Condition condition, Label* label, bool near = kFarJump);
477 void j(Condition condition, const ExternalLabel* label); 495 void j(Condition condition, const ExternalLabel* label);
478 496
479 void jmp(Register reg); 497 void jmp(Register reg);
480 void jmp(Label* label, bool near = kFarJump); 498 void jmp(Label* label, bool near = kFarJump);
481 void jmp(const ExternalLabel* label); 499 void jmp(const ExternalLabel* label);
482 500
483 void lock(); 501 void lock();
484 void cmpxchgl(const Address& address, Register reg); 502 void cmpxchgl(const Address& address, Register reg);
485 503
504 void cpuid();
505
486 /* 506 /*
487 * Macros for High-level operations and implemented on all architectures. 507 * Macros for High-level operations and implemented on all architectures.
488 */ 508 */
489 509
490 void CompareRegisters(Register a, Register b); 510 void CompareRegisters(Register a, Register b);
491 511
492 // Issues a move instruction if 'to' is not the same as 'from'. 512 // Issues a move instruction if 'to' is not the same as 'from'.
493 void MoveRegister(Register to, Register from); 513 void MoveRegister(Register to, Register from);
494 void PushRegister(Register r); 514 void PushRegister(Register r);
495 void PopRegister(Register r); 515 void PopRegister(Register r);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 677 }
658 678
659 679
660 inline void Assembler::EmitOperandSizeOverride() { 680 inline void Assembler::EmitOperandSizeOverride() {
661 EmitUint8(0x66); 681 EmitUint8(0x66);
662 } 682 }
663 683
664 } // namespace dart 684 } // namespace dart
665 685
666 #endif // VM_ASSEMBLER_IA32_H_ 686 #endif // VM_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/assembler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698