Chromium Code Reviews| Index: src/runtime/runtime-test.cc |
| diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc |
| index 2a34d9c03130ba3a9784c5eeaa6bca6a76feb132..0c92f2d4928e2f20ea331984d996ce8f7daaa629 100644 |
| --- a/src/runtime/runtime-test.cc |
| +++ b/src/runtime/runtime-test.cc |
| @@ -156,6 +156,38 @@ RUNTIME_FUNCTION(Runtime_IsConcurrentRecompilationSupported) { |
| isolate->concurrent_recompilation_enabled()); |
| } |
| +RUNTIME_FUNCTION(Runtime_PrintTypeProfile) { |
| + HandleScope scope(isolate); |
|
Yang
2017/03/20 08:48:45
Let's DCHECK that args.length() is 1.
Franzi
2017/03/20 10:09:56
Done.
|
| + if (!FLAG_type_profile) { |
| + return isolate->heap()->undefined_value(); |
| + } |
| + |
| + CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); |
| + if (!function_object->IsJSFunction()) { |
|
Yang
2017/03/20 08:48:45
You can omit this type check if you define functio
Franzi
2017/03/20 10:09:56
Done.
|
| + return isolate->heap()->undefined_value(); |
| + } |
| + Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
| + |
| + 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(); |
|
Yang
2017/03/20 08:48:45
Do you really want to return after the first TypeP
Franzi
2017/03/20 10:09:56
Yes! Sorry, I discussed offline with Michi that we
|
| + } |
| + } |
| + } |
| + return isolate->heap()->undefined_value(); |
| +} |
| RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { |
| HandleScope scope(isolate); |