| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 252 } |
| 253 | 253 |
| 254 | 254 |
| 255 int OS::ActivationFrameAlignment() { | 255 int OS::ActivationFrameAlignment() { |
| 256 // OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI | 256 // OS X activation frames must be 16 byte-aligned; see "Mac OS X ABI |
| 257 // Function Call Guide". | 257 // Function Call Guide". |
| 258 return 16; | 258 return 16; |
| 259 } | 259 } |
| 260 | 260 |
| 261 | 261 |
| 262 const char* OS::LocalTimezone(double time) { |
| 263 if (isnan(time)) return ""; |
| 264 time_t tv = static_cast<time_t>(floor(time/msPerSecond)); |
| 265 struct tm* t = localtime(&tv); |
| 266 if (NULL == t) return ""; |
| 267 return t->tm_zone; |
| 268 } |
| 269 |
| 270 |
| 271 double OS::LocalTimeOffset() { |
| 272 time_t tv = time(NULL); |
| 273 struct tm* t = localtime(&tv); |
| 274 // tm_gmtoff includes any daylight savings offset, so subtract it. |
| 275 return static_cast<double>(t->tm_gmtoff * msPerSecond - |
| 276 (t->tm_isdst > 0 ? 3600 * msPerSecond : 0)); |
| 277 } |
| 278 |
| 279 |
| 262 int OS::StackWalk(Vector<StackFrame> frames) { | 280 int OS::StackWalk(Vector<StackFrame> frames) { |
| 263 // If weak link to execinfo lib has failed, ie because we are on 10.4, abort. | 281 // If weak link to execinfo lib has failed, ie because we are on 10.4, abort. |
| 264 if (backtrace == NULL) | 282 if (backtrace == NULL) |
| 265 return 0; | 283 return 0; |
| 266 | 284 |
| 267 int frames_size = frames.length(); | 285 int frames_size = frames.length(); |
| 268 void** addresses = NewArray<void*>(frames_size); | 286 void** addresses = NewArray<void*>(frames_size); |
| 269 int frames_count = backtrace(addresses, frames_size); | 287 int frames_count = backtrace(addresses, frames_size); |
| 270 | 288 |
| 271 char** symbols; | 289 char** symbols; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 | 652 |
| 635 // Deallocate Mach port for thread. | 653 // Deallocate Mach port for thread. |
| 636 if (IsProfiling()) { | 654 if (IsProfiling()) { |
| 637 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); | 655 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); |
| 638 } | 656 } |
| 639 } | 657 } |
| 640 | 658 |
| 641 #endif // ENABLE_LOGGING_AND_PROFILING | 659 #endif // ENABLE_LOGGING_AND_PROFILING |
| 642 | 660 |
| 643 } } // namespace v8::internal | 661 } } // namespace v8::internal |
| OLD | NEW |