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

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: 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
« runtime/vm/os_linux.cc ('K') | « runtime/vm/os_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <time.h> 7 #include <time.h>
8 #include <malloc.h>
cshapiro 2012/11/29 21:28:17 move to line 7
Cutch 2012/11/29 23:53:17 Done.
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;
17 // localtime_s implicitly sets _timezone, _daylight and _tzname. 18 // localtime_s implicitly sets _timezone, _daylight and _tzname.
(...skipping 77 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 ASSERT(p != NULL);
112 return p;
113 }
114
115
116 void OS::AlignedFree(void* ptr) {
117 _aligned_free(ptr);
118 }
119
120
105 word OS::ActivationFrameAlignment() { 121 word OS::ActivationFrameAlignment() {
106 #ifdef _WIN64 122 #ifdef _WIN64
107 // Windows 64-bit ABI requires the stack to be 16-byte aligned. 123 // Windows 64-bit ABI requires the stack to be 16-byte aligned.
108 return 16; 124 return 16;
109 #else 125 #else
110 // No requirements on Win32. 126 // No requirements on Win32.
111 return 0; 127 return 0;
112 #endif 128 #endif
113 } 129 }
114 130
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 void OS::Abort() { 257 void OS::Abort() {
242 abort(); 258 abort();
243 } 259 }
244 260
245 261
246 void OS::Exit(int code) { 262 void OS::Exit(int code) {
247 exit(code); 263 exit(code);
248 } 264 }
249 265
250 } // namespace dart 266 } // namespace dart
OLDNEW
« runtime/vm/os_linux.cc ('K') | « runtime/vm/os_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698