| Index: runtime/vm/tags.cc
|
| diff --git a/runtime/vm/tags.cc b/runtime/vm/tags.cc
|
| index f05aa22cc77cf3b478de034d91fd3d78e946f146..b1695b82fb0ee550c65cf85fdd79bf04154f0cfa 100644
|
| --- a/runtime/vm/tags.cc
|
| +++ b/runtime/vm/tags.cc
|
| @@ -6,6 +6,8 @@
|
|
|
| #include "vm/isolate.h"
|
| #include "vm/json_stream.h"
|
| +#include "vm/object.h"
|
| +#include "vm/object_store.h"
|
|
|
| namespace dart {
|
|
|
| @@ -78,4 +80,34 @@ void VMTagCounters::PrintToJSONObject(JSONObject* obj) {
|
| }
|
| }
|
|
|
| +
|
| +const char* UserTagHelper::TagName(uword tag_address) {
|
| + Isolate* isolate = Isolate::Current();
|
| + const Instance& tag = Instance::Handle(
|
| + isolate,
|
| + reinterpret_cast<RawInstance*>(tag_address));
|
| + if (tag.IsNull()) {
|
| + return "Default User Tag";
|
| + }
|
| + const Library& profiler_lib = Library::Handle(
|
| + isolate,
|
| + isolate->object_store()->profiler_library());
|
| + ASSERT(!profiler_lib.IsNull());
|
| + const String& tag_class_name = String::Handle(isolate, String::New("Tag"));
|
| + ASSERT(!tag_class_name.IsNull());
|
| + const Class& tag_class = Class::Handle(
|
| + profiler_lib.LookupClass(tag_class_name));
|
| + ASSERT(!tag_class.IsNull());
|
| + const String& label_field_name = String::Handle(String::New("label"));
|
| + ASSERT(!label_field_name.IsNull());
|
| + const Field& label_field =
|
| + Field::Handle(tag_class.LookupField(label_field_name));
|
| + ASSERT(!label_field.IsNull());
|
| + const Object& field = Object::Handle(tag.GetField(label_field));
|
| + ASSERT(!field.IsNull());
|
| + const String& label = String::Cast(field);
|
| + return label.ToCString();
|
| +}
|
| +
|
| +
|
| } // namespace dart
|
|
|