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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months 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
« no previous file with comments | « runtime/vm/optimizer.cc ('k') | runtime/vm/os_fuchsia.cc » ('j') | 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/globals.h" 5 #include "vm/globals.h"
6 #if defined(HOST_OS_ANDROID) 6 #if defined(HOST_OS_ANDROID)
7 7
8 #include "vm/os.h" 8 #include "vm/os.h"
9 9
10 #include <android/log.h> // NOLINT 10 #include <android/log.h> // NOLINT
11 #include <endian.h> // NOLINT 11 #include <endian.h> // NOLINT
12 #include <errno.h> // NOLINT 12 #include <errno.h> // NOLINT
13 #include <limits.h> // NOLINT 13 #include <limits.h> // NOLINT
14 #include <malloc.h> // NOLINT 14 #include <malloc.h> // NOLINT
15 #include <time.h> // NOLINT
16 #include <sys/resource.h> // NOLINT 15 #include <sys/resource.h> // NOLINT
17 #include <sys/time.h> // NOLINT 16 #include <sys/time.h> // NOLINT
18 #include <sys/types.h> // NOLINT 17 #include <sys/types.h> // NOLINT
18 #include <time.h> // NOLINT
19 #include <unistd.h> // NOLINT 19 #include <unistd.h> // NOLINT
20 20
21 #include "platform/utils.h" 21 #include "platform/utils.h"
22 #include "vm/code_observers.h" 22 #include "vm/code_observers.h"
23 #include "vm/dart.h" 23 #include "vm/dart.h"
24 #include "vm/isolate.h" 24 #include "vm/isolate.h"
25 #include "vm/zone.h" 25 #include "vm/zone.h"
26 26
27
28 namespace dart { 27 namespace dart {
29 28
30 // Android CodeObservers. 29 // Android CodeObservers.
31 30
32 #ifndef PRODUCT 31 #ifndef PRODUCT
33 32
34 DEFINE_FLAG(bool, 33 DEFINE_FLAG(bool,
35 generate_perf_events_symbols, 34 generate_perf_events_symbols,
36 false, 35 false,
37 "Generate events symbols for profiling with perf"); 36 "Generate events symbols for profiling with perf");
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 81
83 DISALLOW_COPY_AND_ASSIGN(PerfCodeObserver); 82 DISALLOW_COPY_AND_ASSIGN(PerfCodeObserver);
84 }; 83 };
85 84
86 #endif // !PRODUCT 85 #endif // !PRODUCT
87 86
88 const char* OS::Name() { 87 const char* OS::Name() {
89 return "android"; 88 return "android";
90 } 89 }
91 90
92
93 intptr_t OS::ProcessId() { 91 intptr_t OS::ProcessId() {
94 return static_cast<intptr_t>(getpid()); 92 return static_cast<intptr_t>(getpid());
95 } 93 }
96 94
97
98 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) { 95 static bool LocalTime(int64_t seconds_since_epoch, tm* tm_result) {
99 time_t seconds = static_cast<time_t>(seconds_since_epoch); 96 time_t seconds = static_cast<time_t>(seconds_since_epoch);
100 if (seconds != seconds_since_epoch) return false; 97 if (seconds != seconds_since_epoch) return false;
101 struct tm* error_code = localtime_r(&seconds, tm_result); 98 struct tm* error_code = localtime_r(&seconds, tm_result);
102 return error_code != NULL; 99 return error_code != NULL;
103 } 100 }
104 101
105
106 const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { 102 const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) {
107 tm decomposed; 103 tm decomposed;
108 bool succeeded = LocalTime(seconds_since_epoch, &decomposed); 104 bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
109 // If unsuccessful, return an empty string like V8 does. 105 // If unsuccessful, return an empty string like V8 does.
110 return (succeeded && (decomposed.tm_zone != NULL)) ? decomposed.tm_zone : ""; 106 return (succeeded && (decomposed.tm_zone != NULL)) ? decomposed.tm_zone : "";
111 } 107 }
112 108
113
114 int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) { 109 int OS::GetTimeZoneOffsetInSeconds(int64_t seconds_since_epoch) {
115 tm decomposed; 110 tm decomposed;
116 bool succeeded = LocalTime(seconds_since_epoch, &decomposed); 111 bool succeeded = LocalTime(seconds_since_epoch, &decomposed);
117 // Even if the offset was 24 hours it would still easily fit into 32 bits. 112 // Even if the offset was 24 hours it would still easily fit into 32 bits.
118 // If unsuccessful, return zero like V8 does. 113 // If unsuccessful, return zero like V8 does.
119 return succeeded ? static_cast<int>(decomposed.tm_gmtoff) : 0; 114 return succeeded ? static_cast<int>(decomposed.tm_gmtoff) : 0;
120 } 115 }
121 116
122
123 int OS::GetLocalTimeZoneAdjustmentInSeconds() { 117 int OS::GetLocalTimeZoneAdjustmentInSeconds() {
124 // TODO(floitsch): avoid excessive calls to tzset? 118 // TODO(floitsch): avoid excessive calls to tzset?
125 tzset(); 119 tzset();
126 // Even if the offset was 24 hours it would still easily fit into 32 bits. 120 // Even if the offset was 24 hours it would still easily fit into 32 bits.
127 // Note that Unix and Dart disagree on the sign. 121 // Note that Unix and Dart disagree on the sign.
128 return static_cast<int>(-timezone); 122 return static_cast<int>(-timezone);
129 } 123 }
130 124
131
132 int64_t OS::GetCurrentTimeMillis() { 125 int64_t OS::GetCurrentTimeMillis() {
133 return GetCurrentTimeMicros() / 1000; 126 return GetCurrentTimeMicros() / 1000;
134 } 127 }
135 128
136
137 int64_t OS::GetCurrentTimeMicros() { 129 int64_t OS::GetCurrentTimeMicros() {
138 // gettimeofday has microsecond resolution. 130 // gettimeofday has microsecond resolution.
139 struct timeval tv; 131 struct timeval tv;
140 if (gettimeofday(&tv, NULL) < 0) { 132 if (gettimeofday(&tv, NULL) < 0) {
141 UNREACHABLE(); 133 UNREACHABLE();
142 return 0; 134 return 0;
143 } 135 }
144 return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec; 136 return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec;
145 } 137 }
146 138
147
148 int64_t OS::GetCurrentMonotonicTicks() { 139 int64_t OS::GetCurrentMonotonicTicks() {
149 struct timespec ts; 140 struct timespec ts;
150 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { 141 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
151 UNREACHABLE(); 142 UNREACHABLE();
152 return 0; 143 return 0;
153 } 144 }
154 // Convert to nanoseconds. 145 // Convert to nanoseconds.
155 int64_t result = ts.tv_sec; 146 int64_t result = ts.tv_sec;
156 result *= kNanosecondsPerSecond; 147 result *= kNanosecondsPerSecond;
157 result += ts.tv_nsec; 148 result += ts.tv_nsec;
158 return result; 149 return result;
159 } 150 }
160 151
161
162 int64_t OS::GetCurrentMonotonicFrequency() { 152 int64_t OS::GetCurrentMonotonicFrequency() {
163 return kNanosecondsPerSecond; 153 return kNanosecondsPerSecond;
164 } 154 }
165 155
166
167 int64_t OS::GetCurrentMonotonicMicros() { 156 int64_t OS::GetCurrentMonotonicMicros() {
168 int64_t ticks = GetCurrentMonotonicTicks(); 157 int64_t ticks = GetCurrentMonotonicTicks();
169 ASSERT(GetCurrentMonotonicFrequency() == kNanosecondsPerSecond); 158 ASSERT(GetCurrentMonotonicFrequency() == kNanosecondsPerSecond);
170 return ticks / kNanosecondsPerMicrosecond; 159 return ticks / kNanosecondsPerMicrosecond;
171 } 160 }
172 161
173
174 int64_t OS::GetCurrentThreadCPUMicros() { 162 int64_t OS::GetCurrentThreadCPUMicros() {
175 struct timespec ts; 163 struct timespec ts;
176 if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) { 164 if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) {
177 UNREACHABLE(); 165 UNREACHABLE();
178 return -1; 166 return -1;
179 } 167 }
180 int64_t result = ts.tv_sec; 168 int64_t result = ts.tv_sec;
181 result *= kMicrosecondsPerSecond; 169 result *= kMicrosecondsPerSecond;
182 result += (ts.tv_nsec / kNanosecondsPerMicrosecond); 170 result += (ts.tv_nsec / kNanosecondsPerMicrosecond);
183 return result; 171 return result;
184 } 172 }
185 173
186
187 // TODO(5411554): May need to hoist these architecture dependent code 174 // TODO(5411554): May need to hoist these architecture dependent code
188 // into a architecture specific file e.g: os_ia32_linux.cc 175 // into a architecture specific file e.g: os_ia32_linux.cc
189 intptr_t OS::ActivationFrameAlignment() { 176 intptr_t OS::ActivationFrameAlignment() {
190 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ 177 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \
191 defined(TARGET_ARCH_ARM64) 178 defined(TARGET_ARCH_ARM64)
192 const int kMinimumAlignment = 16; 179 const int kMinimumAlignment = 16;
193 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_DBC) 180 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_DBC)
194 const int kMinimumAlignment = 8; 181 const int kMinimumAlignment = 8;
195 #else 182 #else
196 #error Unsupported architecture. 183 #error Unsupported architecture.
197 #endif 184 #endif
198 intptr_t alignment = kMinimumAlignment; 185 intptr_t alignment = kMinimumAlignment;
199 // TODO(5411554): Allow overriding default stack alignment for 186 // TODO(5411554): Allow overriding default stack alignment for
200 // testing purposes. 187 // testing purposes.
201 // Flags::DebugIsInt("stackalign", &alignment); 188 // Flags::DebugIsInt("stackalign", &alignment);
202 ASSERT(Utils::IsPowerOfTwo(alignment)); 189 ASSERT(Utils::IsPowerOfTwo(alignment));
203 ASSERT(alignment >= kMinimumAlignment); 190 ASSERT(alignment >= kMinimumAlignment);
204 return alignment; 191 return alignment;
205 } 192 }
206 193
207
208 intptr_t OS::PreferredCodeAlignment() { 194 intptr_t OS::PreferredCodeAlignment() {
209 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \ 195 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \
210 defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC) 196 defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_DBC)
211 const int kMinimumAlignment = 32; 197 const int kMinimumAlignment = 32;
212 #elif defined(TARGET_ARCH_ARM) 198 #elif defined(TARGET_ARCH_ARM)
213 const int kMinimumAlignment = 16; 199 const int kMinimumAlignment = 16;
214 #else 200 #else
215 #error Unsupported architecture. 201 #error Unsupported architecture.
216 #endif 202 #endif
217 intptr_t alignment = kMinimumAlignment; 203 intptr_t alignment = kMinimumAlignment;
218 // TODO(5411554): Allow overriding default code alignment for 204 // TODO(5411554): Allow overriding default code alignment for
219 // testing purposes. 205 // testing purposes.
220 // Flags::DebugIsInt("codealign", &alignment); 206 // Flags::DebugIsInt("codealign", &alignment);
221 ASSERT(Utils::IsPowerOfTwo(alignment)); 207 ASSERT(Utils::IsPowerOfTwo(alignment));
222 ASSERT(alignment >= kMinimumAlignment); 208 ASSERT(alignment >= kMinimumAlignment);
223 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment); 209 ASSERT(alignment <= OS::kMaxPreferredCodeAlignment);
224 return alignment; 210 return alignment;
225 } 211 }
226 212
227
228 int OS::NumberOfAvailableProcessors() { 213 int OS::NumberOfAvailableProcessors() {
229 return sysconf(_SC_NPROCESSORS_ONLN); 214 return sysconf(_SC_NPROCESSORS_ONLN);
230 } 215 }
231 216
232
233 uintptr_t OS::MaxRSS() { 217 uintptr_t OS::MaxRSS() {
234 struct rusage usage; 218 struct rusage usage;
235 usage.ru_maxrss = 0; 219 usage.ru_maxrss = 0;
236 int r = getrusage(RUSAGE_SELF, &usage); 220 int r = getrusage(RUSAGE_SELF, &usage);
237 ASSERT(r == 0); 221 ASSERT(r == 0);
238 return usage.ru_maxrss * KB; 222 return usage.ru_maxrss * KB;
239 } 223 }
240 224
241
242 void OS::Sleep(int64_t millis) { 225 void OS::Sleep(int64_t millis) {
243 int64_t micros = millis * kMicrosecondsPerMillisecond; 226 int64_t micros = millis * kMicrosecondsPerMillisecond;
244 SleepMicros(micros); 227 SleepMicros(micros);
245 } 228 }
246 229
247
248 void OS::SleepMicros(int64_t micros) { 230 void OS::SleepMicros(int64_t micros) {
249 struct timespec req; // requested. 231 struct timespec req; // requested.
250 struct timespec rem; // remainder. 232 struct timespec rem; // remainder.
251 int64_t seconds = micros / kMicrosecondsPerSecond; 233 int64_t seconds = micros / kMicrosecondsPerSecond;
252 micros = micros - seconds * kMicrosecondsPerSecond; 234 micros = micros - seconds * kMicrosecondsPerSecond;
253 int64_t nanos = micros * kNanosecondsPerMicrosecond; 235 int64_t nanos = micros * kNanosecondsPerMicrosecond;
254 req.tv_sec = seconds; 236 req.tv_sec = seconds;
255 req.tv_nsec = nanos; 237 req.tv_nsec = nanos;
256 while (true) { 238 while (true) {
257 int r = nanosleep(&req, &rem); 239 int r = nanosleep(&req, &rem);
258 if (r == 0) { 240 if (r == 0) {
259 break; 241 break;
260 } 242 }
261 // We should only ever see an interrupt error. 243 // We should only ever see an interrupt error.
262 ASSERT(errno == EINTR); 244 ASSERT(errno == EINTR);
263 // Copy remainder into requested and repeat. 245 // Copy remainder into requested and repeat.
264 req = rem; 246 req = rem;
265 } 247 }
266 } 248 }
267 249
268
269 void OS::DebugBreak() { 250 void OS::DebugBreak() {
270 __builtin_trap(); 251 __builtin_trap();
271 } 252 }
272 253
273
274 uintptr_t DART_NOINLINE OS::GetProgramCounter() { 254 uintptr_t DART_NOINLINE OS::GetProgramCounter() {
275 return reinterpret_cast<uintptr_t>( 255 return reinterpret_cast<uintptr_t>(
276 __builtin_extract_return_addr(__builtin_return_address(0))); 256 __builtin_extract_return_addr(__builtin_return_address(0)));
277 } 257 }
278 258
279
280 char* OS::StrNDup(const char* s, intptr_t n) { 259 char* OS::StrNDup(const char* s, intptr_t n) {
281 return strndup(s, n); 260 return strndup(s, n);
282 } 261 }
283 262
284
285 intptr_t OS::StrNLen(const char* s, intptr_t n) { 263 intptr_t OS::StrNLen(const char* s, intptr_t n) {
286 return strnlen(s, n); 264 return strnlen(s, n);
287 } 265 }
288 266
289
290 uint16_t HostToBigEndian16(uint16_t value) { 267 uint16_t HostToBigEndian16(uint16_t value) {
291 return htobe16(value); 268 return htobe16(value);
292 } 269 }
293 270
294
295 uint32_t HostToBigEndian32(uint32_t value) { 271 uint32_t HostToBigEndian32(uint32_t value) {
296 return htobe32(value); 272 return htobe32(value);
297 } 273 }
298 274
299
300 uint64_t HostToBigEndian64(uint64_t value) { 275 uint64_t HostToBigEndian64(uint64_t value) {
301 return htobe64(value); 276 return htobe64(value);
302 } 277 }
303 278
304
305 uint16_t HostToLittleEndian16(uint16_t value) { 279 uint16_t HostToLittleEndian16(uint16_t value) {
306 return htole16(value); 280 return htole16(value);
307 } 281 }
308 282
309
310 uint32_t HostToLittleEndian32(uint32_t value) { 283 uint32_t HostToLittleEndian32(uint32_t value) {
311 return htole32(value); 284 return htole32(value);
312 } 285 }
313 286
314
315 uint64_t HostToLittleEndian64(uint64_t value) { 287 uint64_t HostToLittleEndian64(uint64_t value) {
316 return htole64(value); 288 return htole64(value);
317 } 289 }
318 290
319
320 void OS::Print(const char* format, ...) { 291 void OS::Print(const char* format, ...) {
321 va_list args; 292 va_list args;
322 va_start(args, format); 293 va_start(args, format);
323 VFPrint(stdout, format, args); 294 VFPrint(stdout, format, args);
324 // Forward to the Android log for remote access. 295 // Forward to the Android log for remote access.
325 __android_log_vprint(ANDROID_LOG_INFO, "DartVM", format, args); 296 __android_log_vprint(ANDROID_LOG_INFO, "DartVM", format, args);
326 va_end(args); 297 va_end(args);
327 } 298 }
328 299
329
330 void OS::VFPrint(FILE* stream, const char* format, va_list args) { 300 void OS::VFPrint(FILE* stream, const char* format, va_list args) {
331 vfprintf(stream, format, args); 301 vfprintf(stream, format, args);
332 fflush(stream); 302 fflush(stream);
333 } 303 }
334 304
335
336 int OS::SNPrint(char* str, size_t size, const char* format, ...) { 305 int OS::SNPrint(char* str, size_t size, const char* format, ...) {
337 va_list args; 306 va_list args;
338 va_start(args, format); 307 va_start(args, format);
339 int retval = VSNPrint(str, size, format, args); 308 int retval = VSNPrint(str, size, format, args);
340 va_end(args); 309 va_end(args);
341 return retval; 310 return retval;
342 } 311 }
343 312
344
345 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { 313 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) {
346 int retval = vsnprintf(str, size, format, args); 314 int retval = vsnprintf(str, size, format, args);
347 if (retval < 0) { 315 if (retval < 0) {
348 FATAL1("Fatal error in OS::VSNPrint with format '%s'", format); 316 FATAL1("Fatal error in OS::VSNPrint with format '%s'", format);
349 } 317 }
350 return retval; 318 return retval;
351 } 319 }
352 320
353
354 char* OS::SCreate(Zone* zone, const char* format, ...) { 321 char* OS::SCreate(Zone* zone, const char* format, ...) {
355 va_list args; 322 va_list args;
356 va_start(args, format); 323 va_start(args, format);
357 char* buffer = VSCreate(zone, format, args); 324 char* buffer = VSCreate(zone, format, args);
358 va_end(args); 325 va_end(args);
359 return buffer; 326 return buffer;
360 } 327 }
361 328
362
363 char* OS::VSCreate(Zone* zone, const char* format, va_list args) { 329 char* OS::VSCreate(Zone* zone, const char* format, va_list args) {
364 // Measure. 330 // Measure.
365 va_list measure_args; 331 va_list measure_args;
366 va_copy(measure_args, args); 332 va_copy(measure_args, args);
367 intptr_t len = VSNPrint(NULL, 0, format, measure_args); 333 intptr_t len = VSNPrint(NULL, 0, format, measure_args);
368 va_end(measure_args); 334 va_end(measure_args);
369 335
370 char* buffer; 336 char* buffer;
371 if (zone) { 337 if (zone) {
372 buffer = zone->Alloc<char>(len + 1); 338 buffer = zone->Alloc<char>(len + 1);
373 } else { 339 } else {
374 buffer = reinterpret_cast<char*>(malloc(len + 1)); 340 buffer = reinterpret_cast<char*>(malloc(len + 1));
375 } 341 }
376 ASSERT(buffer != NULL); 342 ASSERT(buffer != NULL);
377 343
378 // Print. 344 // Print.
379 va_list print_args; 345 va_list print_args;
380 va_copy(print_args, args); 346 va_copy(print_args, args);
381 VSNPrint(buffer, len + 1, format, print_args); 347 VSNPrint(buffer, len + 1, format, print_args);
382 va_end(print_args); 348 va_end(print_args);
383 return buffer; 349 return buffer;
384 } 350 }
385 351
386
387 bool OS::StringToInt64(const char* str, int64_t* value) { 352 bool OS::StringToInt64(const char* str, int64_t* value) {
388 ASSERT(str != NULL && strlen(str) > 0 && value != NULL); 353 ASSERT(str != NULL && strlen(str) > 0 && value != NULL);
389 int32_t base = 10; 354 int32_t base = 10;
390 char* endptr; 355 char* endptr;
391 int i = 0; 356 int i = 0;
392 if (str[0] == '-') { 357 if (str[0] == '-') {
393 i = 1; 358 i = 1;
394 } 359 }
395 if ((str[i] == '0') && (str[i + 1] == 'x' || str[i + 1] == 'X') && 360 if ((str[i] == '0') && (str[i + 1] == 'x' || str[i + 1] == 'X') &&
396 (str[i + 2] != '\0')) { 361 (str[i + 2] != '\0')) {
397 base = 16; 362 base = 16;
398 } 363 }
399 errno = 0; 364 errno = 0;
400 *value = strtoll(str, &endptr, base); 365 *value = strtoll(str, &endptr, base);
401 return ((errno == 0) && (endptr != str) && (*endptr == 0)); 366 return ((errno == 0) && (endptr != str) && (*endptr == 0));
402 } 367 }
403 368
404
405 void OS::RegisterCodeObservers() { 369 void OS::RegisterCodeObservers() {
406 #ifndef PRODUCT 370 #ifndef PRODUCT
407 if (FLAG_generate_perf_events_symbols) { 371 if (FLAG_generate_perf_events_symbols) {
408 CodeObservers::Register(new PerfCodeObserver); 372 CodeObservers::Register(new PerfCodeObserver);
409 } 373 }
410 #endif // !PRODUCT 374 #endif // !PRODUCT
411 } 375 }
412 376
413
414 void OS::PrintErr(const char* format, ...) { 377 void OS::PrintErr(const char* format, ...) {
415 va_list args; 378 va_list args;
416 va_start(args, format); 379 va_start(args, format);
417 VFPrint(stderr, format, args); 380 VFPrint(stderr, format, args);
418 // Forward to the Android log for remote access. 381 // Forward to the Android log for remote access.
419 __android_log_vprint(ANDROID_LOG_ERROR, "DartVM", format, args); 382 __android_log_vprint(ANDROID_LOG_ERROR, "DartVM", format, args);
420 va_end(args); 383 va_end(args);
421 } 384 }
422 385
423
424 void OS::InitOnce() { 386 void OS::InitOnce() {
425 // TODO(5411554): For now we check that initonce is called only once, 387 // TODO(5411554): For now we check that initonce is called only once,
426 // Once there is more formal mechanism to call InitOnce we can move 388 // Once there is more formal mechanism to call InitOnce we can move
427 // this check there. 389 // this check there.
428 static bool init_once_called = false; 390 static bool init_once_called = false;
429 ASSERT(init_once_called == false); 391 ASSERT(init_once_called == false);
430 init_once_called = true; 392 init_once_called = true;
431 } 393 }
432 394
433
434 void OS::Shutdown() {} 395 void OS::Shutdown() {}
435 396
436
437 void OS::Abort() { 397 void OS::Abort() {
438 abort(); 398 abort();
439 } 399 }
440 400
441
442 void OS::Exit(int code) { 401 void OS::Exit(int code) {
443 exit(code); 402 exit(code);
444 } 403 }
445 404
446 } // namespace dart 405 } // namespace dart
447 406
448 #endif // defined(HOST_OS_ANDROID) 407 #endif // defined(HOST_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/vm/optimizer.cc ('k') | runtime/vm/os_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698