OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #include "vm/tags.h" |
| 6 |
| 7 #include "vm/isolate.h" |
| 8 |
| 9 namespace dart { |
| 10 |
| 11 const char* VMTag::TagName(intptr_t id) { |
| 12 ASSERT(id >= 0); |
| 13 ASSERT(id < kNumVMTags); |
| 14 const TagEntry& entry = entries_[id]; |
| 15 ASSERT(entry.id == id); |
| 16 return entry.name; |
| 17 } |
| 18 |
| 19 |
| 20 VMTag::TagEntry VMTag::entries_[] = { |
| 21 #define DEFINE_VM_TAG_ENTRY(tag) \ |
| 22 { ""#tag, k##tag##TagId }, |
| 23 VM_TAG_LIST(DEFINE_VM_TAG_ENTRY) |
| 24 #undef DEFINE_VM_TAG_ENTRY |
| 25 }; |
| 26 |
| 27 |
| 28 VMTagScope::VMTagScope(intptr_t tag, Isolate* isolate) |
| 29 : StackResource(isolate), |
| 30 isolate_(isolate) { |
| 31 ASSERT(isolate_ != NULL); |
| 32 previous_tag_ = isolate_->vm_tag(); |
| 33 isolate_->set_vm_tag(tag); |
| 34 } |
| 35 |
| 36 |
| 37 VMTagScope::~VMTagScope() { |
| 38 ASSERT(isolate_ != NULL); |
| 39 isolate_->set_vm_tag(previous_tag_); |
| 40 } |
| 41 |
| 42 |
| 43 } // namespace dart |
OLD | NEW |