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

Side by Side Diff: src/heap.h

Issue 104023011: Introduce kGCCallbackForced flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 // 1168 //
1169 // Please note this function does not perform a garbage collection. 1169 // Please note this function does not perform a garbage collection.
1170 MUST_USE_RESULT inline MaybeObject* PrepareForCompare(String* str); 1170 MUST_USE_RESULT inline MaybeObject* PrepareForCompare(String* str);
1171 1171
1172 // Converts the given boolean condition to JavaScript boolean value. 1172 // Converts the given boolean condition to JavaScript boolean value.
1173 inline Object* ToBoolean(bool condition); 1173 inline Object* ToBoolean(bool condition);
1174 1174
1175 // Performs garbage collection operation. 1175 // Performs garbage collection operation.
1176 // Returns whether there is a chance that another major GC could 1176 // Returns whether there is a chance that another major GC could
1177 // collect more garbage. 1177 // collect more garbage.
1178 inline bool CollectGarbage(AllocationSpace space, 1178 inline bool CollectGarbage(
1179 const char* gc_reason = NULL); 1179 AllocationSpace space,
1180 const char* gc_reason = NULL,
1181 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags);
1180 1182
1181 static const int kNoGCFlags = 0; 1183 static const int kNoGCFlags = 0;
1182 static const int kSweepPreciselyMask = 1; 1184 static const int kSweepPreciselyMask = 1;
1183 static const int kReduceMemoryFootprintMask = 2; 1185 static const int kReduceMemoryFootprintMask = 2;
1184 static const int kAbortIncrementalMarkingMask = 4; 1186 static const int kAbortIncrementalMarkingMask = 4;
1185 1187
1186 // Making the heap iterable requires us to sweep precisely and abort any 1188 // Making the heap iterable requires us to sweep precisely and abort any
1187 // incremental marking as well. 1189 // incremental marking as well.
1188 static const int kMakeHeapIterableMask = 1190 static const int kMakeHeapIterableMask =
1189 kSweepPreciselyMask | kAbortIncrementalMarkingMask; 1191 kSweepPreciselyMask | kAbortIncrementalMarkingMask;
1190 1192
1191 // Performs a full garbage collection. If (flags & kMakeHeapIterableMask) is 1193 // Performs a full garbage collection. If (flags & kMakeHeapIterableMask) is
1192 // non-zero, then the slower precise sweeper is used, which leaves the heap 1194 // non-zero, then the slower precise sweeper is used, which leaves the heap
1193 // in a state where we can iterate over the heap visiting all objects. 1195 // in a state where we can iterate over the heap visiting all objects.
1194 void CollectAllGarbage(int flags, const char* gc_reason = NULL); 1196 void CollectAllGarbage(
1197 int flags,
1198 const char* gc_reason = NULL,
1199 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags);
1195 1200
1196 // Last hope GC, should try to squeeze as much as possible. 1201 // Last hope GC, should try to squeeze as much as possible.
1197 void CollectAllAvailableGarbage(const char* gc_reason = NULL); 1202 void CollectAllAvailableGarbage(const char* gc_reason = NULL);
1198 1203
1199 // Check whether the heap is currently iterable. 1204 // Check whether the heap is currently iterable.
1200 bool IsHeapIterable(); 1205 bool IsHeapIterable();
1201 1206
1202 // Ensure that we have swept all spaces in such a way that we can iterate 1207 // Ensure that we have swept all spaces in such a way that we can iterate
1203 // over all objects. May cause a GC. 1208 // over all objects. May cause a GC.
1204 void EnsureHeapIsIterable(); 1209 void EnsureHeapIsIterable();
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 } 1725 }
1721 1726
1722 // Returns the current sweep generation. 1727 // Returns the current sweep generation.
1723 int sweep_generation() { 1728 int sweep_generation() {
1724 return sweep_generation_; 1729 return sweep_generation_;
1725 } 1730 }
1726 1731
1727 inline Isolate* isolate(); 1732 inline Isolate* isolate();
1728 1733
1729 void CallGCPrologueCallbacks(GCType gc_type, GCCallbackFlags flags); 1734 void CallGCPrologueCallbacks(GCType gc_type, GCCallbackFlags flags);
1730 void CallGCEpilogueCallbacks(GCType gc_type); 1735 void CallGCEpilogueCallbacks(GCType gc_type, GCCallbackFlags flags);
1731 1736
1732 inline bool OldGenerationAllocationLimitReached(); 1737 inline bool OldGenerationAllocationLimitReached();
1733 1738
1734 inline void DoScavengeObject(Map* map, HeapObject** slot, HeapObject* obj) { 1739 inline void DoScavengeObject(Map* map, HeapObject** slot, HeapObject* obj) {
1735 scavenging_visitors_table_.GetVisitor(map)(map, slot, obj); 1740 scavenging_visitors_table_.GetVisitor(map)(map, slot, obj);
1736 } 1741 }
1737 1742
1738 void QueueMemoryChunkForFree(MemoryChunk* chunk); 1743 void QueueMemoryChunkForFree(MemoryChunk* chunk);
1739 void FreeQueuedChunks(); 1744 void FreeQueuedChunks();
1740 1745
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 void GarbageCollectionPrologue(); 2070 void GarbageCollectionPrologue();
2066 void GarbageCollectionEpilogue(); 2071 void GarbageCollectionEpilogue();
2067 2072
2068 // Checks whether a global GC is necessary 2073 // Checks whether a global GC is necessary
2069 GarbageCollector SelectGarbageCollector(AllocationSpace space, 2074 GarbageCollector SelectGarbageCollector(AllocationSpace space,
2070 const char** reason); 2075 const char** reason);
2071 2076
2072 // Performs garbage collection operation. 2077 // Performs garbage collection operation.
2073 // Returns whether there is a chance that another major GC could 2078 // Returns whether there is a chance that another major GC could
2074 // collect more garbage. 2079 // collect more garbage.
2075 bool CollectGarbage(AllocationSpace space, 2080 bool CollectGarbage(
2076 GarbageCollector collector, 2081 AllocationSpace space,
2077 const char* gc_reason, 2082 GarbageCollector collector,
2078 const char* collector_reason); 2083 const char* gc_reason,
2084 const char* collector_reason,
2085 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags);
2079 2086
2080 // Performs garbage collection 2087 // Performs garbage collection
2081 // Returns whether there is a chance another major GC could 2088 // Returns whether there is a chance another major GC could
2082 // collect more garbage. 2089 // collect more garbage.
2083 bool PerformGarbageCollection(GarbageCollector collector, 2090 bool PerformGarbageCollection(
2084 GCTracer* tracer); 2091 GarbageCollector collector,
2092 GCTracer* tracer,
2093 const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags);
2085 2094
2086 inline void UpdateOldSpaceLimits(); 2095 inline void UpdateOldSpaceLimits();
2087 2096
2088 // Selects the proper allocation space depending on the given object 2097 // Selects the proper allocation space depending on the given object
2089 // size, pretenuring decision, and preferred old-space. 2098 // size, pretenuring decision, and preferred old-space.
2090 static AllocationSpace SelectSpace(int object_size, 2099 static AllocationSpace SelectSpace(int object_size,
2091 AllocationSpace preferred_old_space, 2100 AllocationSpace preferred_old_space,
2092 PretenureFlag pretenure) { 2101 PretenureFlag pretenure) {
2093 ASSERT(preferred_old_space == OLD_POINTER_SPACE || 2102 ASSERT(preferred_old_space == OLD_POINTER_SPACE ||
2094 preferred_old_space == OLD_DATA_SPACE); 2103 preferred_old_space == OLD_DATA_SPACE);
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
3088 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3097 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3089 3098
3090 private: 3099 private:
3091 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3100 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3092 }; 3101 };
3093 #endif // DEBUG 3102 #endif // DEBUG
3094 3103
3095 } } // namespace v8::internal 3104 } } // namespace v8::internal
3096 3105
3097 #endif // V8_HEAP_H_ 3106 #endif // V8_HEAP_H_
OLDNEW
« include/v8.h ('K') | « src/extensions/gc-extension.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698