Chromium Code Reviews| Index: src/heap/spaces.h |
| diff --git a/src/heap/spaces.h b/src/heap/spaces.h |
| index aa30e7da3b438102f3b7980b85f6e4e93ea116e0..4f76d3b3b5c8dedefd84a7f5b3532a5269659dd8 100644 |
| --- a/src/heap/spaces.h |
| +++ b/src/heap/spaces.h |
| @@ -14,6 +14,7 @@ |
| #include "src/base/platform/mutex.h" |
| #include "src/flags.h" |
| #include "src/hashmap.h" |
| +#include "src/heap/array-buffer-tracker.h" |
| #include "src/list.h" |
| #include "src/objects.h" |
| #include "src/utils.h" |
| @@ -468,6 +469,8 @@ class MemoryChunk { |
| kSweepingInProgress, |
| }; |
| + enum TrackerAccessMode { kDontCreate, kCreateIfNotPresent }; |
|
Hannes Payer (out of office)
2016/05/25 05:22:07
Can we call it ArrayBufferTrackerAccessMode to ass
Michael Lippautz
2016/05/25 06:38:46
Done.
|
| + |
| // Every n write barrier invocations we go to runtime even though |
| // we could have handled it in generated code. This lets us check |
| // whether we have hit the limit and should do some more marking. |
| @@ -523,7 +526,8 @@ class MemoryChunk { |
| + kPointerSize // AtomicValue next_chunk_ |
| + kPointerSize // AtomicValue prev_chunk_ |
| // FreeListCategory categories_[kNumberOfCategories] |
| - + FreeListCategory::kSize * kNumberOfCategories; |
| + + FreeListCategory::kSize * kNumberOfCategories + |
| + kPointerSize; // LocalArrayBufferTracker tracker_ |
| // We add some more space to the computed header size to amount for missing |
| // alignment requirements in our computation. |
| @@ -642,6 +646,16 @@ class MemoryChunk { |
| void AllocateTypedOldToOldSlots(); |
| void ReleaseTypedOldToOldSlots(); |
| + template <TrackerAccessMode tracker_access> |
| + inline LocalArrayBufferTracker* local_tracker() { |
| + if (local_tracker_ == nullptr && tracker_access == kCreateIfNotPresent) { |
| + local_tracker_ = new LocalArrayBufferTracker(heap_); |
| + } |
| + return local_tracker_; |
| + } |
| + |
| + void ReleaseLocalTracker(); |
| + |
| Address area_start() { return area_start_; } |
| Address area_end() { return area_end_; } |
| int area_size() { return static_cast<int>(area_end() - area_start()); } |
| @@ -824,6 +838,8 @@ class MemoryChunk { |
| FreeListCategory categories_[kNumberOfCategories]; |
| + LocalArrayBufferTracker* local_tracker_; |
| + |
| private: |
| void InitializeReservedMemory() { reservation_.Reset(); } |
| @@ -2295,6 +2311,16 @@ class PagedSpace : public Space { |
| inline void UnlinkFreeListCategories(Page* page); |
| inline intptr_t RelinkFreeListCategories(Page* page); |
| + // Callback signature: |
| + // void Callback(Page*); |
| + template <typename Callback> |
| + void ForAllPages(Callback callback) { |
| + PageIterator it(this); |
| + while (it.has_next()) { |
| + callback(it.next()); |
| + } |
| + } |
| + |
| protected: |
| // PagedSpaces that should be included in snapshots have different, i.e., |
| // smaller, initial pages. |