| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 Counters::number_of_symbols.Set(symbol_table()->NumberOfElements()); | 308 Counters::number_of_symbols.Set(symbol_table()->NumberOfElements()); |
| 309 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 309 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
| 310 ReportStatisticsAfterGC(); | 310 ReportStatisticsAfterGC(); |
| 311 #endif | 311 #endif |
| 312 #ifdef ENABLE_DEBUGGER_SUPPORT | 312 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 313 Debug::AfterGarbageCollection(); | 313 Debug::AfterGarbageCollection(); |
| 314 #endif | 314 #endif |
| 315 } | 315 } |
| 316 | 316 |
| 317 | 317 |
| 318 void Heap::CollectAllGarbage() { | 318 void Heap::CollectAllGarbage(bool force_compaction) { |
| 319 // Since we are ignoring the return value, the exact choice of space does | 319 // Since we are ignoring the return value, the exact choice of space does |
| 320 // not matter, so long as we do not specify NEW_SPACE, which would not | 320 // not matter, so long as we do not specify NEW_SPACE, which would not |
| 321 // cause a full GC. | 321 // cause a full GC. |
| 322 MarkCompactCollector::SetForceCompaction(force_compaction); |
| 322 CollectGarbage(0, OLD_POINTER_SPACE); | 323 CollectGarbage(0, OLD_POINTER_SPACE); |
| 324 MarkCompactCollector::SetForceCompaction(false); |
| 323 } | 325 } |
| 324 | 326 |
| 325 | 327 |
| 326 void Heap::CollectAllGarbageIfContextDisposed() { | 328 void Heap::CollectAllGarbageIfContextDisposed() { |
| 327 // If the garbage collector interface is exposed through the global | 329 // If the garbage collector interface is exposed through the global |
| 328 // gc() function, we avoid being clever about forcing GCs when | 330 // gc() function, we avoid being clever about forcing GCs when |
| 329 // contexts are disposed and leave it to the embedder to make | 331 // contexts are disposed and leave it to the embedder to make |
| 330 // informed decisions about when to force a collection. | 332 // informed decisions about when to force a collection. |
| 331 if (!FLAG_expose_gc && context_disposed_pending_) { | 333 if (!FLAG_expose_gc && context_disposed_pending_) { |
| 332 HistogramTimerScope scope(&Counters::gc_context); | 334 HistogramTimerScope scope(&Counters::gc_context); |
| (...skipping 3582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3915 #ifdef DEBUG | 3917 #ifdef DEBUG |
| 3916 bool Heap::GarbageCollectionGreedyCheck() { | 3918 bool Heap::GarbageCollectionGreedyCheck() { |
| 3917 ASSERT(FLAG_gc_greedy); | 3919 ASSERT(FLAG_gc_greedy); |
| 3918 if (Bootstrapper::IsActive()) return true; | 3920 if (Bootstrapper::IsActive()) return true; |
| 3919 if (disallow_allocation_failure()) return true; | 3921 if (disallow_allocation_failure()) return true; |
| 3920 return CollectGarbage(0, NEW_SPACE); | 3922 return CollectGarbage(0, NEW_SPACE); |
| 3921 } | 3923 } |
| 3922 #endif | 3924 #endif |
| 3923 | 3925 |
| 3924 } } // namespace v8::internal | 3926 } } // namespace v8::internal |
| OLD | NEW |