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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/tags.h ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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(uword id) {
12 ASSERT(id != kInvalidTagId);
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 { "InvalidTag", kInvalidTagId, },
22 #define DEFINE_VM_TAG_ENTRY(tag) \
23 { ""#tag, k##tag##TagId },
24 VM_TAG_LIST(DEFINE_VM_TAG_ENTRY)
25 #undef DEFINE_VM_TAG_ENTRY
26 { "kNumVMTags", kNumVMTags },
27 };
28
29
30 VMTagScope::VMTagScope(Isolate* base_isolate, uword tag)
31 : StackResource(base_isolate) {
32 ASSERT(isolate() != NULL);
33 previous_tag_ = isolate()->vm_tag();
34 isolate()->set_vm_tag(tag);
35 }
36
37
38 VMTagScope::~VMTagScope() {
39 ASSERT(isolate() != NULL);
40 isolate()->set_vm_tag(previous_tag_);
41 }
42
43
44 } // namespace dart
OLDNEW
« no previous file with comments | « 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