Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Unified Diff: runtime/vm/os.h

Issue 11414211: Expose transferable constructor to Int8List (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Final review fixes Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698