Bug 231362 - [JSC][32bit] Fix wrong branchAdd32 assembly for ARMv7
Summary: [JSC][32bit] Fix wrong branchAdd32 assembly for ARMv7
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: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-07 07:39 PDT by Mikhail R. Gadelha
Modified: 2021-10-13 10:50 PDT (History)
8 users (show)

See Also:


Attachments
Patch (3.09 KB, patch)
2021-10-07 07:45 PDT, Mikhail R. Gadelha
no flags Details | Formatted Diff | Diff
Patch (4.77 KB, patch)
2021-10-07 13:14 PDT, Mikhail R. Gadelha
no flags Details | Formatted Diff | Diff
Patch (5.93 KB, patch)
2021-10-13 07:39 PDT, Mikhail R. Gadelha
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail R. Gadelha 2021-10-07 07:39:32 PDT
[JSC][32bit] Fix wrong branchAdd32 assembly for ARMv7
Comment 1 Mikhail R. Gadelha 2021-10-07 07:45:23 PDT
Created attachment 440502 [details]
Patch
Comment 2 Keith Miller 2021-10-07 09:17:46 PDT
Comment on attachment 440502 [details]
Patch

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

> Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h:1859
> +        // Do the add.
> +        ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm.m_value);
> +        if (armImm.isValid())
> +            m_assembler.add_S(dataTempRegister, dataTempRegister, armImm);
> +        else {
> +            move(imm, addressTempRegister);
> +            m_assembler.add_S(dataTempRegister, dataTempRegister, addressTempRegister);
> +        }

Can we add an add32 with flags helper that is this? It seems like that could be useful elsewhere in this file.
Comment 3 Mikhail R. Gadelha 2021-10-07 13:14:15 PDT
Created attachment 440530 [details]
Patch
Comment 4 Yusuke Suzuki 2021-10-11 10:43:16 PDT
Comment on attachment 440530 [details]
Patch

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

r=me with changes.

> Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h:200
> +    void add32(TrustedImm32 imm, Address address, bool updateFlags = false)

Let's define it as add32Impl helper private function, and define add32 as

void add32(TrustedImm32 imm, Address address)
{
    constexpr bool updateFlags = false;
    add32Impl(imm, address, updateFlags);
}

> Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h:229
> +    void add32(TrustedImm32 imm, AbsoluteAddress address, bool updateFlags = false)

Let's define it as add32Impl helper private function, and define add32 as

void add32(TrustedImm32 imm, AbsoluteAddress address)
{
    constexpr bool updateFlags = false;
    add32Impl(imm, address, updateFlags);
}

> Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h:1861
> +        add32(imm, dest, true);

Let's make it readable by,

constexpr bool updateFlags = true;
add32(imm, dest, updateFlags);

> Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h:1867
> +        add32(imm, dest, true);

Let's make it readable by,

constexpr bool updateFlags = true;
add32(imm, dest, updateFlags);
Comment 5 Mikhail R. Gadelha 2021-10-13 07:39:03 PDT
Created attachment 441077 [details]
Patch
Comment 6 EWS 2021-10-13 10:49:20 PDT
Committed r284103 (242931@main): <https://commits.webkit.org/242931@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 441077 [details].
Comment 7 Radar WebKit Bug Importer 2021-10-13 10:50:17 PDT
<rdar://problem/84206141>