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

Unified Diff: src/type-feedback-vector.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/type-feedback-vector.h ('k') | src/type-feedback-vector-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/type-feedback-vector.cc
diff --git a/src/type-feedback-vector.cc b/src/type-feedback-vector.cc
index b4886ce2cfab28d570a076d3c57b5df7dd1a9dc7..e21ad93ba6dfff57abe0111222f679598ea88664 100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -230,11 +230,13 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New(
const int slot_count = metadata->slot_count();
const int length = slot_count + kReservedIndexCount;
if (length == kReservedIndexCount) {
- return Handle<TypeFeedbackVector>::cast(factory->empty_fixed_array());
+ return Handle<TypeFeedbackVector>::cast(
+ factory->empty_type_feedback_vector());
}
Handle<FixedArray> array = factory->NewFixedArray(length, TENURED);
array->set(kMetadataIndex, *metadata);
+ array->set(kInvocationCountIndex, Smi::FromInt(0));
DisallowHeapAllocation no_gc;
@@ -628,6 +630,12 @@ int CallICNexus::ExtractCallCount() {
return value;
}
+float CallICNexus::ComputeCallFrequency() {
+ double const invocation_count = vector()->invocation_count();
+ double const call_count = ExtractCallCount();
+ return static_cast<float>(call_count / invocation_count);
+}
+
void CallICNexus::Clear(Code* host) { CallIC::Clear(GetIsolate(), host, this); }
void CallICNexus::ConfigureUninitialized() {
« no previous file with comments | « src/type-feedback-vector.h ('k') | src/type-feedback-vector-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698