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

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: 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 <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 return NULL;
cshapiro 2012/11/30 00:23:25 This return is not needed.
Cutch 2012/11/30 04:09:54 Done.
Cutch 2012/11/30 04:09:54 I was copying the structure of OS::GetCurrentTimeM
79 }
80 return p;
81 }
82
83
84 void OS::AlignedFree(void* ptr) {
85 free(ptr);
86 }
87
88
70 // TODO(5411554): May need to hoist these architecture dependent code 89 // TODO(5411554): May need to hoist these architecture dependent code
71 // into a architecture specific file e.g: os_ia32_linux.cc 90 // into a architecture specific file e.g: os_ia32_linux.cc
72 word OS::ActivationFrameAlignment() { 91 word OS::ActivationFrameAlignment() {
73 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) 92 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
74 const int kMinimumAlignment = 16; 93 const int kMinimumAlignment = 16;
75 #elif defined(TARGET_ARCH_ARM) 94 #elif defined(TARGET_ARCH_ARM)
76 const int kMinimumAlignment = 8; 95 const int kMinimumAlignment = 8;
77 #else 96 #else
78 #error Unsupported architecture. 97 #error Unsupported architecture.
79 #endif 98 #endif
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 void OS::Abort() { 225 void OS::Abort() {
207 abort(); 226 abort();
208 } 227 }
209 228
210 229
211 void OS::Exit(int code) { 230 void OS::Exit(int code) {
212 exit(code); 231 exit(code);
213 } 232 }
214 233
215 } // namespace dart 234 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698