Bug 168996

Summary: Change JSLock to stash PlatformThread instead of std::thread::id.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, ggaren, jfbastien, keith_miller, msaboff, sbarati
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 168920    
Attachments:
Description Flags
proposed patch.
none
proposed patch.
sbarati: review+
patch for landing.
none
patch for landing: added a comment in JSLock to explain why m_ownerThread cannot be an optional. none

Description Mark Lam 2017-02-28 15:45:53 PST
PlatformThread is more useful because it allows us to:
1. suspend / resume threads.
2. find the MachineThreads::Thread which is associated with it.
3. send a signal to the thread.
Comment 1 Mark Lam 2017-02-28 16:19:58 PST
Created attachment 303005 [details]
proposed patch.

Let's test this on the EWS.
Comment 2 Mark Lam 2017-02-28 18:28:40 PST
Comment on attachment 303005 [details]
proposed patch.

Thanks for the review.
Comment 3 WebKit Commit Bot 2017-02-28 18:56:11 PST
Comment on attachment 303005 [details]
proposed patch.

Clearing flags on attachment: 303005

Committed r213202: <http://trac.webkit.org/changeset/213202>
Comment 4 WebKit Commit Bot 2017-02-28 18:56:17 PST
All reviewed patches have been landed.  Closing bug.
Comment 5 Mark Lam 2017-03-01 10:54:27 PST
The patch has been rolled out in r213231: <http://trac.webkit.org/r213231>.
Comment 6 Mark Lam 2017-03-01 11:23:31 PST
Created attachment 303087 [details]
proposed patch.
Comment 7 Saam Barati 2017-03-01 11:42:55 PST
Comment on attachment 303087 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=303087&action=review

r=me

> Source/JavaScriptCore/runtime/JSLock.cpp:173
> +        WTF::storeStoreFence();

This isn't necessary

> Source/JavaScriptCore/runtime/JSLock.h:96
> +    std::optional<PlatformThread> ownerThread() const { return m_ownerThread; }

you need to do the right thing here by checking m_hasOwnerThread
Comment 8 Mark Lam 2017-03-01 11:49:31 PST
Comment on attachment 303087 [details]
proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=303087&action=review

Thanks for the review.

>> Source/JavaScriptCore/runtime/JSLock.cpp:173
>> +        WTF::storeStoreFence();
> 
> This isn't necessary

I've removed this.

>> Source/JavaScriptCore/runtime/JSLock.h:96
>> +    std::optional<PlatformThread> ownerThread() const { return m_ownerThread; }
> 
> you need to do the right thing here by checking m_hasOwnerThread

Fixed.
Comment 9 Mark Lam 2017-03-01 11:50:01 PST
Created attachment 303092 [details]
patch for landing.
Comment 10 Mark Lam 2017-03-01 12:04:02 PST
Created attachment 303095 [details]
patch for landing: added a comment in JSLock to explain why m_ownerThread cannot be an optional.
Comment 11 Mark Lam 2017-03-01 12:18:03 PST
Thanks for the review.  Landed in r213238: <http://trac.webkit.org/r213238>.