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

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

Issue 2107443002: [heap] Optimize ArrayBuffer tracking (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove rehashing logic Created 4 years, 6 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 | « no previous file | src/heap/array-buffer-tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/array-buffer-tracker.h
diff --git a/src/heap/array-buffer-tracker.h b/src/heap/array-buffer-tracker.h
index b015aa0d4bcf4f2d1715523e1381bbee5a82c69e..898024a708b954149f9fd66d238ca162c99edeee 100644
--- a/src/heap/array-buffer-tracker.h
+++ b/src/heap/array-buffer-tracker.h
@@ -5,7 +5,7 @@
#ifndef V8_HEAP_ARRAY_BUFFER_TRACKER_H_
#define V8_HEAP_ARRAY_BUFFER_TRACKER_H_
-#include <unordered_map>
+#include <unordered_set>
#include "src/allocation.h"
#include "src/base/platform/mutex.h"
@@ -59,7 +59,6 @@ class ArrayBufferTracker : public AllStatic {
// Never use directly but instead always call through |ArrayBufferTracker|.
class LocalArrayBufferTracker {
public:
- typedef std::pair<void*, size_t> Value;
typedef JSArrayBuffer* Key;
enum CallbackResult { kKeepEntry, kUpdateEntry, kRemoveEntry };
@@ -68,8 +67,8 @@ class LocalArrayBufferTracker {
explicit LocalArrayBufferTracker(Heap* heap) : heap_(heap) {}
~LocalArrayBufferTracker();
- inline void Add(Key key, const Value& value);
- inline Value Remove(Key key);
+ inline void Add(Key key);
+ inline void Remove(Key key);
// Frees up array buffers determined by |free_mode|.
template <FreeMode free_mode>
@@ -81,7 +80,7 @@ class LocalArrayBufferTracker {
// Callback should be of type:
// CallbackResult fn(JSArrayBuffer* buffer, JSArrayBuffer** new_buffer);
template <typename Callback>
- inline void Process(Callback callback);
+ void Process(Callback callback);
bool IsEmpty() { return array_buffers_.empty(); }
@@ -90,10 +89,10 @@ class LocalArrayBufferTracker {
}
private:
- typedef std::unordered_map<Key, Value> TrackingMap;
+ typedef std::unordered_set<Key> TrackingData;
Heap* heap_;
- TrackingMap array_buffers_;
+ TrackingData array_buffers_;
};
} // namespace internal
« no previous file with comments | « no previous file | src/heap/array-buffer-tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698