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

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: WIP: Allocation sampling for paged/lo spaces Created 4 years, 11 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') | src/heap/heap.cc » ('J')
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 V(UninitializedMap) \ 463 V(UninitializedMap) \
464 V(ArgumentsMarkerMap) \ 464 V(ArgumentsMarkerMap) \
465 V(JSMessageObjectMap) \ 465 V(JSMessageObjectMap) \
466 V(ForeignMap) \ 466 V(ForeignMap) \
467 V(NeanderMap) \ 467 V(NeanderMap) \
468 V(EmptyWeakCell) \ 468 V(EmptyWeakCell) \
469 V(empty_string) \ 469 V(empty_string) \
470 PRIVATE_SYMBOL_LIST(V) 470 PRIVATE_SYMBOL_LIST(V)
471 471
472 // Forward declarations. 472 // Forward declarations.
473 class AllocationObserver;
473 class ArrayBufferTracker; 474 class ArrayBufferTracker;
474 class GCIdleTimeAction; 475 class GCIdleTimeAction;
475 class GCIdleTimeHandler; 476 class GCIdleTimeHandler;
476 class GCIdleTimeHeapState; 477 class GCIdleTimeHeapState;
477 class GCTracer; 478 class GCTracer;
478 class HeapObjectsFilter; 479 class HeapObjectsFilter;
479 class HeapStats; 480 class HeapStats;
480 class HistogramTimer; 481 class HistogramTimer;
481 class InlineAllocationObserver;
482 class Isolate; 482 class Isolate;
483 class MemoryReducer; 483 class MemoryReducer;
484 class ObjectStats; 484 class ObjectStats;
485 class Scavenger; 485 class Scavenger;
486 class ScavengeJob; 486 class ScavengeJob;
487 class WeakObjectRetainer; 487 class WeakObjectRetainer;
488 488
489 489
490 // A queue of objects promoted during scavenge. Each object is accompanied 490 // A queue of objects promoted during scavenge. Each object is accompanied
491 // by it's size to avoid dereferencing a map pointer for scanning. 491 // by it's size to avoid dereferencing a map pointer for scanning.
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after
2335 IncrementalMarking* incremental_marking_; 2335 IncrementalMarking* incremental_marking_;
2336 2336
2337 GCIdleTimeHandler* gc_idle_time_handler_; 2337 GCIdleTimeHandler* gc_idle_time_handler_;
2338 2338
2339 MemoryReducer* memory_reducer_; 2339 MemoryReducer* memory_reducer_;
2340 2340
2341 ObjectStats* object_stats_; 2341 ObjectStats* object_stats_;
2342 2342
2343 ScavengeJob* scavenge_job_; 2343 ScavengeJob* scavenge_job_;
2344 2344
2345 InlineAllocationObserver* idle_scavenge_observer_; 2345 AllocationObserver* idle_scavenge_observer_;
2346 2346
2347 // These two counters are monotomically increasing and never reset. 2347 // These two counters are monotomically increasing and never reset.
2348 size_t full_codegen_bytes_generated_; 2348 size_t full_codegen_bytes_generated_;
2349 size_t crankshaft_codegen_bytes_generated_; 2349 size_t crankshaft_codegen_bytes_generated_;
2350 2350
2351 // This counter is increased before each GC and never reset. 2351 // This counter is increased before each GC and never reset.
2352 // To account for the bytes allocated since the last GC, use the 2352 // To account for the bytes allocated since the last GC, use the
2353 // NewSpaceAllocationCounter() function. 2353 // NewSpaceAllocationCounter() function.
2354 size_t new_space_allocation_counter_; 2354 size_t new_space_allocation_counter_;
2355 2355
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 List<Object*> object_stack_; 2788 List<Object*> object_stack_;
2789 2789
2790 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2790 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2791 2791
2792 private: 2792 private:
2793 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2793 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2794 }; 2794 };
2795 #endif // DEBUG 2795 #endif // DEBUG
2796 2796
2797 // ----------------------------------------------------------------------------- 2797 // -----------------------------------------------------------------------------
2798 // Allows observation of inline allocation in the new space. 2798 // Allows observation of allocations.
2799 class InlineAllocationObserver { 2799 class AllocationObserver {
2800 public: 2800 public:
2801 explicit InlineAllocationObserver(intptr_t step_size) 2801 explicit AllocationObserver(intptr_t step_size)
2802 : step_size_(step_size), bytes_to_next_step_(step_size) { 2802 : step_size_(step_size), bytes_to_next_step_(step_size) {
2803 DCHECK(step_size >= kPointerSize); 2803 DCHECK(step_size >= kPointerSize);
2804 } 2804 }
2805 virtual ~InlineAllocationObserver() {} 2805 virtual ~AllocationObserver() {}
2806 2806
2807 // Called each time the new space does an inline allocation step. This may be 2807 // Called each time the observed space does an allocation step. This may be
2808 // more frequently than the step_size we are monitoring (e.g. when there are 2808 // more frequently than the step_size we are monitoring (e.g. when there are
2809 // multiple observers, or when page or space boundary is encountered.) 2809 // multiple observers, or when page or space boundary is encountered.)
2810 void InlineAllocationStep(int bytes_allocated, Address soon_object, 2810 void AllocationStep(int bytes_allocated, Address soon_object, size_t size) {
2811 size_t size) {
2812 bytes_to_next_step_ -= bytes_allocated; 2811 bytes_to_next_step_ -= bytes_allocated;
2813 if (bytes_to_next_step_ <= 0) { 2812 if (bytes_to_next_step_ <= 0) {
2814 Step(static_cast<int>(step_size_ - bytes_to_next_step_), soon_object, 2813 Step(static_cast<int>(step_size_ - bytes_to_next_step_), soon_object,
2815 size); 2814 size);
2816 step_size_ = GetNextStepSize(); 2815 step_size_ = GetNextStepSize();
2817 bytes_to_next_step_ = step_size_; 2816 bytes_to_next_step_ = step_size_;
2818 } 2817 }
2819 } 2818 }
2820 2819
2821 protected: 2820 protected:
(...skipping 14 matching lines...) Expand all
2836 // first object. 2835 // first object.
2837 virtual void Step(int bytes_allocated, Address soon_object, size_t size) = 0; 2836 virtual void Step(int bytes_allocated, Address soon_object, size_t size) = 0;
2838 2837
2839 // Subclasses can override this method to make step size dynamic. 2838 // Subclasses can override this method to make step size dynamic.
2840 virtual intptr_t GetNextStepSize() { return step_size_; } 2839 virtual intptr_t GetNextStepSize() { return step_size_; }
2841 2840
2842 intptr_t step_size_; 2841 intptr_t step_size_;
2843 intptr_t bytes_to_next_step_; 2842 intptr_t bytes_to_next_step_;
2844 2843
2845 private: 2844 private:
2845 friend class LargeObjectSpace;
2846 friend class NewSpace; 2846 friend class NewSpace;
2847 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); 2847 friend class PagedSpace;
2848 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2848 }; 2849 };
2849 2850
2850 } // namespace internal 2851 } // namespace internal
2851 } // namespace v8 2852 } // namespace v8
2852 2853
2853 #endif // V8_HEAP_HEAP_H_ 2854 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698