| 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" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 333 |
| 334 void FeedbackNexus::ConfigurePremonomorphic() { | 334 void FeedbackNexus::ConfigurePremonomorphic() { |
| 335 SetFeedback(*TypeFeedbackVector::PremonomorphicSentinel(GetIsolate()), | 335 SetFeedback(*TypeFeedbackVector::PremonomorphicSentinel(GetIsolate()), |
| 336 SKIP_WRITE_BARRIER); | 336 SKIP_WRITE_BARRIER); |
| 337 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(GetIsolate()), | 337 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(GetIsolate()), |
| 338 SKIP_WRITE_BARRIER); | 338 SKIP_WRITE_BARRIER); |
| 339 } | 339 } |
| 340 | 340 |
| 341 | 341 |
| 342 void FeedbackNexus::ConfigureMegamorphic() { | 342 void FeedbackNexus::ConfigureMegamorphic() { |
| 343 // Keyed ICs must use ConfigureMegamorphicKeyed. |
| 344 DCHECK_NE(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector()->GetKind(slot())); |
| 345 DCHECK_NE(FeedbackVectorSlotKind::KEYED_STORE_IC, vector()->GetKind(slot())); |
| 346 |
| 343 Isolate* isolate = GetIsolate(); | 347 Isolate* isolate = GetIsolate(); |
| 344 SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(isolate), | 348 SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(isolate), |
| 345 SKIP_WRITE_BARRIER); | 349 SKIP_WRITE_BARRIER); |
| 346 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate), | 350 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate), |
| 347 SKIP_WRITE_BARRIER); | 351 SKIP_WRITE_BARRIER); |
| 348 } | 352 } |
| 349 | 353 |
| 354 void KeyedLoadICNexus::ConfigureMegamorphicKeyed(IcCheckType property_type) { |
| 355 Isolate* isolate = GetIsolate(); |
| 356 SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(isolate), |
| 357 SKIP_WRITE_BARRIER); |
| 358 SetFeedbackExtra(Smi::FromInt(static_cast<int>(property_type)), |
| 359 SKIP_WRITE_BARRIER); |
| 360 } |
| 361 |
| 362 void KeyedStoreICNexus::ConfigureMegamorphicKeyed(IcCheckType property_type) { |
| 363 Isolate* isolate = GetIsolate(); |
| 364 SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(isolate), |
| 365 SKIP_WRITE_BARRIER); |
| 366 SetFeedbackExtra(Smi::FromInt(static_cast<int>(property_type)), |
| 367 SKIP_WRITE_BARRIER); |
| 368 } |
| 350 | 369 |
| 351 InlineCacheState LoadICNexus::StateFromFeedback() const { | 370 InlineCacheState LoadICNexus::StateFromFeedback() const { |
| 352 Isolate* isolate = GetIsolate(); | 371 Isolate* isolate = GetIsolate(); |
| 353 Object* feedback = GetFeedback(); | 372 Object* feedback = GetFeedback(); |
| 354 | 373 |
| 355 if (feedback == *TypeFeedbackVector::UninitializedSentinel(isolate)) { | 374 if (feedback == *TypeFeedbackVector::UninitializedSentinel(isolate)) { |
| 356 return UNINITIALIZED; | 375 return UNINITIALIZED; |
| 357 } else if (feedback == *TypeFeedbackVector::MegamorphicSentinel(isolate)) { | 376 } else if (feedback == *TypeFeedbackVector::MegamorphicSentinel(isolate)) { |
| 358 return MEGAMORPHIC; | 377 return MEGAMORPHIC; |
| 359 } else if (feedback == *TypeFeedbackVector::PremonomorphicSentinel(isolate)) { | 378 } else if (feedback == *TypeFeedbackVector::PremonomorphicSentinel(isolate)) { |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 major_key == CodeStub::NoCache); | 836 major_key == CodeStub::NoCache); |
| 818 if (major_key != CodeStub::NoCache) { | 837 if (major_key != CodeStub::NoCache) { |
| 819 mode = CommonStoreModeBits::decode(minor_key); | 838 mode = CommonStoreModeBits::decode(minor_key); |
| 820 break; | 839 break; |
| 821 } | 840 } |
| 822 } | 841 } |
| 823 | 842 |
| 824 return mode; | 843 return mode; |
| 825 } | 844 } |
| 826 | 845 |
| 846 IcCheckType KeyedLoadICNexus::GetKeyType() const { |
| 847 Object* feedback = GetFeedback(); |
| 848 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { |
| 849 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); |
| 850 } |
| 851 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; |
| 852 } |
| 827 | 853 |
| 828 IcCheckType KeyedStoreICNexus::GetKeyType() const { | 854 IcCheckType KeyedStoreICNexus::GetKeyType() const { |
| 829 // The structure of the vector slots tells us the type. | 855 Object* feedback = GetFeedback(); |
| 830 return GetFeedback()->IsName() ? PROPERTY : ELEMENT; | 856 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { |
| 857 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); |
| 858 } |
| 859 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; |
| 831 } | 860 } |
| 832 } // namespace internal | 861 } // namespace internal |
| 833 } // namespace v8 | 862 } // namespace v8 |
| OLD | NEW |