diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-12-22 13:27:28 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-01-25 08:30:24 +0000 |
commit | e97dd97a10fada91d9b50f129fa733e09971e6d7 (patch) | |
tree | 961673b93a3b55ddf3c6d43ff1134126983c53c9 /src/qml/memory/qv4mm_p.h | |
parent | ac7a0ca517db963f8ecd82b9792f5fdcc85b78ae (diff) |
Align allocations to multiples of Chunk::SlotSize
Change-Id: I13612d055b50331afa5eb9a9b61f4fd2d29b90bd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/memory/qv4mm_p.h')
-rw-r--r-- | src/qml/memory/qv4mm_p.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h index e6417cb2e0..da8579f0dc 100644 --- a/src/qml/memory/qv4mm_p.h +++ b/src/qml/memory/qv4mm_p.h @@ -55,6 +55,7 @@ #include <private/qv4value_p.h> #include <private/qv4scopedvalue_p.h> #include <private/qv4object_p.h> +#include <private/qv4mmdefs_p.h> #include <QVector> //#define DETAILED_MM_STATS @@ -83,7 +84,7 @@ public: // TODO: this is only for 64bit (and x86 with SSE/AVX), so exend it for other architectures to be slightly more efficient (meaning, align on 8-byte boundaries). // Note: all occurrences of "16" in alloc/dealloc are also due to the alignment. static inline std::size_t align(std::size_t size) - { return (size + 15) & ~0xf; } + { return (size + Chunk::SlotSize - 1) & ~(Chunk::SlotSize - 1); } template<typename ManagedType> inline typename ManagedType::Data *allocManaged(std::size_t size, std::size_t unmanagedSize = 0) |