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