Index: src/heap/spaces.h |
diff --git a/src/heap/spaces.h b/src/heap/spaces.h |
index c035342bfa85058dd9be34024e17cbc6d5722be3..df4401bd9e41f4fee4b5720ad7b62de66c2369d4 100644 |
--- a/src/heap/spaces.h |
+++ b/src/heap/spaces.h |
@@ -350,7 +350,8 @@ class MemoryChunk { |
+ kPointerSize // AtomicValue prev_chunk_ |
// FreeListCategory categories_[kNumberOfCategories] |
+ FreeListCategory::kSize * kNumberOfCategories + |
- kPointerSize; // LocalArrayBufferTracker* local_tracker_; |
+ kPointerSize // LocalArrayBufferTracker* local_tracker_; |
+ + kPointerSize; // base::HashMap* black_area_end_marker_map_; |
// We add some more space to the computed header size to amount for missing |
// alignment requirements in our computation. |
@@ -592,6 +593,31 @@ class MemoryChunk { |
void InsertAfter(MemoryChunk* other); |
void Unlink(); |
+ void ReleaseBlackAreaEndMarkerMap() { |
+ if (black_area_end_marker_map_) { |
+ delete black_area_end_marker_map_; |
Michael Lippautz
2016/08/10 16:05:42
nit: we usually also add
black_area_end_marker_m
Hannes Payer (out of office)
2016/08/11 10:51:56
Done.
|
+ } |
+ } |
+ |
+ bool IsBlackAreaEndMarker(Address address) { |
+ if (black_area_end_marker_map_) { |
+ return black_area_end_marker_map_->Lookup( |
+ reinterpret_cast<void*>(address), ObjectHash(address)); |
+ } |
+ return false; |
+ } |
+ |
+ void AddBlackAreaEndMarker(Address address) { |
+ if (!black_area_end_marker_map_) { |
+ black_area_end_marker_map_ = |
+ new base::HashMap(base::HashMap::PointersMatch, 8); |
+ } |
+ black_area_end_marker_map_->InsertNew(reinterpret_cast<void*>(address), |
+ ObjectHash(address)); |
+ } |
+ |
+ bool HasBlackAreas() { return black_area_end_marker_map_ != nullptr; } |
+ |
protected: |
static MemoryChunk* Initialize(Heap* heap, Address base, size_t size, |
Address area_start, Address area_end, |
@@ -660,6 +686,9 @@ class MemoryChunk { |
LocalArrayBufferTracker* local_tracker_; |
+ // Stores the end addresses of black areas. |
+ base::HashMap* black_area_end_marker_map_; |
Michael Lippautz
2016/08/10 16:05:42
How about std::unordered_map?
Hannes Payer (out of office)
2016/08/11 10:51:56
Using std::unordered_set which is sufficient.
|
+ |
private: |
void InitializeReservedMemory() { reservation_.Reset(); } |
@@ -1481,14 +1510,18 @@ class HeapObjectIterator : public ObjectIterator { |
// space. |
class AllocationInfo { |
public: |
- AllocationInfo() : top_(nullptr), limit_(nullptr) {} |
- AllocationInfo(Address top, Address limit) : top_(top), limit_(limit) {} |
+ AllocationInfo() : original_top_(nullptr), top_(nullptr), limit_(nullptr) {} |
+ AllocationInfo(Address top, Address limit) |
+ : original_top_(top), top_(top), limit_(limit) {} |
void Reset(Address top, Address limit) { |
+ original_top_ = top; |
set_top(top); |
set_limit(limit); |
} |
+ Address original_top() { return original_top_; } |
Michael Lippautz
2016/08/10 16:05:41
nit: Let's add the SLOW_DCHECK (like below) so tha
Hannes Payer (out of office)
2016/08/11 10:51:56
Done.
|
+ |
INLINE(void set_top(Address top)) { |
SLOW_DCHECK(top == NULL || |
(reinterpret_cast<intptr_t>(top) & kHeapObjectTagMask) == 0); |
@@ -1522,6 +1555,8 @@ class AllocationInfo { |
#endif |
private: |
+ // The original top address when the allocation info was initialized. |
+ Address original_top_; |
// Current allocation top. |
Address top_; |
// Current allocation limit. |