Oilpan: Avoid looking up TLS in ThreadState::current()
This CL adds a fast, conservative way to determine if we are in the main thread. 1) In ThreadState::init(), take the underestimated size of the main thread. 2) When ThreadState::current() is called, check if the current stack address is within the underestimated size from the stack start of the main thread. If yes, we can immediately return the mainThreadState() without looking up TLS. Otherwise, we look up TLS. TLS is very slow especially in Mac and Windows. This CL improves blink_perf.parser.querySelector-* (and other) benchmarks by 6% in Mac. BUG=420515 Review URL: https://codereview.chromium.org/643883002 git-svn-id: svn://svn.chromium.org/blink/trunk@183637 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Showing
Please register or sign in to comment