| 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 #ifndef V8_TYPE_FEEDBACK_VECTOR_H_ |    5 #ifndef V8_TYPE_FEEDBACK_VECTOR_H_ | 
|    6 #define V8_TYPE_FEEDBACK_VECTOR_H_ |    6 #define V8_TYPE_FEEDBACK_VECTOR_H_ | 
|    7  |    7  | 
|    8 #include <vector> |    8 #include <vector> | 
|    9  |    9  | 
|   10 #include "src/checks.h" |   10 #include "src/checks.h" | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
|   22   FeedbackVectorSpec() : slots_(0), has_ic_slot_(false) {} |   22   FeedbackVectorSpec() : slots_(0), has_ic_slot_(false) {} | 
|   23   explicit FeedbackVectorSpec(int slots) : slots_(slots), has_ic_slot_(false) {} |   23   explicit FeedbackVectorSpec(int slots) : slots_(slots), has_ic_slot_(false) {} | 
|   24   FeedbackVectorSpec(int slots, Code::Kind ic_slot_kind) |   24   FeedbackVectorSpec(int slots, Code::Kind ic_slot_kind) | 
|   25       : slots_(slots), has_ic_slot_(true), ic_kind_(ic_slot_kind) {} |   25       : slots_(slots), has_ic_slot_(true), ic_kind_(ic_slot_kind) {} | 
|   26  |   26  | 
|   27   int slots() const { return slots_; } |   27   int slots() const { return slots_; } | 
|   28  |   28  | 
|   29   int ic_slots() const { return has_ic_slot_ ? 1 : 0; } |   29   int ic_slots() const { return has_ic_slot_ ? 1 : 0; } | 
|   30  |   30  | 
|   31   Code::Kind GetKind(int ic_slot) const { |   31   Code::Kind GetKind(int ic_slot) const { | 
|   32     DCHECK(FLAG_vector_ics && has_ic_slot_ && ic_slot == 0); |   32     DCHECK(has_ic_slot_ && ic_slot == 0); | 
|   33     return ic_kind_; |   33     return ic_kind_; | 
|   34   } |   34   } | 
|   35  |   35  | 
|   36  private: |   36  private: | 
|   37   int slots_; |   37   int slots_; | 
|   38   bool has_ic_slot_; |   38   bool has_ic_slot_; | 
|   39   Code::Kind ic_kind_; |   39   Code::Kind ic_kind_; | 
|   40 }; |   40 }; | 
|   41  |   41  | 
|   42  |   42  | 
|   43 class ZoneFeedbackVectorSpec { |   43 class ZoneFeedbackVectorSpec { | 
|   44  public: |   44  public: | 
|   45   explicit ZoneFeedbackVectorSpec(Zone* zone) |   45   explicit ZoneFeedbackVectorSpec(Zone* zone) | 
|   46       : slots_(0), ic_slots_(0), ic_slot_kinds_(zone) {} |   46       : slots_(0), ic_slots_(0), ic_slot_kinds_(zone) {} | 
|   47  |   47  | 
|   48   ZoneFeedbackVectorSpec(Zone* zone, int slots, int ic_slots) |   48   ZoneFeedbackVectorSpec(Zone* zone, int slots, int ic_slots) | 
|   49       : slots_(slots), |   49       : slots_(slots), ic_slots_(ic_slots), ic_slot_kinds_(ic_slots, zone) {} | 
|   50         ic_slots_(ic_slots), |  | 
|   51         ic_slot_kinds_(FLAG_vector_ics ? ic_slots : 0, zone) {} |  | 
|   52  |   50  | 
|   53   int slots() const { return slots_; } |   51   int slots() const { return slots_; } | 
|   54   void increase_slots(int count) { slots_ += count; } |   52   void increase_slots(int count) { slots_ += count; } | 
|   55  |   53  | 
|   56   int ic_slots() const { return ic_slots_; } |   54   int ic_slots() const { return ic_slots_; } | 
|   57   void increase_ic_slots(int count) { |   55   void increase_ic_slots(int count) { | 
|   58     ic_slots_ += count; |   56     ic_slots_ += count; | 
|   59     if (FLAG_vector_ics) ic_slot_kinds_.resize(ic_slots_); |   57     ic_slot_kinds_.resize(ic_slots_); | 
|   60   } |   58   } | 
|   61  |   59  | 
|   62   void SetKind(int ic_slot, Code::Kind kind) { |   60   void SetKind(int ic_slot, Code::Kind kind) { | 
|   63     DCHECK(FLAG_vector_ics); |  | 
|   64     ic_slot_kinds_[ic_slot] = kind; |   61     ic_slot_kinds_[ic_slot] = kind; | 
|   65   } |   62   } | 
|   66  |   63  | 
|   67   Code::Kind GetKind(int ic_slot) const { |   64   Code::Kind GetKind(int ic_slot) const { | 
|   68     DCHECK(FLAG_vector_ics); |  | 
|   69     return static_cast<Code::Kind>(ic_slot_kinds_.at(ic_slot)); |   65     return static_cast<Code::Kind>(ic_slot_kinds_.at(ic_slot)); | 
|   70   } |   66   } | 
|   71  |   67  | 
|   72  private: |   68  private: | 
|   73   int slots_; |   69   int slots_; | 
|   74   int ic_slots_; |   70   int ic_slots_; | 
|   75   ZoneVector<unsigned char> ic_slot_kinds_; |   71   ZoneVector<unsigned char> ic_slot_kinds_; | 
|   76 }; |   72 }; | 
|   77  |   73  | 
|   78  |   74  | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
|   93   static TypeFeedbackVector* cast(Object* obj) { |   89   static TypeFeedbackVector* cast(Object* obj) { | 
|   94     DCHECK(obj->IsTypeFeedbackVector()); |   90     DCHECK(obj->IsTypeFeedbackVector()); | 
|   95     return reinterpret_cast<TypeFeedbackVector*>(obj); |   91     return reinterpret_cast<TypeFeedbackVector*>(obj); | 
|   96   } |   92   } | 
|   97  |   93  | 
|   98   static const int kReservedIndexCount = 3; |   94   static const int kReservedIndexCount = 3; | 
|   99   static const int kFirstICSlotIndex = 0; |   95   static const int kFirstICSlotIndex = 0; | 
|  100   static const int kWithTypesIndex = 1; |   96   static const int kWithTypesIndex = 1; | 
|  101   static const int kGenericCountIndex = 2; |   97   static const int kGenericCountIndex = 2; | 
|  102  |   98  | 
|  103   static int elements_per_ic_slot() { return FLAG_vector_ics ? 2 : 1; } |   99   static int elements_per_ic_slot() { return 2; } | 
|  104  |  100  | 
|  105   int first_ic_slot_index() const { |  101   int first_ic_slot_index() const { | 
|  106     DCHECK(length() >= kReservedIndexCount); |  102     DCHECK(length() >= kReservedIndexCount); | 
|  107     return Smi::cast(get(kFirstICSlotIndex))->value(); |  103     return Smi::cast(get(kFirstICSlotIndex))->value(); | 
|  108   } |  104   } | 
|  109  |  105  | 
|  110   int ic_with_type_info_count() { |  106   int ic_with_type_info_count() { | 
|  111     return length() > 0 ? Smi::cast(get(kWithTypesIndex))->value() : 0; |  107     return length() > 0 ? Smi::cast(get(kWithTypesIndex))->value() : 0; | 
|  112   } |  108   } | 
|  113  |  109  | 
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  418   void ConfigurePolymorphic(Handle<Name> name, MapHandleList* maps, |  414   void ConfigurePolymorphic(Handle<Name> name, MapHandleList* maps, | 
|  419                             CodeHandleList* handlers); |  415                             CodeHandleList* handlers); | 
|  420  |  416  | 
|  421   InlineCacheState StateFromFeedback() const override; |  417   InlineCacheState StateFromFeedback() const override; | 
|  422   Name* FindFirstName() const override; |  418   Name* FindFirstName() const override; | 
|  423 }; |  419 }; | 
|  424 } |  420 } | 
|  425 }  // namespace v8::internal |  421 }  // namespace v8::internal | 
|  426  |  422  | 
|  427 #endif  // V8_TRANSITIONS_H_ |  423 #endif  // V8_TRANSITIONS_H_ | 
| OLD | NEW |