| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 CollectGarbage(0, OLD_POINTER_SPACE); | 293 CollectGarbage(0, OLD_POINTER_SPACE); |
| 294 } | 294 } |
| 295 | 295 |
| 296 | 296 |
| 297 void Heap::CollectAllGarbageIfContextDisposed() { | 297 void Heap::CollectAllGarbageIfContextDisposed() { |
| 298 // If the garbage collector interface is exposed through the global | 298 // If the garbage collector interface is exposed through the global |
| 299 // gc() function, we avoid being clever about forcing GCs when | 299 // gc() function, we avoid being clever about forcing GCs when |
| 300 // contexts are disposed and leave it to the embedder to make | 300 // contexts are disposed and leave it to the embedder to make |
| 301 // informed decisions about when to force a collection. | 301 // informed decisions about when to force a collection. |
| 302 if (!FLAG_expose_gc && context_disposed_pending_) { | 302 if (!FLAG_expose_gc && context_disposed_pending_) { |
| 303 StatsRateScope scope(&Counters::gc_context); | 303 HistogramTimerScope scope(&Counters::gc_context); |
| 304 CollectAllGarbage(); | 304 CollectAllGarbage(); |
| 305 } | 305 } |
| 306 context_disposed_pending_ = false; | 306 context_disposed_pending_ = false; |
| 307 } | 307 } |
| 308 | 308 |
| 309 | 309 |
| 310 void Heap::NotifyContextDisposed() { | 310 void Heap::NotifyContextDisposed() { |
| 311 context_disposed_pending_ = true; | 311 context_disposed_pending_ = true; |
| 312 } | 312 } |
| 313 | 313 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 328 { GCTracer tracer; | 328 { GCTracer tracer; |
| 329 GarbageCollectionPrologue(); | 329 GarbageCollectionPrologue(); |
| 330 // The GC count was incremented in the prologue. Tell the tracer about | 330 // The GC count was incremented in the prologue. Tell the tracer about |
| 331 // it. | 331 // it. |
| 332 tracer.set_gc_count(gc_count_); | 332 tracer.set_gc_count(gc_count_); |
| 333 | 333 |
| 334 GarbageCollector collector = SelectGarbageCollector(space); | 334 GarbageCollector collector = SelectGarbageCollector(space); |
| 335 // Tell the tracer which collector we've selected. | 335 // Tell the tracer which collector we've selected. |
| 336 tracer.set_collector(collector); | 336 tracer.set_collector(collector); |
| 337 | 337 |
| 338 StatsRate* rate = (collector == SCAVENGER) | 338 HistogramTimer* rate = (collector == SCAVENGER) |
| 339 ? &Counters::gc_scavenger | 339 ? &Counters::gc_scavenger |
| 340 : &Counters::gc_compactor; | 340 : &Counters::gc_compactor; |
| 341 rate->Start(); | 341 rate->Start(); |
| 342 PerformGarbageCollection(space, collector, &tracer); | 342 PerformGarbageCollection(space, collector, &tracer); |
| 343 rate->Stop(); | 343 rate->Stop(); |
| 344 | 344 |
| 345 GarbageCollectionEpilogue(); | 345 GarbageCollectionEpilogue(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 | 348 |
| (...skipping 2984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3333 #ifdef DEBUG | 3333 #ifdef DEBUG |
| 3334 bool Heap::GarbageCollectionGreedyCheck() { | 3334 bool Heap::GarbageCollectionGreedyCheck() { |
| 3335 ASSERT(FLAG_gc_greedy); | 3335 ASSERT(FLAG_gc_greedy); |
| 3336 if (Bootstrapper::IsActive()) return true; | 3336 if (Bootstrapper::IsActive()) return true; |
| 3337 if (disallow_allocation_failure()) return true; | 3337 if (disallow_allocation_failure()) return true; |
| 3338 return CollectGarbage(0, NEW_SPACE); | 3338 return CollectGarbage(0, NEW_SPACE); |
| 3339 } | 3339 } |
| 3340 #endif | 3340 #endif |
| 3341 | 3341 |
| 3342 } } // namespace v8::internal | 3342 } } // namespace v8::internal |
| OLD | NEW |