Chromium Code Reviews| 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 | |
| 14 namespace dart { | |
| 15 | |
| 16 // dart:profiler. | |
| 17 | |
| 18 DEFINE_NATIVE_ENTRY(UserTag_new, 2) { | |
| 19 ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); | |
| 20 GET_NON_NULL_NATIVE_ARGUMENT(String, tag_label, arguments->NativeArgAt(1)); | |
| 21 if (UserTag::TagTableFull(isolate)) { | |
| 22 const String& error = String::Handle( | |
| 23 String::NewFormatted("UserTag instance limit (%" Pd ") reached.", | |
| 24 UserTagHelper::kMaxUserTags)); | |
| 25 const Array& args = Array::Handle(Array::New(1)); | |
| 26 args.SetAt(0, error); | |
| 27 Exceptions::ThrowByType(Exceptions::kUnsupported, args); | |
| 28 } | |
| 29 return UserTag::New(tag_label); | |
| 30 } | |
| 31 | |
| 32 | |
| 33 DEFINE_NATIVE_ENTRY(UserTag_label, 1) { | |
| 34 GET_NON_NULL_NATIVE_ARGUMENT(UserTag, self, arguments->NativeArgAt(0)); | |
|
srdjan
2014/04/09 17:08:18
Use UserTag::CheckedHandle where type is known (e.
Cutch
2014/04/09 20:28:54
Done.
| |
| 35 return self.label(); | |
| 36 } | |
| 37 | |
| 38 | |
| 39 DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 1) { | |
| 40 GET_NON_NULL_NATIVE_ARGUMENT(UserTag, self, arguments->NativeArgAt(0)); | |
|
srdjan
2014/04/09 17:08:18
ditto
Cutch
2014/04/09 20:28:54
Done.
| |
| 41 isolate->set_user_tag(static_cast<uword>(self.tag())); | |
| 42 return Object::null(); | |
| 43 } | |
| 44 | |
| 45 } // namespace dart | |
| OLD | NEW |