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

Side by Side Diff: src/heap/heap.h

Issue 1105693002: Implement IdentityMap<V>, a robust, GC-safe object-identity HashMap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_HEAP_H_ 5 #ifndef V8_HEAP_HEAP_H_
6 #define V8_HEAP_HEAP_H_ 6 #define V8_HEAP_HEAP_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 void RecordFixedArraySubTypeStats(int array_sub_type, size_t size) { 1444 void RecordFixedArraySubTypeStats(int array_sub_type, size_t size) {
1445 DCHECK(array_sub_type <= LAST_FIXED_ARRAY_SUB_TYPE); 1445 DCHECK(array_sub_type <= LAST_FIXED_ARRAY_SUB_TYPE);
1446 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type]++; 1446 object_counts_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type]++;
1447 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type] += size; 1447 object_sizes_[FIRST_FIXED_ARRAY_SUB_TYPE + array_sub_type] += size;
1448 } 1448 }
1449 1449
1450 void TraceObjectStats(); 1450 void TraceObjectStats();
1451 void TraceObjectStat(const char* name, int count, int size, double time); 1451 void TraceObjectStat(const char* name, int count, int size, double time);
1452 void CheckpointObjectStats(); 1452 void CheckpointObjectStats();
1453 1453
1454 struct StrongRootsList {
1455 Object** start_;
1456 Object** end_;
1457 StrongRootsList* next_;
1458 };
1459
1460 void RegisterStrongRoots(Object** start, Object** end) {
1461 StrongRootsList* list = new StrongRootsList();
1462 list->next_ = strong_roots_list_;
1463 list->start_ = start;
1464 list->end_ = end;
1465 strong_roots_list_ = list;
1466 }
1467
1468 void UnregisterStrongRoots(Object** start) {
1469 StrongRootsList* prev = NULL;
1470 for (StrongRootsList* list = strong_roots_list_; list; list = list->next_) {
1471 if (list->start_ == start) {
1472 if (prev) {
1473 prev->next_ = list->next_;
1474 } else {
1475 strong_roots_list_ = list->next_;
1476 }
1477 delete list;
1478 }
1479 prev = list;
1480 }
1481 }
1482
1483 base::Mutex* relocation_mutex() { return &relocation_mutex_; }
1484
1454 // We don't use a LockGuard here since we want to lock the heap 1485 // We don't use a LockGuard here since we want to lock the heap
1455 // only when FLAG_concurrent_recompilation is true. 1486 // only when FLAG_concurrent_recompilation is true.
1456 class RelocationLock { 1487 class RelocationLock {
1457 public: 1488 public:
1458 explicit RelocationLock(Heap* heap) : heap_(heap) { 1489 explicit RelocationLock(Heap* heap) : heap_(heap) {
1459 heap_->relocation_mutex_.Lock(); 1490 heap_->relocation_mutex_.Lock();
1460 } 1491 }
1461 1492
1462 1493
1463 ~RelocationLock() { heap_->relocation_mutex_.Unlock(); } 1494 ~RelocationLock() { heap_->relocation_mutex_.Unlock(); }
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 MemoryChunk* chunks_queued_for_free_; 2175 MemoryChunk* chunks_queued_for_free_;
2145 2176
2146 base::Mutex relocation_mutex_; 2177 base::Mutex relocation_mutex_;
2147 2178
2148 int gc_callbacks_depth_; 2179 int gc_callbacks_depth_;
2149 2180
2150 bool deserialization_complete_; 2181 bool deserialization_complete_;
2151 2182
2152 bool concurrent_sweeping_enabled_; 2183 bool concurrent_sweeping_enabled_;
2153 2184
2185 StrongRootsList* strong_roots_list_;
2186
2154 friend class AlwaysAllocateScope; 2187 friend class AlwaysAllocateScope;
2155 friend class Deserializer; 2188 friend class Deserializer;
2156 friend class Factory; 2189 friend class Factory;
2157 friend class GCCallbacksScope; 2190 friend class GCCallbacksScope;
2158 friend class GCTracer; 2191 friend class GCTracer;
2159 friend class HeapIterator; 2192 friend class HeapIterator;
2160 friend class Isolate; 2193 friend class Isolate;
2161 friend class MarkCompactCollector; 2194 friend class MarkCompactCollector;
2162 friend class MarkCompactMarkingVisitor; 2195 friend class MarkCompactMarkingVisitor;
2163 friend class MapCompact; 2196 friend class MapCompact;
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2605 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2638 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2606 2639
2607 private: 2640 private:
2608 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2641 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2609 }; 2642 };
2610 #endif // DEBUG 2643 #endif // DEBUG
2611 } 2644 }
2612 } // namespace v8::internal 2645 } // namespace v8::internal
2613 2646
2614 #endif // V8_HEAP_HEAP_H_ 2647 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/heap/heap.cc » ('j') | src/heap/identity-map.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698