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