Chromium Code Reviews| Index: src/type-feedback-vector.h |
| diff --git a/src/type-feedback-vector.h b/src/type-feedback-vector.h |
| index b7abad51f1db466da33e33ed5d5e40e395cd83dc..1f7fe11a8a4ae28dbab6b564c44a21f445709443 100644 |
| --- a/src/type-feedback-vector.h |
| +++ b/src/type-feedback-vector.h |
| @@ -74,6 +74,8 @@ class TypeFeedbackVector : public FixedArray { |
| static const int kWithTypesIndex = 1; |
| static const int kGenericCountIndex = 2; |
| + static int elements_per_ic_slot() { return FLAG_vector_ics ? 2 : 1; } |
| + |
| int first_ic_slot_index() const { |
| DCHECK(length() >= kReservedIndexCount); |
| return Smi::cast(get(kFirstICSlotIndex))->value(); |
| @@ -114,7 +116,7 @@ class TypeFeedbackVector : public FixedArray { |
| int ICSlots() const { |
| if (length() == 0) return 0; |
| - return length() - first_ic_slot_index(); |
| + return (length() - first_ic_slot_index()) / elements_per_ic_slot(); |
| } |
| // Conversion from a slot or ic slot to an integer index to the underlying |
| @@ -127,7 +129,7 @@ class TypeFeedbackVector : public FixedArray { |
| int GetIndex(FeedbackVectorICSlot slot) const { |
| int first_ic_slot = first_ic_slot_index(); |
| DCHECK(slot.ToInt() < ICSlots()); |
| - return first_ic_slot + slot.ToInt(); |
| + return first_ic_slot + slot.ToInt() * elements_per_ic_slot(); |
| } |
| // Conversion from an integer index to either a slot or an ic slot. The caller |
| @@ -140,7 +142,8 @@ class TypeFeedbackVector : public FixedArray { |
| FeedbackVectorICSlot ToICSlot(int index) const { |
| DCHECK(index >= first_ic_slot_index() && index < length()); |
| - return FeedbackVectorICSlot(index - first_ic_slot_index()); |
| + int ic_slot = (index - first_ic_slot_index()) / elements_per_ic_slot(); |
| + return FeedbackVectorICSlot(ic_slot); |
| } |
| Object* Get(FeedbackVectorSlot slot) const { return get(GetIndex(slot)); } |
| @@ -252,6 +255,11 @@ class FeedbackNexus { |
| virtual Name* FindFirstName() const { return NULL; } |
| Object* GetFeedback() const { return vector()->Get(slot()); } |
| + Object* GetFeedbackExtra() const { |
| + DCHECK(TypeFeedbackVector::elements_per_ic_slot() > 1); |
| + int extra_index = vector()->GetIndex(slot()) + 1; |
| + return vector()->get(extra_index); |
| + } |
| protected: |
| Isolate* GetIsolate() const { return vector()->GetIsolate(); } |
| @@ -261,13 +269,21 @@ class FeedbackNexus { |
| vector()->Set(slot(), feedback, mode); |
| } |
| + void SetFeedbackExtra(Object* feedback_extra, |
| + WriteBarrierMode mode = UPDATE_WRITE_BARRIER) { |
| + DCHECK(TypeFeedbackVector::elements_per_ic_slot() > 1); |
| + int index = vector()->GetIndex(slot()) + 1; |
| + vector()->set(index, feedback_extra, mode); |
| + } |
| + |
| Handle<FixedArray> EnsureArrayOfSize(int length); |
| - void InstallHandlers(int start_index, MapHandleList* maps, |
| + Handle<FixedArray> EnsureExtraArrayOfSize(int length); |
| + void InstallHandlers(Handle<FixedArray> array, MapHandleList* maps, |
| CodeHandleList* handlers); |
| - int ExtractMaps(int start_index, MapHandleList* maps) const; |
| - MaybeHandle<Code> FindHandlerForMap(int start_index, Handle<Map> map) const; |
| - bool FindHandlers(int start_index, CodeHandleList* code_list, |
| - int length) const; |
| + |
| + int ExtractMapsImpl(MapHandleList* maps) const; |
|
Toon Verwaest
2015/03/11 17:55:02
Impl?
mvstanton
2015/03/12 17:05:34
I'll reorganize this, providing a base implementat
|
| + MaybeHandle<Code> FindHandlerForMapImpl(Handle<Map> map) const; |
| + bool FindHandlersImpl(CodeHandleList* code_list, int length) const; |
| private: |
| // The reason for having a vector handle and a raw pointer is that we can and |