Bug 186954 - We need to have a getDirectConcurrently for use in the compilers
Summary: We need to have a getDirectConcurrently for use in the compilers
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: Keith Miller
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-06-22 17:47 PDT by Keith Miller
Modified: 2018-06-23 03:48 PDT (History)
5 users (show)

See Also:


Attachments
Patch (5.46 KB, patch)
2018-06-22 17:52 PDT, Keith Miller
no flags Details | Formatted Diff | Diff
Patch (8.41 KB, patch)
2018-06-22 18:37 PDT, Keith Miller
no flags Details | Formatted Diff | Diff
Patch (8.37 KB, patch)
2018-06-22 18:37 PDT, Keith Miller
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 Keith Miller 2018-06-22 17:47:23 PDT
ObjectPropertyCondition and Graph::tryGetConstantProperty should lock the structure before calling getDirect
Comment 1 Keith Miller 2018-06-22 17:52:40 PDT
Created attachment 343405 [details]
Patch
Comment 2 Saam Barati 2018-06-22 17:54:36 PDT
Comment on attachment 343405 [details]
Patch

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

> Source/JavaScriptCore/bytecode/PropertyCondition.cpp:400
> +        // If we are flattening the structure at this time we might shrink the butterfly and read garbage.
> +        ConcurrentJSLocker locker(structure->lock());
> +        if (!structure->isValidOffset(offset()))
> +            return PropertyCondition();
> +        value = base->getDirect(offset());

Don't we know if we're doing this concurrently or not? Maybe just lock in that scenario?
Comment 3 Keith Miller 2018-06-22 17:55:34 PDT
Comment on attachment 343405 [details]
Patch

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

>> Source/JavaScriptCore/bytecode/PropertyCondition.cpp:400
>> +        value = base->getDirect(offset());
> 
> Don't we know if we're doing this concurrently or not? Maybe just lock in that scenario?

Fair point, I'll make that change.
Comment 4 Keith Miller 2018-06-22 18:08:14 PDT
Comment on attachment 343405 [details]
Patch

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

>>> Source/JavaScriptCore/bytecode/PropertyCondition.cpp:400
>>> +        value = base->getDirect(offset());
>> 
>> Don't we know if we're doing this concurrently or not? Maybe just lock in that scenario?
> 
> Fair point, I'll make that change.

Actually, we do a lot of things using the concurrent versions of methods inside PropertyCondition when we are on the mutator. We should fix all of them in a more consistent way. I'm just gonna file a bug.
Comment 5 Keith Miller 2018-06-22 18:37:00 PDT
Created attachment 343410 [details]
Patch
Comment 6 Keith Miller 2018-06-22 18:37:48 PDT
Created attachment 343411 [details]
Patch
Comment 7 Keith Miller 2018-06-22 18:38:32 PDT
rdar://problem/41385437
Comment 8 Mark Lam 2018-06-22 23:15:47 PDT
Comment on attachment 343411 [details]
Patch

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

r=me.  If you haven't already done so, I think you should also remove the "if (!value)" check I added in PropertyCondition::isValidValueForAttributes() due to https://bugs.webkit.org/show_bug.cgi?id=186943.  Your changes in attemptToMakeEquivalenceWithoutBarrier() makes that unnecessary.

> Source/JavaScriptCore/dfg/DFGGraph.cpp:1268
> +    // object pointer such that the inlinecaches told us that the object had a structure that it

missing space between "inline" and "caches".

> Source/JavaScriptCore/dfg/DFGGraph.cpp:1270
> +    // caches had alraedy seen. And then the processor reordered the stores. Seems unlikely and

/alraedy/already/.
Comment 9 Keith Miller 2018-06-23 03:46:12 PDT
Comment on attachment 343411 [details]
Patch

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

>> Source/JavaScriptCore/dfg/DFGGraph.cpp:1268
>> +    // object pointer such that the inlinecaches told us that the object had a structure that it
> 
> missing space between "inline" and "caches".

Fixed

>> Source/JavaScriptCore/dfg/DFGGraph.cpp:1270
>> +    // caches had alraedy seen. And then the processor reordered the stores. Seems unlikely and
> 
> /alraedy/already/.

Fixed
Comment 10 Keith Miller 2018-06-23 03:47:11 PDT
(In reply to Mark Lam from comment #8)
> r=me.  If you haven't already done so, I think you should also remove the
> "if (!value)" check I added in
> PropertyCondition::isValidValueForAttributes() due to
> https://bugs.webkit.org/show_bug.cgi?id=186943.  Your changes in
> attemptToMakeEquivalenceWithoutBarrier() makes that unnecessary.

I think I'm just going to undo my change to attemptToMakeEquivalenceWithoutBarrier() instead. That check makes more sense in isValidValueForAttributes().
Comment 11 Keith Miller 2018-06-23 03:48:07 PDT
Committed r233124: <https://trac.webkit.org/changeset/233124>