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

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') | no next file with comments »
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..26285eece0d7c3f0de761f72162bd020e28b42e8
--- /dev/null
+++ b/runtime/lib/profiler.cc
@@ -0,0 +1,52 @@
+// 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"
+#include "vm/object_store.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));
+ return UserTag::New(tag_label);
+}
+
+
+DEFINE_NATIVE_ENTRY(UserTag_label, 1) {
+ const UserTag& self = UserTag::CheckedHandle(arguments->NativeArgAt(0));
+ return self.label();
+}
+
+
+DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 1) {
+ const UserTag& self = UserTag::CheckedHandle(arguments->NativeArgAt(0));
+ self.MakeActive();
+ return Object::null();
+}
+
+
+DEFINE_NATIVE_ENTRY(Profiler_getCurrentTag, 0) {
+ return isolate->current_tag();
+}
+
+
+DEFINE_NATIVE_ENTRY(Profiler_clearCurrentTag, 0) {
+ // Use a NoGCScope to avoid creating a handle for the old current.
+ NoGCScope no_gc;
+ RawUserTag* old_current = isolate->current_tag();
+ UserTag::ClearActive();
+ return old_current;
+}
+
+} // namespace dart
« no previous file with comments | « no previous file | runtime/lib/profiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698