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 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 bool AdvanceSweepers(int step_size) { | 1570 bool AdvanceSweepers(int step_size) { |
1607 bool sweeping_complete = old_data_space()->AdvanceSweeper(step_size); | 1571 bool sweeping_complete = old_data_space()->AdvanceSweeper(step_size); |
1608 sweeping_complete &= old_pointer_space()->AdvanceSweeper(step_size); | 1572 sweeping_complete &= old_pointer_space()->AdvanceSweeper(step_size); |
1609 return sweeping_complete; | 1573 return sweeping_complete; |
1610 } | 1574 } |
1611 | 1575 |
1612 ExternalStringTable* external_string_table() { | 1576 ExternalStringTable* external_string_table() { |
1613 return &external_string_table_; | 1577 return &external_string_table_; |
1614 } | 1578 } |
1615 | 1579 |
1616 ErrorObjectList* error_object_list() { | |
1617 return &error_object_list_; | |
1618 } | |
1619 | |
1620 // Returns the current sweep generation. | 1580 // Returns the current sweep generation. |
1621 int sweep_generation() { | 1581 int sweep_generation() { |
1622 return sweep_generation_; | 1582 return sweep_generation_; |
1623 } | 1583 } |
1624 | 1584 |
1625 inline Isolate* isolate(); | 1585 inline Isolate* isolate(); |
1626 | 1586 |
1627 inline void CallGlobalGCPrologueCallback() { | 1587 inline void CallGlobalGCPrologueCallback() { |
1628 if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_(); | 1588 if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_(); |
1629 } | 1589 } |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2186 | 2146 |
2187 // Shared state read by the scavenge collector and set by ScavengeObject. | 2147 // Shared state read by the scavenge collector and set by ScavengeObject. |
2188 PromotionQueue promotion_queue_; | 2148 PromotionQueue promotion_queue_; |
2189 | 2149 |
2190 // Flag is set when the heap has been configured. The heap can be repeatedly | 2150 // Flag is set when the heap has been configured. The heap can be repeatedly |
2191 // configured through the API until it is set up. | 2151 // configured through the API until it is set up. |
2192 bool configured_; | 2152 bool configured_; |
2193 | 2153 |
2194 ExternalStringTable external_string_table_; | 2154 ExternalStringTable external_string_table_; |
2195 | 2155 |
2196 ErrorObjectList error_object_list_; | |
2197 | |
2198 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2156 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
2199 | 2157 |
2200 MemoryChunk* chunks_queued_for_free_; | 2158 MemoryChunk* chunks_queued_for_free_; |
2201 | 2159 |
2202 Mutex* relocation_mutex_; | 2160 Mutex* relocation_mutex_; |
2203 | 2161 |
2204 friend class Factory; | 2162 friend class Factory; |
2205 friend class GCTracer; | 2163 friend class GCTracer; |
2206 friend class DisallowAllocationFailure; | 2164 friend class DisallowAllocationFailure; |
2207 friend class AlwaysAllocateScope; | 2165 friend class AlwaysAllocateScope; |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2883 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2841 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
2884 | 2842 |
2885 private: | 2843 private: |
2886 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2844 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2887 }; | 2845 }; |
2888 #endif // DEBUG || LIVE_OBJECT_LIST | 2846 #endif // DEBUG || LIVE_OBJECT_LIST |
2889 | 2847 |
2890 } } // namespace v8::internal | 2848 } } // namespace v8::internal |
2891 | 2849 |
2892 #endif // V8_HEAP_H_ | 2850 #endif // V8_HEAP_H_ |
OLD | NEW |