| 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 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 bool AdvanceSweepers(int step_size) { | 1618 bool AdvanceSweepers(int step_size) { |
| 1583 bool sweeping_complete = old_data_space()->AdvanceSweeper(step_size); | 1619 bool sweeping_complete = old_data_space()->AdvanceSweeper(step_size); |
| 1584 sweeping_complete &= old_pointer_space()->AdvanceSweeper(step_size); | 1620 sweeping_complete &= old_pointer_space()->AdvanceSweeper(step_size); |
| 1585 return sweeping_complete; | 1621 return sweeping_complete; |
| 1586 } | 1622 } |
| 1587 | 1623 |
| 1588 ExternalStringTable* external_string_table() { | 1624 ExternalStringTable* external_string_table() { |
| 1589 return &external_string_table_; | 1625 return &external_string_table_; |
| 1590 } | 1626 } |
| 1591 | 1627 |
| 1628 ErrorObjectList* error_object_list() { |
| 1629 return &error_object_list_; |
| 1630 } |
| 1631 |
| 1592 // Returns the current sweep generation. | 1632 // Returns the current sweep generation. |
| 1593 int sweep_generation() { | 1633 int sweep_generation() { |
| 1594 return sweep_generation_; | 1634 return sweep_generation_; |
| 1595 } | 1635 } |
| 1596 | 1636 |
| 1597 inline Isolate* isolate(); | 1637 inline Isolate* isolate(); |
| 1598 | 1638 |
| 1599 inline void CallGlobalGCPrologueCallback() { | 1639 inline void CallGlobalGCPrologueCallback() { |
| 1600 if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_(); | 1640 if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_(); |
| 1601 } | 1641 } |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2158 | 2198 |
| 2159 // Shared state read by the scavenge collector and set by ScavengeObject. | 2199 // Shared state read by the scavenge collector and set by ScavengeObject. |
| 2160 PromotionQueue promotion_queue_; | 2200 PromotionQueue promotion_queue_; |
| 2161 | 2201 |
| 2162 // Flag is set when the heap has been configured. The heap can be repeatedly | 2202 // Flag is set when the heap has been configured. The heap can be repeatedly |
| 2163 // configured through the API until it is set up. | 2203 // configured through the API until it is set up. |
| 2164 bool configured_; | 2204 bool configured_; |
| 2165 | 2205 |
| 2166 ExternalStringTable external_string_table_; | 2206 ExternalStringTable external_string_table_; |
| 2167 | 2207 |
| 2208 ErrorObjectList error_object_list_; |
| 2209 |
| 2168 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 2210 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
| 2169 | 2211 |
| 2170 MemoryChunk* chunks_queued_for_free_; | 2212 MemoryChunk* chunks_queued_for_free_; |
| 2171 | 2213 |
| 2172 Mutex* relocation_mutex_; | 2214 Mutex* relocation_mutex_; |
| 2173 | 2215 |
| 2174 friend class Factory; | 2216 friend class Factory; |
| 2175 friend class GCTracer; | 2217 friend class GCTracer; |
| 2176 friend class DisallowAllocationFailure; | 2218 friend class DisallowAllocationFailure; |
| 2177 friend class AlwaysAllocateScope; | 2219 friend class AlwaysAllocateScope; |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2853 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2895 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
| 2854 | 2896 |
| 2855 private: | 2897 private: |
| 2856 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2898 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2857 }; | 2899 }; |
| 2858 #endif // DEBUG || LIVE_OBJECT_LIST | 2900 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2859 | 2901 |
| 2860 } } // namespace v8::internal | 2902 } } // namespace v8::internal |
| 2861 | 2903 |
| 2862 #endif // V8_HEAP_H_ | 2904 #endif // V8_HEAP_H_ |
| OLD | NEW |