Chromium Code Reviews| 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 bool saved_always_compact_flag = FLAG_always_compact; | |
|
Mads Ager (chromium)
2009/08/19 17:24:23
I would prefer to not use the flags to signal that
Feng Qian
2009/08/20 00:06:08
I had the same thought. There is no obvious way to
| |
| 323 FLAG_always_compact = force_compaction; | |
| 322 CollectGarbage(0, OLD_POINTER_SPACE); | 324 CollectGarbage(0, OLD_POINTER_SPACE); |
| 325 FLAG_always_compact = saved_always_compact_flag; | |
| 323 } | 326 } |
| 324 | 327 |
| 325 | 328 |
| 326 void Heap::CollectAllGarbageIfContextDisposed() { | 329 void Heap::CollectAllGarbageIfContextDisposed() { |
| 327 // If the garbage collector interface is exposed through the global | 330 // If the garbage collector interface is exposed through the global |
| 328 // gc() function, we avoid being clever about forcing GCs when | 331 // gc() function, we avoid being clever about forcing GCs when |
| 329 // contexts are disposed and leave it to the embedder to make | 332 // contexts are disposed and leave it to the embedder to make |
| 330 // informed decisions about when to force a collection. | 333 // informed decisions about when to force a collection. |
| 331 if (!FLAG_expose_gc && context_disposed_pending_) { | 334 if (!FLAG_expose_gc && context_disposed_pending_) { |
| 332 HistogramTimerScope scope(&Counters::gc_context); | 335 HistogramTimerScope scope(&Counters::gc_context); |
| (...skipping 3552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3885 #ifdef DEBUG | 3888 #ifdef DEBUG |
| 3886 bool Heap::GarbageCollectionGreedyCheck() { | 3889 bool Heap::GarbageCollectionGreedyCheck() { |
| 3887 ASSERT(FLAG_gc_greedy); | 3890 ASSERT(FLAG_gc_greedy); |
| 3888 if (Bootstrapper::IsActive()) return true; | 3891 if (Bootstrapper::IsActive()) return true; |
| 3889 if (disallow_allocation_failure()) return true; | 3892 if (disallow_allocation_failure()) return true; |
| 3890 return CollectGarbage(0, NEW_SPACE); | 3893 return CollectGarbage(0, NEW_SPACE); |
| 3891 } | 3894 } |
| 3892 #endif | 3895 #endif |
| 3893 | 3896 |
| 3894 } } // namespace v8::internal | 3897 } } // namespace v8::internal |
| OLD | NEW |