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

Side by Side 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: os.h fix Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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>
46 static T* AllocateAlignedArray(intptr_t n, intptr_t alignment) {
47 T* result = reinterpret_cast<T*>(OS::AlignedAllocate(n * sizeof(*result),
48 alignment));
49 return result;
50 }
siva 2012/11/30 22:15:53 This function here looks pretty ugly and is not st
cshapiro 2012/11/30 22:18:11 It was my idea to stuff this in here. I would hav
siva 2012/11/30 22:33:21 The only use of this currently seems to be in byte
Cutch 2012/11/30 22:34:27 This is how the code was originally structured. Th
cshapiro 2012/11/30 22:35:53 We also have code that uses new and delete which h
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698