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

Unified Diff: src/heap/spaces.h

Issue 1964023002: [heap] Fine-grained JSArrayBuffer tracking (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tests once more Created 4 years, 7 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
Index: src/heap/spaces.h
diff --git a/src/heap/spaces.h b/src/heap/spaces.h
index c8c4d3f5bbd6dd7d97a1d471377e94bf4f416ef4..ae2ff5af9e04f4bf5f7f5f4a6f0f30df72a9c360 100644
--- a/src/heap/spaces.h
+++ b/src/heap/spaces.h
@@ -14,6 +14,7 @@
#include "src/base/platform/mutex.h"
#include "src/flags.h"
#include "src/hashmap.h"
+#include "src/heap/array-buffer-tracker.h"
#include "src/list.h"
#include "src/objects.h"
#include "src/utils.h"
@@ -522,7 +523,8 @@ class MemoryChunk {
+ kPointerSize // AtomicValue next_chunk_
+ kPointerSize // AtomicValue prev_chunk_
// FreeListCategory categories_[kNumberOfCategories]
- + FreeListCategory::kSize * kNumberOfCategories;
+ + FreeListCategory::kSize * kNumberOfCategories +
+ kPointerSize; // LocalArrayBufferTracker tracker_
// We add some more space to the computed header size to amount for missing
// alignment requirements in our computation.
@@ -817,6 +819,8 @@ class MemoryChunk {
FreeListCategory categories_[kNumberOfCategories];
+ LocalArrayBufferTracker* local_tracker_;
+
private:
void InitializeReservedMemory() { reservation_.Reset(); }
@@ -947,6 +951,23 @@ class Page : public MemoryChunk {
available_in_free_list_.Increment(available);
}
+ LocalArrayBufferTracker* local_tracker() {
+ if (local_tracker_ == nullptr) {
+ local_tracker_ = new LocalArrayBufferTracker(heap_);
+ }
+ return local_tracker_;
+ }
+
+ void FreeDeadArraybuffersAndResetTracker() {
+ if (local_tracker_ != nullptr) {
+ local_tracker_->FreeDeadAndReset();
+ if (local_tracker_->IsEmpty()) {
+ delete local_tracker_;
+ local_tracker_ = nullptr;
+ }
+ }
+ }
+
#ifdef DEBUG
void Print();
#endif // DEBUG
@@ -2859,6 +2880,9 @@ class NewSpace : public Space {
void PauseAllocationObservers() override;
void ResumeAllocationObservers() override;
+ SemiSpace* from_space() { return &from_space_; }
+ SemiSpace* to_space() { return &to_space_; }
+
private:
// Update allocation info to match the current to-space page.
void UpdateAllocationInfo();

Powered by Google App Engine
This is Rietveld 408576698