Bug 170097 - [JSC] Move platformThreadSignal to WTF
Summary: [JSC] Move platformThreadSignal to WTF
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-25 04:55 PDT by Yusuke Suzuki
Modified: 2017-03-29 15:07 PDT (History)
10 users (show)

See Also:


Attachments
Patch (7.72 KB, patch)
2017-03-25 04:57 PDT, Yusuke Suzuki
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2017-03-25 04:55:20 PDT
[JSC] Move platformThreadSignal to WTF
Comment 1 Yusuke Suzuki 2017-03-25 04:57:24 PDT
Created attachment 305375 [details]
Patch
Comment 2 Yusuke Suzuki 2017-03-25 05:01:17 PDT
Comment on attachment 305375 [details]
Patch

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

> Source/JavaScriptCore/runtime/JSLock.cpp:112
> +    m_ownerThread = currentThread();

I think it does not cause so much cost. Basically, currentThread() just loads a identifier from thread local storage.
Comment 3 Mark Lam 2017-03-27 13:05:33 PDT
Comment on attachment 305375 [details]
Patch

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

>> Source/JavaScriptCore/runtime/JSLock.cpp:112
>> +    m_ownerThread = currentThread();
> 
> I think it does not cause so much cost. Basically, currentThread() just loads a identifier from thread local storage.

I think this is fine but I would like to run it on some benchmarks first just to make sure.  I'll r+ if I don't find any issues.
Comment 4 Mark Lam 2017-03-28 12:42:46 PDT
(In reply to Mark Lam from comment #3)
> >> Source/JavaScriptCore/runtime/JSLock.cpp:112
> >> +    m_ownerThread = currentThread();
> > 
> > I think it does not cause so much cost. Basically, currentThread() just loads a identifier from thread local storage.
> 
> I think this is fine but I would like to run it on some benchmarks first
> just to make sure.  I'll r+ if I don't find any issues.

I've run the JSC benchmarks and Speedometer.  Perf is neutral.
Comment 5 Mark Lam 2017-03-28 12:43:07 PDT
Comment on attachment 305375 [details]
Patch

r=me
Comment 6 Yusuke Suzuki 2017-03-28 13:01:05 PDT
(In reply to Mark Lam from comment #4)
> (In reply to Mark Lam from comment #3)
> > >> Source/JavaScriptCore/runtime/JSLock.cpp:112
> > >> +    m_ownerThread = currentThread();
> > > 
> > > I think it does not cause so much cost. Basically, currentThread() just loads a identifier from thread local storage.
> > 
> > I think this is fine but I would like to run it on some benchmarks first
> > just to make sure.  I'll r+ if I don't find any issues.
> 
> I've run the JSC benchmarks and Speedometer.  Perf is neutral.

Thanks!!
Comment 7 Yusuke Suzuki 2017-03-28 13:08:58 PDT
Committed r214489: <http://trac.webkit.org/changeset/214489>
Comment 8 JF Bastien 2017-03-29 14:30:57 PDT
Comment on attachment 305375 [details]
Patch

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

> Source/JavaScriptCore/runtime/VMTraps.cpp:458
> +                signalThread(optionalOwnerThread.value(), SIGUSR1);

This function is only defined for USE(PTHREAD), no? Won't that break configurations which aren't USE(PTHREAD) but which build VMTraps.cpp?
Comment 9 Mark Lam 2017-03-29 14:48:32 PDT
(In reply to JF Bastien from comment #8)
> Comment on attachment 305375 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=305375&action=review
> 
> > Source/JavaScriptCore/runtime/VMTraps.cpp:458
> > +                signalThread(optionalOwnerThread.value(), SIGUSR1);
> 
> This function is only defined for USE(PTHREAD), no? Won't that break
> configurations which aren't USE(PTHREAD) but which build VMTraps.cpp?

There's a fall back to a polling based VMTraps for platforms that don't support this.  Right now, the signaling implementation is only used on an opt-in basis.
Comment 10 Mark Lam 2017-03-29 15:07:15 PDT
Comment on attachment 305375 [details]
Patch

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

>>> Source/JavaScriptCore/runtime/VMTraps.cpp:458
>>> +                signalThread(optionalOwnerThread.value(), SIGUSR1);
>> 
>> This function is only defined for USE(PTHREAD), no? Won't that break configurations which aren't USE(PTHREAD) but which build VMTraps.cpp?
> 
> There's a fall back to a polling based VMTraps for platforms that don't support this.  Right now, the signaling implementation is only used on an opt-in basis.

Also USE(PTHREAD) is true for all OS(UNIX), and OS(UNIX) is true for OS(DARWIN), etc.