Chromium Code Reviews| Index: runtime/vm/os.h |
| diff --git a/runtime/vm/os.h b/runtime/vm/os.h |
| index e33b274f7122fd2ec583676464fc8dcba59b8368..e579def638039f5bf9d66cac30dde44fa8799cc7 100644 |
| --- a/runtime/vm/os.h |
| +++ b/runtime/vm/os.h |
| @@ -40,6 +40,22 @@ class OS { |
| // from midnight January 1, 1970 UTC. |
| static int64_t GetCurrentTimeMicros(); |
| + // Returns an aligned array of type T with n entries. |
| + // Alignment must be >= 16 and a power of two. |
| + template<typename T> |
|
cshapiro
2012/11/30 18:56:53
If you are going to live with the NOLINT why not j
Cutch
2012/11/30 19:27:10
Done.
|
| + static T* AllocateAlignedArray(intptr_t n, intptr_t alignment) { |
| + intptr_t size = n*sizeof(T); // NOLINT |
| + void* p = OS::AlignedAllocate(size, alignment); |
| + return reinterpret_cast<T*>(p); |
| + } |
| + |
| + // Returns an aligned pointer in the C heap with room for size bytes. |
| + // Alignment must be >= 16 and a power of two. |
| + static void* AlignedAllocate(intptr_t size, intptr_t alignment); |
| + |
| + // Frees a pointer returned from AlignedAllocate. |
| + static void AlignedFree(void* ptr); |
| + |
| // Returns the activation frame alignment constraint or zero if |
| // the platform doesn't care. Guaranteed to be a power of two. |
| static word ActivationFrameAlignment(); |