| 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/exceptions.h" | 
|---|
| 10 | #include "vm/native_entry.h" | 
|---|
| 11 | #include "vm/object.h" | 
|---|
| 12 | #include "vm/object_store.h" | 
|---|
| 13 |  | 
|---|
| 14 | namespace dart { | 
|---|
| 15 |  | 
|---|
| 16 | // Native implementations of the profiler parts of the dart:developer library. | 
|---|
| 17 |  | 
|---|
| 18 | DEFINE_NATIVE_ENTRY(UserTag_new, 0, 2) { | 
|---|
| 19 | ASSERT( | 
|---|
| 20 | TypeArguments::CheckedHandle(zone, 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 | DEFINE_NATIVE_ENTRY(UserTag_label, 0, 1) { | 
|---|
| 26 | const UserTag& self = UserTag::CheckedHandle(zone, arguments->NativeArgAt(0)); | 
|---|
| 27 | return self.label(); | 
|---|
| 28 | } | 
|---|
| 29 |  | 
|---|
| 30 | DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 0, 1) { | 
|---|
| 31 | const UserTag& self = UserTag::CheckedHandle(zone, arguments->NativeArgAt(0)); | 
|---|
| 32 | if (FLAG_trace_intrinsified_natives) { | 
|---|
| 33 | OS::PrintErr( "UserTag_makeCurrent: %s\n", self.ToCString()); | 
|---|
| 34 | } | 
|---|
| 35 | const UserTag& old = UserTag::Handle(zone, isolate->current_tag()); | 
|---|
| 36 | self.MakeActive(); | 
|---|
| 37 | return old.raw(); | 
|---|
| 38 | } | 
|---|
| 39 |  | 
|---|
| 40 | DEFINE_NATIVE_ENTRY(UserTag_defaultTag, 0, 0) { | 
|---|
| 41 | if (FLAG_trace_intrinsified_natives) { | 
|---|
| 42 | OS::PrintErr( "UserTag_defaultTag\n"); | 
|---|
| 43 | } | 
|---|
| 44 | return isolate->default_tag(); | 
|---|
| 45 | } | 
|---|
| 46 |  | 
|---|
| 47 | DEFINE_NATIVE_ENTRY(Profiler_getCurrentTag, 0, 0) { | 
|---|
| 48 | if (FLAG_trace_intrinsified_natives) { | 
|---|
| 49 | OS::PrintErr( "Profiler_getCurrentTag\n"); | 
|---|
| 50 | } | 
|---|
| 51 | return isolate->current_tag(); | 
|---|
| 52 | } | 
|---|
| 53 |  | 
|---|
| 54 | }  // namespace dart | 
|---|
| 55 |  | 
|---|