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

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

Issue 2755973002: [type profile] Collect return types. (Closed)
Patch Set: Clean up. 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
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 9c52a1f626739eabed973ffff5168f3c021704de..9033c66339ba9c691901ad8a386594b5364b519b 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -693,14 +693,20 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) {
RUNTIME_FUNCTION(Runtime_CollectTypeProfile) {
HandleScope scope(isolate);
- DCHECK_EQ(4, args.length());
- CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
- CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 2);
- CONVERT_SMI_ARG_CHECKED(index, 3);
+ DCHECK_EQ(5, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(Smi, position, 0);
+ CONVERT_ARG_HANDLE_CHECKED(String, name, 1);
+ CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
+ CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 3);
+ CONVERT_SMI_ARG_CHECKED(index, 4);
DCHECK(FLAG_type_profile);
+ Object* function_name = vector->shared_function_info()->name();
Michael Starzinger 2017/03/20 09:29:26 This must be handlified, otherwise the handlified
Michael Starzinger 2017/03/20 09:31:48 s/function and leave/function or leave/
Franzi 2017/03/20 15:38:39 Done.
+ if (!function_name->IsString()) {
+ UNREACHABLE();
+ }
+
Handle<Name> type = Object::TypeOf(isolate, value);
if (value->IsJSReceiver()) {
Handle<JSReceiver> object = Handle<JSReceiver>::cast(value);
@@ -710,11 +716,15 @@ RUNTIME_FUNCTION(Runtime_CollectTypeProfile) {
CollectTypeProfileNexus nexus(vector, vector->ToSlot(index));
nexus.Collect(type);
- PrintF("%s\n", name->ToCString().get());
- nexus.Print();
- PrintF("\n");
+ if (position->value() >= 0) {
+ PrintF("Function: %s, position: %d, expression: %s\n",
+ String::cast(function_name)->ToCString().get(), position->value(),
+ name->ToCString().get());
+ nexus.Print();
+ PrintF("\n");
+ }
- return *name;
+ return *position;
}
// Return property without being observable by accessors or interceptors.

Powered by Google App Engine
This is Rietveld 408576698