| 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_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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 int unresolved_; | 272 int unresolved_; |
| 273 int unresolved_near_positions_[kMaxUnresolvedBranches]; | 273 int unresolved_near_positions_[kMaxUnresolvedBranches]; |
| 274 | 274 |
| 275 friend class Assembler; | 275 friend class Assembler; |
| 276 DISALLOW_COPY_AND_ASSIGN(Label); | 276 DISALLOW_COPY_AND_ASSIGN(Label); |
| 277 }; | 277 }; |
| 278 | 278 |
| 279 | 279 |
| 280 class Assembler : public ValueObject { | 280 class Assembler : public ValueObject { |
| 281 public: | 281 public: |
| 282 Assembler() : buffer_(), prolog_offset_(-1) { } | 282 Assembler() : buffer_(), prolog_offset_(-1), comments_() { } |
| 283 ~Assembler() { } | 283 ~Assembler() { } |
| 284 | 284 |
| 285 static const bool kNearJump = true; | 285 static const bool kNearJump = true; |
| 286 static const bool kFarJump = false; | 286 static const bool kFarJump = false; |
| 287 | 287 |
| 288 /* | 288 /* |
| 289 * Emit Machine Instructions. | 289 * Emit Machine Instructions. |
| 290 */ | 290 */ |
| 291 void call(Register reg); | 291 void call(Register reg); |
| 292 void call(const Address& address); | 292 void call(const Address& address); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 } | 554 } |
| 555 | 555 |
| 556 // Debugging and bringup support. | 556 // Debugging and bringup support. |
| 557 void Stop(const char* message); | 557 void Stop(const char* message); |
| 558 void Unimplemented(const char* message); | 558 void Unimplemented(const char* message); |
| 559 void Untested(const char* message); | 559 void Untested(const char* message); |
| 560 void Unreachable(const char* message); | 560 void Unreachable(const char* message); |
| 561 | 561 |
| 562 static void InitializeMemoryWithBreakpoints(uword data, int length); | 562 static void InitializeMemoryWithBreakpoints(uword data, int length); |
| 563 | 563 |
| 564 void Comment(const char* comment); |
| 565 const Code::Comments& GetCodeComments() const; |
| 566 |
| 564 private: | 567 private: |
| 565 AssemblerBuffer buffer_; | 568 AssemblerBuffer buffer_; |
| 566 int prolog_offset_; | 569 int prolog_offset_; |
| 567 | 570 |
| 571 class CodeComment : public ZoneAllocated { |
| 572 public: |
| 573 CodeComment(intptr_t pc_offset, const String& comment) |
| 574 : pc_offset_(pc_offset), comment_(comment) { } |
| 575 |
| 576 intptr_t pc_offset() const { return pc_offset_; } |
| 577 const String& comment() const { return comment_; } |
| 578 |
| 579 private: |
| 580 intptr_t pc_offset_; |
| 581 const String& comment_; |
| 582 |
| 583 DISALLOW_COPY_AND_ASSIGN(CodeComment); |
| 584 }; |
| 585 |
| 586 GrowableArray<CodeComment*> comments_; |
| 587 |
| 568 inline void EmitUint8(uint8_t value); | 588 inline void EmitUint8(uint8_t value); |
| 569 inline void EmitInt32(int32_t value); | 589 inline void EmitInt32(int32_t value); |
| 570 inline void EmitRegisterOperand(int rm, int reg); | 590 inline void EmitRegisterOperand(int rm, int reg); |
| 571 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); | 591 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); |
| 572 inline void EmitFixup(AssemblerFixup* fixup); | 592 inline void EmitFixup(AssemblerFixup* fixup); |
| 573 inline void EmitOperandSizeOverride(); | 593 inline void EmitOperandSizeOverride(); |
| 574 | 594 |
| 575 void EmitOperand(int rm, const Operand& operand); | 595 void EmitOperand(int rm, const Operand& operand); |
| 576 void EmitImmediate(const Immediate& imm); | 596 void EmitImmediate(const Immediate& imm); |
| 577 void EmitComplex(int rm, const Operand& operand, const Immediate& immediate); | 597 void EmitComplex(int rm, const Operand& operand, const Immediate& immediate); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 } | 633 } |
| 614 | 634 |
| 615 | 635 |
| 616 inline void Assembler::EmitOperandSizeOverride() { | 636 inline void Assembler::EmitOperandSizeOverride() { |
| 617 EmitUint8(0x66); | 637 EmitUint8(0x66); |
| 618 } | 638 } |
| 619 | 639 |
| 620 } // namespace dart | 640 } // namespace dart |
| 621 | 641 |
| 622 #endif // VM_ASSEMBLER_IA32_H_ | 642 #endif // VM_ASSEMBLER_IA32_H_ |
| OLD | NEW |