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

Side by Side Diff: src/heap.h

Issue 299813002: Revert "Fix Heap::IsHeapIterable." (again) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 MakeHeapIterable(); 770 void EnsureHeapIsIterable();
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 //
2397 // HeapIterator can skip free list nodes (that is, de-allocated heap 2394 // HeapIterator can skip free list nodes (that is, de-allocated heap
2398 // objects that still remain in the heap). As implementation of free 2395 // objects that still remain in the heap). As implementation of free
2399 // nodes filtering uses GC marks, it can't be used during MS/MC GC 2396 // nodes filtering uses GC marks, it can't be used during MS/MC GC
2400 // phases. Also, it is forbidden to interrupt iteration in this mode, 2397 // phases. Also, it is forbidden to interrupt iteration in this mode,
2401 // as this will leave heap objects marked (and thus, unusable). 2398 // as this will leave heap objects marked (and thus, unusable).
2402 class HeapObjectsFilter; 2399 class HeapObjectsFilter;
2403 2400
2404 class HeapIterator BASE_EMBEDDED { 2401 class HeapIterator BASE_EMBEDDED {
2405 public: 2402 public:
2406 enum HeapObjectsFiltering { 2403 enum HeapObjectsFiltering {
2407 kNoFiltering, 2404 kNoFiltering,
2408 kFilterUnreachable 2405 kFilterUnreachable
2409 }; 2406 };
2410 2407
2411 explicit HeapIterator(Heap* heap); 2408 explicit HeapIterator(Heap* heap);
2412 HeapIterator(Heap* heap, HeapObjectsFiltering filtering); 2409 HeapIterator(Heap* heap, HeapObjectsFiltering filtering);
2413 ~HeapIterator(); 2410 ~HeapIterator();
2414 2411
2415 HeapObject* next(); 2412 HeapObject* next();
2416 void reset(); 2413 void reset();
2417 2414
2418 private: 2415 private:
2419 struct MakeHeapIterableHelper {
2420 explicit MakeHeapIterableHelper(Heap* heap) { heap->MakeHeapIterable(); }
2421 };
2422
2423 // Perform the initialization. 2416 // Perform the initialization.
2424 void Init(); 2417 void Init();
2425 // Perform all necessary shutdown (destruction) work. 2418 // Perform all necessary shutdown (destruction) work.
2426 void Shutdown(); 2419 void Shutdown();
2427 HeapObject* NextObject(); 2420 HeapObject* NextObject();
2428 2421
2429 MakeHeapIterableHelper make_heap_iterable_helper_;
2430 DisallowHeapAllocation no_heap_allocation_;
2431 Heap* heap_; 2422 Heap* heap_;
2432 HeapObjectsFiltering filtering_; 2423 HeapObjectsFiltering filtering_;
2433 HeapObjectsFilter* filter_; 2424 HeapObjectsFilter* filter_;
2434 // Space iterator for iterating all the spaces. 2425 // Space iterator for iterating all the spaces.
2435 SpaceIterator* space_iterator_; 2426 SpaceIterator* space_iterator_;
2436 // Object iterator for the space currently being iterated. 2427 // Object iterator for the space currently being iterated.
2437 ObjectIterator* object_iterator_; 2428 ObjectIterator* object_iterator_;
2438 }; 2429 };
2439 2430
2440 2431
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2823 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2833 2824
2834 private: 2825 private:
2835 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2826 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2836 }; 2827 };
2837 #endif // DEBUG 2828 #endif // DEBUG
2838 2829
2839 } } // namespace v8::internal 2830 } } // namespace v8::internal
2840 2831
2841 #endif // V8_HEAP_H_ 2832 #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