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/bootstrap_natives.h" |
| 6 |
| 7 #include "include/dart_api.h" |
| 8 |
| 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/exceptions.h" |
| 11 #include "vm/native_entry.h" |
| 12 #include "vm/object.h" |
| 13 #include "vm/object_store.h" |
| 14 |
| 15 namespace dart { |
| 16 |
| 17 // dart:profiler. |
| 18 |
| 19 DEFINE_NATIVE_ENTRY(UserTag_new, 2) { |
| 20 ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); |
| 21 GET_NON_NULL_NATIVE_ARGUMENT(String, tag_label, arguments->NativeArgAt(1)); |
| 22 return UserTag::New(tag_label); |
| 23 } |
| 24 |
| 25 |
| 26 DEFINE_NATIVE_ENTRY(UserTag_label, 1) { |
| 27 const UserTag& self = UserTag::CheckedHandle(arguments->NativeArgAt(0)); |
| 28 return self.label(); |
| 29 } |
| 30 |
| 31 |
| 32 DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 1) { |
| 33 const UserTag& self = UserTag::CheckedHandle(arguments->NativeArgAt(0)); |
| 34 self.MakeActive(); |
| 35 return Object::null(); |
| 36 } |
| 37 |
| 38 |
| 39 DEFINE_NATIVE_ENTRY(Profiler_getCurrentTag, 0) { |
| 40 return isolate->current_tag(); |
| 41 } |
| 42 |
| 43 |
| 44 DEFINE_NATIVE_ENTRY(Profiler_clearCurrentTag, 0) { |
| 45 // Use a NoGCScope to avoid creating a handle for the old current. |
| 46 NoGCScope no_gc; |
| 47 RawUserTag* old_current = isolate->current_tag(); |
| 48 UserTag::ClearActive(); |
| 49 return old_current; |
| 50 } |
| 51 |
| 52 } // namespace dart |
OLD | NEW |