| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 static bool sse2_supported_; | 292 static bool sse2_supported_; |
| 293 static bool sse4_1_supported_; | 293 static bool sse4_1_supported_; |
| 294 #ifdef DEBUG | 294 #ifdef DEBUG |
| 295 static bool initialized_; | 295 static bool initialized_; |
| 296 #endif | 296 #endif |
| 297 }; | 297 }; |
| 298 | 298 |
| 299 | 299 |
| 300 class Assembler : public ValueObject { | 300 class Assembler : public ValueObject { |
| 301 public: | 301 public: |
| 302 Assembler() : buffer_(), prologue_offset_(-1), comments_() { } | 302 Assembler() |
| 303 : buffer_(), |
| 304 object_pool_(GrowableObjectArray::Handle()), |
| 305 prologue_offset_(-1), |
| 306 comments_() { } |
| 303 ~Assembler() { } | 307 ~Assembler() { } |
| 304 | 308 |
| 305 static const bool kNearJump = true; | 309 static const bool kNearJump = true; |
| 306 static const bool kFarJump = false; | 310 static const bool kFarJump = false; |
| 307 | 311 |
| 308 /* | 312 /* |
| 309 * Emit Machine Instructions. | 313 * Emit Machine Instructions. |
| 310 */ | 314 */ |
| 311 void call(Register reg); | 315 void call(Register reg); |
| 312 void call(const Address& address); | 316 void call(const Address& address); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 | 671 |
| 668 int PreferredLoopAlignment() { return 16; } | 672 int PreferredLoopAlignment() { return 16; } |
| 669 void Align(int alignment, int offset); | 673 void Align(int alignment, int offset); |
| 670 void Bind(Label* label); | 674 void Bind(Label* label); |
| 671 | 675 |
| 672 int CodeSize() const { return buffer_.Size(); } | 676 int CodeSize() const { return buffer_.Size(); } |
| 673 int prologue_offset() const { return prologue_offset_; } | 677 int prologue_offset() const { return prologue_offset_; } |
| 674 const ZoneGrowableArray<int>& GetPointerOffsets() const { | 678 const ZoneGrowableArray<int>& GetPointerOffsets() const { |
| 675 return buffer_.pointer_offsets(); | 679 return buffer_.pointer_offsets(); |
| 676 } | 680 } |
| 681 const GrowableObjectArray& object_pool() const { return object_pool_; } |
| 677 | 682 |
| 678 void FinalizeInstructions(const MemoryRegion& region) { | 683 void FinalizeInstructions(const MemoryRegion& region) { |
| 679 buffer_.FinalizeInstructions(region); | 684 buffer_.FinalizeInstructions(region); |
| 680 } | 685 } |
| 681 | 686 |
| 682 // Debugging and bringup support. | 687 // Debugging and bringup support. |
| 683 void Stop(const char* message); | 688 void Stop(const char* message); |
| 684 void Unimplemented(const char* message); | 689 void Unimplemented(const char* message); |
| 685 void Untested(const char* message); | 690 void Untested(const char* message); |
| 686 void Unreachable(const char* message); | 691 void Unreachable(const char* message); |
| 687 | 692 |
| 688 static void InitializeMemoryWithBreakpoints(uword data, int length); | 693 static void InitializeMemoryWithBreakpoints(uword data, int length); |
| 689 | 694 |
| 690 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 695 void Comment(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
| 691 const Code::Comments& GetCodeComments() const; | 696 const Code::Comments& GetCodeComments() const; |
| 692 | 697 |
| 693 static const char* RegisterName(Register reg); | 698 static const char* RegisterName(Register reg); |
| 694 static const char* FpuRegisterName(FpuRegister reg); | 699 static const char* FpuRegisterName(FpuRegister reg); |
| 695 | 700 |
| 696 private: | 701 private: |
| 697 AssemblerBuffer buffer_; | 702 AssemblerBuffer buffer_; |
| 703 GrowableObjectArray& object_pool_; // Object pool is not used on ia32. |
| 698 int prologue_offset_; | 704 int prologue_offset_; |
| 699 | 705 |
| 700 class CodeComment : public ZoneAllocated { | 706 class CodeComment : public ZoneAllocated { |
| 701 public: | 707 public: |
| 702 CodeComment(intptr_t pc_offset, const String& comment) | 708 CodeComment(intptr_t pc_offset, const String& comment) |
| 703 : pc_offset_(pc_offset), comment_(comment) { } | 709 : pc_offset_(pc_offset), comment_(comment) { } |
| 704 | 710 |
| 705 intptr_t pc_offset() const { return pc_offset_; } | 711 intptr_t pc_offset() const { return pc_offset_; } |
| 706 const String& comment() const { return comment_; } | 712 const String& comment() const { return comment_; } |
| 707 | 713 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 } | 770 } |
| 765 | 771 |
| 766 | 772 |
| 767 inline void Assembler::EmitOperandSizeOverride() { | 773 inline void Assembler::EmitOperandSizeOverride() { |
| 768 EmitUint8(0x66); | 774 EmitUint8(0x66); |
| 769 } | 775 } |
| 770 | 776 |
| 771 } // namespace dart | 777 } // namespace dart |
| 772 | 778 |
| 773 #endif // VM_ASSEMBLER_IA32_H_ | 779 #endif // VM_ASSEMBLER_IA32_H_ |
| OLD | NEW |