Reviewers: Dean McNamee, Erik Corry, Message: Thread id's are always int. Fixed conversion to and from void*. Review please.
Description: X64: Fixed conversion between tread_id (int) and void*. Thread id's are always int size values (generated from an int counter). Please review this at http://codereview.chromium.org/113030 Affected files: M src/v8threads.cc Index: src/v8threads.cc diff --git a/src/v8threads.cc b/src/v8threads.cc index 243947636012cf4030782e2b9de472e3d824fe97..bd0e4494955aa08af4f44d5a94e17a281fa5ce39 100644 --- a/src/v8threads.cc +++ b/src/v8threads.cc @@ -309,13 +309,17 @@ void ThreadManager::MarkCompactEpilogue(bool is_compacting) { int ThreadManager::CurrentId() { - return bit_cast<int, void*>(Thread::GetThreadLocal(thread_id_key)); + void* stored_thread_id = Thread::GetThreadLocal(thread_id_key); + intptr_t thread_id_number = bit_cast<intptr_t, void*>(stored_thread_id); + // Thread id's are always ints. + return static_cast<int>(thread_id_number); } void ThreadManager::AssignId() { if (Thread::GetThreadLocal(thread_id_key) == NULL) { - Thread::SetThreadLocal(thread_id_key, bit_cast<void*, int>(next_id_++)); + intptr_t new_id = static_cast<intptr_t>(next_id_++); + Thread::SetThreadLocal(thread_id_key, bit_cast<void*, intptr_t>(new_id)); } } --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list v8-dev@googlegroups.com http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---