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

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

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) 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 <malloc.h>
9 #include <time.h> 10 #include <time.h>
10 #include <sys/resource.h> 11 #include <sys/resource.h>
11 #include <sys/time.h> 12 #include <sys/time.h>
12 #include <sys/types.h> 13 #include <sys/types.h>
13 #include <unistd.h> 14 #include <unistd.h>
14 15
15 #include "platform/utils.h" 16 #include "platform/utils.h"
16 #include "vm/isolate.h" 17 #include "vm/isolate.h"
17 18
18 namespace dart { 19 namespace dart {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // gettimeofday has microsecond resolution. 61 // gettimeofday has microsecond resolution.
61 struct timeval tv; 62 struct timeval tv;
62 if (gettimeofday(&tv, NULL) < 0) { 63 if (gettimeofday(&tv, NULL) < 0) {
63 UNREACHABLE(); 64 UNREACHABLE();
64 return 0; 65 return 0;
65 } 66 }
66 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;
67 } 68 }
68 69
69 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 = memalign(alignment, size);
76 if (p == NULL) {
77 UNREACHABLE();
78 }
79 return p;
80 }
81
82
83 void OS::AlignedFree(void* ptr) {
84 free(ptr);
85 }
86
87
70 // TODO(5411554): May need to hoist these architecture dependent code 88 // TODO(5411554): May need to hoist these architecture dependent code
71 // into a architecture specific file e.g: os_ia32_linux.cc 89 // into a architecture specific file e.g: os_ia32_linux.cc
72 word OS::ActivationFrameAlignment() { 90 word OS::ActivationFrameAlignment() {
73 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) 91 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
74 const int kMinimumAlignment = 16; 92 const int kMinimumAlignment = 16;
75 #elif defined(TARGET_ARCH_ARM) 93 #elif defined(TARGET_ARCH_ARM)
76 const int kMinimumAlignment = 8; 94 const int kMinimumAlignment = 8;
77 #else 95 #else
78 #error Unsupported architecture. 96 #error Unsupported architecture.
79 #endif 97 #endif
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 void OS::Abort() { 224 void OS::Abort() {
207 abort(); 225 abort();
208 } 226 }
209 227
210 228
211 void OS::Exit(int code) { 229 void OS::Exit(int code) {
212 exit(code); 230 exit(code);
213 } 231 }
214 232
215 } // namespace dart 233 } // namespace dart
OLDNEW
« runtime/vm/os.h ('K') | « runtime/vm/os.h ('k') | runtime/vm/os_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698