| OLD | NEW |
| 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 Loading... |
| 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 #ifdef DEBUG |
| 288 static bool initialized_; |
| 289 #endif |
| 290 }; |
| 291 |
| 292 |
| 275 class Assembler : public ValueObject { | 293 class Assembler : public ValueObject { |
| 276 public: | 294 public: |
| 277 Assembler() : buffer_(), prolog_offset_(-1), comments_() { } | 295 Assembler() : buffer_(), prolog_offset_(-1), comments_() { } |
| 278 ~Assembler() { } | 296 ~Assembler() { } |
| 279 | 297 |
| 280 static const bool kNearJump = true; | 298 static const bool kNearJump = true; |
| 281 static const bool kFarJump = false; | 299 static const bool kFarJump = false; |
| 282 | 300 |
| 283 /* | 301 /* |
| 284 * Emit Machine Instructions. | 302 * Emit Machine Instructions. |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 lock(); | 508 lock(); |
| 491 cmpxchgl(address, reg); | 509 cmpxchgl(address, reg); |
| 492 } | 510 } |
| 493 | 511 |
| 494 void cmpxchgq(const Address& address, Register reg); | 512 void cmpxchgq(const Address& address, Register reg); |
| 495 void lock_cmpxchgq(const Address& address, Register reg) { | 513 void lock_cmpxchgq(const Address& address, Register reg) { |
| 496 lock(); | 514 lock(); |
| 497 cmpxchgq(address, reg); | 515 cmpxchgq(address, reg); |
| 498 } | 516 } |
| 499 | 517 |
| 518 void cpuid(); |
| 519 |
| 500 // Issue memory to memory move through a TMP register. | 520 // Issue memory to memory move through a TMP register. |
| 501 void MoveMemoryToMemory(const Address& dst, const Address& src) { | 521 void MoveMemoryToMemory(const Address& dst, const Address& src) { |
| 502 movq(TMP, src); | 522 movq(TMP, src); |
| 503 movq(dst, TMP); | 523 movq(dst, TMP); |
| 504 } | 524 } |
| 505 | 525 |
| 506 void Exchange(Register reg, const Address& mem) { | 526 void Exchange(Register reg, const Address& mem) { |
| 507 movq(TMP, mem); | 527 movq(TMP, mem); |
| 508 movq(mem, reg); | 528 movq(mem, reg); |
| 509 movq(reg, TMP); | 529 movq(reg, TMP); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 } | 727 } |
| 708 | 728 |
| 709 | 729 |
| 710 inline void Assembler::EmitOperandSizeOverride() { | 730 inline void Assembler::EmitOperandSizeOverride() { |
| 711 EmitUint8(0x66); | 731 EmitUint8(0x66); |
| 712 } | 732 } |
| 713 | 733 |
| 714 } // namespace dart | 734 } // namespace dart |
| 715 | 735 |
| 716 #endif // VM_ASSEMBLER_X64_H_ | 736 #endif // VM_ASSEMBLER_X64_H_ |
| OLD | NEW |