OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/tags.h" | 5 #include "vm/tags.h" |
6 | 6 |
7 #include "vm/isolate.h" | 7 #include "vm/isolate.h" |
8 #include "vm/json_stream.h" | 8 #include "vm/json_stream.h" |
9 #include "vm/object.h" | |
10 #include "vm/object_store.h" | |
9 | 11 |
10 namespace dart { | 12 namespace dart { |
11 | 13 |
12 const char* VMTag::TagName(uword tag) { | 14 const char* VMTag::TagName(uword tag) { |
13 ASSERT(tag != kInvalidTagId); | 15 ASSERT(tag != kInvalidTagId); |
14 ASSERT(tag < kNumVMTags); | 16 ASSERT(tag < kNumVMTags); |
15 const TagEntry& entry = entries_[tag]; | 17 const TagEntry& entry = entries_[tag]; |
16 ASSERT(entry.id == tag); | 18 ASSERT(entry.id == tag); |
17 return entry.name; | 19 return entry.name; |
18 } | 20 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 } | 73 } |
72 } | 74 } |
73 { | 75 { |
74 JSONArray arr(obj, "counters"); | 76 JSONArray arr(obj, "counters"); |
75 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { | 77 for (intptr_t i = 1; i < VMTag::kNumVMTags; i++) { |
76 arr.AddValue64(counters_[i]); | 78 arr.AddValue64(counters_[i]); |
77 } | 79 } |
78 } | 80 } |
79 } | 81 } |
80 | 82 |
83 | |
84 const char* UserTags::TagName(uword tag_address) { | |
85 ASSERT(tag_address >= kUserTagIdOffset); | |
86 ASSERT(tag_address < kUserTagIdOffset + kMaxUserTags); | |
87 Isolate* isolate = Isolate::Current(); | |
88 const UserTag& tag = | |
89 UserTag::Handle(isolate, UserTag::FindTagById(tag_address)); | |
90 ASSERT(!tag.IsNull()); | |
91 const String& label = String::Handle(tag.label()); | |
siva
2014/04/09 21:32:01
isolate, tag.label()) here as you already use that
Cutch
2014/04/09 22:27:20
Done.
| |
92 return label.ToCString(); | |
93 } | |
94 | |
95 | |
81 } // namespace dart | 96 } // namespace dart |
OLD | NEW |