| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/tags.h" | 5 #include "vm/tags.h" |
| 6 | 6 |
| 7 #include "vm/isolate.h" | 7 #include "vm/isolate.h" |
| 8 #include "vm/json_stream.h" | 8 #include "vm/json_stream.h" |
| 9 #include "vm/native_entry.h" | 9 #include "vm/native_entry.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 VMTag::TagEntry VMTag::entries_[] = { | 74 VMTag::TagEntry VMTag::entries_[] = { |
| 75 { "InvalidTag", kInvalidTagId, }, | 75 { "InvalidTag", kInvalidTagId, }, |
| 76 #define DEFINE_VM_TAG_ENTRY(tag) \ | 76 #define DEFINE_VM_TAG_ENTRY(tag) \ |
| 77 { ""#tag, k##tag##TagId }, | 77 { ""#tag, k##tag##TagId }, |
| 78 VM_TAG_LIST(DEFINE_VM_TAG_ENTRY) | 78 VM_TAG_LIST(DEFINE_VM_TAG_ENTRY) |
| 79 #undef DEFINE_VM_TAG_ENTRY | 79 #undef DEFINE_VM_TAG_ENTRY |
| 80 { "kNumVMTags", kNumVMTags }, | 80 { "kNumVMTags", kNumVMTags }, |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 | 83 |
| 84 VMTagScope::VMTagScope(Isolate* base_isolate, uword tag) | 84 VMTagScope::VMTagScope(Isolate* base_isolate, uword tag, bool conditional_set) |
| 85 : StackResource(base_isolate) { | 85 : StackResource(base_isolate) { |
| 86 ASSERT(isolate() != NULL); | 86 ASSERT(isolate() != NULL); |
| 87 previous_tag_ = isolate()->vm_tag(); | 87 previous_tag_ = isolate()->vm_tag(); |
| 88 isolate()->set_vm_tag(tag); | 88 if (conditional_set) { |
| 89 isolate()->set_vm_tag(tag); |
| 90 } |
| 89 } | 91 } |
| 90 | 92 |
| 91 | 93 |
| 92 VMTagScope::~VMTagScope() { | 94 VMTagScope::~VMTagScope() { |
| 93 ASSERT(isolate() != NULL); | 95 ASSERT(isolate() != NULL); |
| 94 isolate()->set_vm_tag(previous_tag_); | 96 isolate()->set_vm_tag(previous_tag_); |
| 95 } | 97 } |
| 96 | 98 |
| 97 | 99 |
| 98 VMTagCounters::VMTagCounters() { | 100 VMTagCounters::VMTagCounters() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 Isolate* isolate = Isolate::Current(); | 148 Isolate* isolate = Isolate::Current(); |
| 147 const UserTag& tag = | 149 const UserTag& tag = |
| 148 UserTag::Handle(isolate, UserTag::FindTagById(tag_id)); | 150 UserTag::Handle(isolate, UserTag::FindTagById(tag_id)); |
| 149 ASSERT(!tag.IsNull()); | 151 ASSERT(!tag.IsNull()); |
| 150 const String& label = String::Handle(isolate, tag.label()); | 152 const String& label = String::Handle(isolate, tag.label()); |
| 151 return label.ToCString(); | 153 return label.ToCString(); |
| 152 } | 154 } |
| 153 | 155 |
| 154 | 156 |
| 155 } // namespace dart | 157 } // namespace dart |
| OLD | NEW |