OLD | NEW |
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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 // separate from old space strings. | 468 // separate from old space strings. |
469 List<Object*> new_space_strings_; | 469 List<Object*> new_space_strings_; |
470 List<Object*> old_space_strings_; | 470 List<Object*> old_space_strings_; |
471 | 471 |
472 Heap* heap_; | 472 Heap* heap_; |
473 | 473 |
474 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); | 474 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); |
475 }; | 475 }; |
476 | 476 |
477 | 477 |
478 // The stack property of an error object is implemented as a getter that | |
479 // formats the attached raw stack trace into a string. This raw stack trace | |
480 // keeps code and function objects alive until the getter is called the first | |
481 // time. To release those objects, we call the getter after each GC for | |
482 // newly tenured error objects that are kept in a list. | |
483 class ErrorObjectList { | |
484 public: | |
485 inline void Add(JSObject* object); | |
486 | |
487 inline void Iterate(ObjectVisitor* v); | |
488 | |
489 void TearDown(); | |
490 | |
491 void RemoveUnmarked(Heap* heap); | |
492 | |
493 void DeferredFormatStackTrace(Isolate* isolate); | |
494 | |
495 void UpdateReferences(); | |
496 | |
497 void UpdateReferencesInNewSpace(Heap* heap); | |
498 | |
499 private: | |
500 static const int kBudgetPerGC = 16; | |
501 | |
502 ErrorObjectList() : nested_(false) { } | |
503 | |
504 friend class Heap; | |
505 | |
506 List<Object*> list_; | |
507 bool nested_; | |
508 | |
509 DISALLOW_COPY_AND_ASSIGN(ErrorObjectList); | |
510 }; | |
511 | |
512 | |
513 enum ArrayStorageAllocationMode { | 478 enum ArrayStorageAllocationMode { |
514 DONT_INITIALIZE_ARRAY_ELEMENTS, | 479 DONT_INITIALIZE_ARRAY_ELEMENTS, |
515 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE | 480 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE |
516 }; | 481 }; |
517 | 482 |
518 class Heap { | 483 class Heap { |
519 public: | 484 public: |
520 // Configure heap size before setup. Return false if the heap has been | 485 // Configure heap size before setup. Return false if the heap has been |
521 // set up already. | 486 // set up already. |
522 bool ConfigureHeap(int max_semispace_size, | 487 bool ConfigureHeap(int max_semispace_size, |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 bool EnsureSweepersProgressed(int step_size) { | 1756 bool EnsureSweepersProgressed(int step_size) { |
1792 bool sweeping_complete = old_data_space()->EnsureSweeperProgress(step_size); | 1757 bool sweeping_complete = old_data_space()->EnsureSweeperProgress(step_size); |
1793 sweeping_complete &= old_pointer_space()->EnsureSweeperProgress(step_size); | 1758 sweeping_complete &= old_pointer_space()->EnsureSweeperProgress(step_size); |
1794 return sweeping_complete; | 1759 return sweeping_complete; |
1795 } | 1760 } |
1796 | 1761 |
1797 ExternalStringTable* external_string_table() { | 1762 ExternalStringTable* external_string_table() { |
1798 return &external_string_table_; | 1763 return &external_string_table_; |
1799 } | 1764 } |
1800 | 1765 |
1801 ErrorObjectList* error_object_list() { | |
1802 return &error_object_list_; | |
1803 } | |
1804 | |
1805 // Returns the current sweep generation. | 1766 // Returns the current sweep generation. |
1806 int sweep_generation() { | 1767 int sweep_generation() { |
1807 return sweep_generation_; | 1768 return sweep_generation_; |
1808 } | 1769 } |
1809 | 1770 |
1810 inline Isolate* isolate(); | 1771 inline Isolate* isolate(); |
1811 | 1772 |
1812 void CallGCPrologueCallbacks(GCType gc_type, GCCallbackFlags flags); | 1773 void CallGCPrologueCallbacks(GCType gc_type, GCCallbackFlags flags); |
1813 void CallGCEpilogueCallbacks(GCType gc_type); | 1774 void CallGCEpilogueCallbacks(GCType gc_type); |
1814 | 1775 |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2399 | 2360 |
2400 // Shared state read by the scavenge collector and set by ScavengeObject. | 2361 // Shared state read by the scavenge collector and set by ScavengeObject. |
2401 PromotionQueue promotion_queue_; | 2362 PromotionQueue promotion_queue_; |
2402 | 2363 |
2403 // Flag is set when the heap has been configured. The heap can be repeatedly | 2364 // Flag is set when the heap has been configured. The heap can be repeatedly |
2404 // configured through the API until it is set up. | 2365 // configured through the API until it is set up. |
2405 bool configured_; | 2366 bool configured_; |
2406 | 2367 |
2407 ExternalStringTable external_string_table_; | 2368 ExternalStringTable external_string_table_; |
2408 | 2369 |
2409 ErrorObjectList error_object_list_; | |
2410 | |
2411 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2370 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
2412 | 2371 |
2413 MemoryChunk* chunks_queued_for_free_; | 2372 MemoryChunk* chunks_queued_for_free_; |
2414 | 2373 |
2415 Mutex* relocation_mutex_; | 2374 Mutex* relocation_mutex_; |
2416 #ifdef DEBUG | 2375 #ifdef DEBUG |
2417 bool relocation_mutex_locked_by_optimizer_thread_; | 2376 bool relocation_mutex_locked_by_optimizer_thread_; |
2418 #endif // DEBUG; | 2377 #endif // DEBUG; |
2419 | 2378 |
2420 friend class Factory; | 2379 friend class Factory; |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3091 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3050 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
3092 | 3051 |
3093 private: | 3052 private: |
3094 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3053 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
3095 }; | 3054 }; |
3096 #endif // DEBUG | 3055 #endif // DEBUG |
3097 | 3056 |
3098 } } // namespace v8::internal | 3057 } } // namespace v8::internal |
3099 | 3058 |
3100 #endif // V8_HEAP_H_ | 3059 #endif // V8_HEAP_H_ |
OLD | NEW |