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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 size_t decommitSize = currentSize - newSize; | 845 size_t decommitSize = currentSize - newSize; |
846 partitionDecommitSystemPages(root, charPtr + newSize, decommitSize); | 846 partitionDecommitSystemPages(root, charPtr + newSize, decommitSize); |
847 setSystemPagesInaccessible(charPtr + newSize, decommitSize); | 847 setSystemPagesInaccessible(charPtr + newSize, decommitSize); |
848 } else if (newSize <= partitionPageToDirectMapExtent(page)->mapSize) { | 848 } else if (newSize <= partitionPageToDirectMapExtent(page)->mapSize) { |
849 // Grow within the actually allocated memory. Just need to make the | 849 // Grow within the actually allocated memory. Just need to make the |
850 // pages accessible again. | 850 // pages accessible again. |
851 size_t recommitSize = newSize - currentSize; | 851 size_t recommitSize = newSize - currentSize; |
852 setSystemPagesAccessible(charPtr + currentSize, recommitSize); | 852 setSystemPagesAccessible(charPtr + currentSize, recommitSize); |
853 partitionRecommitSystemPages(root, charPtr + currentSize, recommitSize); | 853 partitionRecommitSystemPages(root, charPtr + currentSize, recommitSize); |
854 | 854 |
855 #ifndef NDEBUG | 855 #if ENABLE(ASSERT) |
856 memset(charPtr + currentSize, kUninitializedByte, recommitSize); | 856 memset(charPtr + currentSize, kUninitializedByte, recommitSize); |
857 #endif | 857 #endif |
858 } else { | 858 } else { |
859 // We can't perform the realloc in-place. | 859 // We can't perform the realloc in-place. |
860 // TODO: support this too when possible. | 860 // TODO: support this too when possible. |
861 return false; | 861 return false; |
862 } | 862 } |
863 | 863 |
864 #ifndef NDEBUG | 864 #if ENABLE(ASSERT) |
865 // Write a new trailing cookie. | 865 // Write a new trailing cookie. |
866 partitionCookieWriteValue(charPtr + newSize - kCookieSize); | 866 partitionCookieWriteValue(charPtr + newSize - kCookieSize); |
867 #endif | 867 #endif |
868 | 868 |
869 page->bucket->slotSize = newSize; | 869 page->bucket->slotSize = newSize; |
870 return true; | 870 return true; |
871 } | 871 } |
872 | 872 |
873 void* partitionReallocGeneric(PartitionRootGeneric* root, void* ptr, size_t newS
ize) | 873 void* partitionReallocGeneric(PartitionRootGeneric* root, void* ptr, size_t newS
ize) |
874 { | 874 { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 printf("total live: %zu bytes\n", totalLive); | 976 printf("total live: %zu bytes\n", totalLive); |
977 printf("total resident: %zu bytes\n", totalResident); | 977 printf("total resident: %zu bytes\n", totalResident); |
978 printf("total freeable: %zu bytes\n", totalFreeable); | 978 printf("total freeable: %zu bytes\n", totalFreeable); |
979 fflush(stdout); | 979 fflush(stdout); |
980 } | 980 } |
981 | 981 |
982 #endif // !NDEBUG | 982 #endif // !NDEBUG |
983 | 983 |
984 } // namespace WTF | 984 } // namespace WTF |
985 | 985 |
OLD | NEW |