| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 | 1079 |
| 1080 // Used for updating survived_since_last_expansion_ at function end. | 1080 // Used for updating survived_since_last_expansion_ at function end. |
| 1081 intptr_t survived_watermark = PromotedSpaceSize(); | 1081 intptr_t survived_watermark = PromotedSpaceSize(); |
| 1082 | 1082 |
| 1083 CheckNewSpaceExpansionCriteria(); | 1083 CheckNewSpaceExpansionCriteria(); |
| 1084 | 1084 |
| 1085 SelectScavengingVisitorsTable(); | 1085 SelectScavengingVisitorsTable(); |
| 1086 | 1086 |
| 1087 incremental_marking()->PrepareForScavenge(); | 1087 incremental_marking()->PrepareForScavenge(); |
| 1088 | 1088 |
| 1089 AdvanceSweepers(new_space_.Size()); | 1089 AdvanceSweepers(static_cast<int>(new_space_.Size())); |
| 1090 | 1090 |
| 1091 // Flip the semispaces. After flipping, to space is empty, from space has | 1091 // Flip the semispaces. After flipping, to space is empty, from space has |
| 1092 // live objects. | 1092 // live objects. |
| 1093 new_space_.Flip(); | 1093 new_space_.Flip(); |
| 1094 new_space_.ResetAllocationInfo(); | 1094 new_space_.ResetAllocationInfo(); |
| 1095 | 1095 |
| 1096 // We need to sweep newly copied objects which can be either in the | 1096 // We need to sweep newly copied objects which can be either in the |
| 1097 // to space or promoted to the old generation. For to-space | 1097 // to space or promoted to the old generation. For to-space |
| 1098 // objects, we treat the bottom of the to space as a queue. Newly | 1098 // objects, we treat the bottom of the to space as a queue. Newly |
| 1099 // copied and unswept objects lie between a 'front' mark and the | 1099 // copied and unswept objects lie between a 'front' mark and the |
| (...skipping 3452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4552 // 1. many incremental marking steps, | 4552 // 1. many incremental marking steps, |
| 4553 // 2. one old space mark-sweep-compact, | 4553 // 2. one old space mark-sweep-compact, |
| 4554 // 3. many lazy sweep steps. | 4554 // 3. many lazy sweep steps. |
| 4555 // Use mark-sweep-compact events to count incremental GCs in a round. | 4555 // Use mark-sweep-compact events to count incremental GCs in a round. |
| 4556 | 4556 |
| 4557 intptr_t size_factor = Min(Max(hint, 30), 1000) / 10; | 4557 intptr_t size_factor = Min(Max(hint, 30), 1000) / 10; |
| 4558 // The size factor is in range [3..100]. | 4558 // The size factor is in range [3..100]. |
| 4559 intptr_t step_size = size_factor * IncrementalMarking::kAllocatedThreshold; | 4559 intptr_t step_size = size_factor * IncrementalMarking::kAllocatedThreshold; |
| 4560 | 4560 |
| 4561 if (incremental_marking()->IsStopped()) { | 4561 if (incremental_marking()->IsStopped()) { |
| 4562 if (!IsSweepingComplete() && !AdvanceSweepers(step_size)) { | 4562 if (!IsSweepingComplete() && |
| 4563 !AdvanceSweepers(static_cast<int>(step_size))) { |
| 4563 return false; | 4564 return false; |
| 4564 } | 4565 } |
| 4565 } | 4566 } |
| 4566 | 4567 |
| 4567 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { | 4568 if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { |
| 4568 if (EnoughGarbageSinceLastIdleRound()) { | 4569 if (EnoughGarbageSinceLastIdleRound()) { |
| 4569 StartIdleRound(); | 4570 StartIdleRound(); |
| 4570 } else { | 4571 } else { |
| 4571 return true; | 4572 return true; |
| 4572 } | 4573 } |
| (...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6581 isolate_->heap()->store_buffer()->Compact(); | 6582 isolate_->heap()->store_buffer()->Compact(); |
| 6582 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6583 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
| 6583 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6584 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
| 6584 next = chunk->next_chunk(); | 6585 next = chunk->next_chunk(); |
| 6585 isolate_->memory_allocator()->Free(chunk); | 6586 isolate_->memory_allocator()->Free(chunk); |
| 6586 } | 6587 } |
| 6587 chunks_queued_for_free_ = NULL; | 6588 chunks_queued_for_free_ = NULL; |
| 6588 } | 6589 } |
| 6589 | 6590 |
| 6590 } } // namespace v8::internal | 6591 } } // namespace v8::internal |
| OLD | NEW |