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

Unified Diff: src/feedback-vector.cc

Issue 2755973002: [type profile] Collect return types. (Closed)
Patch Set: Rebase. 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/feedback-vector.h ('k') | src/interpreter/bytecode-array-builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/feedback-vector.cc
diff --git a/src/feedback-vector.cc b/src/feedback-vector.cc
index ef62a634fd55c93b9547869505eec7b44e3def25..4bdf4823ce9395e825c1b3c69106d40b78fa67ee 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,13 @@ 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);
+ DCHECK(maybe_entry->IsTuple2());
+ 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());
}
}
« no previous file with comments | « src/feedback-vector.h ('k') | src/interpreter/bytecode-array-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698