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

Unified Diff: src/feedback-vector.cc

Issue 2755973002: [type profile] Collect return types. (Closed)
Patch Set: Use the source position. 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/feedback-vector.cc
diff --git a/src/feedback-vector.cc b/src/feedback-vector.cc
index ef62a634fd55c93b9547869505eec7b44e3def25..900d69f763ebe4a30271031b8b11359231d65bfd 100644
--- a/src/feedback-vector.cc
+++ b/src/feedback-vector.cc
@@ -1049,7 +1049,7 @@ InlineCacheState CollectTypeProfileNexus::StateFromFeedback() const {
return MONOMORPHIC;
}
-void CollectTypeProfileNexus::Collect(Handle<Name> type) {
+void CollectTypeProfileNexus::Collect(Handle<Name> type, int position) {
Isolate* isolate = GetIsolate();
Object* const feedback = GetFeedback();
@@ -1060,9 +1060,13 @@ void CollectTypeProfileNexus::Collect(Handle<Name> type) {
} else {
types = Handle<ArrayList>(ArrayList::cast(feedback), isolate);
}
+
+ Handle<Tuple2> entry = isolate->factory()->NewTuple2(
+ type, Handle<Smi>(Smi::FromInt(position), isolate));
+
// TODO(franzih): Somehow sort this list. Either avoid duplicates
// or use the common base type.
- SetFeedback(*ArrayList::Add(types, type));
+ SetFeedback(*ArrayList::Add(types, entry));
}
void CollectTypeProfileNexus::Print() const {
@@ -1078,8 +1082,15 @@ void CollectTypeProfileNexus::Print() const {
list = Handle<ArrayList>(ArrayList::cast(feedback), isolate);
for (int i = 0; i < list->Length(); i++) {
- String* name = String::cast(list->Get(i));
- PrintF("%s\n", name->ToCString().get());
+ Handle<Object> maybe_entry = Handle<Object>(list->Get(i), isolate);
+ if (!maybe_entry->IsTuple2()) {
Michael Starzinger 2017/03/20 17:12:32 The Handle<Tuple2>::cast already covers this. If y
Franzi 2017/03/20 19:29:37 I have no idea what I was thinking 😂. Keeping a DC
+ UNREACHABLE();
+ }
+ Handle<Tuple2> entry = Handle<Tuple2>::cast(maybe_entry);
+ Handle<String> type =
+ Handle<String>(String::cast(entry->value1()), isolate);
+ int position = Smi::cast(entry->value2())->value();
+ PrintF("%d: %s\n", position, type->ToCString().get());
}
}

Powered by Google App Engine
This is Rietveld 408576698