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

Side by Side Diff: runtime/vm/os_linux.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 <time.h> 9 #include <time.h>
10 #include <sys/resource.h> 10 #include <sys/resource.h>
11 #include <sys/time.h> 11 #include <sys/time.h>
12 #include <sys/types.h> 12 #include <sys/types.h>
13 #include <malloc.h>
cshapiro 2012/11/29 21:28:17 ditto
Cutch 2012/11/29 23:53:17 Done.
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 {
19 20
20 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { 21 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) {
21 time_t seconds = static_cast<time_t>(seconds_since_epoch); 22 time_t seconds = static_cast<time_t>(seconds_since_epoch);
22 if (seconds != seconds_since_epoch) return false; 23 if (seconds != seconds_since_epoch) return false;
(...skipping 37 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);
cshapiro 2012/11/29 21:28:17 ditto
Cutch 2012/11/29 23:53:17 Done.
76 ASSERT(p != NULL);
77 return p;
78 }
79
80
81 void OS::AlignedFree(void* ptr) {
82 free(ptr);
83 }
84
85
70 // TODO(5411554): May need to hoist these architecture dependent code 86 // TODO(5411554): May need to hoist these architecture dependent code
71 // into a architecture specific file e.g: os_ia32_linux.cc 87 // into a architecture specific file e.g: os_ia32_linux.cc
72 word OS::ActivationFrameAlignment() { 88 word OS::ActivationFrameAlignment() {
73 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) 89 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
74 const int kMinimumAlignment = 16; 90 const int kMinimumAlignment = 16;
75 #elif defined(TARGET_ARCH_ARM) 91 #elif defined(TARGET_ARCH_ARM)
76 const int kMinimumAlignment = 8; 92 const int kMinimumAlignment = 8;
77 #else 93 #else
78 #error Unsupported architecture. 94 #error Unsupported architecture.
79 #endif 95 #endif
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 void OS::Abort() { 222 void OS::Abort() {
207 abort(); 223 abort();
208 } 224 }
209 225
210 226
211 void OS::Exit(int code) { 227 void OS::Exit(int code) {
212 exit(code); 228 exit(code);
213 } 229 }
214 230
215 } // namespace dart 231 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698