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") \ |
212 V(InitializeVarGlobal_symbol, "InitializeVarGlobal") \ | 213 V(InitializeVarGlobal_symbol, "InitializeVarGlobal") \ |
213 V(InitializeConstGlobal_symbol, "InitializeConstGlobal") \ | 214 V(InitializeConstGlobal_symbol, "InitializeConstGlobal") \ |
214 V(KeyedLoadElementMonomorphic_symbol, \ | 215 V(KeyedLoadElementMonomorphic_symbol, \ |
215 "KeyedLoadElementMonomorphic") \ | 216 "KeyedLoadElementMonomorphic") \ |
216 V(KeyedStoreElementMonomorphic_symbol, \ | 217 V(KeyedStoreElementMonomorphic_symbol, \ |
217 "KeyedStoreElementMonomorphic") \ | 218 "KeyedStoreElementMonomorphic") \ |
218 V(KeyedStoreAndGrowElementMonomorphic_symbol, \ | 219 V(KeyedStoreAndGrowElementMonomorphic_symbol, \ |
219 "KeyedStoreAndGrowElementMonomorphic") \ | 220 "KeyedStoreAndGrowElementMonomorphic") \ |
220 V(stack_overflow_symbol, "kStackOverflowBoilerplate") \ | 221 V(stack_overflow_symbol, "kStackOverflowBoilerplate") \ |
221 V(illegal_access_symbol, "illegal access") \ | 222 V(illegal_access_symbol, "illegal access") \ |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 // separate from old space strings. | 421 // separate from old space strings. |
421 List<Object*> new_space_strings_; | 422 List<Object*> new_space_strings_; |
422 List<Object*> old_space_strings_; | 423 List<Object*> old_space_strings_; |
423 | 424 |
424 Heap* heap_; | 425 Heap* heap_; |
425 | 426 |
426 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); | 427 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); |
427 }; | 428 }; |
428 | 429 |
429 | 430 |
| 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 |
430 enum ArrayStorageAllocationMode { | 466 enum ArrayStorageAllocationMode { |
431 DONT_INITIALIZE_ARRAY_ELEMENTS, | 467 DONT_INITIALIZE_ARRAY_ELEMENTS, |
432 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE | 468 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE |
433 }; | 469 }; |
434 | 470 |
435 class Heap { | 471 class Heap { |
436 public: | 472 public: |
437 // Configure heap size before setup. Return false if the heap has been | 473 // Configure heap size before setup. Return false if the heap has been |
438 // set up already. | 474 // set up already. |
439 bool ConfigureHeap(int max_semispace_size, | 475 bool ConfigureHeap(int max_semispace_size, |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 bool AdvanceSweepers(int step_size) { | 1602 bool AdvanceSweepers(int step_size) { |
1567 bool sweeping_complete = old_data_space()->AdvanceSweeper(step_size); | 1603 bool sweeping_complete = old_data_space()->AdvanceSweeper(step_size); |
1568 sweeping_complete &= old_pointer_space()->AdvanceSweeper(step_size); | 1604 sweeping_complete &= old_pointer_space()->AdvanceSweeper(step_size); |
1569 return sweeping_complete; | 1605 return sweeping_complete; |
1570 } | 1606 } |
1571 | 1607 |
1572 ExternalStringTable* external_string_table() { | 1608 ExternalStringTable* external_string_table() { |
1573 return &external_string_table_; | 1609 return &external_string_table_; |
1574 } | 1610 } |
1575 | 1611 |
| 1612 ErrorObjectList* error_object_list() { |
| 1613 return &error_object_list_; |
| 1614 } |
| 1615 |
1576 // Returns the current sweep generation. | 1616 // Returns the current sweep generation. |
1577 int sweep_generation() { | 1617 int sweep_generation() { |
1578 return sweep_generation_; | 1618 return sweep_generation_; |
1579 } | 1619 } |
1580 | 1620 |
1581 inline Isolate* isolate(); | 1621 inline Isolate* isolate(); |
1582 | 1622 |
1583 inline void CallGlobalGCPrologueCallback() { | 1623 inline void CallGlobalGCPrologueCallback() { |
1584 if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_(); | 1624 if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_(); |
1585 } | 1625 } |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 | 2182 |
2143 // Shared state read by the scavenge collector and set by ScavengeObject. | 2183 // Shared state read by the scavenge collector and set by ScavengeObject. |
2144 PromotionQueue promotion_queue_; | 2184 PromotionQueue promotion_queue_; |
2145 | 2185 |
2146 // Flag is set when the heap has been configured. The heap can be repeatedly | 2186 // Flag is set when the heap has been configured. The heap can be repeatedly |
2147 // configured through the API until it is set up. | 2187 // configured through the API until it is set up. |
2148 bool configured_; | 2188 bool configured_; |
2149 | 2189 |
2150 ExternalStringTable external_string_table_; | 2190 ExternalStringTable external_string_table_; |
2151 | 2191 |
| 2192 ErrorObjectList error_object_list_; |
| 2193 |
2152 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2194 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
2153 | 2195 |
2154 MemoryChunk* chunks_queued_for_free_; | 2196 MemoryChunk* chunks_queued_for_free_; |
2155 | 2197 |
2156 Mutex* relocation_mutex_; | 2198 Mutex* relocation_mutex_; |
2157 | 2199 |
2158 friend class Factory; | 2200 friend class Factory; |
2159 friend class GCTracer; | 2201 friend class GCTracer; |
2160 friend class DisallowAllocationFailure; | 2202 friend class DisallowAllocationFailure; |
2161 friend class AlwaysAllocateScope; | 2203 friend class AlwaysAllocateScope; |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2837 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2879 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
2838 | 2880 |
2839 private: | 2881 private: |
2840 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2882 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2841 }; | 2883 }; |
2842 #endif // DEBUG || LIVE_OBJECT_LIST | 2884 #endif // DEBUG || LIVE_OBJECT_LIST |
2843 | 2885 |
2844 } } // namespace v8::internal | 2886 } } // namespace v8::internal |
2845 | 2887 |
2846 #endif // V8_HEAP_H_ | 2888 #endif // V8_HEAP_H_ |
OLD | NEW |