| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 | 132 |
| 133 // This logic is copied from | 133 // This logic is copied from |
| 134 // StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget. | 134 // StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget. |
| 135 // TODO(mvstanton): with weak handling of all vector ics, this logic should | 135 // TODO(mvstanton): with weak handling of all vector ics, this logic should |
| 136 // actually be completely eliminated and we no longer need to clear the | 136 // actually be completely eliminated and we no longer need to clear the |
| 137 // vector ICs. | 137 // vector ICs. |
| 138 static bool ClearLogic(Heap* heap, int ic_age, Code::Kind kind, | 138 static bool ClearLogic(Heap* heap, int ic_age, Code::Kind kind, |
| 139 InlineCacheState state) { | 139 InlineCacheState state) { |
| 140 if (FLAG_cleanup_code_caches_at_gc && | 140 if (FLAG_cleanup_code_caches_at_gc && |
| 141 (heap->flush_monomorphic_ics() || | 141 (kind == Code::CALL_IC || heap->flush_monomorphic_ics() || |
| 142 // TODO(mvstanton): is this ic_age granular enough? it comes from | 142 // TODO(mvstanton): is this ic_age granular enough? it comes from |
| 143 // the SharedFunctionInfo which may change on a different schedule | 143 // the SharedFunctionInfo which may change on a different schedule |
| 144 // than ic targets. | 144 // than ic targets. |
| 145 // ic_age != heap->global_ic_age() || | 145 // ic_age != heap->global_ic_age() || |
| 146 // is_invalidated_weak_stub || | 146 // is_invalidated_weak_stub || |
| 147 heap->isolate()->serializer_enabled())) { | 147 heap->isolate()->serializer_enabled())) { |
| 148 return true; | 148 return true; |
| 149 } | 149 } |
| 150 return false; | 150 return false; |
| 151 } | 151 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 return UNINITIALIZED; | 278 return UNINITIALIZED; |
| 279 } | 279 } |
| 280 | 280 |
| 281 | 281 |
| 282 InlineCacheState CallICNexus::StateFromFeedback() const { | 282 InlineCacheState CallICNexus::StateFromFeedback() const { |
| 283 Isolate* isolate = GetIsolate(); | 283 Isolate* isolate = GetIsolate(); |
| 284 Object* feedback = GetFeedback(); | 284 Object* feedback = GetFeedback(); |
| 285 | 285 |
| 286 if (feedback == *vector()->MegamorphicSentinel(isolate)) { | 286 if (feedback == *vector()->MegamorphicSentinel(isolate)) { |
| 287 return GENERIC; | 287 return GENERIC; |
| 288 } else if (feedback->IsAllocationSite() || feedback->IsWeakCell()) { | 288 } else if (feedback->IsAllocationSite() || feedback->IsJSFunction()) { |
| 289 return MONOMORPHIC; | 289 return MONOMORPHIC; |
| 290 } | 290 } |
| 291 | 291 |
| 292 CHECK(feedback == *vector()->UninitializedSentinel(isolate)); | 292 CHECK(feedback == *vector()->UninitializedSentinel(isolate)); |
| 293 return UNINITIALIZED; | 293 return UNINITIALIZED; |
| 294 } | 294 } |
| 295 | 295 |
| 296 | 296 |
| 297 void CallICNexus::Clear(Code* host) { CallIC::Clear(GetIsolate(), host, this); } | 297 void CallICNexus::Clear(Code* host) { CallIC::Clear(GetIsolate(), host, this); } |
| 298 | 298 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 312 } | 312 } |
| 313 | 313 |
| 314 | 314 |
| 315 void CallICNexus::ConfigureUninitialized() { | 315 void CallICNexus::ConfigureUninitialized() { |
| 316 SetFeedback(*vector()->UninitializedSentinel(GetIsolate()), | 316 SetFeedback(*vector()->UninitializedSentinel(GetIsolate()), |
| 317 SKIP_WRITE_BARRIER); | 317 SKIP_WRITE_BARRIER); |
| 318 } | 318 } |
| 319 | 319 |
| 320 | 320 |
| 321 void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) { | 321 void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) { |
| 322 Handle<WeakCell> new_cell = GetIsolate()->factory()->NewWeakCell(function); | 322 SetFeedback(*function); |
| 323 SetFeedback(*new_cell); | |
| 324 } | 323 } |
| 325 | 324 |
| 326 | 325 |
| 327 void KeyedLoadICNexus::ConfigureGeneric() { | 326 void KeyedLoadICNexus::ConfigureGeneric() { |
| 328 SetFeedback(*vector()->GenericSentinel(GetIsolate()), SKIP_WRITE_BARRIER); | 327 SetFeedback(*vector()->GenericSentinel(GetIsolate()), SKIP_WRITE_BARRIER); |
| 329 } | 328 } |
| 330 | 329 |
| 331 | 330 |
| 332 void LoadICNexus::ConfigureMegamorphic() { | 331 void LoadICNexus::ConfigureMegamorphic() { |
| 333 SetFeedback(*vector()->MegamorphicSentinel(GetIsolate()), SKIP_WRITE_BARRIER); | 332 SetFeedback(*vector()->MegamorphicSentinel(GetIsolate()), SKIP_WRITE_BARRIER); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 if (feedback->IsFixedArray()) { | 507 if (feedback->IsFixedArray()) { |
| 509 FixedArray* array = FixedArray::cast(feedback); | 508 FixedArray* array = FixedArray::cast(feedback); |
| 510 DCHECK(array->length() >= 3); | 509 DCHECK(array->length() >= 3); |
| 511 Object* name = array->get(0); | 510 Object* name = array->get(0); |
| 512 if (name->IsName()) return Name::cast(name); | 511 if (name->IsName()) return Name::cast(name); |
| 513 } | 512 } |
| 514 return NULL; | 513 return NULL; |
| 515 } | 514 } |
| 516 } | 515 } |
| 517 } // namespace v8::internal | 516 } // namespace v8::internal |
| OLD | NEW |