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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 // Wait until thread terminates. | 343 // Wait until thread terminates. |
344 void Join(); | 344 void Join(); |
345 | 345 |
346 // Abstract method for run handler. | 346 // Abstract method for run handler. |
347 virtual void Run() = 0; | 347 virtual void Run() = 0; |
348 | 348 |
349 // Thread-local storage. | 349 // Thread-local storage. |
350 static LocalStorageKey CreateThreadLocalKey(); | 350 static LocalStorageKey CreateThreadLocalKey(); |
351 static void DeleteThreadLocalKey(LocalStorageKey key); | 351 static void DeleteThreadLocalKey(LocalStorageKey key); |
352 static void* GetThreadLocal(LocalStorageKey key); | 352 static void* GetThreadLocal(LocalStorageKey key); |
| 353 static int GetThreadLocalInt(LocalStorageKey key) { |
| 354 return static_cast<int>(reinterpret_cast<intptr_t>(GetThreadLocal(key))); |
| 355 } |
353 static void SetThreadLocal(LocalStorageKey key, void* value); | 356 static void SetThreadLocal(LocalStorageKey key, void* value); |
| 357 static void SetThreadLocalInt(LocalStorageKey key, int value) { |
| 358 SetThreadLocal(key, reinterpret_cast<void*>(static_cast<intptr_t>(value))); |
| 359 } |
| 360 static bool HasThreadLocal(LocalStorageKey key) { |
| 361 return GetThreadLocal(key) != NULL; |
| 362 } |
354 | 363 |
355 // A hint to the scheduler to let another thread run. | 364 // A hint to the scheduler to let another thread run. |
356 static void YieldCPU(); | 365 static void YieldCPU(); |
357 | 366 |
358 private: | 367 private: |
359 class PlatformData; | 368 class PlatformData; |
360 PlatformData* data_; | 369 PlatformData* data_; |
361 DISALLOW_COPY_AND_ASSIGN(Thread); | 370 DISALLOW_COPY_AND_ASSIGN(Thread); |
362 }; | 371 }; |
363 | 372 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 bool active_; | 528 bool active_; |
520 PlatformData* data_; // Platform specific data. | 529 PlatformData* data_; // Platform specific data. |
521 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 530 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
522 }; | 531 }; |
523 | 532 |
524 #endif // ENABLE_LOGGING_AND_PROFILING | 533 #endif // ENABLE_LOGGING_AND_PROFILING |
525 | 534 |
526 } } // namespace v8::internal | 535 } } // namespace v8::internal |
527 | 536 |
528 #endif // V8_PLATFORM_H_ | 537 #endif // V8_PLATFORM_H_ |
OLD | NEW |