| Index: src/type-feedback-vector.h
|
| diff --git a/src/type-feedback-vector.h b/src/type-feedback-vector.h
|
| index b7abad51f1db466da33e33ed5d5e40e395cd83dc..aba42a6c91027a4d6a660594f82ed77519131941 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)); }
|
| @@ -244,14 +247,17 @@ class FeedbackNexus {
|
| void FindAllMaps(MapHandleList* maps) const { ExtractMaps(maps); }
|
|
|
| virtual InlineCacheState StateFromFeedback() const = 0;
|
| - virtual int ExtractMaps(MapHandleList* maps) const = 0;
|
| - virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const = 0;
|
| - virtual bool FindHandlers(CodeHandleList* code_list, int length = -1) const {
|
| - return length == 0;
|
| - }
|
| + virtual int ExtractMaps(MapHandleList* maps) const;
|
| + virtual MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const;
|
| + virtual bool FindHandlers(CodeHandleList* code_list, int length = -1) const;
|
| 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 +267,17 @@ 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;
|
|
|
| private:
|
| // The reason for having a vector handle and a raw pointer is that we can and
|
| @@ -334,10 +344,6 @@ class LoadICNexus : public FeedbackNexus {
|
| void ConfigurePolymorphic(MapHandleList* maps, CodeHandleList* handlers);
|
|
|
| InlineCacheState StateFromFeedback() const OVERRIDE;
|
| - int ExtractMaps(MapHandleList* maps) const OVERRIDE;
|
| - MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE;
|
| - virtual bool FindHandlers(CodeHandleList* code_list,
|
| - int length = -1) const OVERRIDE;
|
| };
|
|
|
|
|
| @@ -364,10 +370,6 @@ class KeyedLoadICNexus : public FeedbackNexus {
|
| CodeHandleList* handlers);
|
|
|
| InlineCacheState StateFromFeedback() const OVERRIDE;
|
| - int ExtractMaps(MapHandleList* maps) const OVERRIDE;
|
| - MaybeHandle<Code> FindHandlerForMap(Handle<Map> map) const OVERRIDE;
|
| - virtual bool FindHandlers(CodeHandleList* code_list,
|
| - int length = -1) const OVERRIDE;
|
| Name* FindFirstName() const OVERRIDE;
|
| };
|
| }
|
|
|