| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 // 8 ms is long enough for low-end mobile devices to mark common | 593 // 8 ms is long enough for low-end mobile devices to mark common |
| 594 // real-world object graphs. | 594 // real-world object graphs. |
| 595 if (s_estimatedMarkingTimePerByte == 0) | 595 if (s_estimatedMarkingTimePerByte == 0) |
| 596 return 0.008; | 596 return 0.008; |
| 597 | 597 |
| 598 // Assuming that the collection rate of this GC will be mostly equal to | 598 // Assuming that the collection rate of this GC will be mostly equal to |
| 599 // the collection rate of the last GC, estimate the marking time of this GC. | 599 // the collection rate of the last GC, estimate the marking time of this GC. |
| 600 return s_estimatedMarkingTimePerByte * (Heap::allocatedObjectSize() + Heap::
markedObjectSize()); | 600 return s_estimatedMarkingTimePerByte * (Heap::allocatedObjectSize() + Heap::
markedObjectSize()); |
| 601 } | 601 } |
| 602 | 602 |
| 603 Address Heap::allocateOnHeapIndex(ThreadState* state, size_t size, int heapIndex
, size_t gcInfoIndex) |
| 604 { |
| 605 ASSERT(state->isAllocationAllowed()); |
| 606 ASSERT(heapIndex != ThreadState::LargeObjectHeapIndex); |
| 607 NormalPageHeap* heap = static_cast<NormalPageHeap*>(state->heap(heapIndex)); |
| 608 return heap->allocateObject(allocationSizeFromSize(size), gcInfoIndex); |
| 609 } |
| 610 |
| 603 void Heap::reportMemoryUsageHistogram() | 611 void Heap::reportMemoryUsageHistogram() |
| 604 { | 612 { |
| 605 static size_t supportedMaxSizeInMB = 4 * 1024; | 613 static size_t supportedMaxSizeInMB = 4 * 1024; |
| 606 static size_t observedMaxSizeInMB = 0; | 614 static size_t observedMaxSizeInMB = 0; |
| 607 | 615 |
| 608 // We only report the memory in the main thread. | 616 // We only report the memory in the main thread. |
| 609 if (!isMainThread()) | 617 if (!isMainThread()) |
| 610 return; | 618 return; |
| 611 // +1 is for rounding up the sizeInMB. | 619 // +1 is for rounding up the sizeInMB. |
| 612 size_t sizeInMB = Heap::allocatedSpace() / 1024 / 1024 + 1; | 620 size_t sizeInMB = Heap::allocatedSpace() / 1024 / 1024 + 1; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 size_t Heap::s_objectSizeAtLastGC = 0; | 783 size_t Heap::s_objectSizeAtLastGC = 0; |
| 776 size_t Heap::s_markedObjectSize = 0; | 784 size_t Heap::s_markedObjectSize = 0; |
| 777 size_t Heap::s_markedObjectSizeAtLastCompleteSweep = 0; | 785 size_t Heap::s_markedObjectSizeAtLastCompleteSweep = 0; |
| 778 size_t Heap::s_persistentCount = 0; | 786 size_t Heap::s_persistentCount = 0; |
| 779 size_t Heap::s_persistentCountAtLastGC = 0; | 787 size_t Heap::s_persistentCountAtLastGC = 0; |
| 780 size_t Heap::s_collectedPersistentCount = 0; | 788 size_t Heap::s_collectedPersistentCount = 0; |
| 781 size_t Heap::s_partitionAllocSizeAtLastGC = 0; | 789 size_t Heap::s_partitionAllocSizeAtLastGC = 0; |
| 782 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 790 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
| 783 | 791 |
| 784 } // namespace blink | 792 } // namespace blink |
| OLD | NEW |