Ignore:
Timestamp:
Feb 18, 2019, 11:15:57 PM (6 years ago)
Author:
[email protected]
Message:

[ARM] Fix crash with sampling profiler
https://bugs.webkit.org/show_bug.cgi?id=194772

Reviewed by Mark Lam.

JSTests:

Do not skip test since crash with sampling profiler is now fixed.

  • stress/sampling-profiler-richards.js:

Source/JavaScriptCore:

sampling-profiler-richards.js was crashing with an enabled sampling profiler. add32
did not update the stack pointer in a single instruction. The src register was first
moved into the stack pointer, the immediate imm was added in a subsequent instruction.

This was problematic when a signal handler was invoked before applying the immediate,
when the stack pointer is still set to the temporary value. Avoid this by calculating src+imm in
a temporary register and then move it in one go into the stack pointer.

  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::add32):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h

    r240650 r241756  
    178178    void add32(TrustedImm32 imm, RegisterID src, RegisterID dest)
    179179    {
     180        // For adds with stack pointer destination avoid unpredictable instruction
     181        if (dest == ARMRegisters::sp && src != dest) {
     182            add32(imm, src, dataTempRegister);
     183            move(dataTempRegister, dest);
     184            return;
     185        }
     186
    180187        ARMThumbImmediate armImm = ARMThumbImmediate::makeUInt12OrEncodedImm(imm.m_value);
    181 
    182         // For adds with stack pointer destination, moving the src first to sp is
    183         // needed to avoid unpredictable instruction
    184         if (dest == ARMRegisters::sp && src != dest) {
    185             move(src, ARMRegisters::sp);
    186             src = ARMRegisters::sp;
    187         }
    188188
    189189        if (armImm.isValid())
Note: See TracChangeset for help on using the changeset viewer.