| OLD | NEW |
| 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 Loading... |
| 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::CanBeSerialized() { |
| 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() && obj != uninitialized_sentinel) { |
| 220 return false; |
| 221 } |
| 222 } |
| 223 |
| 224 slots = ICSlots(); |
| 225 if (slots == 0) return true; |
| 226 |
| 227 // Now check vector-based ICs. |
| 228 for (int i = 0; i < slots; i++) { |
| 229 FeedbackVectorICSlot slot(i); |
| 230 Object* obj = Get(slot); |
| 231 if (obj != uninitialized_sentinel) { |
| 232 return false; |
| 233 } |
| 234 } |
| 235 return true; |
| 236 } |
| 237 |
| 238 |
| 210 Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) { | 239 Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) { |
| 211 Isolate* isolate = GetIsolate(); | 240 Isolate* isolate = GetIsolate(); |
| 212 Handle<Object> feedback = handle(GetFeedback(), isolate); | 241 Handle<Object> feedback = handle(GetFeedback(), isolate); |
| 213 if (!feedback->IsFixedArray() || | 242 if (!feedback->IsFixedArray() || |
| 214 FixedArray::cast(*feedback)->length() != length) { | 243 FixedArray::cast(*feedback)->length() != length) { |
| 215 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); | 244 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); |
| 216 SetFeedback(*array); | 245 SetFeedback(*array); |
| 217 return array; | 246 return array; |
| 218 } | 247 } |
| 219 return Handle<FixedArray>::cast(feedback); | 248 return Handle<FixedArray>::cast(feedback); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 if (feedback->IsFixedArray()) { | 517 if (feedback->IsFixedArray()) { |
| 489 FixedArray* array = FixedArray::cast(feedback); | 518 FixedArray* array = FixedArray::cast(feedback); |
| 490 DCHECK(array->length() >= 3); | 519 DCHECK(array->length() >= 3); |
| 491 Object* name = array->get(0); | 520 Object* name = array->get(0); |
| 492 if (name->IsName()) return Name::cast(name); | 521 if (name->IsName()) return Name::cast(name); |
| 493 } | 522 } |
| 494 return NULL; | 523 return NULL; |
| 495 } | 524 } |
| 496 } | 525 } |
| 497 } // namespace v8::internal | 526 } // namespace v8::internal |
| OLD | NEW |