| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 | 689 |
| 690 // Code that should be run before and after each GC. Includes some | 690 // Code that should be run before and after each GC. Includes some |
| 691 // reporting/verification activities when compiled with DEBUG set. | 691 // reporting/verification activities when compiled with DEBUG set. |
| 692 static void GarbageCollectionPrologue(); | 692 static void GarbageCollectionPrologue(); |
| 693 static void GarbageCollectionEpilogue(); | 693 static void GarbageCollectionEpilogue(); |
| 694 | 694 |
| 695 enum CollectionPolicy { NORMAL, AGGRESSIVE }; | 695 enum CollectionPolicy { NORMAL, AGGRESSIVE }; |
| 696 | 696 |
| 697 // Performs garbage collection operation. | 697 // Performs garbage collection operation. |
| 698 // Returns whether required_space bytes are available after the collection. | 698 // Returns whether required_space bytes are available after the collection. |
| 699 static bool CollectGarbage(int required_space, | 699 static void CollectGarbage(AllocationSpace space, |
| 700 AllocationSpace space, | |
| 701 CollectionPolicy collectionPolicy = NORMAL); | 700 CollectionPolicy collectionPolicy = NORMAL); |
| 702 | 701 |
| 703 // Performs a full garbage collection. Force compaction if the | 702 // Performs a full garbage collection. Force compaction if the |
| 704 // parameter is true. | 703 // parameter is true. |
| 705 static void CollectAllGarbage(bool force_compaction, | 704 static void CollectAllGarbage(bool force_compaction, |
| 706 CollectionPolicy collectionPolicy = NORMAL); | 705 CollectionPolicy collectionPolicy = NORMAL); |
| 707 | 706 |
| 708 // Last hope GC, should try to squeeze as much as possible. | 707 // Last hope GC, should try to squeeze as much as possible. |
| 709 static void CollectAllAvailableGarbage(); | 708 static void CollectAllAvailableGarbage(); |
| 710 | 709 |
| 711 // Notify the heap that a context has been disposed. | 710 // Notify the heap that a context has been disposed. |
| 712 static int NotifyContextDisposed() { return ++contexts_disposed_; } | 711 static int NotifyContextDisposed() { return ++contexts_disposed_; } |
| 713 | 712 |
| 714 // Utility to invoke the scavenger. This is needed in test code to | 713 // Utility to invoke the scavenger. This is needed in test code to |
| 715 // ensure correct callback for weak global handles. | 714 // ensure correct callback for weak global handles. |
| 716 static void PerformScavenge(); | 715 static void PerformScavenge(); |
| 717 | 716 |
| 718 #ifdef DEBUG | 717 #ifdef DEBUG |
| 719 // Utility used with flag gc-greedy. | 718 // Utility used with flag gc-greedy. |
| 720 static bool GarbageCollectionGreedyCheck(); | 719 static void GarbageCollectionGreedyCheck(); |
| 721 #endif | 720 #endif |
| 722 | 721 |
| 723 static void AddGCPrologueCallback( | 722 static void AddGCPrologueCallback( |
| 724 GCEpilogueCallback callback, GCType gc_type_filter); | 723 GCEpilogueCallback callback, GCType gc_type_filter); |
| 725 static void RemoveGCPrologueCallback(GCEpilogueCallback callback); | 724 static void RemoveGCPrologueCallback(GCEpilogueCallback callback); |
| 726 | 725 |
| 727 static void AddGCEpilogueCallback( | 726 static void AddGCEpilogueCallback( |
| 728 GCEpilogueCallback callback, GCType gc_type_filter); | 727 GCEpilogueCallback callback, GCType gc_type_filter); |
| 729 static void RemoveGCEpilogueCallback(GCEpilogueCallback callback); | 728 static void RemoveGCEpilogueCallback(GCEpilogueCallback callback); |
| 730 | 729 |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 | 2038 |
| 2040 // To speed up scavenge collections new space string are kept | 2039 // To speed up scavenge collections new space string are kept |
| 2041 // separate from old space strings. | 2040 // separate from old space strings. |
| 2042 static List<Object*> new_space_strings_; | 2041 static List<Object*> new_space_strings_; |
| 2043 static List<Object*> old_space_strings_; | 2042 static List<Object*> old_space_strings_; |
| 2044 }; | 2043 }; |
| 2045 | 2044 |
| 2046 } } // namespace v8::internal | 2045 } } // namespace v8::internal |
| 2047 | 2046 |
| 2048 #endif // V8_HEAP_H_ | 2047 #endif // V8_HEAP_H_ |
| OLD | NEW |