Index: runtime/vm/tags.cc |
diff --git a/runtime/vm/tags.cc b/runtime/vm/tags.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c2bab467a6fc947801bd60a91bcb583f0251fb63 |
--- /dev/null |
+++ b/runtime/vm/tags.cc |
@@ -0,0 +1,43 @@ |
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+#include "vm/tags.h" |
+ |
+#include "vm/isolate.h" |
+ |
+namespace dart { |
+ |
+const char* VMTag::TagName(intptr_t id) { |
+ ASSERT(id >= 0); |
+ ASSERT(id < kNumVMTags); |
+ const TagEntry& entry = entries_[id]; |
+ ASSERT(entry.id == id); |
+ return entry.name; |
+} |
+ |
+ |
+VMTag::TagEntry VMTag::entries_[] = { |
+#define DEFINE_VM_TAG_ENTRY(tag) \ |
+ { ""#tag, k##tag##TagId }, |
+ VM_TAG_LIST(DEFINE_VM_TAG_ENTRY) |
+#undef DEFINE_VM_TAG_ENTRY |
+}; |
+ |
+ |
+VMTagScope::VMTagScope(intptr_t tag, Isolate* isolate) |
+ : StackResource(isolate), |
+ isolate_(isolate) { |
+ ASSERT(isolate_ != NULL); |
+ previous_tag_ = isolate_->vm_tag(); |
+ isolate_->set_vm_tag(tag); |
+} |
+ |
+ |
+VMTagScope::~VMTagScope() { |
+ ASSERT(isolate_ != NULL); |
+ isolate_->set_vm_tag(previous_tag_); |
+} |
+ |
+ |
+} // namespace dart |