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

Unified Diff: src/heap/heap.cc

Issue 2337123003: [turbofan] Collect invocation counts and compute relative call frequencies. (Closed)
Patch Set: Address feedback. Created 4 years, 3 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/heap/heap.h ('k') | src/profiler/heap-snapshot-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 31599e5cd044a9b9d8b9bc88c521d4a676b90cb7..6c1fcc1bd75b4c803c0d49242ee829f8f7e43512 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -2820,9 +2820,26 @@ void Heap::CreateInitialObjects() {
}
{
+ // Create a canonical empty TypeFeedbackVector, which is shared by all
+ // functions that don't need actual type feedback slots. Note however
+ // that all these functions will share the same invocation count, but
+ // that shouldn't matter since we only use the invocation count to
+ // relativize the absolute call counts, but we can only have call counts
+ // if we have actual feedback slots.
+ Handle<FixedArray> empty_type_feedback_vector = factory->NewFixedArray(
+ TypeFeedbackVector::kReservedIndexCount, TENURED);
+ empty_type_feedback_vector->set(TypeFeedbackVector::kMetadataIndex,
+ empty_fixed_array());
+ empty_type_feedback_vector->set(TypeFeedbackVector::kInvocationCountIndex,
+ Smi::FromInt(0));
+ set_empty_type_feedback_vector(*empty_type_feedback_vector);
+
+ // We use a canonical empty LiteralsArray for all functions that neither
+ // have literals nor need a TypeFeedbackVector (besides the invocation
+ // count special slot).
Handle<FixedArray> empty_literals_array =
factory->NewFixedArray(1, TENURED);
- empty_literals_array->set(0, *factory->empty_fixed_array());
+ empty_literals_array->set(0, *empty_type_feedback_vector);
set_empty_literals_array(*empty_literals_array);
}
« no previous file with comments | « src/heap/heap.h ('k') | src/profiler/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698