| OLD | NEW |
| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 V(UninitializedMap) \ | 272 V(UninitializedMap) \ |
| 273 V(ArgumentsMarkerMap) \ | 273 V(ArgumentsMarkerMap) \ |
| 274 V(JSMessageObjectMap) \ | 274 V(JSMessageObjectMap) \ |
| 275 V(ForeignMap) \ | 275 V(ForeignMap) \ |
| 276 V(NeanderMap) \ | 276 V(NeanderMap) \ |
| 277 V(EmptyWeakCell) \ | 277 V(EmptyWeakCell) \ |
| 278 V(empty_string) \ | 278 V(empty_string) \ |
| 279 PRIVATE_SYMBOL_LIST(V) | 279 PRIVATE_SYMBOL_LIST(V) |
| 280 | 280 |
| 281 // Forward declarations. | 281 // Forward declarations. |
| 282 class AllocationObserver; |
| 282 class ArrayBufferTracker; | 283 class ArrayBufferTracker; |
| 283 class GCIdleTimeAction; | 284 class GCIdleTimeAction; |
| 284 class GCIdleTimeHandler; | 285 class GCIdleTimeHandler; |
| 285 class GCIdleTimeHeapState; | 286 class GCIdleTimeHeapState; |
| 286 class GCTracer; | 287 class GCTracer; |
| 287 class HeapObjectsFilter; | 288 class HeapObjectsFilter; |
| 288 class HeapStats; | 289 class HeapStats; |
| 289 class HistogramTimer; | 290 class HistogramTimer; |
| 290 class InlineAllocationObserver; | |
| 291 class Isolate; | 291 class Isolate; |
| 292 class MemoryReducer; | 292 class MemoryReducer; |
| 293 class ObjectStats; | 293 class ObjectStats; |
| 294 class Scavenger; | 294 class Scavenger; |
| 295 class ScavengeJob; | 295 class ScavengeJob; |
| 296 class WeakObjectRetainer; | 296 class WeakObjectRetainer; |
| 297 | 297 |
| 298 | 298 |
| 299 // A queue of objects promoted during scavenge. Each object is accompanied | 299 // A queue of objects promoted during scavenge. Each object is accompanied |
| 300 // by it's size to avoid dereferencing a map pointer for scanning. | 300 // by it's size to avoid dereferencing a map pointer for scanning. |
| (...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2146 IncrementalMarking* incremental_marking_; | 2146 IncrementalMarking* incremental_marking_; |
| 2147 | 2147 |
| 2148 GCIdleTimeHandler* gc_idle_time_handler_; | 2148 GCIdleTimeHandler* gc_idle_time_handler_; |
| 2149 | 2149 |
| 2150 MemoryReducer* memory_reducer_; | 2150 MemoryReducer* memory_reducer_; |
| 2151 | 2151 |
| 2152 ObjectStats* object_stats_; | 2152 ObjectStats* object_stats_; |
| 2153 | 2153 |
| 2154 ScavengeJob* scavenge_job_; | 2154 ScavengeJob* scavenge_job_; |
| 2155 | 2155 |
| 2156 InlineAllocationObserver* idle_scavenge_observer_; | 2156 AllocationObserver* idle_scavenge_observer_; |
| 2157 | 2157 |
| 2158 // These two counters are monotomically increasing and never reset. | 2158 // These two counters are monotomically increasing and never reset. |
| 2159 size_t full_codegen_bytes_generated_; | 2159 size_t full_codegen_bytes_generated_; |
| 2160 size_t crankshaft_codegen_bytes_generated_; | 2160 size_t crankshaft_codegen_bytes_generated_; |
| 2161 | 2161 |
| 2162 // This counter is increased before each GC and never reset. | 2162 // This counter is increased before each GC and never reset. |
| 2163 // To account for the bytes allocated since the last GC, use the | 2163 // To account for the bytes allocated since the last GC, use the |
| 2164 // NewSpaceAllocationCounter() function. | 2164 // NewSpaceAllocationCounter() function. |
| 2165 size_t new_space_allocation_counter_; | 2165 size_t new_space_allocation_counter_; |
| 2166 | 2166 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2599 List<Object*> object_stack_; | 2599 List<Object*> object_stack_; |
| 2600 | 2600 |
| 2601 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2601 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2602 | 2602 |
| 2603 private: | 2603 private: |
| 2604 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2604 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2605 }; | 2605 }; |
| 2606 #endif // DEBUG | 2606 #endif // DEBUG |
| 2607 | 2607 |
| 2608 // ----------------------------------------------------------------------------- | 2608 // ----------------------------------------------------------------------------- |
| 2609 // Allows observation of inline allocation in the new space. | 2609 // Allows observation of allocations. |
| 2610 class InlineAllocationObserver { | 2610 class AllocationObserver { |
| 2611 public: | 2611 public: |
| 2612 explicit InlineAllocationObserver(intptr_t step_size) | 2612 explicit AllocationObserver(intptr_t step_size) |
| 2613 : step_size_(step_size), bytes_to_next_step_(step_size) { | 2613 : step_size_(step_size), bytes_to_next_step_(step_size) { |
| 2614 DCHECK(step_size >= kPointerSize); | 2614 DCHECK(step_size >= kPointerSize); |
| 2615 } | 2615 } |
| 2616 virtual ~InlineAllocationObserver() {} | 2616 virtual ~AllocationObserver() {} |
| 2617 | 2617 |
| 2618 // Called each time the new space does an inline allocation step. This may be | 2618 // Called each time the observed space does an allocation step. This may be |
| 2619 // more frequently than the step_size we are monitoring (e.g. when there are | 2619 // more frequently than the step_size we are monitoring (e.g. when there are |
| 2620 // multiple observers, or when page or space boundary is encountered.) | 2620 // multiple observers, or when page or space boundary is encountered.) |
| 2621 void InlineAllocationStep(int bytes_allocated, Address soon_object, | 2621 void AllocationStep(int bytes_allocated, Address soon_object, size_t size) { |
| 2622 size_t size) { | |
| 2623 bytes_to_next_step_ -= bytes_allocated; | 2622 bytes_to_next_step_ -= bytes_allocated; |
| 2624 if (bytes_to_next_step_ <= 0) { | 2623 if (bytes_to_next_step_ <= 0) { |
| 2625 Step(static_cast<int>(step_size_ - bytes_to_next_step_), soon_object, | 2624 Step(static_cast<int>(step_size_ - bytes_to_next_step_), soon_object, |
| 2626 size); | 2625 size); |
| 2627 step_size_ = GetNextStepSize(); | 2626 step_size_ = GetNextStepSize(); |
| 2628 bytes_to_next_step_ = step_size_; | 2627 bytes_to_next_step_ = step_size_; |
| 2629 } | 2628 } |
| 2630 } | 2629 } |
| 2631 | 2630 |
| 2632 protected: | 2631 protected: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2647 // first object. | 2646 // first object. |
| 2648 virtual void Step(int bytes_allocated, Address soon_object, size_t size) = 0; | 2647 virtual void Step(int bytes_allocated, Address soon_object, size_t size) = 0; |
| 2649 | 2648 |
| 2650 // Subclasses can override this method to make step size dynamic. | 2649 // Subclasses can override this method to make step size dynamic. |
| 2651 virtual intptr_t GetNextStepSize() { return step_size_; } | 2650 virtual intptr_t GetNextStepSize() { return step_size_; } |
| 2652 | 2651 |
| 2653 intptr_t step_size_; | 2652 intptr_t step_size_; |
| 2654 intptr_t bytes_to_next_step_; | 2653 intptr_t bytes_to_next_step_; |
| 2655 | 2654 |
| 2656 private: | 2655 private: |
| 2656 friend class LargeObjectSpace; |
| 2657 friend class NewSpace; | 2657 friend class NewSpace; |
| 2658 DISALLOW_COPY_AND_ASSIGN(InlineAllocationObserver); | 2658 friend class PagedSpace; |
| 2659 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
| 2659 }; | 2660 }; |
| 2660 | 2661 |
| 2661 } // namespace internal | 2662 } // namespace internal |
| 2662 } // namespace v8 | 2663 } // namespace v8 |
| 2663 | 2664 |
| 2664 #endif // V8_HEAP_HEAP_H_ | 2665 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |