| 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 reduce_memory_footprint_) { | 536 reduce_memory_footprint_) { |
| 537 mode = REDUCE_MEMORY_FOOTPRINT; | 537 mode = REDUCE_MEMORY_FOOTPRINT; |
| 538 | 538 |
| 539 // We expect that empty pages are easier to compact so slightly bump the | 539 // We expect that empty pages are easier to compact so slightly bump the |
| 540 // limit. | 540 // limit. |
| 541 max_evacuation_candidates += 2; | 541 max_evacuation_candidates += 2; |
| 542 | 542 |
| 543 if (FLAG_trace_fragmentation) { | 543 if (FLAG_trace_fragmentation) { |
| 544 PrintF("Estimated over reserved memory: %.1f MB (setting threshold %d)\n", | 544 PrintF("Estimated over reserved memory: %.1f MB (setting threshold %d)\n", |
| 545 static_cast<double>(over_reserved) / MB, | 545 static_cast<double>(over_reserved) / MB, |
| 546 kFreenessThreshold); | 546 static_cast<int>(kFreenessThreshold)); |
| 547 } | 547 } |
| 548 } | 548 } |
| 549 | 549 |
| 550 intptr_t estimated_release = 0; | 550 intptr_t estimated_release = 0; |
| 551 | 551 |
| 552 Candidate candidates[kMaxMaxEvacuationCandidates]; | 552 Candidate candidates[kMaxMaxEvacuationCandidates]; |
| 553 | 553 |
| 554 int count = 0; | 554 int count = 0; |
| 555 int fragmentation = 0; | 555 int fragmentation = 0; |
| 556 Candidate* least = NULL; | 556 Candidate* least = NULL; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 (Page::kObjectAreaSize - free_bytes); | 589 (Page::kObjectAreaSize - free_bytes); |
| 590 fragmentation = free_pct; | 590 fragmentation = free_pct; |
| 591 } else { | 591 } else { |
| 592 fragmentation = 0; | 592 fragmentation = 0; |
| 593 } | 593 } |
| 594 | 594 |
| 595 if (FLAG_trace_fragmentation) { | 595 if (FLAG_trace_fragmentation) { |
| 596 PrintF("%p [%s]: %d (%.2f%%) free %s\n", | 596 PrintF("%p [%s]: %d (%.2f%%) free %s\n", |
| 597 reinterpret_cast<void*>(p), | 597 reinterpret_cast<void*>(p), |
| 598 AllocationSpaceName(space->identity()), | 598 AllocationSpaceName(space->identity()), |
| 599 free_bytes, | 599 static_cast<int>(free_bytes), |
| 600 static_cast<double>(free_bytes * 100) / Page::kObjectAreaSize, | 600 static_cast<double>(free_bytes * 100) / Page::kObjectAreaSize, |
| 601 (fragmentation > 0) ? "[fragmented]" : ""); | 601 (fragmentation > 0) ? "[fragmented]" : ""); |
| 602 } | 602 } |
| 603 } else { | 603 } else { |
| 604 fragmentation = FreeListFragmentation(space, p); | 604 fragmentation = FreeListFragmentation(space, p); |
| 605 } | 605 } |
| 606 | 606 |
| 607 if (fragmentation != 0) { | 607 if (fragmentation != 0) { |
| 608 if (count < max_evacuation_candidates) { | 608 if (count < max_evacuation_candidates) { |
| 609 candidates[count++] = Candidate(fragmentation, p); | 609 candidates[count++] = Candidate(fragmentation, p); |
| (...skipping 3476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4086 while (buffer != NULL) { | 4086 while (buffer != NULL) { |
| 4087 SlotsBuffer* next_buffer = buffer->next(); | 4087 SlotsBuffer* next_buffer = buffer->next(); |
| 4088 DeallocateBuffer(buffer); | 4088 DeallocateBuffer(buffer); |
| 4089 buffer = next_buffer; | 4089 buffer = next_buffer; |
| 4090 } | 4090 } |
| 4091 *buffer_address = NULL; | 4091 *buffer_address = NULL; |
| 4092 } | 4092 } |
| 4093 | 4093 |
| 4094 | 4094 |
| 4095 } } // namespace v8::internal | 4095 } } // namespace v8::internal |
| OLD | NEW |