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

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

Issue 890663005: Introduce a flag for tracing retaining path in GC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 #ifdef TRACE_RETAINING_PATH
11 #include <map>
12 #include <string>
13 #endif
14
10 #include "src/allocation.h" 15 #include "src/allocation.h"
11 #include "src/assert-scope.h" 16 #include "src/assert-scope.h"
12 #include "src/counters.h" 17 #include "src/counters.h"
13 #include "src/globals.h" 18 #include "src/globals.h"
14 #include "src/heap/gc-idle-time-handler.h" 19 #include "src/heap/gc-idle-time-handler.h"
15 #include "src/heap/gc-tracer.h" 20 #include "src/heap/gc-tracer.h"
16 #include "src/heap/incremental-marking.h" 21 #include "src/heap/incremental-marking.h"
17 #include "src/heap/mark-compact.h" 22 #include "src/heap/mark-compact.h"
18 #include "src/heap/objects-visiting.h" 23 #include "src/heap/objects-visiting.h"
19 #include "src/heap/spaces.h" 24 #include "src/heap/spaces.h"
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 // trigger the event. In order to track ALL allocations one must turn off 1442 // trigger the event. In order to track ALL allocations one must turn off
1438 // FLAG_inline_new and FLAG_use_allocation_folding. 1443 // FLAG_inline_new and FLAG_use_allocation_folding.
1439 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); 1444 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes);
1440 1445
1441 // This event is triggered after object is moved to a new place. 1446 // This event is triggered after object is moved to a new place.
1442 inline void OnMoveEvent(HeapObject* target, HeapObject* source, 1447 inline void OnMoveEvent(HeapObject* target, HeapObject* source,
1443 int size_in_bytes); 1448 int size_in_bytes);
1444 1449
1445 bool deserialization_complete() const { return deserialization_complete_; } 1450 bool deserialization_complete() const { return deserialization_complete_; }
1446 1451
1452 #ifdef TRACE_RETAINING_PATH
1453 void SetCurrentRetainer(HeapObject* obj);
1454 void SetCurrentRootRetainer(std::string root);
1455 void AddRetainedObject(HeapObject* obj);
1456 #endif
1457
1447 protected: 1458 protected:
1448 // Methods made available to tests. 1459 // Methods made available to tests.
1449 1460
1450 // Allocates a JS Map in the heap. 1461 // Allocates a JS Map in the heap.
1451 MUST_USE_RESULT AllocationResult 1462 MUST_USE_RESULT AllocationResult
1452 AllocateMap(InstanceType instance_type, int instance_size, 1463 AllocateMap(InstanceType instance_type, int instance_size,
1453 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 1464 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
1454 1465
1455 // Allocates and initializes a new JavaScript object based on a 1466 // Allocates and initializes a new JavaScript object based on a
1456 // constructor. 1467 // constructor.
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; 2128 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_;
2118 2129
2119 MemoryChunk* chunks_queued_for_free_; 2130 MemoryChunk* chunks_queued_for_free_;
2120 2131
2121 base::Mutex relocation_mutex_; 2132 base::Mutex relocation_mutex_;
2122 2133
2123 int gc_callbacks_depth_; 2134 int gc_callbacks_depth_;
2124 2135
2125 bool deserialization_complete_; 2136 bool deserialization_complete_;
2126 2137
2138 #ifdef TRACE_RETAINING_PATH
2139 void ClearRetainingInfo();
2140 void PrintRetainingPath(HeapObject* obj, const char* comment);
2141 std::map<HeapObject*, HeapObject*> retainer_;
2142 std::map<HeapObject*, std::string> root_retainer_;
2143 HeapObject* current_retainer_;
2144 std::string current_root_retainer_;
2145 #endif
2146
2127 friend class AlwaysAllocateScope; 2147 friend class AlwaysAllocateScope;
2128 friend class Deserializer; 2148 friend class Deserializer;
2129 friend class Factory; 2149 friend class Factory;
2130 friend class GCCallbacksScope; 2150 friend class GCCallbacksScope;
2131 friend class GCTracer; 2151 friend class GCTracer;
2132 friend class HeapIterator; 2152 friend class HeapIterator;
2133 friend class Isolate; 2153 friend class Isolate;
2134 friend class MarkCompactCollector; 2154 friend class MarkCompactCollector;
2135 friend class MarkCompactMarkingVisitor; 2155 friend class MarkCompactMarkingVisitor;
2136 friend class MapCompact; 2156 friend class MapCompact;
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2605 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2586 2606
2587 private: 2607 private:
2588 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2608 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2589 }; 2609 };
2590 #endif // DEBUG 2610 #endif // DEBUG
2591 } 2611 }
2592 } // namespace v8::internal 2612 } // namespace v8::internal
2593 2613
2594 #endif // V8_HEAP_HEAP_H_ 2614 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap/heap.cc » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698