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(uword id) { | |
12 ASSERT(id < kNumVMTags); | |
13 const TagEntry& entry = entries_[id]; | |
14 ASSERT(entry.id == id); | |
15 return entry.name; | |
16 } | |
17 | |
18 | |
19 VMTag::TagEntry VMTag::entries_[] = { | |
20 { "InvalidTag", kInvalidTagId, }, | |
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 { "kNumVMTags", kNumVMTags }, | |
26 }; | |
27 | |
28 | |
29 VMTagScope::VMTagScope(Isolate* isolate, uword tag) | |
30 : StackResource(isolate), | |
31 isolate_(isolate) { | |
32 ASSERT(isolate_ != NULL); | |
33 previous_tag_ = isolate_->vm_tag(); | |
siva
2014/03/13 23:18:47
isolate()->vm_tag();
Cutch
2014/03/14 15:41:51
Done.
| |
34 isolate_->set_vm_tag(tag); | |
35 } | |
36 | |
37 | |
38 VMTagScope::~VMTagScope() { | |
39 ASSERT(isolate_ != NULL); | |
40 isolate_->set_vm_tag(previous_tag_); | |
siva
2014/03/13 23:18:47
isolate()->
Cutch
2014/03/14 15:41:51
Done.
| |
41 } | |
42 | |
43 | |
44 } // namespace dart | |
OLD | NEW |