| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/base/platform/platform.h" | 5 #include "src/base/platform/platform.h" |
| 6 | 6 |
| 7 #if V8_OS_POSIX | 7 #if V8_OS_POSIX |
| 8 #include <unistd.h> // NOLINT | 8 #include <unistd.h> // NOLINT |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 CHECK_EQ(GetValue(arraysize(keys_) - i - 1), | 87 CHECK_EQ(GetValue(arraysize(keys_) - i - 1), |
| 88 Thread::GetExistingThreadLocal(keys_[i])); | 88 Thread::GetExistingThreadLocal(keys_[i])); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 static void* GetValue(size_t x) { | 93 static void* GetValue(size_t x) { |
| 94 return reinterpret_cast<void*>(static_cast<uintptr_t>(x + 1)); | 94 return reinterpret_cast<void*>(static_cast<uintptr_t>(x + 1)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 #if defined(ANDROID) |
| 98 // Older versions of Android have fewer TLS slots (nominally 64, but the |
| 99 // system uses "about 5 of them" itself). |
| 100 Thread::LocalStorageKey keys_[32]; |
| 101 #else |
| 97 Thread::LocalStorageKey keys_[256]; | 102 Thread::LocalStorageKey keys_[256]; |
| 103 #endif |
| 98 }; | 104 }; |
| 99 | 105 |
| 100 } // namespace | 106 } // namespace |
| 101 | 107 |
| 102 | 108 |
| 103 TEST_F(ThreadLocalStorageTest, DoTest) { | 109 TEST_F(ThreadLocalStorageTest, DoTest) { |
| 104 Run(); | 110 Run(); |
| 105 Start(); | 111 Start(); |
| 106 Join(); | 112 Join(); |
| 107 } | 113 } |
| 108 | 114 |
| 109 } // namespace base | 115 } // namespace base |
| 110 } // namespace v8 | 116 } // namespace v8 |
| OLD | NEW |