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

Unified Diff: src/type-feedback-vector.cc

Issue 2325083003: Record call counts also for megamorphic calls. (Closed)
Patch Set: Code comments. 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/x64/code-stubs-x64.cc » ('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 61f5e8b9c7d095a74ceb34d7bd3b5be89f5652dc..b4886ce2cfab28d570a076d3c57b5df7dd1a9dc7 100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -254,8 +254,11 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New(
value = *uninitialized_sentinel;
}
array->set(index, value, SKIP_WRITE_BARRIER);
+
+ value = kind == FeedbackVectorSlotKind::CALL_IC ? Smi::FromInt(0)
+ : *uninitialized_sentinel;
for (int j = 1; j < entry_size; j++) {
- array->set(index + j, *uninitialized_sentinel, SKIP_WRITE_BARRIER);
+ array->set(index + j, value, SKIP_WRITE_BARRIER);
}
i += entry_size;
}
@@ -620,16 +623,19 @@ InlineCacheState CallICNexus::StateFromFeedback() const {
int CallICNexus::ExtractCallCount() {
Object* call_count = GetFeedbackExtra();
- if (call_count->IsSmi()) {
- int value = Smi::cast(call_count)->value();
- return value;
- }
- return -1;
+ CHECK(call_count->IsSmi());
+ int value = Smi::cast(call_count)->value();
+ return value;
}
-
void CallICNexus::Clear(Code* host) { CallIC::Clear(GetIsolate(), host, this); }
+void CallICNexus::ConfigureUninitialized() {
+ Isolate* isolate = GetIsolate();
+ SetFeedback(*TypeFeedbackVector::UninitializedSentinel(isolate),
+ SKIP_WRITE_BARRIER);
+ SetFeedbackExtra(Smi::FromInt(0), SKIP_WRITE_BARRIER);
+}
void CallICNexus::ConfigureMonomorphicArray() {
Object* feedback = GetFeedback();
@@ -650,10 +656,13 @@ void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) {
void CallICNexus::ConfigureMegamorphic() {
- FeedbackNexus::ConfigureMegamorphic();
+ SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(GetIsolate()),
+ SKIP_WRITE_BARRIER);
+ Smi* count = Smi::cast(GetFeedbackExtra());
+ int new_count = count->value() + 1;
+ SetFeedbackExtra(Smi::FromInt(new_count), SKIP_WRITE_BARRIER);
}
-
void CallICNexus::ConfigureMegamorphic(int call_count) {
SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(GetIsolate()),
SKIP_WRITE_BARRIER);
« no previous file with comments | « src/type-feedback-vector.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698