Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: src/heap.h

Issue 291193005: Attempt no. 3 to fix Heap::IsHeapIterable and HeapIterator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove EnsureHeapIterable and DisallocAllocation calls from LiveEdit::FindActiveGenerators Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/debug.cc ('k') | src/heap.cc » ('j') | src/heap-profiler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_H_ 5 #ifndef V8_HEAP_H_
6 #define V8_HEAP_H_ 6 #define V8_HEAP_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "allocation.h" 10 #include "allocation.h"
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags); 760 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags);
761 761
762 // Last hope GC, should try to squeeze as much as possible. 762 // Last hope GC, should try to squeeze as much as possible.
763 void CollectAllAvailableGarbage(const char* gc_reason = NULL); 763 void CollectAllAvailableGarbage(const char* gc_reason = NULL);
764 764
765 // Check whether the heap is currently iterable. 765 // Check whether the heap is currently iterable.
766 bool IsHeapIterable(); 766 bool IsHeapIterable();
767 767
768 // Ensure that we have swept all spaces in such a way that we can iterate 768 // Ensure that we have swept all spaces in such a way that we can iterate
769 // over all objects. May cause a GC. 769 // over all objects. May cause a GC.
770 void EnsureHeapIsIterable(); 770 void MakeHeapIterable();
771 771
772 // Notify the heap that a context has been disposed. 772 // Notify the heap that a context has been disposed.
773 int NotifyContextDisposed(); 773 int NotifyContextDisposed();
774 774
775 inline void increment_scan_on_scavenge_pages() { 775 inline void increment_scan_on_scavenge_pages() {
776 scan_on_scavenge_pages_++; 776 scan_on_scavenge_pages_++;
777 if (FLAG_gc_verbose) { 777 if (FLAG_gc_verbose) {
778 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); 778 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_);
779 } 779 }
780 } 780 }
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 NewSpace new_space_; 1542 NewSpace new_space_;
1543 OldSpace* old_pointer_space_; 1543 OldSpace* old_pointer_space_;
1544 OldSpace* old_data_space_; 1544 OldSpace* old_data_space_;
1545 OldSpace* code_space_; 1545 OldSpace* code_space_;
1546 MapSpace* map_space_; 1546 MapSpace* map_space_;
1547 CellSpace* cell_space_; 1547 CellSpace* cell_space_;
1548 PropertyCellSpace* property_cell_space_; 1548 PropertyCellSpace* property_cell_space_;
1549 LargeObjectSpace* lo_space_; 1549 LargeObjectSpace* lo_space_;
1550 HeapState gc_state_; 1550 HeapState gc_state_;
1551 int gc_post_processing_depth_; 1551 int gc_post_processing_depth_;
1552 Address new_space_top_after_last_gc_;
1552 1553
1553 // Returns the amount of external memory registered since last global gc. 1554 // Returns the amount of external memory registered since last global gc.
1554 int64_t PromotedExternalMemorySize(); 1555 int64_t PromotedExternalMemorySize();
1555 1556
1556 unsigned int ms_count_; // how many mark-sweep collections happened 1557 unsigned int ms_count_; // how many mark-sweep collections happened
1557 unsigned int gc_count_; // how many gc happened 1558 unsigned int gc_count_; // how many gc happened
1558 1559
1559 // For post mortem debugging. 1560 // For post mortem debugging.
1560 static const int kRememberedUnmappedPages = 128; 1561 static const int kRememberedUnmappedPages = 128;
1561 int remembered_unmapped_pages_index_; 1562 int remembered_unmapped_pages_index_;
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 int current_space_; // from enum AllocationSpace. 2385 int current_space_; // from enum AllocationSpace.
2385 ObjectIterator* iterator_; // object iterator for the current space. 2386 ObjectIterator* iterator_; // object iterator for the current space.
2386 HeapObjectCallback size_func_; 2387 HeapObjectCallback size_func_;
2387 }; 2388 };
2388 2389
2389 2390
2390 // A HeapIterator provides iteration over the whole heap. It 2391 // A HeapIterator provides iteration over the whole heap. It
2391 // aggregates the specific iterators for the different spaces as 2392 // aggregates the specific iterators for the different spaces as
2392 // these can only iterate over one space only. 2393 // these can only iterate over one space only.
2393 // 2394 //
2395 // HeapIterator ensures there is no allocation during its lifetime
2396 // (using an embedded DisallowHeapAllocation instance).
2397 //
2394 // HeapIterator can skip free list nodes (that is, de-allocated heap 2398 // HeapIterator can skip free list nodes (that is, de-allocated heap
2395 // objects that still remain in the heap). As implementation of free 2399 // objects that still remain in the heap). As implementation of free
2396 // nodes filtering uses GC marks, it can't be used during MS/MC GC 2400 // nodes filtering uses GC marks, it can't be used during MS/MC GC
2397 // phases. Also, it is forbidden to interrupt iteration in this mode, 2401 // phases. Also, it is forbidden to interrupt iteration in this mode,
2398 // as this will leave heap objects marked (and thus, unusable). 2402 // as this will leave heap objects marked (and thus, unusable).
2399 class HeapObjectsFilter; 2403 class HeapObjectsFilter;
2400 2404
2401 class HeapIterator BASE_EMBEDDED { 2405 class HeapIterator BASE_EMBEDDED {
2402 public: 2406 public:
2403 enum HeapObjectsFiltering { 2407 enum HeapObjectsFiltering {
2404 kNoFiltering, 2408 kNoFiltering,
2405 kFilterUnreachable 2409 kFilterUnreachable
2406 }; 2410 };
2407 2411
2408 explicit HeapIterator(Heap* heap); 2412 explicit HeapIterator(Heap* heap);
2409 HeapIterator(Heap* heap, HeapObjectsFiltering filtering); 2413 HeapIterator(Heap* heap, HeapObjectsFiltering filtering);
2410 ~HeapIterator(); 2414 ~HeapIterator();
2411 2415
2412 HeapObject* next(); 2416 HeapObject* next();
2413 void reset(); 2417 void reset();
2414 2418
2415 private: 2419 private:
2420 struct MakeHeapIterableHelper {
2421 explicit MakeHeapIterableHelper(Heap* heap) { heap->MakeHeapIterable(); }
2422 };
2423
2416 // Perform the initialization. 2424 // Perform the initialization.
2417 void Init(); 2425 void Init();
2418 // Perform all necessary shutdown (destruction) work. 2426 // Perform all necessary shutdown (destruction) work.
2419 void Shutdown(); 2427 void Shutdown();
2420 HeapObject* NextObject(); 2428 HeapObject* NextObject();
2421 2429
2430 MakeHeapIterableHelper make_heap_iterable_helper_;
2431 DisallowHeapAllocation no_heap_allocation_;
2422 Heap* heap_; 2432 Heap* heap_;
2423 HeapObjectsFiltering filtering_; 2433 HeapObjectsFiltering filtering_;
2424 HeapObjectsFilter* filter_; 2434 HeapObjectsFilter* filter_;
2425 // Space iterator for iterating all the spaces. 2435 // Space iterator for iterating all the spaces.
2426 SpaceIterator* space_iterator_; 2436 SpaceIterator* space_iterator_;
2427 // Object iterator for the space currently being iterated. 2437 // Object iterator for the space currently being iterated.
2428 ObjectIterator* object_iterator_; 2438 ObjectIterator* object_iterator_;
2429 }; 2439 };
2430 2440
2431 2441
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2823 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2833 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2824 2834
2825 private: 2835 private:
2826 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2836 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2827 }; 2837 };
2828 #endif // DEBUG 2838 #endif // DEBUG
2829 2839
2830 } } // namespace v8::internal 2840 } } // namespace v8::internal
2831 2841
2832 #endif // V8_HEAP_H_ 2842 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/heap.cc » ('j') | src/heap-profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698