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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 V(object_symbol, "object") \ | 202 V(object_symbol, "object") \ |
203 V(prototype_symbol, "prototype") \ | 203 V(prototype_symbol, "prototype") \ |
204 V(string_symbol, "string") \ | 204 V(string_symbol, "string") \ |
205 V(String_symbol, "String") \ | 205 V(String_symbol, "String") \ |
206 V(Date_symbol, "Date") \ | 206 V(Date_symbol, "Date") \ |
207 V(this_symbol, "this") \ | 207 V(this_symbol, "this") \ |
208 V(to_string_symbol, "toString") \ | 208 V(to_string_symbol, "toString") \ |
209 V(char_at_symbol, "CharAt") \ | 209 V(char_at_symbol, "CharAt") \ |
210 V(undefined_symbol, "undefined") \ | 210 V(undefined_symbol, "undefined") \ |
211 V(value_of_symbol, "valueOf") \ | 211 V(value_of_symbol, "valueOf") \ |
212 V(stack_symbol, "stack") \ | |
213 V(InitializeVarGlobal_symbol, "InitializeVarGlobal") \ | 212 V(InitializeVarGlobal_symbol, "InitializeVarGlobal") \ |
214 V(InitializeConstGlobal_symbol, "InitializeConstGlobal") \ | 213 V(InitializeConstGlobal_symbol, "InitializeConstGlobal") \ |
215 V(KeyedLoadElementMonomorphic_symbol, \ | 214 V(KeyedLoadElementMonomorphic_symbol, \ |
216 "KeyedLoadElementMonomorphic") \ | 215 "KeyedLoadElementMonomorphic") \ |
217 V(KeyedStoreElementMonomorphic_symbol, \ | 216 V(KeyedStoreElementMonomorphic_symbol, \ |
218 "KeyedStoreElementMonomorphic") \ | 217 "KeyedStoreElementMonomorphic") \ |
219 V(KeyedStoreAndGrowElementMonomorphic_symbol, \ | 218 V(KeyedStoreAndGrowElementMonomorphic_symbol, \ |
220 "KeyedStoreAndGrowElementMonomorphic") \ | 219 "KeyedStoreAndGrowElementMonomorphic") \ |
221 V(stack_overflow_symbol, "kStackOverflowBoilerplate") \ | 220 V(stack_overflow_symbol, "kStackOverflowBoilerplate") \ |
222 V(illegal_access_symbol, "illegal access") \ | 221 V(illegal_access_symbol, "illegal access") \ |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // separate from old space strings. | 420 // separate from old space strings. |
422 List<Object*> new_space_strings_; | 421 List<Object*> new_space_strings_; |
423 List<Object*> old_space_strings_; | 422 List<Object*> old_space_strings_; |
424 | 423 |
425 Heap* heap_; | 424 Heap* heap_; |
426 | 425 |
427 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); | 426 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); |
428 }; | 427 }; |
429 | 428 |
430 | 429 |
431 // The stack property of an error object is implemented as a getter that | |
432 // formats the attached raw stack trace into a string. This raw stack trace | |
433 // keeps code and function objects alive until the getter is called the first | |
434 // time. To release those objects, we call the getter after each GC for | |
435 // newly tenured error objects that are kept in a list. | |
436 class ErrorObjectList { | |
437 public: | |
438 inline void Add(JSObject* object); | |
439 | |
440 inline void Iterate(ObjectVisitor* v); | |
441 | |
442 void TearDown(); | |
443 | |
444 void RemoveUnmarked(Heap* heap); | |
445 | |
446 void DeferredFormatStackTrace(Isolate* isolate); | |
447 | |
448 void UpdateReferences(); | |
449 | |
450 void UpdateReferencesInNewSpace(Heap* heap); | |
451 | |
452 private: | |
453 static const int kBudgetPerGC = 16; | |
454 | |
455 ErrorObjectList() : nested_(false) { } | |
456 | |
457 friend class Heap; | |
458 | |
459 List<Object*> list_; | |
460 bool nested_; | |
461 | |
462 DISALLOW_COPY_AND_ASSIGN(ErrorObjectList); | |
463 }; | |
464 | |
465 | |
466 enum ArrayStorageAllocationMode { | 430 enum ArrayStorageAllocationMode { |
467 DONT_INITIALIZE_ARRAY_ELEMENTS, | 431 DONT_INITIALIZE_ARRAY_ELEMENTS, |
468 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE | 432 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE |
469 }; | 433 }; |
470 | 434 |
471 class Heap { | 435 class Heap { |
472 public: | 436 public: |
473 // Configure heap size before setup. Return false if the heap has been | 437 // Configure heap size before setup. Return false if the heap has been |
474 // set up already. | 438 // set up already. |
475 bool ConfigureHeap(int max_semispace_size, | 439 bool ConfigureHeap(int max_semispace_size, |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 bool AdvanceSweepers(int step_size) { | 1582 bool AdvanceSweepers(int step_size) { |
1619 bool sweeping_complete = old_data_space()->AdvanceSweeper(step_size); | 1583 bool sweeping_complete = old_data_space()->AdvanceSweeper(step_size); |
1620 sweeping_complete &= old_pointer_space()->AdvanceSweeper(step_size); | 1584 sweeping_complete &= old_pointer_space()->AdvanceSweeper(step_size); |
1621 return sweeping_complete; | 1585 return sweeping_complete; |
1622 } | 1586 } |
1623 | 1587 |
1624 ExternalStringTable* external_string_table() { | 1588 ExternalStringTable* external_string_table() { |
1625 return &external_string_table_; | 1589 return &external_string_table_; |
1626 } | 1590 } |
1627 | 1591 |
1628 ErrorObjectList* error_object_list() { | |
1629 return &error_object_list_; | |
1630 } | |
1631 | |
1632 // Returns the current sweep generation. | 1592 // Returns the current sweep generation. |
1633 int sweep_generation() { | 1593 int sweep_generation() { |
1634 return sweep_generation_; | 1594 return sweep_generation_; |
1635 } | 1595 } |
1636 | 1596 |
1637 inline Isolate* isolate(); | 1597 inline Isolate* isolate(); |
1638 | 1598 |
1639 inline void CallGlobalGCPrologueCallback() { | 1599 inline void CallGlobalGCPrologueCallback() { |
1640 if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_(); | 1600 if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_(); |
1641 } | 1601 } |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2198 | 2158 |
2199 // Shared state read by the scavenge collector and set by ScavengeObject. | 2159 // Shared state read by the scavenge collector and set by ScavengeObject. |
2200 PromotionQueue promotion_queue_; | 2160 PromotionQueue promotion_queue_; |
2201 | 2161 |
2202 // Flag is set when the heap has been configured. The heap can be repeatedly | 2162 // Flag is set when the heap has been configured. The heap can be repeatedly |
2203 // configured through the API until it is set up. | 2163 // configured through the API until it is set up. |
2204 bool configured_; | 2164 bool configured_; |
2205 | 2165 |
2206 ExternalStringTable external_string_table_; | 2166 ExternalStringTable external_string_table_; |
2207 | 2167 |
2208 ErrorObjectList error_object_list_; | |
2209 | |
2210 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2168 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
2211 | 2169 |
2212 MemoryChunk* chunks_queued_for_free_; | 2170 MemoryChunk* chunks_queued_for_free_; |
2213 | 2171 |
2214 Mutex* relocation_mutex_; | 2172 Mutex* relocation_mutex_; |
2215 | 2173 |
2216 friend class Factory; | 2174 friend class Factory; |
2217 friend class GCTracer; | 2175 friend class GCTracer; |
2218 friend class DisallowAllocationFailure; | 2176 friend class DisallowAllocationFailure; |
2219 friend class AlwaysAllocateScope; | 2177 friend class AlwaysAllocateScope; |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2895 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2853 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
2896 | 2854 |
2897 private: | 2855 private: |
2898 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2856 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2899 }; | 2857 }; |
2900 #endif // DEBUG || LIVE_OBJECT_LIST | 2858 #endif // DEBUG || LIVE_OBJECT_LIST |
2901 | 2859 |
2902 } } // namespace v8::internal | 2860 } } // namespace v8::internal |
2903 | 2861 |
2904 #endif // V8_HEAP_H_ | 2862 #endif // V8_HEAP_H_ |
OLD | NEW |