Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Unified Diff: src/heap/array-buffer-tracker-inl.h

Issue 2210263002: [heap] Improve size profiling for ArrayBuffer tracking (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/array-buffer-tracker.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/heap/array-buffer-tracker.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698