Chromium Code Reviews| Index: src/heap/heap.h |
| diff --git a/src/heap/heap.h b/src/heap/heap.h |
| index aa63a00650ea3c4e8074e0786a80fce06a84819e..b481d5378fd7b80a715d7054a145d3d48239f34b 100644 |
| --- a/src/heap/heap.h |
| +++ b/src/heap/heap.h |
| @@ -422,16 +422,13 @@ namespace internal { |
| PRIVATE_SYMBOL_LIST(V) |
| // Forward declarations. |
| +class HeapObjectsFilter; |
| class HeapStats; |
| class Isolate; |
| class MemoryReducer; |
| class WeakObjectRetainer; |
| -typedef String* (*ExternalStringTableUpdaterCallback)(Heap* heap, |
| - Object** pointer); |
| - |
| - |
| // A queue of objects promoted during scavenge. Each object is accompanied |
| // by it's size to avoid dereferencing a map pointer for scanning. |
| // The last page in to-space is used for the promotion queue. On conflict |
| @@ -541,46 +538,6 @@ typedef void (*ScavengingCallback)(Map* map, HeapObject** slot, |
| HeapObject* object); |
| -// External strings table is a place where all external strings are |
| -// registered. We need to keep track of such strings to properly |
| -// finalize them. |
| -class ExternalStringTable { |
| - public: |
| - // Registers an external string. |
| - inline void AddString(String* string); |
| - |
| - inline void Iterate(ObjectVisitor* v); |
| - |
| - // Restores internal invariant and gets rid of collected strings. |
| - // Must be called after each Iterate() that modified the strings. |
| - void CleanUp(); |
| - |
| - // Destroys all allocated memory. |
| - void TearDown(); |
| - |
| - private: |
| - explicit ExternalStringTable(Heap* heap) : heap_(heap) {} |
| - |
| - friend class Heap; |
| - |
| - inline void Verify(); |
| - |
| - inline void AddOldString(String* string); |
| - |
| - // Notifies the table that only a prefix of the new list is valid. |
| - inline void ShrinkNewStrings(int position); |
| - |
| - // To speed up scavenge collections new space string are kept |
| - // separate from old space strings. |
| - List<Object*> new_space_strings_; |
| - List<Object*> old_space_strings_; |
| - |
| - Heap* heap_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); |
| -}; |
| - |
| - |
| enum ArrayStorageAllocationMode { |
| DONT_INITIALIZE_ARRAY_ELEMENTS, |
| INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE |
| @@ -870,10 +827,6 @@ class Heap { |
| // index. |
| void MoveElements(FixedArray* array, int dst_index, int src_index, int len); |
| - // Finalizes an external string by deleting the associated external |
| - // data and clearing the resource pointer. |
| - inline void FinalizeExternalString(String* string); |
| - |
| // Initialize a filler object to keep the ability to iterate over the heap |
| // when introducing gaps within pages. |
| void CreateFillerObjectAt(Address addr, int size); |
| @@ -1220,10 +1173,6 @@ class Heap { |
| return &mark_compact_collector_; |
| } |
| - ExternalStringTable* external_string_table() { |
| - return &external_string_table_; |
| - } |
| - |
| // =========================================================================== |
| // Root set access. ========================================================== |
| // =========================================================================== |
| @@ -1393,6 +1342,17 @@ class Heap { |
| IncrementalMarking* incremental_marking() { return &incremental_marking_; } |
| // =========================================================================== |
| + // External string table API. ================================================ |
| + // =========================================================================== |
| + |
| + // Registers an external string. |
| + inline void AddExternalString(String* string); |
|
Michael Starzinger
2015/08/25 14:18:30
Wasn't sure whether "AddExternalString" or "Regist
Michael Lippautz
2015/08/25 17:23:37
We already have a couple of Register*() methods. L
Michael Starzinger
2015/08/26 08:39:57
Done.
|
| + |
| + // Finalizes an external string by deleting the associated external |
| + // data and clearing the resource pointer. |
| + inline void FinalizeExternalString(String* string); |
| + |
| + // =========================================================================== |
| // Methods checking/returning the space of a given object/address. =========== |
| // =========================================================================== |
| @@ -1613,6 +1573,45 @@ class Heap { |
| private: |
| class UnmapFreeMemoryTask; |
| + // External strings table is a place where all external strings are |
| + // registered. We need to keep track of such strings to properly |
| + // finalize them. |
| + class ExternalStringTable { |
| + public: |
| + // Registers an external string. |
| + inline void AddString(String* string); |
| + |
| + inline void Iterate(ObjectVisitor* v); |
| + |
| + // Restores internal invariant and gets rid of collected strings. |
| + // Must be called after each Iterate() that modified the strings. |
| + void CleanUp(); |
| + |
| + // Destroys all allocated memory. |
| + void TearDown(); |
| + |
| + private: |
| + explicit ExternalStringTable(Heap* heap) : heap_(heap) {} |
| + |
| + friend class Heap; |
|
Michael Lippautz
2015/08/25 17:23:37
Move to bottom.
Michael Starzinger
2015/08/26 08:39:57
Done.
|
| + |
| + inline void Verify(); |
| + |
| + inline void AddOldString(String* string); |
| + |
| + // Notifies the table that only a prefix of the new list is valid. |
| + inline void ShrinkNewStrings(int position); |
| + |
| + // To speed up scavenge collections new space string are kept |
| + // separate from old space strings. |
| + List<Object*> new_space_strings_; |
| + List<Object*> old_space_strings_; |
| + |
| + Heap* heap_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); |
| + }; |
| + |
| struct StrongRootsList; |
| struct StringTypeTable { |
| @@ -1646,6 +1645,9 @@ class Heap { |
| bool pass_isolate; |
| }; |
| + typedef String* (*ExternalStringTableUpdaterCallback)(Heap* heap, |
| + Object** pointer); |
| + |
| static const int kInitialStringTableSize = 2048; |
| static const int kInitialEvalCacheSize = 64; |
| static const int kInitialNumberStringCacheSize = 256; |
| @@ -2569,8 +2571,6 @@ class SpaceIterator : public Malloced { |
| // nodes filtering uses GC marks, it can't be used during MS/MC GC |
| // phases. Also, it is forbidden to interrupt iteration in this mode, |
| // as this will leave heap objects marked (and thus, unusable). |
| -class HeapObjectsFilter; |
| - |
| class HeapIterator BASE_EMBEDDED { |
| public: |
| enum HeapObjectsFiltering { kNoFiltering, kFilterUnreachable }; |