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

Unified Diff: src/runtime/runtime-test.cc

Issue 2757993002: [runtime] Add function for printing type profile. (Closed)
Patch Set: Address review comments. Created 3 years, 9 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 | « src/runtime/runtime-object.cc ('k') | test/message/type-profile/collect-type-profile.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index 2a34d9c03130ba3a9784c5eeaa6bca6a76feb132..2c179607d8f8ff4c744d2d519015f578d24f223c 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -156,6 +156,35 @@ RUNTIME_FUNCTION(Runtime_IsConcurrentRecompilationSupported) {
isolate->concurrent_recompilation_enabled());
}
+RUNTIME_FUNCTION(Runtime_PrintTypeProfile) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(1, args.length());
+
+ if (!FLAG_type_profile) {
+ return isolate->heap()->undefined_value();
+ }
+
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+ if (function->has_feedback_vector()) {
+ FeedbackVector* vector = function->feedback_vector();
+
+ Object* function_name = vector->shared_function_info()->name();
+ PrintF("Function: %s\n", String::cast(function_name)->ToCString().get());
+
+ FeedbackMetadataIterator iter(vector->metadata());
+ while (iter.HasNext()) {
+ FeedbackSlot slot = iter.Next();
+ FeedbackSlotKind kind = iter.kind();
+ if (kind == FeedbackSlotKind::kTypeProfile) {
+ CollectTypeProfileNexus nexus(vector, slot);
+ nexus.Print();
+ PrintF("\n");
+ return isolate->heap()->undefined_value();
+ }
+ }
+ }
+ return isolate->heap()->undefined_value();
+}
RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
HandleScope scope(isolate);
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/message/type-profile/collect-type-profile.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698