5 #ifndef V8_HEAP_ARRAY_BUFFER_TRACKER_H_ 6 #define V8_HEAP_ARRAY_BUFFER_TRACKER_H_ 8 #include <unordered_map> 10 #include "src/allocation.h" 11 #include "src/base/platform/mutex.h" 12 #include "src/globals.h" 13 #include "src/objects/js-array-buffer.h" 25 kUpdateForwardedRemoveOthers,
26 kUpdateForwardedKeepOthers,
39 static void PrepareToFreeDeadInNewSpace(
Heap* heap);
44 template <
typename MarkingState>
45 static void FreeDead(
Page* page, MarkingState* marking_state);
49 static void FreeAll(
Page* page);
53 static bool ProcessBuffers(
Page* page, ProcessingMode mode);
59 static void TearDown(
Heap* heap);
67 enum CallbackResult { kKeepEntry, kUpdateEntry, kRemoveEntry };
68 enum FreeMode { kFreeDead, kFreeAll };
83 template <
typename Callback>
84 void Free(Callback should_free);
91 template <
typename Callback>
92 void Process(Callback callback);
94 bool IsEmpty()
const {
return array_buffers_.empty(); }
97 return array_buffers_.find(buffer) != array_buffers_.end();
104 return reinterpret_cast<size_t>(buffer) >> 3;
113 typedef std::unordered_map<JSArrayBuffer*, JSArrayBuffer::Allocation, Hasher>
118 inline void AddInternal(
JSArrayBuffer* buffer,
size_t length);
120 inline Space* space();
125 TrackingData array_buffers_;
130 #endif // V8_HEAP_ARRAY_BUFFER_TRACKER_H_