| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #ifndef RUNTIME_VM_TAGS_H_ | 5 #ifndef RUNTIME_VM_TAGS_H_ |
| 6 #define RUNTIME_VM_TAGS_H_ | 6 #define RUNTIME_VM_TAGS_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 static void RegisterRuntimeEntry(RuntimeEntry* runtime_entry); | 69 static void RegisterRuntimeEntry(RuntimeEntry* runtime_entry); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 struct TagEntry { | 72 struct TagEntry { |
| 73 const char* name; | 73 const char* name; |
| 74 uword id; | 74 uword id; |
| 75 }; | 75 }; |
| 76 static TagEntry entries_[]; | 76 static TagEntry entries_[]; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 | |
| 80 class VMTagScope : StackResource { | 79 class VMTagScope : StackResource { |
| 81 public: | 80 public: |
| 82 VMTagScope(Thread* thread, uword tag, bool conditional_set = true); | 81 VMTagScope(Thread* thread, uword tag, bool conditional_set = true); |
| 83 ~VMTagScope(); | 82 ~VMTagScope(); |
| 84 | 83 |
| 85 private: | 84 private: |
| 86 uword previous_tag_; | 85 uword previous_tag_; |
| 87 | 86 |
| 88 DISALLOW_ALLOCATION(); | 87 DISALLOW_ALLOCATION(); |
| 89 DISALLOW_IMPLICIT_CONSTRUCTORS(VMTagScope); | 88 DISALLOW_IMPLICIT_CONSTRUCTORS(VMTagScope); |
| 90 }; | 89 }; |
| 91 | 90 |
| 92 | |
| 93 class VMTagCounters { | 91 class VMTagCounters { |
| 94 public: | 92 public: |
| 95 VMTagCounters(); | 93 VMTagCounters(); |
| 96 | 94 |
| 97 void Increment(uword tag); | 95 void Increment(uword tag); |
| 98 | 96 |
| 99 int64_t count(uword tag); | 97 int64_t count(uword tag); |
| 100 | 98 |
| 101 #ifndef PRODUCT | 99 #ifndef PRODUCT |
| 102 void PrintToJSONObject(JSONObject* obj); | 100 void PrintToJSONObject(JSONObject* obj); |
| 103 #endif // !PRODUCT | 101 #endif // !PRODUCT |
| 104 | 102 |
| 105 private: | 103 private: |
| 106 int64_t counters_[VMTag::kNumVMTags]; | 104 int64_t counters_[VMTag::kNumVMTags]; |
| 107 }; | 105 }; |
| 108 | 106 |
| 109 | |
| 110 class UserTags : public AllStatic { | 107 class UserTags : public AllStatic { |
| 111 public: | 108 public: |
| 112 // UserTag id space: [kUserTagIdOffset, kUserTagIdOffset + kMaxUserTags). | 109 // UserTag id space: [kUserTagIdOffset, kUserTagIdOffset + kMaxUserTags). |
| 113 static const intptr_t kMaxUserTags = 256; | 110 static const intptr_t kMaxUserTags = 256; |
| 114 static const uword kUserTagIdOffset = 0x4096; | 111 static const uword kUserTagIdOffset = 0x4096; |
| 115 static const uword kDefaultUserTag = kUserTagIdOffset; | 112 static const uword kDefaultUserTag = kUserTagIdOffset; |
| 116 static const char* TagName(uword tag_id); | 113 static const char* TagName(uword tag_id); |
| 117 static bool IsUserTag(uword tag_id) { | 114 static bool IsUserTag(uword tag_id) { |
| 118 return (tag_id >= kUserTagIdOffset) && | 115 return (tag_id >= kUserTagIdOffset) && |
| 119 (tag_id < kUserTagIdOffset + kMaxUserTags); | 116 (tag_id < kUserTagIdOffset + kMaxUserTags); |
| 120 } | 117 } |
| 121 }; | 118 }; |
| 122 | 119 |
| 123 | |
| 124 } // namespace dart | 120 } // namespace dart |
| 125 | 121 |
| 126 #endif // RUNTIME_VM_TAGS_H_ | 122 #endif // RUNTIME_VM_TAGS_H_ |
| OLD | NEW |