| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // free space in the new space after the collection compared to | 383 // free space in the new space after the collection compared to |
| 384 // before. | 384 // before. |
| 385 if (space == NEW_SPACE && !MarkCompactCollector::HasCompacted()) { | 385 if (space == NEW_SPACE && !MarkCompactCollector::HasCompacted()) { |
| 386 Scavenge(); | 386 Scavenge(); |
| 387 } | 387 } |
| 388 } else { | 388 } else { |
| 389 Scavenge(); | 389 Scavenge(); |
| 390 } | 390 } |
| 391 Counters::objs_since_last_young.Set(0); | 391 Counters::objs_since_last_young.Set(0); |
| 392 | 392 |
| 393 // Process weak handles post gc. | 393 PostGarbageCollectionProcessing(); |
| 394 GlobalHandles::PostGarbageCollectionProcessing(); | |
| 395 | 394 |
| 396 if (collector == MARK_COMPACTOR) { | 395 if (collector == MARK_COMPACTOR) { |
| 397 // Register the amount of external allocated memory. | 396 // Register the amount of external allocated memory. |
| 398 amount_of_external_allocated_memory_at_last_global_gc_ = | 397 amount_of_external_allocated_memory_at_last_global_gc_ = |
| 399 amount_of_external_allocated_memory_; | 398 amount_of_external_allocated_memory_; |
| 400 } | 399 } |
| 401 | 400 |
| 402 if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) { | 401 if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) { |
| 403 ASSERT(!allocation_allowed_); | 402 ASSERT(!allocation_allowed_); |
| 404 global_gc_epilogue_callback_(); | 403 global_gc_epilogue_callback_(); |
| 405 } | 404 } |
| 406 } | 405 } |
| 407 | 406 |
| 408 | 407 |
| 408 void Heap::PostGarbageCollectionProcessing() { |
| 409 // Process weak handles post gc. |
| 410 GlobalHandles::PostGarbageCollectionProcessing(); |
| 411 // Update flat string readers. |
| 412 FlatStringReader::PostGarbageCollectionProcessing(); |
| 413 } |
| 414 |
| 415 |
| 409 void Heap::MarkCompact(GCTracer* tracer) { | 416 void Heap::MarkCompact(GCTracer* tracer) { |
| 410 gc_state_ = MARK_COMPACT; | 417 gc_state_ = MARK_COMPACT; |
| 411 mc_count_++; | 418 mc_count_++; |
| 412 tracer->set_full_gc_count(mc_count_); | 419 tracer->set_full_gc_count(mc_count_); |
| 413 LOG(ResourceEvent("markcompact", "begin")); | 420 LOG(ResourceEvent("markcompact", "begin")); |
| 414 | 421 |
| 415 MarkCompactPrologue(); | 422 MarkCompactPrologue(); |
| 416 | 423 |
| 417 MarkCompactCollector::CollectGarbage(tracer); | 424 MarkCompactCollector::CollectGarbage(tracer); |
| 418 | 425 |
| (...skipping 2850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3269 #ifdef DEBUG | 3276 #ifdef DEBUG |
| 3270 bool Heap::GarbageCollectionGreedyCheck() { | 3277 bool Heap::GarbageCollectionGreedyCheck() { |
| 3271 ASSERT(FLAG_gc_greedy); | 3278 ASSERT(FLAG_gc_greedy); |
| 3272 if (Bootstrapper::IsActive()) return true; | 3279 if (Bootstrapper::IsActive()) return true; |
| 3273 if (disallow_allocation_failure()) return true; | 3280 if (disallow_allocation_failure()) return true; |
| 3274 return CollectGarbage(0, NEW_SPACE); | 3281 return CollectGarbage(0, NEW_SPACE); |
| 3275 } | 3282 } |
| 3276 #endif | 3283 #endif |
| 3277 | 3284 |
| 3278 } } // namespace v8::internal | 3285 } } // namespace v8::internal |
| OLD | NEW |