| 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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 // string might stay non-flat even when not a failure is returned. | 912 // string might stay non-flat even when not a failure is returned. |
| 913 // | 913 // |
| 914 // Please note this function does not perform a garbage collection. | 914 // Please note this function does not perform a garbage collection. |
| 915 MUST_USE_RESULT inline MaybeObject* PrepareForCompare(String* str); | 915 MUST_USE_RESULT inline MaybeObject* PrepareForCompare(String* str); |
| 916 | 916 |
| 917 // Converts the given boolean condition to JavaScript boolean value. | 917 // Converts the given boolean condition to JavaScript boolean value. |
| 918 inline Object* ToBoolean(bool condition); | 918 inline Object* ToBoolean(bool condition); |
| 919 | 919 |
| 920 // Code that should be run before and after each GC. Includes some | 920 // Code that should be run before and after each GC. Includes some |
| 921 // reporting/verification activities when compiled with DEBUG set. | 921 // reporting/verification activities when compiled with DEBUG set. |
| 922 void GarbageCollectionPrologue(); | 922 void GarbageCollectionPrologue(GarbageCollector collector); |
| 923 void GarbageCollectionEpilogue(); | 923 void GarbageCollectionEpilogue(); |
| 924 | 924 |
| 925 // Performs garbage collection operation. | 925 // Performs garbage collection operation. |
| 926 // Returns whether there is a chance that another major GC could | 926 // Returns whether there is a chance that another major GC could |
| 927 // collect more garbage. | 927 // collect more garbage. |
| 928 bool CollectGarbage(AllocationSpace space, GarbageCollector collector); | 928 bool CollectGarbage(AllocationSpace space, GarbageCollector collector); |
| 929 | 929 |
| 930 // Performs garbage collection operation. | 930 // Performs garbage collection operation. |
| 931 // Returns whether there is a chance that another major GC could | 931 // Returns whether there is a chance that another major GC could |
| 932 // collect more garbage. | 932 // collect more garbage. |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 return last_empty_page_was_given_back_to_the_os_; | 1448 return last_empty_page_was_given_back_to_the_os_; |
| 1449 } | 1449 } |
| 1450 | 1450 |
| 1451 void QueueMemoryChunkForFree(MemoryChunk* chunk); | 1451 void QueueMemoryChunkForFree(MemoryChunk* chunk); |
| 1452 void FreeQueuedChunks(); | 1452 void FreeQueuedChunks(); |
| 1453 | 1453 |
| 1454 // Completely clear the Instanceof cache (to stop it keeping objects alive | 1454 // Completely clear the Instanceof cache (to stop it keeping objects alive |
| 1455 // around a GC). | 1455 // around a GC). |
| 1456 inline void CompletelyClearInstanceofCache(); | 1456 inline void CompletelyClearInstanceofCache(); |
| 1457 | 1457 |
| 1458 // Heap visualizer support. |
| 1459 bool has_visualizer() { return visualizer_ != NULL; } |
| 1460 HeapVisualizer* visualizer() { return visualizer_; } |
| 1461 void set_visualizer(HeapVisualizer* that) { |
| 1462 visualizer_ = that; |
| 1463 } |
| 1464 void UpdateVisualizers(Page* page); |
| 1465 void UpdateVisualizer(HeapVisualizer* visualizer); |
| 1466 void VisualizeCrankshaft(); // Entering Crankshaft optimizer. |
| 1467 void VisualizeCrankshaftDone(); // Exiting Crankshaft optimizer. |
| 1468 void UpdateHeapVisualizer(HeapVisualizer* visualizer, NewSpace* space); |
| 1469 void UpdateHeapVisualizer(HeapVisualizer* visualizer, PagedSpace* space); |
| 1470 void UpdateHeapVisualizer(HeapVisualizer* visualizer, |
| 1471 LargeObjectSpace* space); |
| 1472 void VisualizerTimeStamp(HeapVisualizer::ProfileState); |
| 1473 |
| 1458 private: | 1474 private: |
| 1459 Heap(); | 1475 Heap(); |
| 1460 | 1476 |
| 1461 // This can be calculated directly from a pointer to the heap; however, it is | 1477 // This can be calculated directly from a pointer to the heap; however, it is |
| 1462 // more expedient to get at the isolate directly from within Heap methods. | 1478 // more expedient to get at the isolate directly from within Heap methods. |
| 1463 Isolate* isolate_; | 1479 Isolate* isolate_; |
| 1464 | 1480 |
| 1465 intptr_t code_range_size_; | 1481 intptr_t code_range_size_; |
| 1466 int reserved_semispace_size_; | 1482 int reserved_semispace_size_; |
| 1467 int max_semispace_size_; | 1483 int max_semispace_size_; |
| 1468 int initial_semispace_size_; | 1484 int initial_semispace_size_; |
| 1469 intptr_t max_old_generation_size_; | 1485 intptr_t max_old_generation_size_; |
| 1470 intptr_t max_executable_size_; | 1486 intptr_t max_executable_size_; |
| 1471 | 1487 |
| 1472 // For keeping track of how much data has survived | 1488 // For keeping track of how much data has survived |
| 1473 // scavenge since last new space expansion. | 1489 // scavenge since last new space expansion. |
| 1474 int survived_since_last_expansion_; | 1490 int survived_since_last_expansion_; |
| 1475 | 1491 |
| 1476 // For keeping track on when to flush RegExp code. | 1492 // For keeping track on when to flush RegExp code. |
| 1477 int sweep_generation_; | 1493 int sweep_generation_; |
| 1478 | 1494 |
| 1479 int always_allocate_scope_depth_; | 1495 int always_allocate_scope_depth_; |
| 1480 int linear_allocation_scope_depth_; | 1496 int linear_allocation_scope_depth_; |
| 1481 | 1497 |
| 1498 HeapVisualizer* visualizer_; |
| 1499 |
| 1482 // For keeping track of context disposals. | 1500 // For keeping track of context disposals. |
| 1483 int contexts_disposed_; | 1501 int contexts_disposed_; |
| 1484 | 1502 |
| 1485 int scan_on_scavenge_pages_; | 1503 int scan_on_scavenge_pages_; |
| 1486 | 1504 |
| 1487 #if defined(V8_TARGET_ARCH_X64) | 1505 #if defined(V8_TARGET_ARCH_X64) |
| 1488 static const int kMaxObjectSizeInNewSpace = 1024*KB; | 1506 static const int kMaxObjectSizeInNewSpace = 1024*KB; |
| 1489 #else | 1507 #else |
| 1490 static const int kMaxObjectSizeInNewSpace = 512*KB; | 1508 static const int kMaxObjectSizeInNewSpace = 512*KB; |
| 1491 #endif | 1509 #endif |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2506 | 2524 |
| 2507 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2525 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2508 }; | 2526 }; |
| 2509 #endif // DEBUG || LIVE_OBJECT_LIST | 2527 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2510 | 2528 |
| 2511 } } // namespace v8::internal | 2529 } } // namespace v8::internal |
| 2512 | 2530 |
| 2513 #undef HEAP | 2531 #undef HEAP |
| 2514 | 2532 |
| 2515 #endif // V8_HEAP_H_ | 2533 #endif // V8_HEAP_H_ |
| OLD | NEW |