OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 buffer[kBufferSize - 1] = '\0'; | 576 buffer[kBufferSize - 1] = '\0'; |
577 char* period_pos = strchr(buffer, '.'); | 577 char* period_pos = strchr(buffer, '.'); |
578 *period_pos = '\0'; | 578 *period_pos = '\0'; |
579 int kernel_version_major = | 579 int kernel_version_major = |
580 static_cast<int>(strtol(buffer, NULL, 10)); // NOLINT | 580 static_cast<int>(strtol(buffer, NULL, 10)); // NOLINT |
581 // The constants below are taken from pthreads.s from the XNU kernel | 581 // The constants below are taken from pthreads.s from the XNU kernel |
582 // sources archive at www.opensource.apple.com. | 582 // sources archive at www.opensource.apple.com. |
583 if (kernel_version_major < 11) { | 583 if (kernel_version_major < 11) { |
584 // 8.x.x (Tiger), 9.x.x (Leopard), 10.x.x (Snow Leopard) have the | 584 // 8.x.x (Tiger), 9.x.x (Leopard), 10.x.x (Snow Leopard) have the |
585 // same offsets. | 585 // same offsets. |
586 #if defined(V8_HOST_ARCH_IA32) | 586 #if V8_HOST_ARCH_IA32 |
587 kMacTlsBaseOffset = 0x48; | 587 kMacTlsBaseOffset = 0x48; |
588 #else | 588 #else |
589 kMacTlsBaseOffset = 0x60; | 589 kMacTlsBaseOffset = 0x60; |
590 #endif | 590 #endif |
591 } else { | 591 } else { |
592 // 11.x.x (Lion) changed the offset. | 592 // 11.x.x (Lion) changed the offset. |
593 kMacTlsBaseOffset = 0; | 593 kMacTlsBaseOffset = 0; |
594 } | 594 } |
595 | 595 |
596 Release_Store(&tls_base_offset_initialized, 1); | 596 Release_Store(&tls_base_offset_initialized, 1); |
597 } | 597 } |
598 | 598 |
| 599 |
599 static void CheckFastTls(Thread::LocalStorageKey key) { | 600 static void CheckFastTls(Thread::LocalStorageKey key) { |
600 void* expected = reinterpret_cast<void*>(0x1234CAFE); | 601 void* expected = reinterpret_cast<void*>(0x1234CAFE); |
601 Thread::SetThreadLocal(key, expected); | 602 Thread::SetThreadLocal(key, expected); |
602 void* actual = Thread::GetExistingThreadLocal(key); | 603 void* actual = Thread::GetExistingThreadLocal(key); |
603 if (expected != actual) { | 604 if (expected != actual) { |
604 V8_Fatal(__FILE__, __LINE__, | 605 V8_Fatal(__FILE__, __LINE__, |
605 "V8 failed to initialize fast TLS on current kernel"); | 606 "V8 failed to initialize fast TLS on current kernel"); |
606 } | 607 } |
607 Thread::SetThreadLocal(key, NULL); | 608 Thread::SetThreadLocal(key, NULL); |
608 } | 609 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 limit_mutex = CreateMutex(); | 745 limit_mutex = CreateMutex(); |
745 } | 746 } |
746 | 747 |
747 | 748 |
748 void OS::TearDown() { | 749 void OS::TearDown() { |
749 delete limit_mutex; | 750 delete limit_mutex; |
750 } | 751 } |
751 | 752 |
752 | 753 |
753 } } // namespace v8::internal | 754 } } // namespace v8::internal |
OLD | NEW |