⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280701 in webkit


Ignore:
Timestamp:
Aug 5, 2021, 11:30:29 AM (5 years ago)
Author:
Russell Epstein
Message:

Cherry-pick r280659. rdar://problem/81569033

[ARM64] Fix Zoom black screen during video meeting on Safari
https://bugs.webkit.org/show_bug.cgi?id=228776

Reviewed by Saam Barati.

The problem (rdar://81434487) reports that Zoom turns to a black screen during the video
meeting on Safari. The reproduction of this problem is verified and bisected to the previous patch
(https://bugs.webkit.org/show_bug.cgi?id=228057). Previously, we introduce a pattern
matching for instruction EON-with-shift on ARM64, where the pattern is d = n ((m ShiftType amount) -1).

x = m ShiftType amount
y = x -1
z = n
y

We check canBeInternal() on x but not on y based on the computing cost analysis in that patch,
which is totally wrong. If the pattern matching is triggered, then the compiler would not emit
the corresponding Air of x after lowering, leading to data corruption or system crash since y
depends on x.

In the real world example (Zoom video meeting), we find the B3 IR:

...
Int32 b@528 = SShr(b@526, $31(b@527), Wasm: {opcode: I32ShrS, location: 0x26b})
Int32 b@529 = BitXor(b@528, $-1(b@144), Wasm: {opcode: I32Xor, location: 0x26e})
...
Int32 b@551 = BitXor(b@446, b@529, Wasm: {opcode: I32Xor, location: 0x28e})
...

After Lowering to Air:

...
Not32 %fp, %x2, b@529
...
XorNotRightShift32 %tmp199, %tmp211, $31, %tmp209, b@551
...

Since the implementation of the previous patch does commitInternal() on b@528, the operand of
b@529 turns to a frame pointer. To resolve this problem, we should either check canBeInternal()
on both b@528 and b@529 or not at all.

  • b3/B3LowerToAir.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280659 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612.1.27.0-branch/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612.1.27.0-branch/Source/JavaScriptCore/ChangeLog

    r280579 r280701  
     12021-08-05  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r280659. rdar://problem/81569033
     4
     5    [ARM64] Fix Zoom black screen during video meeting on Safari
     6    https://bugs.webkit.org/show_bug.cgi?id=228776
     7   
     8    Reviewed by Saam Barati.
     9   
     10    The problem (rdar://81434487) reports that Zoom turns to a black screen during the video
     11    meeting on Safari. The reproduction of this problem is verified and bisected to the previous patch
     12    (https://bugs.webkit.org/show_bug.cgi?id=228057). Previously, we introduce a pattern
     13    matching for instruction EON-with-shift on ARM64, where the pattern is d = n ^ ((m ShiftType amount) ^ -1).
     14   
     15        x = m ShiftType amount
     16        y = x ^ -1
     17        z = n ^ y
     18   
     19    We check canBeInternal() on x but not on y based on the computing cost analysis in that patch,
     20    which is totally wrong. If the pattern matching is triggered, then the compiler would not emit
     21    the corresponding Air of x after lowering, leading to data corruption or system crash since y
     22    depends on x.
     23   
     24    In the real world example (Zoom video meeting), we find the B3 IR:
     25   
     26        ...
     27        Int32 b@528 = SShr(b@526, $31(b@527), Wasm: {opcode: I32ShrS, location: 0x26b})
     28        Int32 b@529 = BitXor(b@528, $-1(b@144), Wasm: {opcode: I32Xor, location: 0x26e})
     29        ...
     30        Int32 b@551 = BitXor(b@446, b@529, Wasm: {opcode: I32Xor, location: 0x28e})
     31        ...
     32   
     33    After Lowering to Air:
     34   
     35        ...
     36        Not32 %fp, %x2, b@529
     37        ...
     38        XorNotRightShift32 %tmp199, %tmp211, $31, %tmp209, b@551
     39        ...
     40   
     41    Since the implementation of the previous patch does commitInternal() on b@528, the operand of
     42    b@529 turns to a frame pointer. To resolve this problem, we should either check canBeInternal()
     43    on both b@528 and b@529 or not at all.
     44   
     45    * b3/B3LowerToAir.cpp:
     46   
     47    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280659 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     48
     49    2021-08-04  Yijia Huang  <yijia_huang@apple.com>
     50
     51            [ARM64] Fix Zoom black screen during video meeting on Safari
     52            https://bugs.webkit.org/show_bug.cgi?id=228776
     53
     54            Reviewed by Saam Barati.
     55
     56            The problem (rdar://81434487) reports that Zoom turns to a black screen during the video
     57            meeting on Safari. The reproduction of this problem is verified and bisected to the previous patch
     58            (https://bugs.webkit.org/show_bug.cgi?id=228057). Previously, we introduce a pattern
     59            matching for instruction EON-with-shift on ARM64, where the pattern is d = n ^ ((m ShiftType amount) ^ -1).
     60
     61                x = m ShiftType amount
     62                y = x ^ -1
     63                z = n ^ y
     64
     65            We check canBeInternal() on x but not on y based on the computing cost analysis in that patch,
     66            which is totally wrong. If the pattern matching is triggered, then the compiler would not emit
     67            the corresponding Air of x after lowering, leading to data corruption or system crash since y
     68            depends on x.
     69
     70            In the real world example (Zoom video meeting), we find the B3 IR:
     71
     72                ...
     73                Int32 b@528 = SShr(b@526, $31(b@527), Wasm: {opcode: I32ShrS, location: 0x26b})
     74                Int32 b@529 = BitXor(b@528, $-1(b@144), Wasm: {opcode: I32Xor, location: 0x26e})
     75                ...
     76                Int32 b@551 = BitXor(b@446, b@529, Wasm: {opcode: I32Xor, location: 0x28e})
     77                ...
     78
     79
     80            After Lowering to Air:
     81
     82                ...
     83                Not32 %fp, %x2, b@529
     84                ...
     85                XorNotRightShift32 %tmp199, %tmp211, $31, %tmp209, b@551
     86                ...
     87
     88            Since the implementation of the previous patch does commitInternal() on b@528, the operand of
     89            b@529 turns to a frame pointer. To resolve this problem, we should either check canBeInternal()
     90            on both b@528 and b@529 or not at all.
     91
     92            * b3/B3LowerToAir.cpp:
     93
    1942021-08-02  Yijia Huang  <yijia_huang@apple.com>
    295
  • branches/safari-612.1.27.0-branch/Source/JavaScriptCore/b3/B3LowerToAir.cpp

    r280579 r280701  
    32093209                        XorNotRightShift32, XorNotRightShift64,
    32103210                        XorNotUnsignedRightShift32, XorNotUnsignedRightShift64);
    3211                     if (!isValidForm(opcode, Arg::Tmp, Arg::Tmp, Arg::Imm, Arg::Tmp))
     3211                    if (!isValidForm(opcode, Arg::Tmp, Arg::Tmp, Arg::Imm, Arg::Tmp) || !canBeInternal(right))
    32123212                        return false;
    32133213                    Value* mValue = shiftValue->child(0);
     
    32213221
    32223222                    append(opcode, tmp(nValue), tmp(mValue), imm(amountValue), tmp(m_value));
     3223                    commitInternal(right);
    32233224                    commitInternal(shiftValue);
    32243225                    return true;
Note: See TracChangeset for help on using the changeset viewer.