| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Tests of fast TLS support. | 3 // Tests of fast TLS support. |
| 4 | 4 |
| 5 #include "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "cctest.h" | 7 #include "cctest.h" |
| 8 #include "checks.h" | 8 #include "checks.h" |
| 9 #include "platform.h" | 9 #include "platform.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 for (int i = 0; i < kValueCount; i++) { | 41 for (int i = 0; i < kValueCount; i++) { |
| 42 CHECK_EQ(GetValue(kValueCount - i - 1), | 42 CHECK_EQ(GetValue(kValueCount - i - 1), |
| 43 Thread::GetThreadLocal(keys[i])); | 43 Thread::GetThreadLocal(keys[i])); |
| 44 CHECK_EQ(GetValue(kValueCount - i - 1), | 44 CHECK_EQ(GetValue(kValueCount - i - 1), |
| 45 Thread::GetExistingThreadLocal(keys[i])); | 45 Thread::GetExistingThreadLocal(keys[i])); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 class TestThread : public Thread { | 49 class TestThread : public Thread { |
| 50 public: | 50 public: |
| 51 TestThread() : Thread(NULL, "TestThread") {} | 51 TestThread() : Thread("TestThread") {} |
| 52 | 52 |
| 53 virtual void Run() { | 53 virtual void Run() { |
| 54 DoTest(); | 54 DoTest(); |
| 55 } | 55 } |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 TEST(FastTLS) { | 58 TEST(FastTLS) { |
| 59 for (int i = 0; i < kValueCount; i++) { | 59 for (int i = 0; i < kValueCount; i++) { |
| 60 keys[i] = Thread::CreateThreadLocalKey(); | 60 keys[i] = Thread::CreateThreadLocalKey(); |
| 61 } | 61 } |
| 62 DoTest(); | 62 DoTest(); |
| 63 TestThread thread; | 63 TestThread thread; |
| 64 thread.Start(); | 64 thread.Start(); |
| 65 thread.Join(); | 65 thread.Join(); |
| 66 } | 66 } |
| OLD | NEW |