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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 static void SetThreadLocalInt(LocalStorageKey key, int value) { | 414 static void SetThreadLocalInt(LocalStorageKey key, int value) { |
415 SetThreadLocal(key, reinterpret_cast<void*>(static_cast<intptr_t>(value))); | 415 SetThreadLocal(key, reinterpret_cast<void*>(static_cast<intptr_t>(value))); |
416 } | 416 } |
417 static bool HasThreadLocal(LocalStorageKey key) { | 417 static bool HasThreadLocal(LocalStorageKey key) { |
418 return GetThreadLocal(key) != NULL; | 418 return GetThreadLocal(key) != NULL; |
419 } | 419 } |
420 | 420 |
421 // A hint to the scheduler to let another thread run. | 421 // A hint to the scheduler to let another thread run. |
422 static void YieldCPU(); | 422 static void YieldCPU(); |
423 | 423 |
| 424 // The thread name length is limited to 16 based on Linux's implementation of |
| 425 // prctl(). |
| 426 static const int kMaxThreadNameLength = 16; |
424 private: | 427 private: |
425 void set_name(const char *name); | 428 void set_name(const char *name); |
426 | 429 |
427 class PlatformData; | 430 class PlatformData; |
428 PlatformData* data_; | 431 PlatformData* data_; |
429 | 432 |
430 // The thread name length is limited to 16 based on Linux's implementation of | |
431 // prctl(). | |
432 static const int kMaxThreadNameLength = 16; | |
433 char name_[kMaxThreadNameLength]; | 433 char name_[kMaxThreadNameLength]; |
434 | 434 |
435 DISALLOW_COPY_AND_ASSIGN(Thread); | 435 DISALLOW_COPY_AND_ASSIGN(Thread); |
436 }; | 436 }; |
437 | 437 |
438 | 438 |
439 // ---------------------------------------------------------------------------- | 439 // ---------------------------------------------------------------------------- |
440 // Mutex | 440 // Mutex |
441 // | 441 // |
442 // Mutexes are used for serializing access to non-reentrant sections of code. | 442 // Mutexes are used for serializing access to non-reentrant sections of code. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 PlatformData* data_; // Platform specific data. | 624 PlatformData* data_; // Platform specific data. |
625 int samples_taken_; // Counts stack samples taken. | 625 int samples_taken_; // Counts stack samples taken. |
626 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 626 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
627 }; | 627 }; |
628 | 628 |
629 #endif // ENABLE_LOGGING_AND_PROFILING | 629 #endif // ENABLE_LOGGING_AND_PROFILING |
630 | 630 |
631 } } // namespace v8::internal | 631 } } // namespace v8::internal |
632 | 632 |
633 #endif // V8_PLATFORM_H_ | 633 #endif // V8_PLATFORM_H_ |
OLD | NEW |