| 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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 const UserTag& self = UserTag::CheckedHandle(arguments->NativeArgAt(0)); | 29 const UserTag& self = UserTag::CheckedHandle(arguments->NativeArgAt(0)); |
| 30 return self.label(); | 30 return self.label(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 | 33 |
| 34 DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 1) { | 34 DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 1) { |
| 35 const UserTag& self = UserTag::CheckedHandle(arguments->NativeArgAt(0)); | 35 const UserTag& self = UserTag::CheckedHandle(arguments->NativeArgAt(0)); |
| 36 if (FLAG_trace_intrinsified_natives) { | 36 if (FLAG_trace_intrinsified_natives) { |
| 37 OS::Print("UserTag_makeCurrent: %s\n", self.ToCString()); | 37 OS::Print("UserTag_makeCurrent: %s\n", self.ToCString()); |
| 38 } | 38 } |
| 39 const UserTag& old = UserTag::Handle(isolate->current_tag()); |
| 39 self.MakeActive(); | 40 self.MakeActive(); |
| 40 return Object::null(); | 41 return old.raw(); |
| 42 } |
| 43 |
| 44 |
| 45 DEFINE_NATIVE_ENTRY(UserTag_defaultTag, 0) { |
| 46 if (FLAG_trace_intrinsified_natives) { |
| 47 OS::Print("UserTag_defaultTag\n"); |
| 48 } |
| 49 return isolate->object_store()->default_tag(); |
| 41 } | 50 } |
| 42 | 51 |
| 43 | 52 |
| 44 DEFINE_NATIVE_ENTRY(Profiler_getCurrentTag, 0) { | 53 DEFINE_NATIVE_ENTRY(Profiler_getCurrentTag, 0) { |
| 45 if (FLAG_trace_intrinsified_natives) { | 54 if (FLAG_trace_intrinsified_natives) { |
| 46 OS::Print("Profiler_getCurrentTag\n"); | 55 OS::Print("Profiler_getCurrentTag\n"); |
| 47 } | 56 } |
| 48 return isolate->current_tag(); | 57 return isolate->current_tag(); |
| 49 } | 58 } |
| 50 | 59 |
| 51 | 60 |
| 52 DEFINE_NATIVE_ENTRY(Profiler_clearCurrentTag, 0) { | |
| 53 // Use a NoGCScope to avoid creating a handle for the old current. | |
| 54 NoGCScope no_gc; | |
| 55 RawUserTag* old_current = isolate->current_tag(); | |
| 56 UserTag::ClearActive(); | |
| 57 if (FLAG_trace_intrinsified_natives) { | |
| 58 OS::Print("Profiler_clearCurrentTag\n"); | |
| 59 } | |
| 60 return old_current; | |
| 61 } | |
| 62 | |
| 63 } // namespace dart | 61 } // namespace dart |
| OLD | NEW |