| 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/native_entry.h" | 9 #include "vm/native_entry.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 | 77 |
| 78 void VMTag::RegisterRuntimeEntry(RuntimeEntry* runtime_entry) { | 78 void VMTag::RegisterRuntimeEntry(RuntimeEntry* runtime_entry) { |
| 79 ASSERT(runtime_entry != NULL); | 79 ASSERT(runtime_entry != NULL); |
| 80 runtime_entry->set_next(runtime_entry_list); | 80 runtime_entry->set_next(runtime_entry_list); |
| 81 runtime_entry_list = runtime_entry; | 81 runtime_entry_list = runtime_entry; |
| 82 } | 82 } |
| 83 | 83 |
| 84 | 84 |
| 85 VMTag::TagEntry VMTag::entries_[] = { | 85 VMTag::TagEntry VMTag::entries_[] = { |
| 86 { "InvalidTag", kInvalidTagId, }, | 86 { |
| 87 #define DEFINE_VM_TAG_ENTRY(tag) \ | 87 "InvalidTag", kInvalidTagId, |
| 88 { ""#tag, k##tag##TagId }, | 88 }, |
| 89 VM_TAG_LIST(DEFINE_VM_TAG_ENTRY) | 89 #define DEFINE_VM_TAG_ENTRY(tag) {"" #tag, k##tag##TagId}, |
| 90 VM_TAG_LIST(DEFINE_VM_TAG_ENTRY) |
| 90 #undef DEFINE_VM_TAG_ENTRY | 91 #undef DEFINE_VM_TAG_ENTRY |
| 91 { "kNumVMTags", kNumVMTags }, | 92 {"kNumVMTags", kNumVMTags}, |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 | 95 |
| 95 VMTagScope::VMTagScope(Thread* thread, uword tag, bool conditional_set) | 96 VMTagScope::VMTagScope(Thread* thread, uword tag, bool conditional_set) |
| 96 : StackResource(thread) { | 97 : StackResource(thread) { |
| 97 ASSERT(isolate() != NULL); | 98 ASSERT(isolate() != NULL); |
| 98 previous_tag_ = thread->vm_tag(); | 99 previous_tag_ = thread->vm_tag(); |
| 99 if (conditional_set) { | 100 if (conditional_set) { |
| 100 thread->set_vm_tag(tag); | 101 thread->set_vm_tag(tag); |
| 101 } | 102 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 156 } |
| 156 } | 157 } |
| 157 } | 158 } |
| 158 #endif // !PRODUCT | 159 #endif // !PRODUCT |
| 159 | 160 |
| 160 | 161 |
| 161 const char* UserTags::TagName(uword tag_id) { | 162 const char* UserTags::TagName(uword tag_id) { |
| 162 ASSERT(tag_id >= kUserTagIdOffset); | 163 ASSERT(tag_id >= kUserTagIdOffset); |
| 163 ASSERT(tag_id < kUserTagIdOffset + kMaxUserTags); | 164 ASSERT(tag_id < kUserTagIdOffset + kMaxUserTags); |
| 164 Zone* zone = Thread::Current()->zone(); | 165 Zone* zone = Thread::Current()->zone(); |
| 165 const UserTag& tag = | 166 const UserTag& tag = UserTag::Handle(zone, UserTag::FindTagById(tag_id)); |
| 166 UserTag::Handle(zone, UserTag::FindTagById(tag_id)); | |
| 167 ASSERT(!tag.IsNull()); | 167 ASSERT(!tag.IsNull()); |
| 168 const String& label = String::Handle(zone, tag.label()); | 168 const String& label = String::Handle(zone, tag.label()); |
| 169 return label.ToCString(); | 169 return label.ToCString(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 | 172 |
| 173 } // namespace dart | 173 } // namespace dart |
| OLD | NEW |