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 4523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4534 void Heap::EnsureHeapIsIterable() { | 4534 void Heap::EnsureHeapIsIterable() { |
4535 ASSERT(IsAllocationAllowed()); | 4535 ASSERT(IsAllocationAllowed()); |
4536 if (!IsHeapIterable()) { | 4536 if (!IsHeapIterable()) { |
4537 CollectAllGarbage(kMakeHeapIterableMask); | 4537 CollectAllGarbage(kMakeHeapIterableMask); |
4538 } | 4538 } |
4539 ASSERT(IsHeapIterable()); | 4539 ASSERT(IsHeapIterable()); |
4540 } | 4540 } |
4541 | 4541 |
4542 | 4542 |
4543 bool Heap::IdleNotification(int hint) { | 4543 bool Heap::IdleNotification(int hint) { |
| 4544 if (hint >= 1000) return IdleGlobalGC(); |
4544 if (contexts_disposed_ > 0 || !FLAG_incremental_marking || | 4545 if (contexts_disposed_ > 0 || !FLAG_incremental_marking || |
4545 FLAG_expose_gc || Serializer::enabled()) { | 4546 FLAG_expose_gc || Serializer::enabled()) { |
4546 return hint < 1000 ? true : IdleGlobalGC(); | 4547 return true; |
4547 } | 4548 } |
4548 | 4549 |
4549 // By doing small chunks of GC work in each IdleNotification, | 4550 // By doing small chunks of GC work in each IdleNotification, |
4550 // perform a round of incremental GCs and after that wait until | 4551 // perform a round of incremental GCs and after that wait until |
4551 // the mutator creates enough garbage to justify a new round. | 4552 // the mutator creates enough garbage to justify a new round. |
4552 // An incremental GC progresses as follows: | 4553 // An incremental GC progresses as follows: |
4553 // 1. many incremental marking steps, | 4554 // 1. many incremental marking steps, |
4554 // 2. one old space mark-sweep-compact, | 4555 // 2. one old space mark-sweep-compact, |
4555 // 3. many lazy sweep steps. | 4556 // 3. many lazy sweep steps. |
4556 // Use mark-sweep-compact events to count incremental GCs in a round. | 4557 // Use mark-sweep-compact events to count incremental GCs in a round. |
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6583 isolate_->heap()->store_buffer()->Compact(); | 6584 isolate_->heap()->store_buffer()->Compact(); |
6584 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6585 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6585 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6586 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6586 next = chunk->next_chunk(); | 6587 next = chunk->next_chunk(); |
6587 isolate_->memory_allocator()->Free(chunk); | 6588 isolate_->memory_allocator()->Free(chunk); |
6588 } | 6589 } |
6589 chunks_queued_for_free_ = NULL; | 6590 chunks_queued_for_free_ = NULL; |
6590 } | 6591 } |
6591 | 6592 |
6592 } } // namespace v8::internal | 6593 } } // namespace v8::internal |
OLD | NEW |