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

Side by Side Diff: src/heap.h

Issue 285693006: Fix Heap::IsHeapIterable. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleanup 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') | no next file with comments »
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 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 int current_space_; // from enum AllocationSpace. 2384 int current_space_; // from enum AllocationSpace.
2385 ObjectIterator* iterator_; // object iterator for the current space. 2385 ObjectIterator* iterator_; // object iterator for the current space.
2386 HeapObjectCallback size_func_; 2386 HeapObjectCallback size_func_;
2387 }; 2387 };
2388 2388
2389 2389
2390 // A HeapIterator provides iteration over the whole heap. It 2390 // A HeapIterator provides iteration over the whole heap. It
2391 // aggregates the specific iterators for the different spaces as 2391 // aggregates the specific iterators for the different spaces as
2392 // these can only iterate over one space only. 2392 // these can only iterate over one space only.
2393 // 2393 //
2394 // HeapIterator ensures there is no allocation during its lifetime
2395 // (using an embedded DisallowHeapAllocation instance).
2396 //
2394 // HeapIterator can skip free list nodes (that is, de-allocated heap 2397 // HeapIterator can skip free list nodes (that is, de-allocated heap
2395 // objects that still remain in the heap). As implementation of free 2398 // 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 2399 // 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, 2400 // phases. Also, it is forbidden to interrupt iteration in this mode,
2398 // as this will leave heap objects marked (and thus, unusable). 2401 // as this will leave heap objects marked (and thus, unusable).
2399 class HeapObjectsFilter; 2402 class HeapObjectsFilter;
2400 2403
2401 class HeapIterator BASE_EMBEDDED { 2404 class HeapIterator BASE_EMBEDDED {
2402 public: 2405 public:
2403 enum HeapObjectsFiltering { 2406 enum HeapObjectsFiltering {
2404 kNoFiltering, 2407 kNoFiltering,
2405 kFilterUnreachable 2408 kFilterUnreachable
2406 }; 2409 };
2407 2410
2408 explicit HeapIterator(Heap* heap); 2411 explicit HeapIterator(Heap* heap);
2409 HeapIterator(Heap* heap, HeapObjectsFiltering filtering); 2412 HeapIterator(Heap* heap, HeapObjectsFiltering filtering);
2410 ~HeapIterator(); 2413 ~HeapIterator();
2411 2414
2412 HeapObject* next(); 2415 HeapObject* next();
2413 void reset(); 2416 void reset();
2414 2417
2415 private: 2418 private:
2419 struct MakeHeapIterableHelper {
2420 explicit MakeHeapIterableHelper(Heap* heap) { heap->MakeHeapIterable(); }
2421 };
2422
2416 // Perform the initialization. 2423 // Perform the initialization.
2417 void Init(); 2424 void Init();
2418 // Perform all necessary shutdown (destruction) work. 2425 // Perform all necessary shutdown (destruction) work.
2419 void Shutdown(); 2426 void Shutdown();
2420 HeapObject* NextObject(); 2427 HeapObject* NextObject();
2421 2428
2429 MakeHeapIterableHelper make_heap_iterable_helper_;
2430 DisallowHeapAllocation no_heap_allocation_;
2422 Heap* heap_; 2431 Heap* heap_;
2423 HeapObjectsFiltering filtering_; 2432 HeapObjectsFiltering filtering_;
2424 HeapObjectsFilter* filter_; 2433 HeapObjectsFilter* filter_;
2425 // Space iterator for iterating all the spaces. 2434 // Space iterator for iterating all the spaces.
2426 SpaceIterator* space_iterator_; 2435 SpaceIterator* space_iterator_;
2427 // Object iterator for the space currently being iterated. 2436 // Object iterator for the space currently being iterated.
2428 ObjectIterator* object_iterator_; 2437 ObjectIterator* object_iterator_;
2429 }; 2438 };
2430 2439
2431 2440
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2823 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2832 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2824 2833
2825 private: 2834 private:
2826 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2835 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2827 }; 2836 };
2828 #endif // DEBUG 2837 #endif // DEBUG
2829 2838
2830 } } // namespace v8::internal 2839 } } // namespace v8::internal
2831 2840
2832 #endif // V8_HEAP_H_ 2841 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698