Chromium Code Reviews| Index: runtime/lib/profiler.cc |
| diff --git a/runtime/lib/profiler.cc b/runtime/lib/profiler.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8a4863c179419b411786b0ce0782b590f291230a |
| --- /dev/null |
| +++ b/runtime/lib/profiler.cc |
| @@ -0,0 +1,45 @@ |
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +#include "vm/bootstrap_natives.h" |
| + |
| +#include "include/dart_api.h" |
| + |
| +#include "vm/bigint_operations.h" |
| +#include "vm/exceptions.h" |
| +#include "vm/native_entry.h" |
| +#include "vm/object.h" |
| + |
| +namespace dart { |
| + |
| +// dart:profiler. |
| + |
|
srdjan
2014/04/09 17:08:19
Since natives are slow comparably, it is important
Cutch
2014/04/09 20:28:54
This will be in the next CL.
|
| +DEFINE_NATIVE_ENTRY(UserTag_new, 2) { |
| + ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull()); |
| + GET_NON_NULL_NATIVE_ARGUMENT(String, tag_label, arguments->NativeArgAt(1)); |
| + if (UserTag::TagTableFull(isolate)) { |
| + const String& error = String::Handle( |
| + String::NewFormatted("UserTag instance limit (%" Pd ") reached.", |
| + UserTagHelper::kMaxUserTags)); |
| + const Array& args = Array::Handle(Array::New(1)); |
| + args.SetAt(0, error); |
| + Exceptions::ThrowByType(Exceptions::kUnsupported, args); |
| + } |
| + return UserTag::New(tag_label); |
| +} |
| + |
| + |
| +DEFINE_NATIVE_ENTRY(UserTag_label, 1) { |
| + GET_NON_NULL_NATIVE_ARGUMENT(UserTag, self, arguments->NativeArgAt(0)); |
| + return self.label(); |
| +} |
| + |
| + |
| +DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 1) { |
| + GET_NON_NULL_NATIVE_ARGUMENT(UserTag, self, arguments->NativeArgAt(0)); |
| + isolate->set_user_tag(static_cast<uword>(self.tag())); |
| + return Object::null(); |
| +} |
| + |
| +} // namespace dart |