Following up on Geoffrey Garen's comment (bug #135848, comment 4), we should look to remove the hardcoded constant __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0, which imposes a maintenance burden as we need to keep its value synchronized with the value of a macro define by the same name in System/pthread_machdep.h. This constant was hardcoded because the iOS public SDK neither includes the header System/pthread_machdep.h nor supports the use of the thread local storage attribute __thread as of the time of writing. One alternative to hardcoding the constant __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0 is to add logic for toolchains that don't support C++ thread local storage to initialize a shared Pthread key exactly once (say, using std::call_once()). Then we would use a similar approach to the System/pthread_machdep.h logic in <http://trac.webkit.org/browser/trunk/Source/bmalloc/bmalloc/PerThread.h?rev=166956#L56> and explicitly save/retrieve the thread-specific data using this shared key and pthread_{get, set}specific().
Created attachment 236553 [details] Patch
Comment on attachment 236553 [details] Patch r=me The #ifdefs are starting to get gross, but I don't have a better suggestion :/.
Committed r172576: <http://trac.webkit.org/changeset/172576>
Committed build fix in <http://trac.webkit.org/changeset/172577>.