| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 | 209 |
| 210 // Forward declaration of the GCTracer class. | 210 // Forward declaration of the GCTracer class. |
| 211 class GCTracer; | 211 class GCTracer; |
| 212 class HeapStats; | 212 class HeapStats; |
| 213 class Isolate; | 213 class Isolate; |
| 214 | 214 |
| 215 | 215 |
| 216 typedef String* (*ExternalStringTableUpdaterCallback)(Object** pointer); | 216 typedef String* (*ExternalStringTableUpdaterCallback)(Object** pointer); |
| 217 | 217 |
| 218 typedef bool (*DirtyRegionCallback)(Address start, | 218 typedef bool (*DirtyRegionCallback)(Heap* heap, |
| 219 Address start, |
| 219 Address end, | 220 Address end, |
| 220 ObjectSlotCallback copy_object_func); | 221 ObjectSlotCallback copy_object_func); |
| 221 | 222 |
| 222 | 223 |
| 223 // The all static Heap captures the interface to the global object heap. | 224 // The all static Heap captures the interface to the global object heap. |
| 224 // All JavaScript contexts by this process share the same object heap. | 225 // All JavaScript contexts by this process share the same object heap. |
| 225 | 226 |
| 226 #ifdef DEBUG | 227 #ifdef DEBUG |
| 227 class HeapDebugUtils; | 228 class HeapDebugUtils; |
| 228 #endif | 229 #endif |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 | 865 |
| 865 // Iterate pointers to from semispace of new space found in memory interval | 866 // Iterate pointers to from semispace of new space found in memory interval |
| 866 // from start to end. | 867 // from start to end. |
| 867 // Update dirty marks for page containing start address. | 868 // Update dirty marks for page containing start address. |
| 868 void IterateAndMarkPointersToFromSpace(Address start, | 869 void IterateAndMarkPointersToFromSpace(Address start, |
| 869 Address end, | 870 Address end, |
| 870 ObjectSlotCallback callback); | 871 ObjectSlotCallback callback); |
| 871 | 872 |
| 872 // Iterate pointers to new space found in memory interval from start to end. | 873 // Iterate pointers to new space found in memory interval from start to end. |
| 873 // Return true if pointers to new space was found. | 874 // Return true if pointers to new space was found. |
| 874 static bool IteratePointersInDirtyRegion(Address start, | 875 static bool IteratePointersInDirtyRegion(Heap* heap, |
| 876 Address start, |
| 875 Address end, | 877 Address end, |
| 876 ObjectSlotCallback callback); | 878 ObjectSlotCallback callback); |
| 877 | 879 |
| 878 | 880 |
| 879 // Iterate pointers to new space found in memory interval from start to end. | 881 // Iterate pointers to new space found in memory interval from start to end. |
| 880 // This interval is considered to belong to the map space. | 882 // This interval is considered to belong to the map space. |
| 881 // Return true if pointers to new space was found. | 883 // Return true if pointers to new space was found. |
| 882 static bool IteratePointersInDirtyMapsRegion(Address start, | 884 static bool IteratePointersInDirtyMapsRegion(Heap* heap, |
| 885 Address start, |
| 883 Address end, | 886 Address end, |
| 884 ObjectSlotCallback callback); | 887 ObjectSlotCallback callback); |
| 885 | 888 |
| 886 | 889 |
| 887 // Returns whether the object resides in new space. | 890 // Returns whether the object resides in new space. |
| 888 inline bool InNewSpace(Object* object); | 891 inline bool InNewSpace(Object* object); |
| 889 inline bool InFromSpace(Object* object); | 892 inline bool InFromSpace(Object* object); |
| 890 inline bool InToSpace(Object* object); | 893 inline bool InToSpace(Object* object); |
| 891 | 894 |
| 892 // Checks whether an address/object in the heap (including auxiliary | 895 // Checks whether an address/object in the heap (including auxiliary |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 } | 984 } |
| 982 | 985 |
| 983 void TracePathToObject(Object* target); | 986 void TracePathToObject(Object* target); |
| 984 void TracePathToGlobal(); | 987 void TracePathToGlobal(); |
| 985 #endif | 988 #endif |
| 986 | 989 |
| 987 // Callback function passed to Heap::Iterate etc. Copies an object if | 990 // Callback function passed to Heap::Iterate etc. Copies an object if |
| 988 // necessary, the object might be promoted to an old space. The caller must | 991 // necessary, the object might be promoted to an old space. The caller must |
| 989 // ensure the precondition that the object is (a) a heap object and (b) in | 992 // ensure the precondition that the object is (a) a heap object and (b) in |
| 990 // the heap's from space. | 993 // the heap's from space. |
| 991 static void ScavengePointer(HeapObject** p); | 994 static inline void ScavengePointer(HeapObject** p); |
| 992 inline void ScavengeObject(HeapObject** p, HeapObject* object); | 995 static inline void ScavengeObject(HeapObject** p, HeapObject* object); |
| 993 | 996 |
| 994 // Commits from space if it is uncommitted. | 997 // Commits from space if it is uncommitted. |
| 995 void EnsureFromSpaceIsCommitted(); | 998 void EnsureFromSpaceIsCommitted(); |
| 996 | 999 |
| 997 // Support for partial snapshots. After calling this we can allocate a | 1000 // Support for partial snapshots. After calling this we can allocate a |
| 998 // certain number of bytes using only linear allocation (with a | 1001 // certain number of bytes using only linear allocation (with a |
| 999 // LinearAllocationScope and an AlwaysAllocateScope) without using freelists | 1002 // LinearAllocationScope and an AlwaysAllocateScope) without using freelists |
| 1000 // or causing a GC. It returns true of space was reserved or false if a GC is | 1003 // or causing a GC. It returns true of space was reserved or false if a GC is |
| 1001 // needed. For paged spaces the space requested must include the space wasted | 1004 // needed. For paged spaces the space requested must include the space wasted |
| 1002 // at the end of each page when allocating linearly. | 1005 // at the end of each page when allocating linearly. |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 // around a GC). | 1368 // around a GC). |
| 1366 inline void CompletelyClearInstanceofCache(); | 1369 inline void CompletelyClearInstanceofCache(); |
| 1367 | 1370 |
| 1368 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 1371 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
| 1369 // Record statistics before and after garbage collection. | 1372 // Record statistics before and after garbage collection. |
| 1370 void ReportStatisticsBeforeGC(); | 1373 void ReportStatisticsBeforeGC(); |
| 1371 void ReportStatisticsAfterGC(); | 1374 void ReportStatisticsAfterGC(); |
| 1372 #endif | 1375 #endif |
| 1373 | 1376 |
| 1374 // Slow part of scavenge object. | 1377 // Slow part of scavenge object. |
| 1375 void ScavengeObjectSlow(HeapObject** p, HeapObject* object); | 1378 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); |
| 1376 | 1379 |
| 1377 // Initializes a function with a shared part and prototype. | 1380 // Initializes a function with a shared part and prototype. |
| 1378 // Returns the function. | 1381 // Returns the function. |
| 1379 // Note: this code was factored out of AllocateFunction such that | 1382 // Note: this code was factored out of AllocateFunction such that |
| 1380 // other parts of the VM could use it. Specifically, a function that creates | 1383 // other parts of the VM could use it. Specifically, a function that creates |
| 1381 // instances of type JS_FUNCTION_TYPE benefit from the use of this function. | 1384 // instances of type JS_FUNCTION_TYPE benefit from the use of this function. |
| 1382 // Please note this does not perform a garbage collection. | 1385 // Please note this does not perform a garbage collection. |
| 1383 MUST_USE_RESULT inline Object* InitializeFunction(JSFunction* function, | 1386 MUST_USE_RESULT inline Object* InitializeFunction(JSFunction* function, |
| 1384 SharedFunctionInfo* shared, | 1387 SharedFunctionInfo* shared, |
| 1385 Object* prototype); | 1388 Object* prototype); |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 SubCache* caches_[kNumberOfCaches]; | 2078 SubCache* caches_[kNumberOfCaches]; |
| 2076 DISALLOW_COPY_AND_ASSIGN(TranscendentalCache); | 2079 DISALLOW_COPY_AND_ASSIGN(TranscendentalCache); |
| 2077 }; | 2080 }; |
| 2078 | 2081 |
| 2079 | 2082 |
| 2080 } } // namespace v8::internal | 2083 } } // namespace v8::internal |
| 2081 | 2084 |
| 2082 #undef HEAP | 2085 #undef HEAP |
| 2083 | 2086 |
| 2084 #endif // V8_HEAP_H_ | 2087 #endif // V8_HEAP_H_ |
| OLD | NEW |