Chromium Code Reviews| 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/type-feedback-vector.h" | 5 #include "src/type-feedback-vector.h" |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
| 9 #include "src/ic/ic-state.h" | 9 #include "src/ic/ic-state.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| 11 #include "src/type-feedback-vector-inl.h" | 11 #include "src/type-feedback-vector-inl.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 std::ostream& operator<<(std::ostream& os, FeedbackVectorSlotKind kind) { | 16 std::ostream& operator<<(std::ostream& os, FeedbackVectorSlotKind kind) { |
| 17 return os << TypeFeedbackVector::Kind2String(kind); | 17 return os << TypeFeedbackVector::Kind2String(kind); |
| 18 } | 18 } |
| 19 | 19 |
| 20 | 20 |
| 21 FeedbackVectorSlotKind TypeFeedbackVector::GetKind( | 21 FeedbackVectorSlotKind TypeFeedbackVector::GetKind( |
| 22 FeedbackVectorICSlot slot) const { | 22 FeedbackVectorSlot slot) const { |
| 23 int index = VectorICComputer::index(kReservedIndexCount, slot.ToInt()); | 23 int index = VectorICComputer::index(kReservedIndexCount, slot.ToInt()); |
| 24 int data = Smi::cast(get(index))->value(); | 24 int data = Smi::cast(get(index))->value(); |
| 25 return VectorICComputer::decode(data, slot.ToInt()); | 25 return VectorICComputer::decode(data, slot.ToInt()); |
| 26 } | 26 } |
| 27 | 27 |
| 28 | 28 |
| 29 void TypeFeedbackVector::SetKind(FeedbackVectorICSlot slot, | 29 void TypeFeedbackVector::SetKind(FeedbackVectorSlot slot, |
| 30 FeedbackVectorSlotKind kind) { | 30 FeedbackVectorSlotKind kind) { |
| 31 int index = VectorICComputer::index(kReservedIndexCount, slot.ToInt()); | 31 int index = VectorICComputer::index(kReservedIndexCount, slot.ToInt()); |
| 32 int data = Smi::cast(get(index))->value(); | 32 int data = Smi::cast(get(index))->value(); |
| 33 int new_data = VectorICComputer::encode(data, slot.ToInt(), kind); | 33 int new_data = VectorICComputer::encode(data, slot.ToInt(), kind); |
| 34 set(index, Smi::FromInt(new_data)); | 34 set(index, Smi::FromInt(new_data)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 | 37 |
| 38 template Handle<TypeFeedbackVector> TypeFeedbackVector::Allocate( | 38 template Handle<TypeFeedbackVector> TypeFeedbackVector::New( |
| 39 Isolate* isolate, const StaticFeedbackVectorSpec* spec); | 39 Isolate* isolate, const StaticFeedbackVectorSpec* spec); |
| 40 template Handle<TypeFeedbackVector> TypeFeedbackVector::Allocate( | 40 template Handle<TypeFeedbackVector> TypeFeedbackVector::New( |
| 41 Isolate* isolate, const FeedbackVectorSpec* spec); | 41 Isolate* isolate, const FeedbackVectorSpec* spec); |
| 42 | 42 |
| 43 | 43 |
| 44 // static | 44 // static |
| 45 template <typename Spec> | 45 template <typename Spec> |
| 46 Handle<TypeFeedbackVector> TypeFeedbackVector::Allocate(Isolate* isolate, | 46 Handle<TypeFeedbackVector> TypeFeedbackVector::New(Isolate* isolate, |
| 47 const Spec* spec) { | 47 const Spec* spec) { |
| 48 const int slot_count = spec->slots(); | 48 const int slot_count = spec->slots(); |
| 49 const int ic_slot_count = spec->ic_slots(); | 49 const int index_count = VectorICComputer::word_count(slot_count); |
| 50 const int index_count = VectorICComputer::word_count(ic_slot_count); | 50 const int length = slot_count + index_count + kReservedIndexCount; |
| 51 const int length = slot_count + (ic_slot_count * elements_per_ic_slot()) + | |
| 52 index_count + kReservedIndexCount; | |
| 53 if (length == kReservedIndexCount) { | 51 if (length == kReservedIndexCount) { |
| 54 return Handle<TypeFeedbackVector>::cast( | 52 return Handle<TypeFeedbackVector>::cast( |
| 55 isolate->factory()->empty_fixed_array()); | 53 isolate->factory()->empty_fixed_array()); |
| 56 } | 54 } |
| 55 #ifdef DEBUG | |
| 56 for (int i = 0; i < slot_count;) { | |
| 57 FeedbackVectorSlotKind kind = spec->GetKind(i); | |
| 58 int entry_size = TypeFeedbackVector::GetSlotSize(kind); | |
| 59 for (int j = 1; j < entry_size; j++) { | |
| 60 FeedbackVectorSlotKind kind = spec->GetKind(i + j); | |
| 61 DCHECK_EQ(FeedbackVectorSlotKind::INVALID, kind); | |
| 62 } | |
| 63 i += entry_size; | |
| 64 } | |
| 65 #endif | |
| 57 | 66 |
| 58 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length, TENURED); | 67 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length, TENURED); |
| 59 if (ic_slot_count > 0) { | 68 array->set(kSlotsCountIndex, Smi::FromInt(slot_count)); |
| 60 array->set(kFirstICSlotIndex, | |
| 61 Smi::FromInt(slot_count + index_count + kReservedIndexCount)); | |
| 62 } else { | |
| 63 array->set(kFirstICSlotIndex, Smi::FromInt(length)); | |
| 64 } | |
| 65 array->set(kWithTypesIndex, Smi::FromInt(0)); | 69 array->set(kWithTypesIndex, Smi::FromInt(0)); |
| 66 array->set(kGenericCountIndex, Smi::FromInt(0)); | 70 array->set(kGenericCountIndex, Smi::FromInt(0)); |
| 67 // Fill the indexes with zeros. | 71 // Fill the indexes with zeros. |
| 68 for (int i = 0; i < index_count; i++) { | 72 for (int i = 0; i < index_count; i++) { |
| 69 array->set(kReservedIndexCount + i, Smi::FromInt(0)); | 73 array->set(kReservedIndexCount + i, Smi::FromInt(0)); |
| 70 } | 74 } |
| 71 | 75 |
| 72 // Ensure we can skip the write barrier | 76 // Ensure we can skip the write barrier |
| 73 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate); | 77 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate); |
| 74 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); | 78 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); |
| 75 for (int i = kReservedIndexCount + index_count; i < length; i++) { | 79 for (int i = kReservedIndexCount + index_count; i < length; i++) { |
| 76 array->set(i, *uninitialized_sentinel, SKIP_WRITE_BARRIER); | 80 array->set(i, *uninitialized_sentinel, SKIP_WRITE_BARRIER); |
| 77 } | 81 } |
| 78 | 82 |
| 79 Handle<TypeFeedbackVector> vector = Handle<TypeFeedbackVector>::cast(array); | 83 Handle<TypeFeedbackVector> vector = Handle<TypeFeedbackVector>::cast(array); |
| 80 for (int i = 0; i < ic_slot_count; i++) { | 84 for (int i = 0; i < slot_count; i++) { |
| 81 vector->SetKind(FeedbackVectorICSlot(i), spec->GetKind(i)); | 85 vector->SetKind(FeedbackVectorSlot(i), spec->GetKind(i)); |
| 82 } | 86 } |
| 83 return vector; | 87 return vector; |
| 84 } | 88 } |
| 85 | 89 |
| 86 | 90 |
| 87 template int TypeFeedbackVector::GetIndexFromSpec(const FeedbackVectorSpec*, | |
| 88 FeedbackVectorICSlot); | |
| 89 template int TypeFeedbackVector::GetIndexFromSpec(const FeedbackVectorSpec*, | |
| 90 FeedbackVectorSlot); | |
| 91 | |
| 92 | |
| 93 // static | 91 // static |
| 94 template <typename Spec> | 92 int TypeFeedbackVector::GetIndexFromSpec(const FeedbackVectorSpec* spec, |
| 95 int TypeFeedbackVector::GetIndexFromSpec(const Spec* spec, | |
| 96 FeedbackVectorSlot slot) { | 93 FeedbackVectorSlot slot) { |
| 97 const int ic_slot_count = spec->ic_slots(); | 94 const int slot_count = spec->slots(); |
| 98 const int index_count = VectorICComputer::word_count(ic_slot_count); | 95 const int index_count = VectorICComputer::word_count(slot_count); |
| 99 return kReservedIndexCount + index_count + slot.ToInt(); | 96 return kReservedIndexCount + index_count + slot.ToInt(); |
| 100 } | 97 } |
| 101 | 98 |
| 102 | 99 |
| 103 // static | |
| 104 template <typename Spec> | |
| 105 int TypeFeedbackVector::GetIndexFromSpec(const Spec* spec, | |
| 106 FeedbackVectorICSlot slot) { | |
| 107 const int slot_count = spec->slots(); | |
| 108 const int ic_slot_count = spec->ic_slots(); | |
| 109 const int index_count = VectorICComputer::word_count(ic_slot_count); | |
| 110 return kReservedIndexCount + index_count + slot_count + | |
| 111 slot.ToInt() * elements_per_ic_slot(); | |
| 112 } | |
| 113 | |
| 114 | |
| 115 // static | 100 // static |
| 116 int TypeFeedbackVector::PushAppliedArgumentsIndex() { | 101 int TypeFeedbackVector::PushAppliedArgumentsIndex() { |
| 117 const int index_count = VectorICComputer::word_count(1); | 102 const int index_count = VectorICComputer::word_count(1); |
| 118 return kReservedIndexCount + index_count; | 103 return kReservedIndexCount + index_count; |
| 119 } | 104 } |
| 120 | 105 |
| 121 | 106 |
| 122 // static | 107 // static |
| 123 Handle<TypeFeedbackVector> TypeFeedbackVector::CreatePushAppliedArgumentsVector( | 108 Handle<TypeFeedbackVector> TypeFeedbackVector::CreatePushAppliedArgumentsVector( |
| 124 Isolate* isolate) { | 109 Isolate* isolate) { |
| 125 FeedbackVectorSlotKind kinds[] = {FeedbackVectorSlotKind::KEYED_LOAD_IC}; | 110 FeedbackVectorSlotKind kinds[] = {FeedbackVectorSlotKind::KEYED_LOAD_IC, |
| 126 StaticFeedbackVectorSpec spec(0, 1, kinds); | 111 FeedbackVectorSlotKind::INVALID}; |
| 112 StaticFeedbackVectorSpec spec(arraysize(kinds), kinds); | |
|
mvstanton
2015/10/01 10:24:31
This confused me a minute, but then I see what you
Igor Sheludko
2015/10/01 12:46:29
I remade StaticFeedbackVectorSpec to be less confu
| |
| 127 Handle<TypeFeedbackVector> feedback_vector = | 113 Handle<TypeFeedbackVector> feedback_vector = |
| 128 isolate->factory()->NewTypeFeedbackVector(&spec); | 114 TypeFeedbackVector::New(isolate, &spec); |
| 129 DCHECK(PushAppliedArgumentsIndex() == | 115 DCHECK(PushAppliedArgumentsIndex() == |
| 130 feedback_vector->GetIndex(FeedbackVectorICSlot(0))); | 116 feedback_vector->GetIndex(FeedbackVectorSlot(0))); |
| 131 return feedback_vector; | 117 return feedback_vector; |
| 132 } | 118 } |
| 133 | 119 |
| 134 | 120 |
| 135 // static | 121 // static |
| 136 Handle<TypeFeedbackVector> TypeFeedbackVector::Copy( | 122 Handle<TypeFeedbackVector> TypeFeedbackVector::Copy( |
| 137 Isolate* isolate, Handle<TypeFeedbackVector> vector) { | 123 Isolate* isolate, Handle<TypeFeedbackVector> vector) { |
| 138 Handle<TypeFeedbackVector> result; | 124 Handle<TypeFeedbackVector> result; |
| 139 result = Handle<TypeFeedbackVector>::cast( | 125 result = Handle<TypeFeedbackVector>::cast( |
| 140 isolate->factory()->CopyFixedArray(Handle<FixedArray>::cast(vector))); | 126 isolate->factory()->CopyFixedArray(Handle<FixedArray>::cast(vector))); |
| 141 return result; | 127 return result; |
| 142 } | 128 } |
| 143 | 129 |
| 144 | 130 |
| 145 bool TypeFeedbackVector::SpecDiffersFrom( | 131 bool TypeFeedbackVector::SpecDiffersFrom( |
| 146 const FeedbackVectorSpec* other_spec) const { | 132 const FeedbackVectorSpec* other_spec) const { |
| 147 if (other_spec->slots() != Slots() || other_spec->ic_slots() != ICSlots()) { | 133 if (other_spec->slots() != Slots()) { |
| 148 return true; | 134 return true; |
| 149 } | 135 } |
| 150 | 136 |
| 151 int ic_slots = ICSlots(); | 137 int slots = Slots(); |
| 152 for (int i = 0; i < ic_slots; i++) { | 138 for (int i = 0; i < slots; i++) { |
| 153 if (GetKind(FeedbackVectorICSlot(i)) != other_spec->GetKind(i)) { | 139 if (GetKind(FeedbackVectorSlot(i)) != other_spec->GetKind(i)) { |
| 154 return true; | 140 return true; |
| 155 } | 141 } |
| 156 } | 142 } |
| 157 return false; | 143 return false; |
| 158 } | 144 } |
| 159 | 145 |
| 160 | 146 |
| 161 // This logic is copied from | 147 // This logic is copied from |
| 162 // StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget. | 148 // StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget. |
| 163 static bool ClearLogic(Heap* heap) { | 149 static bool ClearLogic(Isolate* isolate) { |
| 164 return FLAG_cleanup_code_caches_at_gc && | 150 return FLAG_cleanup_code_caches_at_gc && isolate->serializer_enabled(); |
| 165 heap->isolate()->serializer_enabled(); | |
| 166 } | 151 } |
| 167 | 152 |
| 168 | 153 |
| 169 void TypeFeedbackVector::ClearSlotsImpl(SharedFunctionInfo* shared, | 154 void TypeFeedbackVector::ClearSlotsImpl(SharedFunctionInfo* shared, |
| 170 bool force_clear) { | 155 bool force_clear) { |
| 171 int slots = Slots(); | 156 Isolate* isolate = GetIsolate(); |
| 172 Heap* heap = GetIsolate()->heap(); | |
| 173 | 157 |
| 174 if (!force_clear && !ClearLogic(heap)) return; | 158 if (!force_clear && !ClearLogic(isolate)) return; |
| 175 | 159 |
| 176 Object* uninitialized_sentinel = | 160 Object* uninitialized_sentinel = |
| 177 TypeFeedbackVector::RawUninitializedSentinel(heap); | 161 TypeFeedbackVector::RawUninitializedSentinel(isolate); |
| 178 for (int i = 0; i < slots; i++) { | |
| 179 FeedbackVectorSlot slot(i); | |
| 180 Object* obj = Get(slot); | |
| 181 if (obj->IsHeapObject()) { | |
| 182 InstanceType instance_type = | |
| 183 HeapObject::cast(obj)->map()->instance_type(); | |
| 184 // AllocationSites are exempt from clearing. They don't store Maps | |
| 185 // or Code pointers which can cause memory leaks if not cleared | |
| 186 // regularly. | |
| 187 if (instance_type != ALLOCATION_SITE_TYPE) { | |
| 188 Set(slot, uninitialized_sentinel, SKIP_WRITE_BARRIER); | |
| 189 } | |
| 190 } | |
| 191 } | |
| 192 } | |
| 193 | 162 |
| 163 TypeFeedbackMetadataIterator iter(this); | |
|
mvstanton
2015/10/01 10:24:31
This iterator is pretty cool!
| |
| 164 while (iter.HasNext()) { | |
| 165 FeedbackVectorSlot slot = iter.Next(); | |
| 166 FeedbackVectorSlotKind kind = iter.kind(); | |
| 194 | 167 |
| 195 void TypeFeedbackVector::ClearICSlotsImpl(SharedFunctionInfo* shared, | |
| 196 bool force_clear) { | |
| 197 Heap* heap = GetIsolate()->heap(); | |
| 198 | |
| 199 if (!force_clear && !ClearLogic(heap)) return; | |
| 200 | |
| 201 int slots = ICSlots(); | |
| 202 Code* host = shared->code(); | |
| 203 Object* uninitialized_sentinel = | |
| 204 TypeFeedbackVector::RawUninitializedSentinel(heap); | |
| 205 for (int i = 0; i < slots; i++) { | |
| 206 FeedbackVectorICSlot slot(i); | |
| 207 Object* obj = Get(slot); | 168 Object* obj = Get(slot); |
| 208 if (obj != uninitialized_sentinel) { | 169 if (obj != uninitialized_sentinel) { |
| 209 FeedbackVectorSlotKind kind = GetKind(slot); | |
| 210 switch (kind) { | 170 switch (kind) { |
| 211 case FeedbackVectorSlotKind::CALL_IC: { | 171 case FeedbackVectorSlotKind::CALL_IC: { |
| 212 CallICNexus nexus(this, slot); | 172 CallICNexus nexus(this, slot); |
| 213 nexus.Clear(host); | 173 nexus.Clear(shared->code()); |
| 214 break; | 174 break; |
| 215 } | 175 } |
| 216 case FeedbackVectorSlotKind::LOAD_IC: { | 176 case FeedbackVectorSlotKind::LOAD_IC: { |
| 217 LoadICNexus nexus(this, slot); | 177 LoadICNexus nexus(this, slot); |
| 218 nexus.Clear(host); | 178 nexus.Clear(shared->code()); |
| 219 break; | 179 break; |
| 220 } | 180 } |
| 221 case FeedbackVectorSlotKind::KEYED_LOAD_IC: { | 181 case FeedbackVectorSlotKind::KEYED_LOAD_IC: { |
| 222 KeyedLoadICNexus nexus(this, slot); | 182 KeyedLoadICNexus nexus(this, slot); |
| 223 nexus.Clear(host); | 183 nexus.Clear(shared->code()); |
| 224 break; | 184 break; |
| 225 } | 185 } |
| 226 case FeedbackVectorSlotKind::STORE_IC: { | 186 case FeedbackVectorSlotKind::STORE_IC: { |
| 227 DCHECK(FLAG_vector_stores); | 187 DCHECK(FLAG_vector_stores); |
| 228 StoreICNexus nexus(this, slot); | 188 StoreICNexus nexus(this, slot); |
| 229 nexus.Clear(host); | 189 nexus.Clear(shared->code()); |
| 230 break; | 190 break; |
| 231 } | 191 } |
| 232 case FeedbackVectorSlotKind::KEYED_STORE_IC: { | 192 case FeedbackVectorSlotKind::KEYED_STORE_IC: { |
| 233 DCHECK(FLAG_vector_stores); | 193 DCHECK(FLAG_vector_stores); |
| 234 KeyedStoreICNexus nexus(this, slot); | 194 KeyedStoreICNexus nexus(this, slot); |
| 235 nexus.Clear(host); | 195 nexus.Clear(shared->code()); |
| 236 break; | 196 break; |
| 237 } | 197 } |
| 238 case FeedbackVectorSlotKind::UNUSED: | 198 case FeedbackVectorSlotKind::STUB: { |
| 199 if (obj->IsHeapObject()) { | |
| 200 InstanceType instance_type = | |
| 201 HeapObject::cast(obj)->map()->instance_type(); | |
| 202 // AllocationSites are exempt from clearing. They don't store Maps | |
| 203 // or Code pointers which can cause memory leaks if not cleared | |
| 204 // regularly. | |
| 205 if (instance_type != ALLOCATION_SITE_TYPE) { | |
| 206 Set(slot, uninitialized_sentinel, SKIP_WRITE_BARRIER); | |
| 207 } | |
| 208 } | |
| 209 break; | |
| 210 } | |
| 211 case FeedbackVectorSlotKind::INVALID: | |
| 239 case FeedbackVectorSlotKind::KINDS_NUMBER: | 212 case FeedbackVectorSlotKind::KINDS_NUMBER: |
| 240 UNREACHABLE(); | 213 UNREACHABLE(); |
| 241 break; | 214 break; |
| 242 } | 215 } |
| 243 } | 216 } |
| 244 } | 217 } |
| 245 } | 218 } |
| 246 | 219 |
| 247 | 220 |
| 248 // static | 221 // static |
| 249 void TypeFeedbackVector::ClearAllKeyedStoreICs(Isolate* isolate) { | 222 void TypeFeedbackVector::ClearAllKeyedStoreICs(Isolate* isolate) { |
| 250 DCHECK(FLAG_vector_stores); | 223 DCHECK(FLAG_vector_stores); |
| 251 SharedFunctionInfo::Iterator iterator(isolate); | 224 SharedFunctionInfo::Iterator iterator(isolate); |
| 252 SharedFunctionInfo* shared; | 225 SharedFunctionInfo* shared; |
| 253 while ((shared = iterator.Next())) { | 226 while ((shared = iterator.Next())) { |
| 254 TypeFeedbackVector* vector = shared->feedback_vector(); | 227 TypeFeedbackVector* vector = shared->feedback_vector(); |
| 255 vector->ClearKeyedStoreICs(shared); | 228 vector->ClearKeyedStoreICs(shared); |
| 256 } | 229 } |
| 257 } | 230 } |
| 258 | 231 |
| 259 | 232 |
| 260 void TypeFeedbackVector::ClearKeyedStoreICs(SharedFunctionInfo* shared) { | 233 void TypeFeedbackVector::ClearKeyedStoreICs(SharedFunctionInfo* shared) { |
| 261 Heap* heap = GetIsolate()->heap(); | 234 Isolate* isolate = GetIsolate(); |
| 262 | 235 |
| 263 int slots = ICSlots(); | |
| 264 Code* host = shared->code(); | 236 Code* host = shared->code(); |
| 265 Object* uninitialized_sentinel = | 237 Object* uninitialized_sentinel = |
| 266 TypeFeedbackVector::RawUninitializedSentinel(heap); | 238 TypeFeedbackVector::RawUninitializedSentinel(isolate); |
| 267 for (int i = 0; i < slots; i++) { | 239 |
| 268 FeedbackVectorICSlot slot(i); | 240 TypeFeedbackMetadataIterator iter(this); |
| 241 while (iter.HasNext()) { | |
| 242 FeedbackVectorSlot slot = iter.Next(); | |
| 243 FeedbackVectorSlotKind kind = iter.kind(); | |
| 244 if (kind != FeedbackVectorSlotKind::KEYED_STORE_IC) continue; | |
| 269 Object* obj = Get(slot); | 245 Object* obj = Get(slot); |
| 270 if (obj != uninitialized_sentinel) { | 246 if (obj != uninitialized_sentinel) { |
| 271 FeedbackVectorSlotKind kind = GetKind(slot); | 247 DCHECK(FLAG_vector_stores); |
| 272 if (kind == FeedbackVectorSlotKind::KEYED_STORE_IC) { | 248 KeyedStoreICNexus nexus(this, slot); |
| 273 DCHECK(FLAG_vector_stores); | 249 nexus.Clear(host); |
| 274 KeyedStoreICNexus nexus(this, slot); | |
| 275 nexus.Clear(host); | |
| 276 } | |
| 277 } | 250 } |
| 278 } | 251 } |
| 279 } | 252 } |
| 280 | 253 |
| 281 | 254 |
| 282 // static | 255 // static |
| 283 Handle<TypeFeedbackVector> TypeFeedbackVector::DummyVector(Isolate* isolate) { | 256 Handle<TypeFeedbackVector> TypeFeedbackVector::DummyVector(Isolate* isolate) { |
| 284 return Handle<TypeFeedbackVector>::cast(isolate->factory()->dummy_vector()); | 257 return Handle<TypeFeedbackVector>::cast(isolate->factory()->dummy_vector()); |
| 285 } | 258 } |
| 286 | 259 |
| 287 | 260 |
| 288 const char* TypeFeedbackVector::Kind2String(FeedbackVectorSlotKind kind) { | 261 const char* TypeFeedbackVector::Kind2String(FeedbackVectorSlotKind kind) { |
| 289 switch (kind) { | 262 switch (kind) { |
| 290 case FeedbackVectorSlotKind::UNUSED: | 263 case FeedbackVectorSlotKind::INVALID: |
| 291 return "UNUSED"; | 264 return "INVALID"; |
| 292 case FeedbackVectorSlotKind::CALL_IC: | 265 case FeedbackVectorSlotKind::CALL_IC: |
| 293 return "CALL_IC"; | 266 return "CALL_IC"; |
| 294 case FeedbackVectorSlotKind::LOAD_IC: | 267 case FeedbackVectorSlotKind::LOAD_IC: |
| 295 return "LOAD_IC"; | 268 return "LOAD_IC"; |
| 296 case FeedbackVectorSlotKind::KEYED_LOAD_IC: | 269 case FeedbackVectorSlotKind::KEYED_LOAD_IC: |
| 297 return "KEYED_LOAD_IC"; | 270 return "KEYED_LOAD_IC"; |
| 298 case FeedbackVectorSlotKind::STORE_IC: | 271 case FeedbackVectorSlotKind::STORE_IC: |
| 299 return "STORE_IC"; | 272 return "STORE_IC"; |
| 300 case FeedbackVectorSlotKind::KEYED_STORE_IC: | 273 case FeedbackVectorSlotKind::KEYED_STORE_IC: |
| 301 return "KEYED_STORE_IC"; | 274 return "KEYED_STORE_IC"; |
| 275 case FeedbackVectorSlotKind::STUB: | |
| 276 return "STUB"; | |
| 302 case FeedbackVectorSlotKind::KINDS_NUMBER: | 277 case FeedbackVectorSlotKind::KINDS_NUMBER: |
| 303 break; | 278 break; |
| 304 } | 279 } |
| 305 UNREACHABLE(); | 280 UNREACHABLE(); |
| 306 return "?"; | 281 return "?"; |
| 307 } | 282 } |
| 308 | 283 |
| 309 | 284 |
| 310 Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) { | 285 Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) { |
| 311 Isolate* isolate = GetIsolate(); | 286 Isolate* isolate = GetIsolate(); |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 831 return mode; | 806 return mode; |
| 832 } | 807 } |
| 833 | 808 |
| 834 | 809 |
| 835 IcCheckType KeyedStoreICNexus::GetKeyType() const { | 810 IcCheckType KeyedStoreICNexus::GetKeyType() const { |
| 836 // The structure of the vector slots tells us the type. | 811 // The structure of the vector slots tells us the type. |
| 837 return GetFeedback()->IsName() ? PROPERTY : ELEMENT; | 812 return GetFeedback()->IsName() ? PROPERTY : ELEMENT; |
| 838 } | 813 } |
| 839 } // namespace internal | 814 } // namespace internal |
| 840 } // namespace v8 | 815 } // namespace v8 |
| OLD | NEW |