Index: src/heap/heap.h |
diff --git a/src/heap/heap.h b/src/heap/heap.h |
index db57591984d341f0c893b603deb2e760a63b9c73..b3a83be4c3f2e966dc11809bddd3c0bc846bb40c 100644 |
--- a/src/heap/heap.h |
+++ b/src/heap/heap.h |
@@ -1598,11 +1598,11 @@ class Heap { |
void UnregisterArrayBuffer(bool in_new_space, void* data); |
// A live ArrayBuffer was discovered during marking/scavenge. |
- void RegisterLiveArrayBuffer(bool in_new_space, void* data); |
+ void RegisterLiveArrayBuffer(bool from_scavenge, void* data); |
// Frees all backing store pointers that weren't discovered in the previous |
// marking or scavenge phase. |
- void FreeDeadArrayBuffers(bool in_new_space); |
+ void FreeDeadArrayBuffers(bool from_scavenge); |
// Prepare for a new scavenge phase. A new marking phase is implicitly |
// prepared by finishing the previous one. |
@@ -2372,10 +2372,24 @@ class Heap { |
bool concurrent_sweeping_enabled_; |
+ // |live_array_buffers_| maps externally allocated memory used as backing |
+ // store for ArrayBuffers to the length of the respective memory blocks. |
+ // |
+ // At the beginning of mark/compact, |not_yet_discovered_array_buffers_| is |
+ // a copy of |live_array_buffers_| and we remove pointers as we discover live |
+ // ArrayBuffer objects during marking. At the end of mark/compact, the |
+ // remaining memory blocks can be freed. |
std::map<void*, size_t> live_array_buffers_; |
- std::map<void*, size_t> live_new_array_buffers_; |
std::map<void*, size_t> not_yet_discovered_array_buffers_; |
- std::map<void*, size_t> not_yet_discovered_new_array_buffers_; |
+ |
+ // To be able to free memory held by ArrayBuffers during scavenge as well, we |
+ // have a separate list of allocated memory held by ArrayBuffers in new space. |
+ // |
+ // Since mark/compact also evacuates the new space, all pointers in the |
+ // |live_array_buffers_for_scavenge_| list are also in the |
+ // |live_array_buffers_| list. |
+ std::map<void*, size_t> live_array_buffers_for_scavenge_; |
+ std::map<void*, size_t> not_yet_discovered_array_buffers_for_scavenge_; |
struct StrongRootsList; |
StrongRootsList* strong_roots_list_; |