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

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

Issue 804933002: Make sure we don't accidentially serialize type feedback (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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') | no next file » | 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 45028b87879f7bbe2984179c111f586ce6f9025e..5154e2078fc4c960298f28a5041559ad32c4a4f4 100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -207,6 +207,42 @@ void TypeFeedbackVector::ClearSlots(SharedFunctionInfo* shared) {
}
+bool TypeFeedbackVector::IsCleared() {
+ int slots = Slots();
+ Isolate* isolate = GetIsolate();
+ Object* uninitialized_sentinel =
+ TypeFeedbackVector::RawUninitializedSentinel(isolate->heap());
+
+ for (int i = 0; i < slots; i++) {
+ FeedbackVectorSlot slot(i);
+ Object* obj = Get(slot);
+ if (obj->IsHeapObject()) {
+ InstanceType instance_type =
+ HeapObject::cast(obj)->map()->instance_type();
+ // AllocationSites are exempt from clearing. They don't store Maps
+ // or Code pointers which can cause memory leaks if not cleared
+ // regularly.
+ if (instance_type != ALLOCATION_SITE_TYPE) {
+ return false;
+ }
+ }
+ }
+
+ slots = ICSlots();
+ if (slots == 0) return true;
+
+ // Now check vector-based ICs.
+ for (int i = 0; i < slots; i++) {
+ FeedbackVectorICSlot slot(i);
+ Object* obj = Get(slot);
+ if (obj != uninitialized_sentinel) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) {
Isolate* isolate = GetIsolate();
Handle<Object> feedback = handle(GetFeedback(), isolate);
« no previous file with comments | « src/type-feedback-vector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698