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

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

Issue 1625753002: Allocation sampling for paged/lo spaces (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: USE for DCHECK only variable Created 4 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
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <map> 9 #include <map>
10 10
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 V(UninitializedMap) \ 268 V(UninitializedMap) \
269 V(ArgumentsMarkerMap) \ 269 V(ArgumentsMarkerMap) \
270 V(JSMessageObjectMap) \ 270 V(JSMessageObjectMap) \
271 V(ForeignMap) \ 271 V(ForeignMap) \
272 V(NeanderMap) \ 272 V(NeanderMap) \
273 V(EmptyWeakCell) \ 273 V(EmptyWeakCell) \
274 V(empty_string) \ 274 V(empty_string) \
275 PRIVATE_SYMBOL_LIST(V) 275 PRIVATE_SYMBOL_LIST(V)
276 276
277 // Forward declarations. 277 // Forward declarations.
278 class AllocationObserver;
278 class ArrayBufferTracker; 279 class ArrayBufferTracker;
279 class GCIdleTimeAction; 280 class GCIdleTimeAction;
280 class GCIdleTimeHandler; 281 class GCIdleTimeHandler;
281 class GCIdleTimeHeapState; 282 class GCIdleTimeHeapState;
282 class GCTracer; 283 class GCTracer;
283 class HeapObjectsFilter; 284 class HeapObjectsFilter;
284 class HeapStats; 285 class HeapStats;
285 class HistogramTimer; 286 class HistogramTimer;
286 class InlineAllocationObserver;
287 class Isolate; 287 class Isolate;
288 class MemoryReducer; 288 class MemoryReducer;
289 class ObjectStats; 289 class ObjectStats;
290 class Scavenger; 290 class Scavenger;
291 class ScavengeJob; 291 class ScavengeJob;
292 class WeakObjectRetainer; 292 class WeakObjectRetainer;
293 293
294 294
295 // A queue of objects promoted during scavenge. Each object is accompanied 295 // A queue of objects promoted during scavenge. Each object is accompanied
296 // by it's size to avoid dereferencing a map pointer for scanning. 296 // by it's size to avoid dereferencing a map pointer for scanning.
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after
2121 IncrementalMarking* incremental_marking_; 2121 IncrementalMarking* incremental_marking_;
2122 2122
2123 GCIdleTimeHandler* gc_idle_time_handler_; 2123 GCIdleTimeHandler* gc_idle_time_handler_;
2124 2124
2125 MemoryReducer* memory_reducer_; 2125 MemoryReducer* memory_reducer_;
2126 2126
2127 ObjectStats* object_stats_; 2127 ObjectStats* object_stats_;
2128 2128
2129 ScavengeJob* scavenge_job_; 2129 ScavengeJob* scavenge_job_;
2130 2130
2131 InlineAllocationObserver* idle_scavenge_observer_; 2131 AllocationObserver* idle_scavenge_observer_;
2132 2132
2133 // These two counters are monotomically increasing and never reset. 2133 // These two counters are monotomically increasing and never reset.
2134 size_t full_codegen_bytes_generated_; 2134 size_t full_codegen_bytes_generated_;
2135 size_t crankshaft_codegen_bytes_generated_; 2135 size_t crankshaft_codegen_bytes_generated_;
2136 2136
2137 // This counter is increased before each GC and never reset. 2137 // This counter is increased before each GC and never reset.
2138 // To account for the bytes allocated since the last GC, use the 2138 // To account for the bytes allocated since the last GC, use the
2139 // NewSpaceAllocationCounter() function. 2139 // NewSpaceAllocationCounter() function.
2140 size_t new_space_allocation_counter_; 2140 size_t new_space_allocation_counter_;
2141 2141
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 List<Object*> object_stack_; 2574 List<Object*> object_stack_;
2575 2575
2576 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2576 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2577 2577
2578 private: 2578 private:
2579 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2579 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2580 }; 2580 };
2581 #endif // DEBUG 2581 #endif // DEBUG
2582 2582
2583 // ----------------------------------------------------------------------------- 2583 // -----------------------------------------------------------------------------
2584 // Allows observation of inline allocation in the new space. 2584 // Allows observation of allocations.
2585 class InlineAllocationObserver { 2585 class AllocationObserver {
2586 public: 2586 public:
2587 explicit InlineAllocationObserver(intptr_t step_size) 2587 explicit AllocationObserver(intptr_t step_size)
2588 : step_size_(step_size), bytes_to_next_step_(step_size) { 2588 : step_size_(step_size), bytes_to_next_step_(step_size) {
2589 DCHECK(step_size >= kPointerSize); 2589 DCHECK(step_size >= kPointerSize);
2590 } 2590 }
2591 virtual ~InlineAllocationObserver() {} 2591 virtual ~AllocationObserver() {}
2592 2592
2593 // Called each time the new space does an inline allocation step. This may be 2593 // Called each time the observed space does an allocation step. This may be
2594 // more frequently than the step_size we are monitoring (e.g. when there are 2594 // more frequently than the step_size we are monitoring (e.g. when there are
2595 // multiple observers, or when page or space boundary is encountered.) 2595 // multiple observers, or when page or space boundary is encountered.)
2596 void InlineAllocationStep(int bytes_allocated, Address soon_object, 2596 void AllocationStep(int bytes_allocated, Address soon_object, size_t size) {
2597 size_t size) {
2598 bytes_to_next_step_ -= bytes_allocated; 2597 bytes_to_next_step_ -= bytes_allocated;
2599 if (bytes_to_next_step_ <= 0) { 2598 if (bytes_to_next_step_ <= 0) {
2600 Step(static_cast<int>(step_size_ - bytes_to_next_step_), soon_object, 2599 Step(static_cast<int>(step_size_ - bytes_to_next_step_), soon_object,
2601 size); 2600 size);
2602 step_size_ = GetNextStepSize(); 2601 step_size_ = GetNextStepSize();
2603 bytes_to_next_step_ = step_size_; 2602 bytes_to_next_step_ = step_size_;
2604 } 2603 }
2605 } 2604 }
2606 2605
2607 protected: 2606 protected:
(...skipping 14 matching lines...) Expand all
2622 // first object. 2621 // first object.
2623 virtual void Step(int bytes_allocated, Address soon_object, size_t size) = 0; 2622 virtual void Step(int bytes_allocated, Address soon_object, size_t size) = 0;
2624 2623
2625 // Subclasses can override this method to make step size dynamic. 2624 // Subclasses can override this method to make step size dynamic.
2626 virtual intptr_t GetNextStepSize() { return step_size_; } 2625 virtual intptr_t GetNextStepSize() { return step_size_; }
2627 2626
2628 intptr_t step_size_; 2627 intptr_t step_size_;
2629 intptr_t bytes_to_next_step_; 2628 intptr_t bytes_to_next_step_;
2630 2629
2631 private: 2630 private:
2631 friend class LargeObjectSpace;
2632 friend class NewSpace; 2632 friend class NewSpace;
2633 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); 2633 friend class PagedSpace;
2634 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2634 }; 2635 };
2635 2636
2636 } // namespace internal 2637 } // namespace internal
2637 } // namespace v8 2638 } // namespace v8
2638 2639
2639 #endif // V8_HEAP_HEAP_H_ 2640 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698