| OLD | NEW |
| 1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2005, Google Inc. |
| 2 // All rights reserved. | 2 // 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Check that no bit is set at position ADDRESS_BITS or higher. | 93 // Check that no bit is set at position ADDRESS_BITS or higher. |
| 94 template <int ADDRESS_BITS> bool CheckAddressBits(uintptr_t ptr) { | 94 template <int ADDRESS_BITS> bool CheckAddressBits(uintptr_t ptr) { |
| 95 return (ptr >> ADDRESS_BITS) == 0; | 95 return (ptr >> ADDRESS_BITS) == 0; |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Specialize for the bit width of a pointer to avoid undefined shift. | 98 // Specialize for the bit width of a pointer to avoid undefined shift. |
| 99 template <> bool CheckAddressBits<8 * sizeof(void*)>(uintptr_t ptr) { | 99 template <> bool CheckAddressBits<8 * sizeof(void*)>(uintptr_t ptr) { |
| 100 return true; | 100 return true; |
| 101 } | 101 } |
| 102 | 102 |
| 103 #if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(__x86_64__) | 103 #if defined(OS_LINUX) && defined(__x86_64__) |
| 104 #define ASLR_IS_SUPPORTED | 104 #define ASLR_IS_SUPPORTED |
| 105 #endif | 105 #endif |
| 106 | 106 |
| 107 #if defined(ASLR_IS_SUPPORTED) | 107 #if defined(ASLR_IS_SUPPORTED) |
| 108 // From libdieharder, public domain library by Bob Jenkins (rngav.c). | 108 // From libdieharder, public domain library by Bob Jenkins (rngav.c). |
| 109 // Described at http://burtleburtle.net/bob/rand/smallprng.html. | 109 // Described at http://burtleburtle.net/bob/rand/smallprng.html. |
| 110 // Not cryptographically secure, but good enough for what we need. | 110 // Not cryptographically secure, but good enough for what we need. |
| 111 typedef uint32_t u4; | 111 typedef uint32_t u4; |
| 112 struct ranctx { | 112 struct ranctx { |
| 113 u4 a; | 113 u4 a; |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 } | 686 } |
| 687 } | 687 } |
| 688 #endif | 688 #endif |
| 689 } | 689 } |
| 690 | 690 |
| 691 void TCMalloc_SystemCommit(void* start, size_t length) { | 691 void TCMalloc_SystemCommit(void* start, size_t length) { |
| 692 // Nothing to do here. TCMalloc_SystemRelease does not alter pages | 692 // Nothing to do here. TCMalloc_SystemRelease does not alter pages |
| 693 // such that they need to be re-committed before they can be used by the | 693 // such that they need to be re-committed before they can be used by the |
| 694 // application. | 694 // application. |
| 695 } | 695 } |
| OLD | NEW |