| 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 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 // Heap doesn't guarantee that it can allocate an object that requires | 1405 // Heap doesn't guarantee that it can allocate an object that requires |
| 1406 // all available bytes. Check MaxHeapObjectSize() instead. | 1406 // all available bytes. Check MaxHeapObjectSize() instead. |
| 1407 intptr_t Available(); | 1407 intptr_t Available(); |
| 1408 | 1408 |
| 1409 // Returns of size of all objects residing in the heap. | 1409 // Returns of size of all objects residing in the heap. |
| 1410 intptr_t SizeOfObjects(); | 1410 intptr_t SizeOfObjects(); |
| 1411 | 1411 |
| 1412 void UpdateSurvivalStatistics(int start_new_space_size); | 1412 void UpdateSurvivalStatistics(int start_new_space_size); |
| 1413 | 1413 |
| 1414 inline void IncrementPromotedObjectsSize(int object_size) { | 1414 inline void IncrementPromotedObjectsSize(int object_size) { |
| 1415 DCHECK(object_size > 0); | 1415 DCHECK_GE(object_size, 0); |
| 1416 promoted_objects_size_ += object_size; | 1416 promoted_objects_size_ += object_size; |
| 1417 } | 1417 } |
| 1418 inline intptr_t promoted_objects_size() { return promoted_objects_size_; } | 1418 inline intptr_t promoted_objects_size() { return promoted_objects_size_; } |
| 1419 | 1419 |
| 1420 inline void IncrementSemiSpaceCopiedObjectSize(int object_size) { | 1420 inline void IncrementSemiSpaceCopiedObjectSize(int object_size) { |
| 1421 DCHECK(object_size > 0); | 1421 DCHECK_GE(object_size, 0); |
| 1422 semi_space_copied_object_size_ += object_size; | 1422 semi_space_copied_object_size_ += object_size; |
| 1423 } | 1423 } |
| 1424 inline intptr_t semi_space_copied_object_size() { | 1424 inline intptr_t semi_space_copied_object_size() { |
| 1425 return semi_space_copied_object_size_; | 1425 return semi_space_copied_object_size_; |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 inline intptr_t SurvivedNewSpaceObjectSize() { | 1428 inline intptr_t SurvivedNewSpaceObjectSize() { |
| 1429 return promoted_objects_size_ + semi_space_copied_object_size_; | 1429 return promoted_objects_size_ + semi_space_copied_object_size_; |
| 1430 } | 1430 } |
| 1431 | 1431 |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 double mutator_speed); | 1921 double mutator_speed); |
| 1922 | 1922 |
| 1923 // =========================================================================== | 1923 // =========================================================================== |
| 1924 // Idle notification. ======================================================== | 1924 // Idle notification. ======================================================== |
| 1925 // =========================================================================== | 1925 // =========================================================================== |
| 1926 | 1926 |
| 1927 bool RecentIdleNotificationHappened(); | 1927 bool RecentIdleNotificationHappened(); |
| 1928 void ScheduleIdleScavengeIfNeeded(int bytes_allocated); | 1928 void ScheduleIdleScavengeIfNeeded(int bytes_allocated); |
| 1929 | 1929 |
| 1930 // =========================================================================== | 1930 // =========================================================================== |
| 1931 // HeapIterator helpers. ===================================================== |
| 1932 // =========================================================================== |
| 1933 |
| 1934 void heap_iterator_start() { heap_iterator_depth_++; } |
| 1935 |
| 1936 void heap_iterator_end() { heap_iterator_depth_--; } |
| 1937 |
| 1938 bool in_heap_iterator() { return heap_iterator_depth_ > 0; } |
| 1939 |
| 1940 // =========================================================================== |
| 1931 // Allocation methods. ======================================================= | 1941 // Allocation methods. ======================================================= |
| 1932 // =========================================================================== | 1942 // =========================================================================== |
| 1933 | 1943 |
| 1934 // Returns a deep copy of the JavaScript object. | 1944 // Returns a deep copy of the JavaScript object. |
| 1935 // Properties and elements are copied too. | 1945 // Properties and elements are copied too. |
| 1936 // Optionally takes an AllocationSite to be appended in an AllocationMemento. | 1946 // Optionally takes an AllocationSite to be appended in an AllocationMemento. |
| 1937 MUST_USE_RESULT AllocationResult CopyJSObject(JSObject* source, | 1947 MUST_USE_RESULT AllocationResult CopyJSObject(JSObject* source, |
| 1938 AllocationSite* site = NULL); | 1948 AllocationSite* site = NULL); |
| 1939 | 1949 |
| 1940 // Allocates a JS Map in the heap. | 1950 // Allocates a JS Map in the heap. |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2373 base::Mutex relocation_mutex_; | 2383 base::Mutex relocation_mutex_; |
| 2374 | 2384 |
| 2375 int gc_callbacks_depth_; | 2385 int gc_callbacks_depth_; |
| 2376 | 2386 |
| 2377 bool deserialization_complete_; | 2387 bool deserialization_complete_; |
| 2378 | 2388 |
| 2379 StrongRootsList* strong_roots_list_; | 2389 StrongRootsList* strong_roots_list_; |
| 2380 | 2390 |
| 2381 ArrayBufferTracker* array_buffer_tracker_; | 2391 ArrayBufferTracker* array_buffer_tracker_; |
| 2382 | 2392 |
| 2393 // The depth of HeapIterator nestings. |
| 2394 int heap_iterator_depth_; |
| 2395 |
| 2383 // Used for testing purposes. | 2396 // Used for testing purposes. |
| 2384 bool force_oom_; | 2397 bool force_oom_; |
| 2385 | 2398 |
| 2386 // Classes in "heap" can be friends. | 2399 // Classes in "heap" can be friends. |
| 2387 friend class AlwaysAllocateScope; | 2400 friend class AlwaysAllocateScope; |
| 2388 friend class GCCallbacksScope; | 2401 friend class GCCallbacksScope; |
| 2389 friend class GCTracer; | 2402 friend class GCTracer; |
| 2390 friend class HeapIterator; | 2403 friend class HeapIterator; |
| 2391 friend class IdleScavengeObserver; | 2404 friend class IdleScavengeObserver; |
| 2392 friend class IncrementalMarking; | 2405 friend class IncrementalMarking; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2755 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2768 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2756 | 2769 |
| 2757 private: | 2770 private: |
| 2758 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2771 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2759 }; | 2772 }; |
| 2760 #endif // DEBUG | 2773 #endif // DEBUG |
| 2761 } // namespace internal | 2774 } // namespace internal |
| 2762 } // namespace v8 | 2775 } // namespace v8 |
| 2763 | 2776 |
| 2764 #endif // V8_HEAP_HEAP_H_ | 2777 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |