| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); | 1038 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); |
| 1039 // Iterates over all the other roots in the heap. | 1039 // Iterates over all the other roots in the heap. |
| 1040 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); | 1040 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); |
| 1041 | 1041 |
| 1042 // Iterate pointers to from semispace of new space found in memory interval | 1042 // Iterate pointers to from semispace of new space found in memory interval |
| 1043 // from start to end. | 1043 // from start to end. |
| 1044 void IterateAndMarkPointersToFromSpace(Address start, | 1044 void IterateAndMarkPointersToFromSpace(Address start, |
| 1045 Address end, | 1045 Address end, |
| 1046 ObjectSlotCallback callback); | 1046 ObjectSlotCallback callback); |
| 1047 | 1047 |
| 1048 // Iterate pointers to new space found in memory interval from start to end. | |
| 1049 static void IteratePointersToNewSpace(Heap* heap, | |
| 1050 Address start, | |
| 1051 Address end, | |
| 1052 ObjectSlotCallback callback); | |
| 1053 | |
| 1054 | |
| 1055 // Iterate pointers to new space found in memory interval from start to end. | |
| 1056 // This interval is considered to belong to the map space. | |
| 1057 static void IteratePointersFromMapsToNewSpace(Heap* heap, | |
| 1058 Address start, | |
| 1059 Address end, | |
| 1060 ObjectSlotCallback callback); | |
| 1061 | |
| 1062 | |
| 1063 // Returns whether the object resides in new space. | 1048 // Returns whether the object resides in new space. |
| 1064 inline bool InNewSpace(Object* object); | 1049 inline bool InNewSpace(Object* object); |
| 1065 inline bool InNewSpace(Address addr); | 1050 inline bool InNewSpace(Address addr); |
| 1066 inline bool InNewSpacePage(Address addr); | 1051 inline bool InNewSpacePage(Address addr); |
| 1067 inline bool InFromSpace(Object* object); | 1052 inline bool InFromSpace(Object* object); |
| 1068 inline bool InToSpace(Object* object); | 1053 inline bool InToSpace(Object* object); |
| 1069 | 1054 |
| 1070 // Checks whether an address/object in the heap (including auxiliary | 1055 // Checks whether an address/object in the heap (including auxiliary |
| 1071 // area and unused area). | 1056 // area and unused area). |
| 1072 bool Contains(Address addr); | 1057 bool Contains(Address addr); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 inline void CallGlobalGCEpilogueCallback() { | 1420 inline void CallGlobalGCEpilogueCallback() { |
| 1436 if (global_gc_epilogue_callback_ != NULL) global_gc_epilogue_callback_(); | 1421 if (global_gc_epilogue_callback_ != NULL) global_gc_epilogue_callback_(); |
| 1437 } | 1422 } |
| 1438 | 1423 |
| 1439 inline bool OldGenerationAllocationLimitReached(); | 1424 inline bool OldGenerationAllocationLimitReached(); |
| 1440 | 1425 |
| 1441 inline void DoScavengeObject(Map* map, HeapObject** slot, HeapObject* obj) { | 1426 inline void DoScavengeObject(Map* map, HeapObject** slot, HeapObject* obj) { |
| 1442 scavenging_visitors_table_.GetVisitor(map)(map, slot, obj); | 1427 scavenging_visitors_table_.GetVisitor(map)(map, slot, obj); |
| 1443 } | 1428 } |
| 1444 | 1429 |
| 1445 bool ShouldWeGiveBackAPageToTheOS() { | |
| 1446 last_empty_page_was_given_back_to_the_os_ = | |
| 1447 !last_empty_page_was_given_back_to_the_os_; | |
| 1448 return last_empty_page_was_given_back_to_the_os_; | |
| 1449 } | |
| 1450 | |
| 1451 void QueueMemoryChunkForFree(MemoryChunk* chunk); | 1430 void QueueMemoryChunkForFree(MemoryChunk* chunk); |
| 1452 void FreeQueuedChunks(); | 1431 void FreeQueuedChunks(); |
| 1453 | 1432 |
| 1454 // Completely clear the Instanceof cache (to stop it keeping objects alive | 1433 // Completely clear the Instanceof cache (to stop it keeping objects alive |
| 1455 // around a GC). | 1434 // around a GC). |
| 1456 inline void CompletelyClearInstanceofCache(); | 1435 inline void CompletelyClearInstanceofCache(); |
| 1457 | 1436 |
| 1458 private: | 1437 private: |
| 1459 Heap(); | 1438 Heap(); |
| 1460 | 1439 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 PromotionQueue promotion_queue_; | 1790 PromotionQueue promotion_queue_; |
| 1812 | 1791 |
| 1813 // Flag is set when the heap has been configured. The heap can be repeatedly | 1792 // Flag is set when the heap has been configured. The heap can be repeatedly |
| 1814 // configured through the API until it is setup. | 1793 // configured through the API until it is setup. |
| 1815 bool configured_; | 1794 bool configured_; |
| 1816 | 1795 |
| 1817 ExternalStringTable external_string_table_; | 1796 ExternalStringTable external_string_table_; |
| 1818 | 1797 |
| 1819 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 1798 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
| 1820 | 1799 |
| 1821 bool last_empty_page_was_given_back_to_the_os_; | |
| 1822 MemoryChunk* chunks_queued_for_free_; | 1800 MemoryChunk* chunks_queued_for_free_; |
| 1823 | 1801 |
| 1824 friend class Factory; | 1802 friend class Factory; |
| 1825 friend class GCTracer; | 1803 friend class GCTracer; |
| 1826 friend class DisallowAllocationFailure; | 1804 friend class DisallowAllocationFailure; |
| 1827 friend class AlwaysAllocateScope; | 1805 friend class AlwaysAllocateScope; |
| 1828 friend class LinearAllocationScope; | 1806 friend class LinearAllocationScope; |
| 1829 friend class Page; | 1807 friend class Page; |
| 1830 friend class Isolate; | 1808 friend class Isolate; |
| 1831 friend class MarkCompactCollector; | 1809 friend class MarkCompactCollector; |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2506 | 2484 |
| 2507 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2485 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2508 }; | 2486 }; |
| 2509 #endif // DEBUG || LIVE_OBJECT_LIST | 2487 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2510 | 2488 |
| 2511 } } // namespace v8::internal | 2489 } } // namespace v8::internal |
| 2512 | 2490 |
| 2513 #undef HEAP | 2491 #undef HEAP |
| 2514 | 2492 |
| 2515 #endif // V8_HEAP_H_ | 2493 #endif // V8_HEAP_H_ |
| OLD | NEW |