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

Side by Side Diff: runtime/vm/assembler_x64.h

Issue 10407019: Extend assembler with ability to produce comments for the generated code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
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_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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 } 523 }
524 524
525 void SmiUntag(Register reg) { 525 void SmiUntag(Register reg) {
526 sarq(reg, Immediate(kSmiTagSize)); 526 sarq(reg, Immediate(kSmiTagSize));
527 } 527 }
528 528
529 int PreferredLoopAlignment() { return 16; } 529 int PreferredLoopAlignment() { return 16; }
530 void Align(int alignment, int offset); 530 void Align(int alignment, int offset);
531 void Bind(Label* label); 531 void Bind(Label* label);
532 532
533 void Comment(const char* format, ...);
534 CodeComments GetComments();
srdjan 2012/05/17 17:22:08 ditto from ia32
Vyacheslav Egorov (Google) 2012/05/17 21:16:27 Done.
535
533 int CodeSize() const { return buffer_.Size(); } 536 int CodeSize() const { return buffer_.Size(); }
534 int prolog_offset() const { return prolog_offset_; } 537 int prolog_offset() const { return prolog_offset_; }
535 const ZoneGrowableArray<int>& GetPointerOffsets() const { 538 const ZoneGrowableArray<int>& GetPointerOffsets() const {
536 return buffer_.pointer_offsets(); 539 return buffer_.pointer_offsets();
537 } 540 }
538 541
539 void FinalizeInstructions(const MemoryRegion& region) { 542 void FinalizeInstructions(const MemoryRegion& region) {
540 buffer_.FinalizeInstructions(region); 543 buffer_.FinalizeInstructions(region);
541 } 544 }
542 545
543 // Debugging and bringup support. 546 // Debugging and bringup support.
544 void Stop(const char* message); 547 void Stop(const char* message);
545 void Unimplemented(const char* message); 548 void Unimplemented(const char* message);
546 void Untested(const char* message); 549 void Untested(const char* message);
547 void Unreachable(const char* message); 550 void Unreachable(const char* message);
548 551
549 static void InitializeMemoryWithBreakpoints(uword data, int length); 552 static void InitializeMemoryWithBreakpoints(uword data, int length);
550 553
551 private: 554 private:
552 AssemblerBuffer buffer_; 555 AssemblerBuffer buffer_;
553 int prolog_offset_; 556 int prolog_offset_;
554 557
558 class CodeComment : public ZoneAllocated {
559 public:
560 CodeComment(intptr_t pc, const String& comment)
561 : pc_(pc), comment_(comment) { }
562
563 intptr_t pc() const { return pc_; }
564 const String& comment() const { return comment_; }
565
566 private:
567 intptr_t pc_;
568 const String& comment_;
569 };
570
571 GrowableArray<CodeComment*> comments_;
572
555 inline void EmitUint8(uint8_t value); 573 inline void EmitUint8(uint8_t value);
556 inline void EmitInt32(int32_t value); 574 inline void EmitInt32(int32_t value);
557 inline void EmitInt64(int64_t value); 575 inline void EmitInt64(int64_t value);
558 576
559 inline void EmitRegisterREX(Register reg, uint8_t rex); 577 inline void EmitRegisterREX(Register reg, uint8_t rex);
560 inline void EmitRegisterOperand(int rm, int reg); 578 inline void EmitRegisterOperand(int rm, int reg);
561 inline void EmitOperandREX(int rm, const Operand& operand, uint8_t rex); 579 inline void EmitOperandREX(int rm, const Operand& operand, uint8_t rex);
562 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg); 580 inline void EmitXmmRegisterOperand(int rm, XmmRegister reg);
563 inline void EmitFixup(AssemblerFixup* fixup); 581 inline void EmitFixup(AssemblerFixup* fixup);
564 inline void EmitOperandSizeOverride(); 582 inline void EmitOperandSizeOverride();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 } 631 }
614 632
615 633
616 inline void Assembler::EmitOperandSizeOverride() { 634 inline void Assembler::EmitOperandSizeOverride() {
617 EmitUint8(0x66); 635 EmitUint8(0x66);
618 } 636 }
619 637
620 } // namespace dart 638 } // namespace dart
621 639
622 #endif // VM_ASSEMBLER_X64_H_ 640 #endif // VM_ASSEMBLER_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698