Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index 93f57333a150498810f73f264c74082e2147ff3b..1ccb12dade61aba9f47254de6e57b5e429364023 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -5389,24 +5389,24 @@ class Code: public HeapObject { |
| }; |
| -// This class describes the layout of dependent codes array of a map. The |
| -// array is partitioned into several groups of dependent codes. Each group |
| -// contains codes with the same dependency on the map. The array has the |
| -// following layout for n dependency groups: |
| +// Dependent code is a singly linked list of fixed arrays. Each array contains |
| +// code objects in weak cells for one dependent group. The suffix of the array |
| +// can be filled with the undefined value if the number of codes is less than |
| +// the length of the array. |
| // |
| -// +----+----+-----+----+---------+----------+-----+---------+-----------+ |
| -// | C1 | C2 | ... | Cn | group 1 | group 2 | ... | group n | undefined | |
| -// +----+----+-----+----+---------+----------+-----+---------+-----------+ |
| +// +------+-----------------+--------+--------+-----+--------+-----------+-----+ |
| +// | next | count & group 1 | code 1 | code 2 | ... | code n | undefined | ... | |
| +// +------+-----------------+--------+--------+-----+--------+-----------+-----+ |
| +// | |
| +// V |
| +// +------+-----------------+--------+--------+-----+--------+-----------+-----+ |
| +// | next | count & group 2 | code 1 | code 2 | ... | code m | undefined | ... | |
| +// +------+-----------------+--------+--------+-----+--------+-----------+-----+ |
| +// | |
| +// V |
| +// empty_fixed_array() |
| // |
| -// The first n elements are Smis, each of them specifies the number of codes |
| -// in the corresponding group. The subsequent elements contain grouped code |
| -// objects in weak cells. The suffix of the array can be filled with the |
| -// undefined value if the number of codes is less than the length of the |
| -// array. The order of the code objects within a group is not preserved. |
| -// |
| -// All code indexes used in the class are counted starting from the first |
| -// code object of the first group. In other words, code index 0 corresponds |
| -// to array index n = kCodesStartIndex. |
| +// The list of fixed arrays is ordered by dependency groups. |
| class DependentCode: public FixedArray { |
| public: |
| @@ -5441,19 +5441,8 @@ class DependentCode: public FixedArray { |
| static const int kGroupCount = kAllocationSiteTransitionChangedGroup + 1; |
| - // Array for holding the index of the first code object of each group. |
| - // The last element stores the total number of code objects. |
| - class GroupStartIndexes { |
| - public: |
| - explicit GroupStartIndexes(DependentCode* entries); |
| - void Recompute(DependentCode* entries); |
| - int at(int i) { return start_indexes_[i]; } |
| - int number_of_entries() { return start_indexes_[kGroupCount]; } |
| - private: |
| - int start_indexes_[kGroupCount + 1]; |
| - }; |
| - |
| bool Contains(DependencyGroup group, WeakCell* code_cell); |
| + bool IsEmpty(DependencyGroup group); |
| static Handle<DependentCode> InsertCompilationDependencies( |
| Handle<DependentCode> entries, DependencyGroup group, |
| @@ -5477,8 +5466,14 @@ class DependentCode: public FixedArray { |
| // The following low-level accessors should only be used by this class |
| // and the mark compact collector. |
| - inline int number_of_entries(DependencyGroup group); |
| - inline void set_number_of_entries(DependencyGroup group, int value); |
| + inline DependentCode* next_link(); |
| + inline void set_next_link(DependentCode* next); |
| + inline int flags(); |
| + inline void set_flags(int flags); |
|
Igor Sheludko
2015/11/20 12:35:32
I think the flags accessors should be private.
ulan
2015/11/23 09:01:11
Done.
|
| + inline int count(); |
| + inline void set_count(int value); |
| + inline DependencyGroup group(); |
| + inline void set_group(DependencyGroup group); |
| inline Object* object_at(int i); |
| inline void set_object_at(int i, Object* object); |
| inline void clear_at(int i); |
| @@ -5492,10 +5487,9 @@ class DependentCode: public FixedArray { |
| static Handle<DependentCode> Insert(Handle<DependentCode> entries, |
| DependencyGroup group, |
| Handle<Object> object); |
| + static Handle<DependentCode> New(DependencyGroup group, Handle<Object> object, |
| + Handle<DependentCode> next); |
| static Handle<DependentCode> EnsureSpace(Handle<DependentCode> entries); |
| - // Make a room at the end of the given group by moving out the first |
| - // code objects of the subsequent groups. |
| - inline void ExtendGroup(DependencyGroup group); |
| // Compact by removing cleared weak cells and return true if there was |
| // any cleared weak cell. |
| bool Compact(); |
| @@ -5503,7 +5497,11 @@ class DependentCode: public FixedArray { |
| if (number_of_entries < 5) return number_of_entries + 1; |
| return number_of_entries * 5 / 4; |
| } |
| - static const int kCodesStartIndex = kGroupCount; |
| + class GroupField : public BitField<int, 0, 3> {}; |
|
Igor Sheludko
2015/11/20 12:35:32
Please add this:
STATIC_ASSERT(kGroupCount <= Gr
ulan
2015/11/23 09:01:11
Done.
|
| + class CountField : public BitField<int, 3, 27> {}; |
| + static const int kNextLinkIndex = 0; |
| + static const int kFlagsIndex = 1; |
| + static const int kCodesStartIndex = 2; |
| }; |