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

Changeset 280659 in webkit


Ignore:
Timestamp:
Aug 4, 2021, 2:17:57 PM (5 years ago)
Author:
Yijia Huang
Message:

[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:
Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r280650 r280659  
     12021-08-04  Yijia Huang  <yijia_huang@apple.com>
     2
     3        [ARM64] Fix Zoom black screen during video meeting on Safari
     4        https://bugs.webkit.org/show_bug.cgi?id=228776
     5
     6        Reviewed by Saam Barati.
     7
     8        The problem (rdar://81434487) reports that Zoom turns to a black screen during the video
     9        meeting on Safari. The reproduction of this problem is verified and bisected to the previous patch
     10        (https://bugs.webkit.org/show_bug.cgi?id=228057). Previously, we introduce a pattern
     11        matching for instruction EON-with-shift on ARM64, where the pattern is d = n ^ ((m ShiftType amount) ^ -1).
     12
     13            x = m ShiftType amount
     14            y = x ^ -1
     15            z = n ^ y
     16
     17        We check canBeInternal() on x but not on y based on the computing cost analysis in that patch,
     18        which is totally wrong. If the pattern matching is triggered, then the compiler would not emit
     19        the corresponding Air of x after lowering, leading to data corruption or system crash since y
     20        depends on x.
     21
     22        In the real world example (Zoom video meeting), we find the B3 IR:
     23
     24            ...
     25            Int32 b@528 = SShr(b@526, $31(b@527), Wasm: {opcode: I32ShrS, location: 0x26b})
     26            Int32 b@529 = BitXor(b@528, $-1(b@144), Wasm: {opcode: I32Xor, location: 0x26e})
     27            ...
     28            Int32 b@551 = BitXor(b@446, b@529, Wasm: {opcode: I32Xor, location: 0x28e})
     29            ...
     30
     31
     32        After Lowering to Air:
     33
     34            ...
     35            Not32 %fp, %x2, b@529
     36            ...
     37            XorNotRightShift32 %tmp199, %tmp211, $31, %tmp209, b@551
     38            ...
     39
     40        Since the implementation of the previous patch does commitInternal() on b@528, the operand of
     41        b@529 turns to a frame pointer. To resolve this problem, we should either check canBeInternal()
     42        on both b@528 and b@529 or not at all.
     43
     44        * b3/B3LowerToAir.cpp:
     45
    1462021-08-04  Commit Queue  <commit-queue@webkit.org>
    247
  • trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp

    r280583 r280659  
    32083208                        XorNotRightShift32, XorNotRightShift64,
    32093209                        XorNotUnsignedRightShift32, XorNotUnsignedRightShift64);
    3210                     if (!isValidForm(opcode, Arg::Tmp, Arg::Tmp, Arg::Imm, Arg::Tmp))
     3210                    if (!isValidForm(opcode, Arg::Tmp, Arg::Tmp, Arg::Imm, Arg::Tmp) || !canBeInternal(right))
    32113211                        return false;
    32123212                    Value* mValue = shiftValue->child(0);
     
    32203220
    32213221                    append(opcode, tmp(nValue), tmp(mValue), imm(amountValue), tmp(m_value));
     3222                    commitInternal(right);
    32223223                    commitInternal(shiftValue);
    32233224                    return true;
Note: See TracChangeset for help on using the changeset viewer.