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

Unified Diff: runtime/vm/object.cc

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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 86bd0b75b5a41a80af1696a8b22783424d70eb19..5b528ce22574bf81c1110d663a6259e50fa304ab 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -6072,11 +6072,65 @@ const char* ExceptionHandlers::ToCString() const {
}
+CodeComments CodeComments::New(int count) {
+ if (count == 0) return CodeComments();
+ return CodeComments(Array::New(count * kNumberOfEntries));
+}
+
+
+intptr_t CodeComments::Length() {
+ return comments_.IsNull() ? 0 : (comments_.Length() / kNumberOfEntries);
+}
+
+
+intptr_t CodeComments::PCAt(int idx) {
+ return Smi::CheckedHandle(
+ comments_.At(idx * kNumberOfEntries + kPCEntry)).Value();
+}
+
+
+void CodeComments::SetPCAt(int idx, intptr_t pc) {
+ comments_.SetAt(idx * kNumberOfEntries + kPCEntry,
+ Smi::Handle(Smi::New(pc)));
+}
+
+
+const String& CodeComments::CommentAt(int idx) {
+ return String::CheckedHandle(
+ comments_.At(idx * kNumberOfEntries + kCommentEntry));
+}
+
+
+void CodeComments::SetCommentAt(int idx, const String& comment) {
+ comments_.SetAt(idx * kNumberOfEntries + kCommentEntry, comment);
+}
+
+
+CodeComments::CodeComments(RawArray* comments)
+ : comments_(Array::Handle(comments)) {
+}
+
+
+CodeComments::CodeComments()
+ : comments_(Array::Handle()) {
+}
+
+
void Code::set_stackmaps(const Array& maps) const {
StorePointer(&raw_ptr()->stackmaps_, maps.raw());
}
+CodeComments Code::comments() const {
+ return CodeComments(raw_ptr()->comments_);
+}
+
+
+void Code::set_comments(const CodeComments& comments) const {
+ StorePointer(&raw_ptr()->comments_, comments.comments_.raw());
+}
+
+
RawCode* Code::New(int pointer_offsets_length) {
const Class& cls = Class::Handle(Object::code_class());
Code& result = Code::Handle();
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698