Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Unified Diff: runtime/vm/tags.cc

Issue 195733009: Basic tag infrastructure (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/tags.cc
diff --git a/runtime/vm/tags.cc b/runtime/vm/tags.cc
new file mode 100644
index 0000000000000000000000000000000000000000..39424ef5bd16b46c21ed5a1dae1a63ac7b4c003b
--- /dev/null
+++ b/runtime/vm/tags.cc
@@ -0,0 +1,44 @@
+// 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(uword id) {
+ ASSERT(id < kNumVMTags);
+ const TagEntry& entry = entries_[id];
+ ASSERT(entry.id == id);
+ return entry.name;
+}
+
+
+VMTag::TagEntry VMTag::entries_[] = {
+ { "InvalidTag", kInvalidTagId, },
+#define DEFINE_VM_TAG_ENTRY(tag) \
+ { ""#tag, k##tag##TagId },
+ VM_TAG_LIST(DEFINE_VM_TAG_ENTRY)
+#undef DEFINE_VM_TAG_ENTRY
+ { "kNumVMTags", kNumVMTags },
+};
+
+
+VMTagScope::VMTagScope(Isolate* isolate, uword tag)
+ : StackResource(isolate),
+ isolate_(isolate) {
+ ASSERT(isolate_ != NULL);
+ previous_tag_ = isolate_->vm_tag();
siva 2014/03/13 23:18:47 isolate()->vm_tag();
Cutch 2014/03/14 15:41:51 Done.
+ isolate_->set_vm_tag(tag);
+}
+
+
+VMTagScope::~VMTagScope() {
+ ASSERT(isolate_ != NULL);
+ isolate_->set_vm_tag(previous_tag_);
siva 2014/03/13 23:18:47 isolate()->
Cutch 2014/03/14 15:41:51 Done.
+}
+
+
+} // namespace dart
« runtime/vm/tags.h ('K') | « runtime/vm/tags.h ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698