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

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

Issue 2011563003: Revert of "[heap] Fine-grained JSArrayBuffer tracking" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« 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
deleted file mode 100644
index 5a5be4938e8074126d3d6833392f910732428765..0000000000000000000000000000000000000000
--- a/src/heap/array-buffer-tracker-inl.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2016 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/heap/array-buffer-tracker.h"
-#include "src/heap/heap.h"
-#include "src/heap/mark-compact.h"
-#include "src/isolate.h"
-
-namespace v8 {
-namespace internal {
-
-template <typename Callback>
-void LocalArrayBufferTracker::Process(Callback callback) {
- JSArrayBuffer* new_buffer = nullptr;
- size_t freed_memory = 0;
- for (TrackingMap::iterator it = live_.begin(); it != live_.end();) {
- switch (callback(it->first, &new_buffer)) {
- case kKeepEntry:
- it++;
- break;
- case kKeepAndUpdateEntry:
- DCHECK_NOT_NULL(new_buffer);
- Page::FromAddress(new_buffer->address())
- ->local_tracker<Page::kCreateIfNotPresent>()
- ->AddLive(new_buffer, it->second);
- live_.erase(it++);
- break;
- case kRemoveEntry:
- heap_->isolate()->array_buffer_allocator()->Free(it->second.first,
- it->second.second);
- freed_memory += it->second.second;
- live_.erase(it++);
- break;
- default:
- UNREACHABLE();
- }
- }
- if (freed_memory > 0) {
- heap_->update_amount_of_external_allocated_freed_memory(
- static_cast<intptr_t>(freed_memory));
- }
- not_yet_discovered_.clear();
- started_ = false;
-}
-
-template <LocalArrayBufferTracker::LivenessIndicator liveness_indicator>
-void LocalArrayBufferTracker::ScanAndFreeDead() {
- switch (liveness_indicator) {
- case kForwardingPointer:
- Process([](JSArrayBuffer* old_buffer, JSArrayBuffer** new_buffer) {
- MapWord map_word = old_buffer->map_word();
- if (map_word.IsForwardingAddress()) {
- *new_buffer = JSArrayBuffer::cast(map_word.ToForwardingAddress());
- return LocalArrayBufferTracker::kKeepAndUpdateEntry;
- }
- return LocalArrayBufferTracker::kRemoveEntry;
- });
- break;
- case kMarkBit:
- Process([](JSArrayBuffer* old_buffer, JSArrayBuffer**) {
- if (Marking::IsBlackOrGrey(Marking::MarkBitFrom(old_buffer))) {
- return LocalArrayBufferTracker::kKeepEntry;
- }
- return LocalArrayBufferTracker::kRemoveEntry;
- });
- break;
- default:
- UNREACHABLE();
- }
-}
-
-} // namespace internal
-} // namespace v8
« 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