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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/type-feedback-vector.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ic/ic.h" 7 #include "src/ic/ic.h"
8 #include "src/ic/ic-state.h" 8 #include "src/ic/ic-state.h"
9 #include "src/objects.h" 9 #include "src/objects.h"
10 #include "src/type-feedback-vector-inl.h" 10 #include "src/type-feedback-vector-inl.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 KeyedLoadICNexus nexus(this, slot); 200 KeyedLoadICNexus nexus(this, slot);
201 if (ClearLogic(heap, ic_age, kind, nexus.StateFromFeedback())) { 201 if (ClearLogic(heap, ic_age, kind, nexus.StateFromFeedback())) {
202 nexus.Clear(host); 202 nexus.Clear(host);
203 } 203 }
204 } 204 }
205 } 205 }
206 } 206 }
207 } 207 }
208 208
209 209
210 bool TypeFeedbackVector::IsCleared() {
211 int slots = Slots();
212 Isolate* isolate = GetIsolate();
213 Object* uninitialized_sentinel =
214 TypeFeedbackVector::RawUninitializedSentinel(isolate->heap());
215
216 for (int i = 0; i < slots; i++) {
217 FeedbackVectorSlot slot(i);
218 Object* obj = Get(slot);
219 if (obj->IsHeapObject()) {
220 InstanceType instance_type =
221 HeapObject::cast(obj)->map()->instance_type();
222 // AllocationSites are exempt from clearing. They don't store Maps
223 // or Code pointers which can cause memory leaks if not cleared
224 // regularly.
225 if (instance_type != ALLOCATION_SITE_TYPE) {
226 return false;
227 }
228 }
229 }
230
231 slots = ICSlots();
232 if (slots == 0) return true;
233
234 // Now check vector-based ICs.
235 for (int i = 0; i < slots; i++) {
236 FeedbackVectorICSlot slot(i);
237 Object* obj = Get(slot);
238 if (obj != uninitialized_sentinel) {
239 return false;
240 }
241 }
242 return true;
243 }
244
245
210 Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) { 246 Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) {
211 Isolate* isolate = GetIsolate(); 247 Isolate* isolate = GetIsolate();
212 Handle<Object> feedback = handle(GetFeedback(), isolate); 248 Handle<Object> feedback = handle(GetFeedback(), isolate);
213 if (!feedback->IsFixedArray() || 249 if (!feedback->IsFixedArray() ||
214 FixedArray::cast(*feedback)->length() != length) { 250 FixedArray::cast(*feedback)->length() != length) {
215 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); 251 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length);
216 SetFeedback(*array); 252 SetFeedback(*array);
217 return array; 253 return array;
218 } 254 }
219 return Handle<FixedArray>::cast(feedback); 255 return Handle<FixedArray>::cast(feedback);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 if (feedback->IsFixedArray()) { 524 if (feedback->IsFixedArray()) {
489 FixedArray* array = FixedArray::cast(feedback); 525 FixedArray* array = FixedArray::cast(feedback);
490 DCHECK(array->length() >= 3); 526 DCHECK(array->length() >= 3);
491 Object* name = array->get(0); 527 Object* name = array->get(0);
492 if (name->IsName()) return Name::cast(name); 528 if (name->IsName()) return Name::cast(name);
493 } 529 }
494 return NULL; 530 return NULL;
495 } 531 }
496 } 532 }
497 } // namespace v8::internal 533 } // namespace v8::internal
OLDNEW
« 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