| 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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 Address* OldSpaceAllocationTopAddress() { | 806 Address* OldSpaceAllocationTopAddress() { |
| 807 return old_space_->allocation_top_address(); | 807 return old_space_->allocation_top_address(); |
| 808 } | 808 } |
| 809 Address* OldSpaceAllocationLimitAddress() { | 809 Address* OldSpaceAllocationLimitAddress() { |
| 810 return old_space_->allocation_limit_address(); | 810 return old_space_->allocation_limit_address(); |
| 811 } | 811 } |
| 812 | 812 |
| 813 // TODO(hpayer): There is still a missmatch between capacity and actual | 813 // TODO(hpayer): There is still a missmatch between capacity and actual |
| 814 // committed memory size. | 814 // committed memory size. |
| 815 bool CanExpandOldGeneration(int size) { | 815 bool CanExpandOldGeneration(int size) { |
| 816 if (force_oom_) return false; |
| 816 return (CommittedOldGenerationMemory() + size) < MaxOldGenerationSize(); | 817 return (CommittedOldGenerationMemory() + size) < MaxOldGenerationSize(); |
| 817 } | 818 } |
| 818 | 819 |
| 819 // Clear the Instanceof cache (used when a prototype changes). | 820 // Clear the Instanceof cache (used when a prototype changes). |
| 820 inline void ClearInstanceofCache(); | 821 inline void ClearInstanceofCache(); |
| 821 | 822 |
| 822 // FreeSpace objects have a null map after deserialization. Update the map. | 823 // FreeSpace objects have a null map after deserialization. Update the map. |
| 823 void RepairFreeListsAfterDeserialization(); | 824 void RepairFreeListsAfterDeserialization(); |
| 824 | 825 |
| 825 // Move len elements within a given array from src_index index to dst_index | 826 // Move len elements within a given array from src_index index to dst_index |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 MUST_USE_RESULT AllocationResult | 2107 MUST_USE_RESULT AllocationResult |
| 2107 AllocateForeign(Address address, PretenureFlag pretenure = NOT_TENURED); | 2108 AllocateForeign(Address address, PretenureFlag pretenure = NOT_TENURED); |
| 2108 | 2109 |
| 2109 MUST_USE_RESULT AllocationResult | 2110 MUST_USE_RESULT AllocationResult |
| 2110 AllocateCode(int object_size, bool immovable); | 2111 AllocateCode(int object_size, bool immovable); |
| 2111 | 2112 |
| 2112 MUST_USE_RESULT AllocationResult InternalizeStringWithKey(HashTableKey* key); | 2113 MUST_USE_RESULT AllocationResult InternalizeStringWithKey(HashTableKey* key); |
| 2113 | 2114 |
| 2114 MUST_USE_RESULT AllocationResult InternalizeString(String* str); | 2115 MUST_USE_RESULT AllocationResult InternalizeString(String* str); |
| 2115 | 2116 |
| 2117 void set_force_oom(bool value) { force_oom_ = value; } |
| 2118 |
| 2116 // The amount of external memory registered through the API kept alive | 2119 // The amount of external memory registered through the API kept alive |
| 2117 // by global handles | 2120 // by global handles |
| 2118 int64_t amount_of_external_allocated_memory_; | 2121 int64_t amount_of_external_allocated_memory_; |
| 2119 | 2122 |
| 2120 // Caches the amount of external memory registered at the last global gc. | 2123 // Caches the amount of external memory registered at the last global gc. |
| 2121 int64_t amount_of_external_allocated_memory_at_last_global_gc_; | 2124 int64_t amount_of_external_allocated_memory_at_last_global_gc_; |
| 2122 | 2125 |
| 2123 // This can be calculated directly from a pointer to the heap; however, it is | 2126 // This can be calculated directly from a pointer to the heap; however, it is |
| 2124 // more expedient to get at the isolate directly from within Heap methods. | 2127 // more expedient to get at the isolate directly from within Heap methods. |
| 2125 Isolate* isolate_; | 2128 Isolate* isolate_; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 int gc_callbacks_depth_; | 2359 int gc_callbacks_depth_; |
| 2357 | 2360 |
| 2358 bool deserialization_complete_; | 2361 bool deserialization_complete_; |
| 2359 | 2362 |
| 2360 bool concurrent_sweeping_enabled_; | 2363 bool concurrent_sweeping_enabled_; |
| 2361 | 2364 |
| 2362 StrongRootsList* strong_roots_list_; | 2365 StrongRootsList* strong_roots_list_; |
| 2363 | 2366 |
| 2364 ArrayBufferTracker* array_buffer_tracker_; | 2367 ArrayBufferTracker* array_buffer_tracker_; |
| 2365 | 2368 |
| 2369 // Used for testing purposes. |
| 2370 bool force_oom_; |
| 2371 |
| 2366 // Classes in "heap" can be friends. | 2372 // Classes in "heap" can be friends. |
| 2367 friend class AlwaysAllocateScope; | 2373 friend class AlwaysAllocateScope; |
| 2368 friend class GCCallbacksScope; | 2374 friend class GCCallbacksScope; |
| 2369 friend class GCTracer; | 2375 friend class GCTracer; |
| 2370 friend class HeapIterator; | 2376 friend class HeapIterator; |
| 2371 friend class IdleScavengeObserver; | 2377 friend class IdleScavengeObserver; |
| 2372 friend class IncrementalMarking; | 2378 friend class IncrementalMarking; |
| 2373 friend class IteratePointersToFromSpaceVisitor; | 2379 friend class IteratePointersToFromSpaceVisitor; |
| 2374 friend class MarkCompactCollector; | 2380 friend class MarkCompactCollector; |
| 2375 friend class MarkCompactMarkingVisitor; | 2381 friend class MarkCompactMarkingVisitor; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2735 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2741 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2736 | 2742 |
| 2737 private: | 2743 private: |
| 2738 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2744 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2739 }; | 2745 }; |
| 2740 #endif // DEBUG | 2746 #endif // DEBUG |
| 2741 } // namespace internal | 2747 } // namespace internal |
| 2742 } // namespace v8 | 2748 } // namespace v8 |
| 2743 | 2749 |
| 2744 #endif // V8_HEAP_HEAP_H_ | 2750 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |