Bug 202324 - OSR exit shouldn't bother updating get_by_id array profiles that have changed modes
Summary: OSR exit shouldn't bother updating get_by_id array profiles that have changed...
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: 2019-09-27 11:10 PDT by Keith Miller
Modified: 2019-10-02 14:10 PDT (History)
8 users (show)

See Also:


Attachments
Patch (3.94 KB, patch)
2019-09-27 11:11 PDT, Keith Miller
no flags Details | Formatted Diff | Diff
Patch for landing (4.08 KB, patch)
2019-09-27 11:44 PDT, Keith Miller
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Miller 2019-09-27 11:10:32 PDT
OSR exit shouldn't bother updating get_by_id array profiles that have changed modes
Comment 1 Keith Miller 2019-09-27 11:11:50 PDT
Created attachment 379744 [details]
Patch
Comment 2 Keith Miller 2019-09-27 11:11:52 PDT
<rdar://problem/52669110>
Comment 3 Yusuke Suzuki 2019-09-27 11:33:29 PDT
Comment on attachment 379744 [details]
Patch

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

r=me

> Source/JavaScriptCore/dfg/DFGOSRExit.cpp:523
> +            bool doProfile = instruction->opcodeID() != op_get_by_id || instruction->as<OpGetById>().metadata(profiledCodeBlock).m_modeMetadata.mode == GetByIdMode::ArrayLength;

You can use `!instruction->is<OpGetById>()`.

> Source/JavaScriptCore/dfg/DFGOSRExit.cpp:1176
> +                if (instruction->opcodeID() == op_get_by_id) {

Ditto. You can use `instruction->is<OpGetById>()`.
Comment 4 Keith Miller 2019-09-27 11:34:16 PDT
Comment on attachment 379744 [details]
Patch

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

>> Source/JavaScriptCore/dfg/DFGOSRExit.cpp:523
>> +            bool doProfile = instruction->opcodeID() != op_get_by_id || instruction->as<OpGetById>().metadata(profiledCodeBlock).m_modeMetadata.mode == GetByIdMode::ArrayLength;
> 
> You can use `!instruction->is<OpGetById>()`.

Nice! Fixed, thanks!

>> Source/JavaScriptCore/dfg/DFGOSRExit.cpp:1176
>> +                if (instruction->opcodeID() == op_get_by_id) {
> 
> Ditto. You can use `instruction->is<OpGetById>()`.

ditto.
Comment 5 Mark Lam 2019-09-27 11:34:48 PDT
Comment on attachment 379744 [details]
Patch

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

> Source/JavaScriptCore/dfg/DFGOSRExit.cpp:1174
>              if (ArrayProfile* arrayProfile = jit.baselineCodeBlockFor(codeOrigin)->getArrayProfile(codeOrigin.bytecodeIndex())) {
> +                const Instruction* instruction = jit.baselineCodeBlockFor(codeOrigin)->instructions().at(codeOrigin.bytecodeIndex()).ptr();

Can you just compute jit.baselineCodeBlockFor(codeOrigin) once and pre-cache it?
Comment 6 Keith Miller 2019-09-27 11:42:09 PDT
Comment on attachment 379744 [details]
Patch

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

>> Source/JavaScriptCore/dfg/DFGOSRExit.cpp:1174
>> +                const Instruction* instruction = jit.baselineCodeBlockFor(codeOrigin)->instructions().at(codeOrigin.bytecodeIndex()).ptr();
> 
> Can you just compute jit.baselineCodeBlockFor(codeOrigin) once and pre-cache it?

Sure, done.
Comment 7 Keith Miller 2019-09-27 11:44:43 PDT
Created attachment 379749 [details]
Patch for landing
Comment 8 WebKit Commit Bot 2019-09-27 12:30:14 PDT
Comment on attachment 379749 [details]
Patch for landing

Clearing flags on attachment: 379749

Committed r250440: <https://trac.webkit.org/changeset/250440>
Comment 9 WebKit Commit Bot 2019-09-27 12:30:16 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Saam Barati 2019-10-01 17:33:30 PDT
You missed the FTL
Comment 11 Keith Miller 2019-10-02 14:02:35 PDT
(In reply to Saam Barati from comment #10)
> You missed the FTL

Whoops, will fix.
Comment 12 Keith Miller 2019-10-02 14:10:23 PDT
See: https://bugs.webkit.org/show_bug.cgi?id=202493 for FTL version.