Bug 156821

Summary: Lets do less locking of symbol tables in the BytecodeGenerator where we don't have race conditions
Product: WebKit Reporter: Saam Barati <saam>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, commit-queue, fpizlo, ggaren, gskachkov, keith_miller, mark.lam, msaboff, oliver, sukolsak, ysuzuki
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch
fpizlo: review+, buildbot: commit-queue-
Archive of layout-test-results from ews117 for mac-yosemite
none
patch for landing
none
patch for landing none

Description Saam Barati 2016-04-20 16:42:35 PDT
...
Comment 1 Filip Pizlo 2016-04-20 17:36:21 PDT
I've always wanted a mode of LockHolder that says "shut up I know I don't need a lock here", to pass to methods that need a LockHolder& when I know that I own the object.  It could lead to nice syntax:

foo->something(LockHolder::DANGER_NO_LOCKING, ...);

I don't know if that applies in this case, but this could be broadly useful. It would be OK to call this in cases where you know that you just allocated 'foo' and so it hasn't escaped into the "global" heap yet.
Comment 2 Saam Barati 2016-04-21 11:46:25 PDT
Created attachment 276939 [details]
patch
Comment 3 WebKit Commit Bot 2016-04-21 11:47:16 PDT
Attachment 276939 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:864:  Missing space before {  [whitespace/braces] [5]
ERROR: Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:3286:  Missing space before {  [whitespace/braces] [5]
Total errors found: 2 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Filip Pizlo 2016-04-21 11:49:09 PDT
Comment on attachment 276939 [details]
patch

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

> Source/JavaScriptCore/runtime/ConcurrentJITLock.h:120
> +    enum NoLockingNecessaryTag { NoLockingNecessary };
> +    ConcurrentJITLocker(NoLockingNecessaryTag)
> +        : ConcurrentJITLockerBase(nullptr)
> +    {
> +    }
> +

Can you move this to WTF::Locker?
Comment 5 Geoffrey Garen 2016-04-21 11:49:47 PDT
Comment on attachment 276939 [details]
patch

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

> Source/JavaScriptCore/runtime/ConcurrentJITLock.h:119
> +    enum NoLockingNecessaryTag { NoLockingNecessary };
> +    ConcurrentJITLocker(NoLockingNecessaryTag)
> +        : ConcurrentJITLockerBase(nullptr)
> +    {
> +    }

Can we assert here that the lock is not held?
Comment 6 Filip Pizlo 2016-04-21 11:51:56 PDT
(In reply to comment #5)
> Comment on attachment 276939 [details]
> patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=276939&action=review
> 
> > Source/JavaScriptCore/runtime/ConcurrentJITLock.h:119
> > +    enum NoLockingNecessaryTag { NoLockingNecessary };
> > +    ConcurrentJITLocker(NoLockingNecessaryTag)
> > +        : ConcurrentJITLockerBase(nullptr)
> > +    {
> > +    }
> 
> Can we assert here that the lock is not held?

When we talked about this earlier we meant for it to be useful in any context where you know that it's not meaningful to even speak of the lock.  You may have an object A that normally gets synchronized using a lock in object B, where object B owns object A.  You could use this version of the constructor in a code path that runs before you have even allocated object B, for example because you give object A to object B when you create object B.  To support those idioms, you wouldn't want to have to even mention the lock here.
Comment 7 Saam Barati 2016-04-21 12:22:15 PDT
Created attachment 276942 [details]
patch

Added to WTF::Locker too.
Comment 8 WebKit Commit Bot 2016-04-21 12:24:58 PDT
Attachment 276942 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:864:  Missing space before {  [whitespace/braces] [5]
ERROR: Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:3286:  Missing space before {  [whitespace/braces] [5]
ERROR: Source/WTF/wtf/Locker.h:47:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 3 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Build Bot 2016-04-21 13:18:32 PDT
Comment on attachment 276942 [details]
patch

Attachment 276942 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1197672

Number of test failures exceeded the failure limit.
Comment 10 Build Bot 2016-04-21 13:18:36 PDT
Created attachment 276947 [details]
Archive of layout-test-results from ews117 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 11 Saam Barati 2016-04-21 14:04:33 PDT
Created attachment 276956 [details]
patch for landing
Comment 12 WebKit Commit Bot 2016-04-21 14:06:15 PDT
Attachment 276956 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:864:  Missing space before {  [whitespace/braces] [5]
ERROR: Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:3286:  Missing space before {  [whitespace/braces] [5]
ERROR: Source/WTF/wtf/Locker.h:47:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 3 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Saam Barati 2016-04-21 14:36:26 PDT
Created attachment 276962 [details]
patch for landing
Comment 14 WebKit Commit Bot 2016-04-21 14:38:49 PDT
Attachment 276962 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:864:  Missing space before {  [whitespace/braces] [5]
ERROR: Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:3286:  Missing space before {  [whitespace/braces] [5]
ERROR: Source/WTF/wtf/Locker.h:47:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 3 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 WebKit Commit Bot 2016-04-21 17:09:17 PDT
Comment on attachment 276962 [details]
patch for landing

Clearing flags on attachment: 276962

Committed r199848: <http://trac.webkit.org/changeset/199848>
Comment 16 WebKit Commit Bot 2016-04-21 17:09:23 PDT
All reviewed patches have been landed.  Closing bug.