Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_OS_H_ | 5 #ifndef VM_OS_H_ |
| 6 #define VM_OS_H_ | 6 #define VM_OS_H_ |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 | 9 |
| 10 // Forward declarations. | 10 // Forward declarations. |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 static int GetLocalTimeZoneAdjustmentInSeconds(); | 33 static int GetLocalTimeZoneAdjustmentInSeconds(); |
| 34 | 34 |
| 35 // Returns the current time in milliseconds measured | 35 // Returns the current time in milliseconds measured |
| 36 // from midnight January 1, 1970 UTC. | 36 // from midnight January 1, 1970 UTC. |
| 37 static int64_t GetCurrentTimeMillis(); | 37 static int64_t GetCurrentTimeMillis(); |
| 38 | 38 |
| 39 // Returns the current time in microseconds measured | 39 // Returns the current time in microseconds measured |
| 40 // from midnight January 1, 1970 UTC. | 40 // from midnight January 1, 1970 UTC. |
| 41 static int64_t GetCurrentTimeMicros(); | 41 static int64_t GetCurrentTimeMicros(); |
| 42 | 42 |
| 43 // Returns an aligned array of type T with n entries. | |
| 44 // Alignment must be >= 16 and a power of two. | |
| 45 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.
| |
| 46 static T* AllocateAlignedArray(intptr_t n, intptr_t alignment) { | |
| 47 intptr_t size = n*sizeof(T); // NOLINT | |
| 48 void* p = OS::AlignedAllocate(size, alignment); | |
| 49 return reinterpret_cast<T*>(p); | |
| 50 } | |
| 51 | |
| 52 // Returns an aligned pointer in the C heap with room for size bytes. | |
| 53 // Alignment must be >= 16 and a power of two. | |
| 54 static void* AlignedAllocate(intptr_t size, intptr_t alignment); | |
| 55 | |
| 56 // Frees a pointer returned from AlignedAllocate. | |
| 57 static void AlignedFree(void* ptr); | |
| 58 | |
| 43 // Returns the activation frame alignment constraint or zero if | 59 // Returns the activation frame alignment constraint or zero if |
| 44 // the platform doesn't care. Guaranteed to be a power of two. | 60 // the platform doesn't care. Guaranteed to be a power of two. |
| 45 static word ActivationFrameAlignment(); | 61 static word ActivationFrameAlignment(); |
| 46 | 62 |
| 47 // This constant is guaranteed to be greater or equal to the | 63 // This constant is guaranteed to be greater or equal to the |
| 48 // preferred code alignment on all platforms. | 64 // preferred code alignment on all platforms. |
| 49 static const int kMaxPreferredCodeAlignment = 32; | 65 static const int kMaxPreferredCodeAlignment = 32; |
| 50 | 66 |
| 51 // Returns the preferred code alignment or zero if | 67 // Returns the preferred code alignment or zero if |
| 52 // the platform doesn't care. Guaranteed to be a power of two. | 68 // the platform doesn't care. Guaranteed to be a power of two. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 static void Shutdown(); | 118 static void Shutdown(); |
| 103 | 119 |
| 104 static void Abort(); | 120 static void Abort(); |
| 105 | 121 |
| 106 static void Exit(int code); | 122 static void Exit(int code); |
| 107 }; | 123 }; |
| 108 | 124 |
| 109 } // namespace dart | 125 } // namespace dart |
| 110 | 126 |
| 111 #endif // VM_OS_H_ | 127 #endif // VM_OS_H_ |
| OLD | NEW |