| 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 17 matching lines...) Expand all Loading... |
| 28 #ifndef V8_HEAP_H_ | 28 #ifndef V8_HEAP_H_ |
| 29 #define V8_HEAP_H_ | 29 #define V8_HEAP_H_ |
| 30 | 30 |
| 31 #include <math.h> | 31 #include <math.h> |
| 32 | 32 |
| 33 #include "allocation.h" | 33 #include "allocation.h" |
| 34 #include "globals.h" | 34 #include "globals.h" |
| 35 #include "incremental-marking.h" | 35 #include "incremental-marking.h" |
| 36 #include "list.h" | 36 #include "list.h" |
| 37 #include "mark-compact.h" | 37 #include "mark-compact.h" |
| 38 #include "objects-visiting.h" |
| 38 #include "spaces.h" | 39 #include "spaces.h" |
| 39 #include "splay-tree-inl.h" | 40 #include "splay-tree-inl.h" |
| 40 #include "store-buffer.h" | 41 #include "store-buffer.h" |
| 41 #include "v8-counters.h" | 42 #include "v8-counters.h" |
| 42 #include "v8globals.h" | 43 #include "v8globals.h" |
| 43 | 44 |
| 44 namespace v8 { | 45 namespace v8 { |
| 45 namespace internal { | 46 namespace internal { |
| 46 | 47 |
| 47 // TODO(isolates): remove HEAP here | 48 // TODO(isolates): remove HEAP here |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 286 |
| 286 private: | 287 private: |
| 287 // The front of the queue is higher in memory than the rear. | 288 // The front of the queue is higher in memory than the rear. |
| 288 intptr_t* front_; | 289 intptr_t* front_; |
| 289 intptr_t* rear_; | 290 intptr_t* rear_; |
| 290 | 291 |
| 291 DISALLOW_COPY_AND_ASSIGN(PromotionQueue); | 292 DISALLOW_COPY_AND_ASSIGN(PromotionQueue); |
| 292 }; | 293 }; |
| 293 | 294 |
| 294 | 295 |
| 296 typedef void (*ScavengingCallback)(Map* map, |
| 297 HeapObject** slot, |
| 298 HeapObject* object); |
| 299 |
| 300 |
| 295 // External strings table is a place where all external strings are | 301 // External strings table is a place where all external strings are |
| 296 // registered. We need to keep track of such strings to properly | 302 // registered. We need to keep track of such strings to properly |
| 297 // finalize them. | 303 // finalize them. |
| 298 class ExternalStringTable { | 304 class ExternalStringTable { |
| 299 public: | 305 public: |
| 300 // Registers an external string. | 306 // Registers an external string. |
| 301 inline void AddString(String* string); | 307 inline void AddString(String* string); |
| 302 | 308 |
| 303 inline void Iterate(ObjectVisitor* v); | 309 inline void Iterate(ObjectVisitor* v); |
| 304 | 310 |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_(); | 1320 if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_(); |
| 1315 } | 1321 } |
| 1316 | 1322 |
| 1317 inline void CallGlobalGCEpilogueCallback() { | 1323 inline void CallGlobalGCEpilogueCallback() { |
| 1318 if (global_gc_epilogue_callback_ != NULL) global_gc_epilogue_callback_(); | 1324 if (global_gc_epilogue_callback_ != NULL) global_gc_epilogue_callback_(); |
| 1319 } | 1325 } |
| 1320 | 1326 |
| 1321 | 1327 |
| 1322 inline bool OldGenerationAllocationLimitReached(); | 1328 inline bool OldGenerationAllocationLimitReached(); |
| 1323 | 1329 |
| 1330 inline void DoScavengeObject(Map* map, HeapObject** slot, HeapObject* obj) { |
| 1331 scavenging_visitors_table_.GetVisitor(map)(map, slot, obj); |
| 1332 } |
| 1333 |
| 1324 private: | 1334 private: |
| 1325 Heap(); | 1335 Heap(); |
| 1326 | 1336 |
| 1327 // This can be calculated directly from a pointer to the heap; however, it is | 1337 // This can be calculated directly from a pointer to the heap; however, it is |
| 1328 // more expedient to get at the isolate directly from within Heap methods. | 1338 // more expedient to get at the isolate directly from within Heap methods. |
| 1329 Isolate* isolate_; | 1339 Isolate* isolate_; |
| 1330 | 1340 |
| 1331 int reserved_semispace_size_; | 1341 int reserved_semispace_size_; |
| 1332 int max_semispace_size_; | 1342 int max_semispace_size_; |
| 1333 int initial_semispace_size_; | 1343 int initial_semispace_size_; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 | 1538 |
| 1529 void CreateFixedStubs(); | 1539 void CreateFixedStubs(); |
| 1530 | 1540 |
| 1531 MaybeObject* CreateOddball(const char* to_string, | 1541 MaybeObject* CreateOddball(const char* to_string, |
| 1532 Object* to_number, | 1542 Object* to_number, |
| 1533 byte kind); | 1543 byte kind); |
| 1534 | 1544 |
| 1535 // Allocate empty fixed array. | 1545 // Allocate empty fixed array. |
| 1536 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray(); | 1546 MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray(); |
| 1537 | 1547 |
| 1538 void SwitchScavengingVisitorsTableIfProfilingWasEnabled(); | |
| 1539 | |
| 1540 // Performs a minor collection in new generation. | 1548 // Performs a minor collection in new generation. |
| 1541 void Scavenge(); | 1549 void Scavenge(); |
| 1542 | 1550 |
| 1543 static String* UpdateNewSpaceReferenceInExternalStringTableEntry( | 1551 static String* UpdateNewSpaceReferenceInExternalStringTableEntry( |
| 1544 Heap* heap, | 1552 Heap* heap, |
| 1545 Object** pointer); | 1553 Object** pointer); |
| 1546 | 1554 |
| 1547 Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front); | 1555 Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front); |
| 1548 static void ScavengeStoreBufferCallback(Heap* heap, | 1556 static void ScavengeStoreBufferCallback(Heap* heap, |
| 1549 MemoryChunk* page, | 1557 MemoryChunk* page, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 | 1680 |
| 1673 // Shared state read by the scavenge collector and set by ScavengeObject. | 1681 // Shared state read by the scavenge collector and set by ScavengeObject. |
| 1674 PromotionQueue promotion_queue_; | 1682 PromotionQueue promotion_queue_; |
| 1675 | 1683 |
| 1676 // Flag is set when the heap has been configured. The heap can be repeatedly | 1684 // Flag is set when the heap has been configured. The heap can be repeatedly |
| 1677 // configured through the API until it is setup. | 1685 // configured through the API until it is setup. |
| 1678 bool configured_; | 1686 bool configured_; |
| 1679 | 1687 |
| 1680 ExternalStringTable external_string_table_; | 1688 ExternalStringTable external_string_table_; |
| 1681 | 1689 |
| 1690 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
| 1691 |
| 1682 friend class Factory; | 1692 friend class Factory; |
| 1683 friend class GCTracer; | 1693 friend class GCTracer; |
| 1684 friend class DisallowAllocationFailure; | 1694 friend class DisallowAllocationFailure; |
| 1685 friend class AlwaysAllocateScope; | 1695 friend class AlwaysAllocateScope; |
| 1686 friend class LinearAllocationScope; | 1696 friend class LinearAllocationScope; |
| 1687 friend class Page; | 1697 friend class Page; |
| 1688 friend class Isolate; | 1698 friend class Isolate; |
| 1689 friend class MarkCompactCollector; | 1699 friend class MarkCompactCollector; |
| 1690 friend class MapCompact; | 1700 friend class MapCompact; |
| 1691 | 1701 |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2346 | 2356 |
| 2347 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2357 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2348 }; | 2358 }; |
| 2349 #endif // DEBUG || LIVE_OBJECT_LIST | 2359 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2350 | 2360 |
| 2351 } } // namespace v8::internal | 2361 } } // namespace v8::internal |
| 2352 | 2362 |
| 2353 #undef HEAP | 2363 #undef HEAP |
| 2354 | 2364 |
| 2355 #endif // V8_HEAP_H_ | 2365 #endif // V8_HEAP_H_ |
| OLD | NEW |