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

Side by Side Diff: runtime/vm/os_win.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 <malloc.h>
7 #include <time.h> 8 #include <time.h>
8 9
9 #include "platform/assert.h" 10 #include "platform/assert.h"
10 11
11 namespace dart { 12 namespace dart {
12 13
13 // As a side-effect sets the globals _timezone, _daylight and _tzname. 14 // As a side-effect sets the globals _timezone, _daylight and _tzname.
14 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { 15 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) {
15 time_t seconds = static_cast<time_t>(seconds_since_epoch); 16 time_t seconds = static_cast<time_t>(seconds_since_epoch);
16 if (seconds != seconds_since_epoch) return false; 17 if (seconds != seconds_since_epoch) return false;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 union TimeStamp { 96 union TimeStamp {
96 FILETIME ft_; 97 FILETIME ft_;
97 int64_t t_; 98 int64_t t_;
98 }; 99 };
99 TimeStamp time; 100 TimeStamp time;
100 GetSystemTimeAsFileTime(&time.ft_); 101 GetSystemTimeAsFileTime(&time.ft_);
101 return (time.t_ - kTimeEpoc) / kTimeScaler; 102 return (time.t_ - kTimeEpoc) / kTimeScaler;
102 } 103 }
103 104
104 105
106 void* OS::AlignedAllocate(intptr_t size, intptr_t alignment) {
107 const int kMinimumAlignment = 16;
108 ASSERT(Utils::IsPowerOfTwo(alignment));
109 ASSERT(alignment >= kMinimumAlignment);
110 void* p = _aligned_malloc(size, alignment);
111 if (p == NULL) {
112 UNREACHABLE();
113 return NULL;
cshapiro 2012/11/30 00:23:25 ditto
Cutch 2012/11/30 04:09:54 Done.
114 }
115 return p;
116 }
117
118
119 void OS::AlignedFree(void* ptr) {
120 _aligned_free(ptr);
121 }
122
123
105 word OS::ActivationFrameAlignment() { 124 word OS::ActivationFrameAlignment() {
106 #ifdef _WIN64 125 #ifdef _WIN64
107 // Windows 64-bit ABI requires the stack to be 16-byte aligned. 126 // Windows 64-bit ABI requires the stack to be 16-byte aligned.
108 return 16; 127 return 16;
109 #else 128 #else
110 // No requirements on Win32. 129 // No requirements on Win32.
111 return 0; 130 return 0;
112 #endif 131 #endif
113 } 132 }
114 133
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 void OS::Abort() { 260 void OS::Abort() {
242 abort(); 261 abort();
243 } 262 }
244 263
245 264
246 void OS::Exit(int code) { 265 void OS::Exit(int code) {
247 exit(code); 266 exit(code);
248 } 267 }
249 268
250 } // namespace dart 269 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698