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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 return result; | 728 return result; |
729 } | 729 } |
730 | 730 |
731 Address NormalPageArena::allocateFromFreeList(size_t allocationSize, size_t gcIn
foIndex) | 731 Address NormalPageArena::allocateFromFreeList(size_t allocationSize, size_t gcIn
foIndex) |
732 { | 732 { |
733 // Try reusing a block from the largest bin. The underlying reasoning | 733 // Try reusing a block from the largest bin. The underlying reasoning |
734 // being that we want to amortize this slow allocation call by carving | 734 // being that we want to amortize this slow allocation call by carving |
735 // off as a large a free block as possible in one go; a block that will | 735 // off as a large a free block as possible in one go; a block that will |
736 // service this block and let following allocations be serviced quickly | 736 // service this block and let following allocations be serviced quickly |
737 // by bump allocation. | 737 // by bump allocation. |
738 size_t bucketSize = 1 << m_freeList.m_biggestFreeListIndex; | 738 size_t bucketSize = static_cast<size_t>(1) << m_freeList.m_biggestFreeListIn
dex; |
739 int index = m_freeList.m_biggestFreeListIndex; | 739 int index = m_freeList.m_biggestFreeListIndex; |
740 for (; index > 0; --index, bucketSize >>= 1) { | 740 for (; index > 0; --index, bucketSize >>= 1) { |
741 FreeListEntry* entry = m_freeList.m_freeLists[index]; | 741 FreeListEntry* entry = m_freeList.m_freeLists[index]; |
742 if (allocationSize > bucketSize) { | 742 if (allocationSize > bucketSize) { |
743 // Final bucket candidate; check initial entry if it is able | 743 // Final bucket candidate; check initial entry if it is able |
744 // to service this allocation. Do not perform a linear scan, | 744 // to service this allocation. Do not perform a linear scan, |
745 // as it is considered too costly. | 745 // as it is considered too costly. |
746 if (!entry || entry->size() < allocationSize) | 746 if (!entry || entry->size() < allocationSize) |
747 break; | 747 break; |
748 } | 748 } |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 | 1561 |
1562 m_hasEntries = true; | 1562 m_hasEntries = true; |
1563 size_t index = hash(address); | 1563 size_t index = hash(address); |
1564 ASSERT(!(index & 1)); | 1564 ASSERT(!(index & 1)); |
1565 Address cachePage = roundToBlinkPageStart(address); | 1565 Address cachePage = roundToBlinkPageStart(address); |
1566 m_entries[index + 1] = m_entries[index]; | 1566 m_entries[index + 1] = m_entries[index]; |
1567 m_entries[index] = cachePage; | 1567 m_entries[index] = cachePage; |
1568 } | 1568 } |
1569 | 1569 |
1570 } // namespace blink | 1570 } // namespace blink |
OLD | NEW |