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

Side by Side Diff: runtime/vm/os_macos.cc

Issue 11414211: Expose transferable constructor to Int8List (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review fixes 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "vm/os.h" 5 #include "vm/os.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <limits.h> 8 #include <limits.h>
9 #include <mach/mach.h> 9 #include <mach/mach.h>
10 #include <mach/clock.h> 10 #include <mach/clock.h>
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // gettimeofday has microsecond resolution. 61 // gettimeofday has microsecond resolution.
62 struct timeval tv; 62 struct timeval tv;
63 if (gettimeofday(&tv, NULL) < 0) { 63 if (gettimeofday(&tv, NULL) < 0) {
64 UNREACHABLE(); 64 UNREACHABLE();
65 return 0; 65 return 0;
66 } 66 }
67 return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec; 67 return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec;
68 } 68 }
69 69
70 70
71 void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) {
72 const int kMinimumAlignment = 16;
73 ASSERT(Utils::IsPowerOfTwo(alignment));
74 ASSERT(alignment >= kMinimumAlignment);
75 void* p = NULL;
76 int r;
77 r = posix_memalign(&p, alignment, size);
78 if (p == NULL) {
79 UNREACHABLE();
80 }
81 return p;
82 }
83
84
85 void OS::AlignedFree(void* ptr) {
86 free(ptr);
87 }
88
89
71 word OS::ActivationFrameAlignment() { 90 word OS::ActivationFrameAlignment() {
72 // OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI 91 // OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI
73 // Function Call Guide". 92 // Function Call Guide".
74 return 16; 93 return 16;
75 } 94 }
76 95
77 96
78 word OS::PreferredCodeAlignment() { 97 word OS::PreferredCodeAlignment() {
79 ASSERT(32 <= OS::kMaxPreferredCodeAlignment); 98 ASSERT(32 <= OS::kMaxPreferredCodeAlignment);
80 return 32; 99 return 32;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void OS::Abort() { 200 void OS::Abort() {
182 abort(); 201 abort();
183 } 202 }
184 203
185 204
186 void OS::Exit(int code) { 205 void OS::Exit(int code) {
187 exit(code); 206 exit(code);
188 } 207 }
189 208
190 } // namespace dart 209 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698