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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 static bool sse4_1_supported_; | 285 static bool sse4_1_supported_; |
286 #ifdef DEBUG | 286 #ifdef DEBUG |
287 static bool initialized_; | 287 static bool initialized_; |
288 #endif | 288 #endif |
289 }; | 289 }; |
290 | 290 |
291 | 291 |
292 class Assembler : public ValueObject { | 292 class Assembler : public ValueObject { |
293 public: | 293 public: |
294 Assembler() : buffer_(), prolog_offset_(-1), comments_() { } | 294 Assembler() : buffer_(), prologue_offset_(-1), comments_() { } |
295 ~Assembler() { } | 295 ~Assembler() { } |
296 | 296 |
297 static const bool kNearJump = true; | 297 static const bool kNearJump = true; |
298 static const bool kFarJump = false; | 298 static const bool kFarJump = false; |
299 | 299 |
300 /* | 300 /* |
301 * Emit Machine Instructions. | 301 * Emit Machine Instructions. |
302 */ | 302 */ |
303 void call(Register reg); | 303 void call(Register reg); |
304 void call(const Address& address); | 304 void call(const Address& address); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 } | 618 } |
619 | 619 |
620 int PreferredLoopAlignment() { return 16; } | 620 int PreferredLoopAlignment() { return 16; } |
621 void Align(int alignment, int offset); | 621 void Align(int alignment, int offset); |
622 void Bind(Label* label); | 622 void Bind(Label* label); |
623 | 623 |
624 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 624 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
625 const Code::Comments& GetCodeComments() const; | 625 const Code::Comments& GetCodeComments() const; |
626 | 626 |
627 int CodeSize() const { return buffer_.Size(); } | 627 int CodeSize() const { return buffer_.Size(); } |
628 int prolog_offset() const { return prolog_offset_; } | 628 int prologue_offset() const { return prologue_offset_; } |
629 const ZoneGrowableArray<int>& GetPointerOffsets() const { | 629 const ZoneGrowableArray<int>& GetPointerOffsets() const { |
630 return buffer_.pointer_offsets(); | 630 return buffer_.pointer_offsets(); |
631 } | 631 } |
632 | 632 |
633 void FinalizeInstructions(const MemoryRegion& region) { | 633 void FinalizeInstructions(const MemoryRegion& region) { |
634 buffer_.FinalizeInstructions(region); | 634 buffer_.FinalizeInstructions(region); |
635 } | 635 } |
636 | 636 |
637 // Debugging and bringup support. | 637 // Debugging and bringup support. |
638 void Stop(const char* message); | 638 void Stop(const char* message); |
639 void Unimplemented(const char* message); | 639 void Unimplemented(const char* message); |
640 void Untested(const char* message); | 640 void Untested(const char* message); |
641 void Unreachable(const char* message); | 641 void Unreachable(const char* message); |
642 | 642 |
643 static void InitializeMemoryWithBreakpoints(uword data, int length); | 643 static void InitializeMemoryWithBreakpoints(uword data, int length); |
644 | 644 |
645 static const char* RegisterName(Register reg); | 645 static const char* RegisterName(Register reg); |
646 | 646 |
647 static const char* XmmRegisterName(XmmRegister reg); | 647 static const char* XmmRegisterName(XmmRegister reg); |
648 | 648 |
649 private: | 649 private: |
650 AssemblerBuffer buffer_; | 650 AssemblerBuffer buffer_; |
651 int prolog_offset_; | 651 int prologue_offset_; |
652 | 652 |
653 class CodeComment : public ZoneAllocated { | 653 class CodeComment : public ZoneAllocated { |
654 public: | 654 public: |
655 CodeComment(intptr_t pc_offset, const String& comment) | 655 CodeComment(intptr_t pc_offset, const String& comment) |
656 : pc_offset_(pc_offset), comment_(comment) { } | 656 : pc_offset_(pc_offset), comment_(comment) { } |
657 | 657 |
658 intptr_t pc_offset() const { return pc_offset_; } | 658 intptr_t pc_offset() const { return pc_offset_; } |
659 const String& comment() const { return comment_; } | 659 const String& comment() const { return comment_; } |
660 | 660 |
661 private: | 661 private: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 } | 777 } |
778 | 778 |
779 | 779 |
780 inline void Assembler::EmitOperandSizeOverride() { | 780 inline void Assembler::EmitOperandSizeOverride() { |
781 EmitUint8(0x66); | 781 EmitUint8(0x66); |
782 } | 782 } |
783 | 783 |
784 } // namespace dart | 784 } // namespace dart |
785 | 785 |
786 #endif // VM_ASSEMBLER_X64_H_ | 786 #endif // VM_ASSEMBLER_X64_H_ |
OLD | NEW |