| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // true). | 90 // true). |
| 91 WTF_EXPORT WARN_UNUSED_RETURN bool setSystemPagesAccessible(void* addr, size_t l
en); | 91 WTF_EXPORT WARN_UNUSED_RETURN bool setSystemPagesAccessible(void* addr, size_t l
en); |
| 92 | 92 |
| 93 // Decommit one or more system pages. Decommitted means that the physical memory | 93 // Decommit one or more system pages. Decommitted means that the physical memory |
| 94 // is released to the system, but the virtual address space remains reserved. | 94 // is released to the system, but the virtual address space remains reserved. |
| 95 // System pages are re-committed by calling recommitSystemPages(). Touching | 95 // System pages are re-committed by calling recommitSystemPages(). Touching |
| 96 // a decommitted page _may_ fault. | 96 // a decommitted page _may_ fault. |
| 97 // Clients should not make any assumptions about the contents of decommitted | 97 // Clients should not make any assumptions about the contents of decommitted |
| 98 // system pages, before or after they write to the page. The only guarantee | 98 // system pages, before or after they write to the page. The only guarantee |
| 99 // provided is that the contents of the system page will be deterministic again | 99 // provided is that the contents of the system page will be deterministic again |
| 100 // after recommitting and writing to it. In particlar note that system pages are
// not guaranteed to be zero-filled upon re-commit. | 100 // after recommitting and writing to it. In particlar note that system pages are |
| 101 // len must be a multiple of kSystemPageSize bytes. | 101 // not guaranteed to be zero-filled upon re-commit. len must be a multiple of |
| 102 // kSystemPageSize bytes. |
| 102 WTF_EXPORT void decommitSystemPages(void* addr, size_t len); | 103 WTF_EXPORT void decommitSystemPages(void* addr, size_t len); |
| 103 | 104 |
| 104 // Recommit one or more system pages. Decommitted system pages must be | 105 // Recommit one or more system pages. Decommitted system pages must be |
| 105 // recommitted before they are read are written again. | 106 // recommitted before they are read are written again. |
| 106 // Note that this operation may be a no-op on some platforms. | 107 // Note that this operation may be a no-op on some platforms. |
| 107 // len must be a multiple of kSystemPageSize bytes. | 108 // len must be a multiple of kSystemPageSize bytes. |
| 108 WTF_EXPORT void recommitSystemPages(void* addr, size_t len); | 109 WTF_EXPORT void recommitSystemPages(void* addr, size_t len); |
| 109 | 110 |
| 110 // Discard one or more system pages. Discarding is a hint to the system that | 111 // Discard one or more system pages. Discarding is a hint to the system that |
| 111 // the page is no longer required. The hint may: | 112 // the page is no longer required. The hint may: |
| 112 // - Do nothing. | 113 // - Do nothing. |
| 113 // - Discard the page immediately, freeing up physical pages. | 114 // - Discard the page immediately, freeing up physical pages. |
| 114 // - Discard the page at some time in the future in response to memory pressure. | 115 // - Discard the page at some time in the future in response to memory pressure. |
| 115 // Only committed pages should be discarded. Discarding a page does not | 116 // Only committed pages should be discarded. Discarding a page does not |
| 116 // decommit it, and it is valid to discard an already-discarded page. | 117 // decommit it, and it is valid to discard an already-discarded page. |
| 117 // A read or write to a discarded page will not fault. | 118 // A read or write to a discarded page will not fault. |
| 118 // Reading from a discarded page may return the original page content, or a | 119 // Reading from a discarded page may return the original page content, or a |
| 119 // page full of zeroes. | 120 // page full of zeroes. |
| 120 // Writing to a discarded page is the only guaranteed way to tell the system | 121 // Writing to a discarded page is the only guaranteed way to tell the system |
| 121 // that the page is required again. Once written to, the content of the page is
// guaranteed stable once more. After being written to, the page content may be | 122 // that the page is required again. Once written to, the content of the page is |
| 123 // guaranteed stable once more. After being written to, the page content may be |
| 122 // based on the original page content, or a page of zeroes. | 124 // based on the original page content, or a page of zeroes. |
| 123 // len must be a multiple of kSystemPageSize bytes. | 125 // len must be a multiple of kSystemPageSize bytes. |
| 124 WTF_EXPORT void discardSystemPages(void* addr, size_t len); | 126 WTF_EXPORT void discardSystemPages(void* addr, size_t len); |
| 125 | 127 |
| 126 } // namespace WTF | 128 } // namespace WTF |
| 127 | 129 |
| 128 #endif // WTF_PageAllocator_h | 130 #endif // WTF_PageAllocator_h |
| OLD | NEW |