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

Side by Side Diff: src/heap.h

Issue 4295004: Attempt to collect more garbage before panicking with out of memory. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing various English usage concerns Created 10 years, 1 month 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/global-handles.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 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 static Object* ToBoolean(bool condition) { 698 static Object* ToBoolean(bool condition) {
699 return condition ? true_value() : false_value(); 699 return condition ? true_value() : false_value();
700 } 700 }
701 701
702 // Code that should be run before and after each GC. Includes some 702 // Code that should be run before and after each GC. Includes some
703 // reporting/verification activities when compiled with DEBUG set. 703 // reporting/verification activities when compiled with DEBUG set.
704 static void GarbageCollectionPrologue(); 704 static void GarbageCollectionPrologue();
705 static void GarbageCollectionEpilogue(); 705 static void GarbageCollectionEpilogue();
706 706
707 // Performs garbage collection operation. 707 // Performs garbage collection operation.
708 // Returns whether required_space bytes are available after the collection. 708 // Returns whether there is a chance that another major GC could
709 static void CollectGarbage(AllocationSpace space); 709 // collect more garbage.
710 static bool CollectGarbage(AllocationSpace space, GarbageCollector collector);
711
712 // Performs garbage collection operation.
713 // Returns whether there is a chance that another major GC could
714 // collect more garbage.
715 inline static bool CollectGarbage(AllocationSpace space);
710 716
711 // Performs a full garbage collection. Force compaction if the 717 // Performs a full garbage collection. Force compaction if the
712 // parameter is true. 718 // parameter is true.
713 static void CollectAllGarbage(bool force_compaction); 719 static void CollectAllGarbage(bool force_compaction);
714 720
721 // Last hope GC, should try to squeeze as much as possible.
722 static void CollectAllAvailableGarbage();
723
715 // Notify the heap that a context has been disposed. 724 // Notify the heap that a context has been disposed.
716 static int NotifyContextDisposed() { return ++contexts_disposed_; } 725 static int NotifyContextDisposed() { return ++contexts_disposed_; }
717 726
718 // Utility to invoke the scavenger. This is needed in test code to 727 // Utility to invoke the scavenger. This is needed in test code to
719 // ensure correct callback for weak global handles. 728 // ensure correct callback for weak global handles.
720 static void PerformScavenge(); 729 static void PerformScavenge();
721 730
722 #ifdef DEBUG 731 #ifdef DEBUG
723 // Utility used with flag gc-greedy. 732 // Utility used with flag gc-greedy.
724 static void GarbageCollectionGreedyCheck(); 733 static void GarbageCollectionGreedyCheck();
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 static void MarkMapPointersAsEncoded(bool encoded) { 1248 static void MarkMapPointersAsEncoded(bool encoded) {
1240 gc_safe_size_of_old_object_ = encoded 1249 gc_safe_size_of_old_object_ = encoded
1241 ? &GcSafeSizeOfOldObjectWithEncodedMap 1250 ? &GcSafeSizeOfOldObjectWithEncodedMap
1242 : &GcSafeSizeOfOldObject; 1251 : &GcSafeSizeOfOldObject;
1243 } 1252 }
1244 1253
1245 // Checks whether a global GC is necessary 1254 // Checks whether a global GC is necessary
1246 static GarbageCollector SelectGarbageCollector(AllocationSpace space); 1255 static GarbageCollector SelectGarbageCollector(AllocationSpace space);
1247 1256
1248 // Performs garbage collection 1257 // Performs garbage collection
1249 static void PerformGarbageCollection(GarbageCollector collector, 1258 // Returns whether there is a chance another major GC could
1259 // collect more garbage.
1260 static bool PerformGarbageCollection(GarbageCollector collector,
1250 GCTracer* tracer); 1261 GCTracer* tracer);
1251 1262
1252 // Allocate an uninitialized object in map space. The behavior is identical 1263 // Allocate an uninitialized object in map space. The behavior is identical
1253 // to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't 1264 // to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't
1254 // have to test the allocation space argument and (b) can reduce code size 1265 // have to test the allocation space argument and (b) can reduce code size
1255 // (since both AllocateRaw and AllocateRawMap are inlined). 1266 // (since both AllocateRaw and AllocateRawMap are inlined).
1256 MUST_USE_RESULT static inline MaybeObject* AllocateRawMap(); 1267 MUST_USE_RESULT static inline MaybeObject* AllocateRawMap();
1257 1268
1258 // Allocate an uninitialized object in the global property cell space. 1269 // Allocate an uninitialized object in the global property cell space.
1259 MUST_USE_RESULT static inline MaybeObject* AllocateRawCell(); 1270 MUST_USE_RESULT static inline MaybeObject* AllocateRawCell();
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 // Return whether this object should be retained. If NULL is returned the 2078 // Return whether this object should be retained. If NULL is returned the
2068 // object has no references. Otherwise the address of the retained object 2079 // object has no references. Otherwise the address of the retained object
2069 // should be returned as in some GC situations the object has been moved. 2080 // should be returned as in some GC situations the object has been moved.
2070 virtual Object* RetainAs(Object* object) = 0; 2081 virtual Object* RetainAs(Object* object) = 0;
2071 }; 2082 };
2072 2083
2073 2084
2074 } } // namespace v8::internal 2085 } } // namespace v8::internal
2075 2086
2076 #endif // V8_HEAP_H_ 2087 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/global-handles.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698