Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 COMPACT_FREE_LISTS, | 624 COMPACT_FREE_LISTS, |
| 625 REDUCE_MEMORY_FOOTPRINT | 625 REDUCE_MEMORY_FOOTPRINT |
| 626 }; | 626 }; |
| 627 | 627 |
| 628 CompactionMode mode = COMPACT_FREE_LISTS; | 628 CompactionMode mode = COMPACT_FREE_LISTS; |
| 629 | 629 |
| 630 intptr_t reserved = number_of_pages * space->AreaSize(); | 630 intptr_t reserved = number_of_pages * space->AreaSize(); |
| 631 intptr_t over_reserved = reserved - space->SizeOfObjects(); | 631 intptr_t over_reserved = reserved - space->SizeOfObjects(); |
| 632 static const intptr_t kFreenessThreshold = 50; | 632 static const intptr_t kFreenessThreshold = 50; |
| 633 | 633 |
| 634 if (over_reserved >= 2 * space->AreaSize()) { | 634 if (over_reserved >= 2 * space->AreaSize() || |
| 635 (reduce_memory_footprint_ && over_reserved >= space->AreaSize())) { | |
|
Michael Starzinger
2012/08/10 13:03:14
Can we merge these two conditions into the two fol
| |
| 635 // If reduction of memory footprint was requested, we are aggressive | 636 // If reduction of memory footprint was requested, we are aggressive |
| 636 // about choosing pages to free. We expect that half-empty pages | 637 // about choosing pages to free. We expect that half-empty pages |
| 637 // are easier to compact so slightly bump the limit. | 638 // are easier to compact so slightly bump the limit. |
| 638 if (reduce_memory_footprint_) { | 639 if (reduce_memory_footprint_) { |
| 639 mode = REDUCE_MEMORY_FOOTPRINT; | 640 mode = REDUCE_MEMORY_FOOTPRINT; |
| 640 max_evacuation_candidates += 2; | 641 max_evacuation_candidates += 2; |
| 641 } | 642 } |
| 642 | 643 |
| 643 // If over-usage is very high (more than a third of the space), we | 644 // If over-usage is very high (more than a third of the space), we |
| 644 // try to free all mostly empty pages. We expect that almost empty | 645 // try to free all mostly empty pages. We expect that almost empty |
| (...skipping 3562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4207 while (buffer != NULL) { | 4208 while (buffer != NULL) { |
| 4208 SlotsBuffer* next_buffer = buffer->next(); | 4209 SlotsBuffer* next_buffer = buffer->next(); |
| 4209 DeallocateBuffer(buffer); | 4210 DeallocateBuffer(buffer); |
| 4210 buffer = next_buffer; | 4211 buffer = next_buffer; |
| 4211 } | 4212 } |
| 4212 *buffer_address = NULL; | 4213 *buffer_address = NULL; |
| 4213 } | 4214 } |
| 4214 | 4215 |
| 4215 | 4216 |
| 4216 } } // namespace v8::internal | 4217 } } // namespace v8::internal |
| OLD | NEW |