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

Unified Diff: runtime/vm/tags.cc

Issue 230863005: Initial UserTag and dart:profiler library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « runtime/vm/tags.h ('k') | runtime/vm/vm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/tags.cc
diff --git a/runtime/vm/tags.cc b/runtime/vm/tags.cc
index 68f9c51c0deebf39451d744b05f6cd31af837a8b..21e1d5adf2c35cb040e1028d1292e0572979a06f 100644
--- a/runtime/vm/tags.cc
+++ b/runtime/vm/tags.cc
@@ -8,6 +8,7 @@
#include "vm/json_stream.h"
#include "vm/native_entry.h"
#include "vm/runtime_entry.h"
+#include "vm/object.h"
namespace dart {
@@ -32,6 +33,9 @@ const char* VMTag::TagName(uword tag) {
bool VMTag::IsNativeEntryTag(uword tag) {
+ if (tag == 0) {
+ return false;
+ }
ASSERT(tag != kInvalidTagId);
ASSERT(tag != kNumVMTags);
return (tag > kNumVMTags) && !IsRuntimeEntryTag(tag);
@@ -138,4 +142,17 @@ void VMTagCounters::PrintToJSONObject(JSONObject* obj) {
}
}
+
+const char* UserTags::TagName(uword tag_id) {
+ ASSERT(tag_id >= kUserTagIdOffset);
+ ASSERT(tag_id < kUserTagIdOffset + kMaxUserTags);
+ Isolate* isolate = Isolate::Current();
+ const UserTag& tag =
+ UserTag::Handle(isolate, UserTag::FindTagById(tag_id));
+ ASSERT(!tag.IsNull());
+ const String& label = String::Handle(isolate, tag.label());
+ return label.ToCString();
+}
+
+
} // namespace dart
« no previous file with comments | « runtime/vm/tags.h ('k') | runtime/vm/vm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698