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

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: Add tests 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 ASSERT(r == 0);
79 return p;
80 }
81
82
83 void OS::AlignedFree(void* ptr) {
84 free(ptr);
85 }
86
87
71 word OS::ActivationFrameAlignment() { 88 word OS::ActivationFrameAlignment() {
72 // OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI 89 // OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI
73 // Function Call Guide". 90 // Function Call Guide".
74 return 16; 91 return 16;
75 } 92 }
76 93
77 94
78 word OS::PreferredCodeAlignment() { 95 word OS::PreferredCodeAlignment() {
79 ASSERT(32 <= OS::kMaxPreferredCodeAlignment); 96 ASSERT(32 <= OS::kMaxPreferredCodeAlignment);
80 return 32; 97 return 32;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void OS::Abort() { 198 void OS::Abort() {
182 abort(); 199 abort();
183 } 200 }
184 201
185 202
186 void OS::Exit(int code) { 203 void OS::Exit(int code) {
187 exit(code); 204 exit(code);
188 } 205 }
189 206
190 } // namespace dart 207 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698