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

Unified 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: address Srdjan comments 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/assembler_x64.h
diff --git a/runtime/vm/assembler_x64.h b/runtime/vm/assembler_x64.h
index b4b0ee8744d57c605991194f5274429714ceea8b..af9e1ed40719d7435d2b3b1ce4f0dfe946d825ca 100644
--- a/runtime/vm/assembler_x64.h
+++ b/runtime/vm/assembler_x64.h
@@ -296,7 +296,7 @@ class Label : public ValueObject {
class Assembler : public ValueObject {
public:
- Assembler() : buffer_(), prolog_offset_(-1) { }
+ Assembler() : buffer_(), prolog_offset_(-1), comments_() { }
~Assembler() { }
static const bool kNearJump = true;
@@ -530,6 +530,9 @@ class Assembler : public ValueObject {
void Align(int alignment, int offset);
void Bind(Label* label);
+ void Comment(const char* format, ...);
+ const Code::Comments& GetCodeComments() const;
+
int CodeSize() const { return buffer_.Size(); }
int prolog_offset() const { return prolog_offset_; }
const ZoneGrowableArray<int>& GetPointerOffsets() const {
@@ -552,6 +555,23 @@ class Assembler : public ValueObject {
AssemblerBuffer buffer_;
int prolog_offset_;
+ class CodeComment : public ZoneAllocated {
+ public:
+ CodeComment(intptr_t pc_offset, const String& comment)
+ : pc_offset_(pc_offset), comment_(comment) { }
+
+ intptr_t pc_offset() const { return pc_offset_; }
+ const String& comment() const { return comment_; }
+
+ private:
+ intptr_t pc_offset_;
+ const String& comment_;
+
+ DISALLOW_COPY_AND_ASSIGN(CodeComment);
+ };
+
+ GrowableArray<CodeComment*> comments_;
+
inline void EmitUint8(uint8_t value);
inline void EmitInt32(int32_t value);
inline void EmitInt64(int64_t value);

Powered by Google App Engine
This is Rietveld 408576698