| 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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 void RegisterExternallyReferencedObject(Object** object); | 1194 void RegisterExternallyReferencedObject(Object** object); |
| 1195 | 1195 |
| 1196 void RegisterWrappersWithEmbedderHeapTracer(); | 1196 void RegisterWrappersWithEmbedderHeapTracer(); |
| 1197 | 1197 |
| 1198 // In order to avoid running out of memory we force tracing wrappers if there | 1198 // In order to avoid running out of memory we force tracing wrappers if there |
| 1199 // are too many of them. | 1199 // are too many of them. |
| 1200 bool RequiresImmediateWrapperProcessing(); | 1200 bool RequiresImmediateWrapperProcessing(); |
| 1201 | 1201 |
| 1202 EmbedderHeapTracer* embedder_heap_tracer() { return embedder_heap_tracer_; } | 1202 EmbedderHeapTracer* embedder_heap_tracer() { return embedder_heap_tracer_; } |
| 1203 | 1203 |
| 1204 EmbedderReachableReferenceReporter* embedder_reachable_reference_reporter() { | |
| 1205 return embedder_reference_reporter_; | |
| 1206 } | |
| 1207 | |
| 1208 size_t wrappers_to_trace() { return wrappers_to_trace_.size(); } | 1204 size_t wrappers_to_trace() { return wrappers_to_trace_.size(); } |
| 1209 | 1205 |
| 1210 // =========================================================================== | 1206 // =========================================================================== |
| 1211 // External string table API. ================================================ | 1207 // External string table API. ================================================ |
| 1212 // =========================================================================== | 1208 // =========================================================================== |
| 1213 | 1209 |
| 1214 // Registers an external string. | 1210 // Registers an external string. |
| 1215 inline void RegisterExternalString(String* string); | 1211 inline void RegisterExternalString(String* string); |
| 1216 | 1212 |
| 1217 // Finalizes an external string by deleting the associated external | 1213 // Finalizes an external string by deleting the associated external |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2304 int gc_callbacks_depth_; | 2300 int gc_callbacks_depth_; |
| 2305 | 2301 |
| 2306 bool deserialization_complete_; | 2302 bool deserialization_complete_; |
| 2307 | 2303 |
| 2308 StrongRootsList* strong_roots_list_; | 2304 StrongRootsList* strong_roots_list_; |
| 2309 | 2305 |
| 2310 // The depth of HeapIterator nestings. | 2306 // The depth of HeapIterator nestings. |
| 2311 int heap_iterator_depth_; | 2307 int heap_iterator_depth_; |
| 2312 | 2308 |
| 2313 EmbedderHeapTracer* embedder_heap_tracer_; | 2309 EmbedderHeapTracer* embedder_heap_tracer_; |
| 2314 EmbedderReachableReferenceReporter* embedder_reference_reporter_; | |
| 2315 std::vector<std::pair<void*, void*>> wrappers_to_trace_; | 2310 std::vector<std::pair<void*, void*>> wrappers_to_trace_; |
| 2316 | 2311 |
| 2317 // Used for testing purposes. | 2312 // Used for testing purposes. |
| 2318 bool force_oom_; | 2313 bool force_oom_; |
| 2319 bool delay_sweeper_tasks_for_testing_; | 2314 bool delay_sweeper_tasks_for_testing_; |
| 2320 | 2315 |
| 2321 // Classes in "heap" can be friends. | 2316 // Classes in "heap" can be friends. |
| 2322 friend class AlwaysAllocateScope; | 2317 friend class AlwaysAllocateScope; |
| 2323 friend class GCCallbacksScope; | 2318 friend class GCCallbacksScope; |
| 2324 friend class GCTracer; | 2319 friend class GCTracer; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2628 intptr_t step_size_; | 2623 intptr_t step_size_; |
| 2629 intptr_t bytes_to_next_step_; | 2624 intptr_t bytes_to_next_step_; |
| 2630 | 2625 |
| 2631 private: | 2626 private: |
| 2632 friend class LargeObjectSpace; | 2627 friend class LargeObjectSpace; |
| 2633 friend class NewSpace; | 2628 friend class NewSpace; |
| 2634 friend class PagedSpace; | 2629 friend class PagedSpace; |
| 2635 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2630 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
| 2636 }; | 2631 }; |
| 2637 | 2632 |
| 2638 class TracePossibleWrapperReporter : public EmbedderReachableReferenceReporter { | |
| 2639 public: | |
| 2640 explicit TracePossibleWrapperReporter(Heap* heap) : heap_(heap) {} | |
| 2641 void ReportExternalReference(Value* object) override { | |
| 2642 heap_->RegisterExternallyReferencedObject( | |
| 2643 reinterpret_cast<Object**>(object)); | |
| 2644 } | |
| 2645 | |
| 2646 private: | |
| 2647 Heap* heap_; | |
| 2648 }; | |
| 2649 | |
| 2650 } // namespace internal | 2633 } // namespace internal |
| 2651 } // namespace v8 | 2634 } // namespace v8 |
| 2652 | 2635 |
| 2653 #endif // V8_HEAP_HEAP_H_ | 2636 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |