Bug 176345 - [DFG] PutByVal with Array::Generic is too generic
Summary: [DFG] PutByVal with Array::Generic is too generic
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-04 20:14 PDT by Yusuke Suzuki
Modified: 2017-09-27 12:37 PDT (History)
9 users (show)

See Also:


Attachments
Patch (29.88 KB, patch)
2017-09-08 05:33 PDT, Yusuke Suzuki
fpizlo: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Yusuke Suzuki 2017-09-08 04:43:25 PDT
We should have some fixup to remove runtime branches.
For example,

PutByVal(CellUse, StringUse, UntypedUse).
Comment 2 Yusuke Suzuki 2017-09-08 05:33:46 PDT
Created attachment 320257 [details]
Patch
Comment 3 Saam Barati 2017-09-08 11:20:35 PDT
Comment on attachment 320257 [details]
Patch

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

> Source/JavaScriptCore/dfg/DFGOperations.cpp:151
> +        RELEASE_ASSERT(base->isObject());

what guarantees this? Inside Fixup, you speculate Cell, not object? If it's guaranteed, why don't you speculate object?
Comment 4 Yusuke Suzuki 2017-09-08 11:23:35 PDT
Comment on attachment 320257 [details]
Patch

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

>> Source/JavaScriptCore/dfg/DFGOperations.cpp:151
>> +        RELEASE_ASSERT(base->isObject());
> 
> what guarantees this? Inside Fixup, you speculate Cell, not object? If it's guaranteed, why don't you speculate object?

This is originally guaranteed in operationPutByVal generic functions too. This is because we emit `op_put_by_val` with direct flag only for objects.
Comment 5 Filip Pizlo 2017-09-08 11:26:02 PDT
Comment on attachment 320257 [details]
Patch

Cool!

I think that we can make the Generic case even better by implementing it as an inline cache.  Then we can have baseline, DFG, and FTL share that inline cache.  And we could use it for better array access profiling.
Comment 6 Yusuke Suzuki 2017-09-08 11:55:18 PDT
(In reply to Filip Pizlo from comment #5)
> Comment on attachment 320257 [details]
> Patch
> 
> Cool!
> 
> I think that we can make the Generic case even better by implementing it as
> an inline cache.  Then we can have baseline, DFG, and FTL share that inline
> cache.  And we could use it for better array access profiling.

It sounds nice. We already have IC for GetByVal if it sees only one String/Symbol Identifier. But adding this type of IC (String/Symbol specialization) could further improve performance in baseline, DFG, and FTL.
Comment 7 Yusuke Suzuki 2017-09-08 11:58:40 PDT
Committed r221793: <http://trac.webkit.org/changeset/221793>
Comment 8 Saam Barati 2017-09-08 12:42:30 PDT
Comment on attachment 320257 [details]
Patch

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

>>> Source/JavaScriptCore/dfg/DFGOperations.cpp:151
>>> +        RELEASE_ASSERT(base->isObject());
>> 
>> what guarantees this? Inside Fixup, you speculate Cell, not object? If it's guaranteed, why don't you speculate object?
> 
> This is originally guaranteed in operationPutByVal generic functions too. This is because we emit `op_put_by_val` with direct flag only for objects.

Right, but your patch looks like it’s calling this from non-direct case. Am I missing something?
Comment 9 Yusuke Suzuki 2017-09-08 21:53:34 PDT
Comment on attachment 320257 [details]
Patch

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

>>>> Source/JavaScriptCore/dfg/DFGOperations.cpp:151
>>>> +        RELEASE_ASSERT(base->isObject());
>>> 
>>> what guarantees this? Inside Fixup, you speculate Cell, not object? If it's guaranteed, why don't you speculate object?
>> 
>> This is originally guaranteed in operationPutByVal generic functions too. This is because we emit `op_put_by_val` with direct flag only for objects.
> 
> Right, but your patch looks like it’s calling this from non-direct case. Am I missing something?

This "direct" template param is true only when it's used for PutByValDirect.
Comment 10 Saam Barati 2017-09-08 22:40:58 PDT
Comment on attachment 320257 [details]
Patch

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

>>>>> Source/JavaScriptCore/dfg/DFGOperations.cpp:151
>>>>> +        RELEASE_ASSERT(base->isObject());
>>>> 
>>>> what guarantees this? Inside Fixup, you speculate Cell, not object? If it's guaranteed, why don't you speculate object?
>>> 
>>> This is originally guaranteed in operationPutByVal generic functions too. This is because we emit `op_put_by_val` with direct flag only for objects.
>> 
>> Right, but your patch looks like it’s calling this from non-direct case. Am I missing something?
> 
> This "direct" template param is true only when it's used for PutByValDirect.

Sorry I was completely misreading the code. This LGTM
Comment 11 Radar WebKit Bug Importer 2017-09-27 12:37:30 PDT
<rdar://problem/34693626>