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

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

Issue 1618693004: Revert "Revert of [profiler] Implement POC Sampling Heap Profiler (patchset #12 id:220001 of https:… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add flag to suppress randomness from sampling heap profiler tests 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 | « src/flag-definitions.h ('k') | src/heap/incremental-marking.h » ('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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 471
472 // Forward declarations. 472 // Forward declarations.
473 class ArrayBufferTracker; 473 class ArrayBufferTracker;
474 class GCIdleTimeAction; 474 class GCIdleTimeAction;
475 class GCIdleTimeHandler; 475 class GCIdleTimeHandler;
476 class GCIdleTimeHeapState; 476 class GCIdleTimeHeapState;
477 class GCTracer; 477 class GCTracer;
478 class HeapObjectsFilter; 478 class HeapObjectsFilter;
479 class HeapStats; 479 class HeapStats;
480 class HistogramTimer; 480 class HistogramTimer;
481 class InlineAllocationObserver;
481 class Isolate; 482 class Isolate;
482 class MemoryReducer; 483 class MemoryReducer;
483 class ObjectStats; 484 class ObjectStats;
484 class Scavenger; 485 class Scavenger;
485 class ScavengeJob; 486 class ScavengeJob;
486 class WeakObjectRetainer; 487 class WeakObjectRetainer;
487 488
488 489
489 // A queue of objects promoted during scavenge. Each object is accompanied 490 // A queue of objects promoted during scavenge. Each object is accompanied
490 // 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 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 WhatToFind what_to_find_; 2786 WhatToFind what_to_find_;
2786 VisitMode visit_mode_; 2787 VisitMode visit_mode_;
2787 List<Object*> object_stack_; 2788 List<Object*> object_stack_;
2788 2789
2789 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2790 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2790 2791
2791 private: 2792 private:
2792 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2793 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2793 }; 2794 };
2794 #endif // DEBUG 2795 #endif // DEBUG
2796
2797 // -----------------------------------------------------------------------------
2798 // Allows observation of inline allocation in the new space.
2799 class InlineAllocationObserver {
2800 public:
2801 explicit InlineAllocationObserver(intptr_t step_size)
2802 : step_size_(step_size), bytes_to_next_step_(step_size) {
2803 DCHECK(step_size >= kPointerSize);
2804 }
2805 virtual ~InlineAllocationObserver() {}
2806
2807 // Called each time the new space does an inline allocation step. This may be
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.)
2810 void InlineAllocationStep(int bytes_allocated, Address soon_object,
2811 size_t size) {
2812 bytes_to_next_step_ -= bytes_allocated;
2813 if (bytes_to_next_step_ <= 0) {
2814 Step(static_cast<int>(step_size_ - bytes_to_next_step_), soon_object,
2815 size);
2816 step_size_ = GetNextStepSize();
2817 bytes_to_next_step_ = step_size_;
2818 }
2819 }
2820
2821 protected:
2822 intptr_t step_size() const { return step_size_; }
2823 intptr_t bytes_to_next_step() const { return bytes_to_next_step_; }
2824
2825 // Pure virtual method provided by the subclasses that gets called when at
2826 // least step_size bytes have been allocated. soon_object is the address just
2827 // allocated (but not yet initialized.) size is the size of the object as
2828 // requested (i.e. w/o the alignment fillers). Some complexities to be aware
2829 // of:
2830 // 1) soon_object will be nullptr in cases where we end up observing an
2831 // allocation that happens to be a filler space (e.g. page boundaries.)
2832 // 2) size is the requested size at the time of allocation. Right-trimming
2833 // may change the object size dynamically.
2834 // 3) soon_object may actually be the first object in an allocation-folding
2835 // group. In such a case size is the size of the group rather than the
2836 // first object.
2837 virtual void Step(int bytes_allocated, Address soon_object, size_t size) = 0;
2838
2839 // Subclasses can override this method to make step size dynamic.
2840 virtual intptr_t GetNextStepSize() { return step_size_; }
2841
2842 intptr_t step_size_;
2843 intptr_t bytes_to_next_step_;
2844
2845 private:
2846 friend class NewSpace;
2847 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver);
2848 };
2849
2795 } // namespace internal 2850 } // namespace internal
2796 } // namespace v8 2851 } // namespace v8
2797 2852
2798 #endif // V8_HEAP_HEAP_H_ 2853 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698