Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: runtime/lib/profiler.cc

Issue 230863005: Initial UserTag and dart:profiler library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/lib/profiler.dart » ('j') | runtime/vm/object.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
+
+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));
srdjan 2014/04/09 17:08:18 Use UserTag::CheckedHandle where type is known (e.
Cutch 2014/04/09 20:28:54 Done.
+ return self.label();
+}
+
+
+DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 1) {
+ 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.
+ isolate->set_user_tag(static_cast<uword>(self.tag()));
+ return Object::null();
+}
+
+} // namespace dart
« no previous file with comments | « no previous file | runtime/lib/profiler.dart » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698