Index: src/heap/array-buffer-tracker-inl.h |
diff --git a/src/heap/array-buffer-tracker-inl.h b/src/heap/array-buffer-tracker-inl.h |
index f5bdead89a5d74f7b791d6ba170ab2bbb5474ac0..6582c2cdab52be09ff5318c629112d40c47238f9 100644 |
--- a/src/heap/array-buffer-tracker-inl.h |
+++ b/src/heap/array-buffer-tracker-inl.h |
@@ -10,7 +10,7 @@ |
namespace v8 { |
namespace internal { |
-void ArrayBufferTracker::RegisterNew(Heap* heap, JSArrayBuffer* buffer) { |
+void ArrayBufferTracker::RegisterNew(JSArrayBuffer* buffer) { |
void* data = buffer->backing_store(); |
if (!data) return; |
@@ -26,13 +26,18 @@ void ArrayBufferTracker::RegisterNew(Heap* heap, JSArrayBuffer* buffer) { |
DCHECK_NOT_NULL(tracker); |
tracker->Add(buffer, length); |
} |
+ if (page->InNewSpace()) { |
+ retained_from_new_space_.Increment(length); |
+ } else { |
+ retained_from_old_space_.Increment(length); |
+ } |
// We may go over the limit of externally allocated memory here. We call the |
// api function to trigger a GC in this case. |
- reinterpret_cast<v8::Isolate*>(heap->isolate()) |
+ reinterpret_cast<v8::Isolate*>(heap_->isolate()) |
->AdjustAmountOfExternalAllocatedMemory(length); |
} |
-void ArrayBufferTracker::Unregister(Heap* heap, JSArrayBuffer* buffer) { |
+void ArrayBufferTracker::Unregister(JSArrayBuffer* buffer) { |
void* data = buffer->backing_store(); |
if (!data) return; |
@@ -44,7 +49,12 @@ void ArrayBufferTracker::Unregister(Heap* heap, JSArrayBuffer* buffer) { |
DCHECK_NOT_NULL(tracker); |
length = tracker->Remove(buffer); |
} |
- heap->update_external_memory(-static_cast<intptr_t>(length)); |
+ if (page->InNewSpace()) { |
+ retained_from_new_space_.Decrement(length); |
+ } else { |
+ retained_from_old_space_.Decrement(length); |
+ } |
+ heap_->update_external_memory(-static_cast<int64_t>(length)); |
} |
void LocalArrayBufferTracker::Add(Key key, const Value& value) { |