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

Unified Diff: runtime/vm/assembler.cc

Issue 12090034: Initial revision of ARM assembler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | runtime/vm/assembler_arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler.cc
===================================================================
--- runtime/vm/assembler.cc (revision 17773)
+++ runtime/vm/assembler.cc (working copy)
@@ -13,6 +13,10 @@
namespace dart {
+DEFINE_FLAG(bool, code_comments, false,
+ "Include comments into code and disassembly");
+
+
static uword NewContents(intptr_t capacity) {
Zone* zone = Isolate::Current()->current_zone();
uword result = zone->AllocUnsafe(capacity);
@@ -185,4 +189,31 @@
Stop(buffer);
}
+
+void Assembler::Comment(const char* format, ...) {
+ if (FLAG_code_comments) {
+ char buffer[1024];
+
+ va_list args;
+ va_start(args, format);
+ OS::VSNPrint(buffer, sizeof(buffer), format, args);
+ va_end(args);
+
+ comments_.Add(new CodeComment(buffer_.GetPosition(),
+ String::Handle(String::New(buffer))));
+ }
+}
+
+
+const Code::Comments& Assembler::GetCodeComments() const {
+ Code::Comments& comments = Code::Comments::New(comments_.length());
+
+ for (intptr_t i = 0; i < comments_.length(); i++) {
+ comments.SetPCOffsetAt(i, comments_[i]->pc_offset());
+ comments.SetCommentAt(i, comments_[i]->comment());
+ }
+
+ return comments;
+}
+
} // namespace dart
« no previous file with comments | « no previous file | runtime/vm/assembler_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698