| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 old_gen_promotion_limit_ = | 471 old_gen_promotion_limit_ = |
| 472 old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3); | 472 old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3); |
| 473 old_gen_allocation_limit_ = | 473 old_gen_allocation_limit_ = |
| 474 old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2); | 474 old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2); |
| 475 old_gen_exhausted_ = false; | 475 old_gen_exhausted_ = false; |
| 476 } | 476 } |
| 477 Scavenge(); | 477 Scavenge(); |
| 478 | 478 |
| 479 Counters::objs_since_last_young.Set(0); | 479 Counters::objs_since_last_young.Set(0); |
| 480 | 480 |
| 481 PostGarbageCollectionProcessing(); | 481 if (collector == MARK_COMPACTOR) { |
| 482 DisableAssertNoAllocation allow_allocation; |
| 483 GlobalHandles::PostGarbageCollectionProcessing(); |
| 484 } |
| 485 |
| 486 // Update relocatables. |
| 487 Relocatable::PostGarbageCollectionProcessing(); |
| 482 | 488 |
| 483 if (collector == MARK_COMPACTOR) { | 489 if (collector == MARK_COMPACTOR) { |
| 484 // Register the amount of external allocated memory. | 490 // Register the amount of external allocated memory. |
| 485 amount_of_external_allocated_memory_at_last_global_gc_ = | 491 amount_of_external_allocated_memory_at_last_global_gc_ = |
| 486 amount_of_external_allocated_memory_; | 492 amount_of_external_allocated_memory_; |
| 487 } | 493 } |
| 488 | 494 |
| 489 if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) { | 495 if (collector == MARK_COMPACTOR && global_gc_epilogue_callback_) { |
| 490 ASSERT(!allocation_allowed_); | 496 ASSERT(!allocation_allowed_); |
| 491 global_gc_epilogue_callback_(); | 497 global_gc_epilogue_callback_(); |
| 492 } | 498 } |
| 493 VerifySymbolTable(); | 499 VerifySymbolTable(); |
| 494 } | 500 } |
| 495 | 501 |
| 496 | 502 |
| 497 void Heap::PostGarbageCollectionProcessing() { | |
| 498 // Process weak handles post gc. | |
| 499 { | |
| 500 DisableAssertNoAllocation allow_allocation; | |
| 501 GlobalHandles::PostGarbageCollectionProcessing(); | |
| 502 } | |
| 503 // Update relocatables. | |
| 504 Relocatable::PostGarbageCollectionProcessing(); | |
| 505 } | |
| 506 | |
| 507 | |
| 508 void Heap::MarkCompact(GCTracer* tracer) { | 503 void Heap::MarkCompact(GCTracer* tracer) { |
| 509 gc_state_ = MARK_COMPACT; | 504 gc_state_ = MARK_COMPACT; |
| 510 mc_count_++; | 505 mc_count_++; |
| 511 tracer->set_full_gc_count(mc_count_); | 506 tracer->set_full_gc_count(mc_count_); |
| 512 LOG(ResourceEvent("markcompact", "begin")); | 507 LOG(ResourceEvent("markcompact", "begin")); |
| 513 | 508 |
| 514 MarkCompactCollector::Prepare(tracer); | 509 MarkCompactCollector::Prepare(tracer); |
| 515 | 510 |
| 516 bool is_compacting = MarkCompactCollector::IsCompacting(); | 511 bool is_compacting = MarkCompactCollector::IsCompacting(); |
| 517 | 512 |
| (...skipping 3374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3892 for (int i = 0; i < kNumberOfCaches; i++) { | 3887 for (int i = 0; i < kNumberOfCaches; i++) { |
| 3893 if (caches_[i] != NULL) { | 3888 if (caches_[i] != NULL) { |
| 3894 delete caches_[i]; | 3889 delete caches_[i]; |
| 3895 caches_[i] = NULL; | 3890 caches_[i] = NULL; |
| 3896 } | 3891 } |
| 3897 } | 3892 } |
| 3898 } | 3893 } |
| 3899 | 3894 |
| 3900 | 3895 |
| 3901 } } // namespace v8::internal | 3896 } } // namespace v8::internal |
| OLD | NEW |