Changeset 189891 in webkit


Ignore:
Timestamp:
Sep 16, 2015 6:16:09 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Fix 32-bit build issues in WebAssembly
https://bugs.webkit.org/show_bug.cgi?id=149240

Patch by Sukolsak Sakshuwong <Sukolsak Sakshuwong> on 2015-09-16
Reviewed by Geoffrey Garen.

Fix the syntax error and replace the instructions that are not available on
64-bit platforms.

  • wasm/WASMFunctionCompiler.h:

(JSC::WASMFunctionCompiler::startFunction):
(JSC::WASMFunctionCompiler::endFunction):
(JSC::WASMFunctionCompiler::buildReturn):
(JSC::WASMFunctionCompiler::callAndUnboxResult):
(JSC::WASMFunctionCompiler::loadValueAndConvertToDouble):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r189889 r189891  
     12015-09-16  Sukolsak Sakshuwong  <sukolsak@gmail.com>
     2
     3        Fix 32-bit build issues in WebAssembly
     4        https://bugs.webkit.org/show_bug.cgi?id=149240
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Fix the syntax error and replace the instructions that are not available on
     9        64-bit platforms.
     10
     11        * wasm/WASMFunctionCompiler.h:
     12        (JSC::WASMFunctionCompiler::startFunction):
     13        (JSC::WASMFunctionCompiler::endFunction):
     14        (JSC::WASMFunctionCompiler::buildReturn):
     15        (JSC::WASMFunctionCompiler::callAndUnboxResult):
     16        (JSC::WASMFunctionCompiler::loadValueAndConvertToDouble):
     17
    1182015-09-16  Geoffrey Garen  <ggaren@apple.com>
    219
  • trunk/Source/JavaScriptCore/wasm/WASMFunctionCompiler.h

    r189822 r189891  
    136136        for (uint32_t i = 0; i < numberOfF32LocalVariables; ++i)
    137137            store32(TrustedImm32(0), localAddress(localIndex++));
    138         for (uint32_t i = 0; i < numberOfF64LocalVariables; ++i)
     138        for (uint32_t i = 0; i < numberOfF64LocalVariables; ++i) {
     139#if USE(JSVALUE64)
    139140            store64(TrustedImm64(0), localAddress(localIndex++));
     141#else
     142            store32(TrustedImm32(0), localAddress(localIndex));
     143            store32(TrustedImm32(0), localAddress(localIndex).withOffset(4));
     144            localIndex++;
     145#endif
     146        }
    140147
    141148        m_codeBlock->setNumParameters(1 + arguments.size());
     
    147154
    148155        // FIXME: Remove these if the last statement is a return statement.
    149         move(TrustedImm64(JSValue::encode(jsUndefined())), GPRInfo::returnValueGPR);
     156#if USE(JSVALUE64)
     157        JSValueRegs returnValueRegs(GPRInfo::returnValueGPR);
     158#else
     159        JSValueRegs returnValueRegs(GPRInfo::returnValueGPR2, GPRInfo::returnValueGPR);
     160#endif
     161        moveTrustedValue(jsUndefined(), returnValueRegs);
    150162        emitFunctionEpilogue();
    151163        ret();
     
    245257    void buildReturn(int, WASMExpressionType returnType)
    246258    {
     259#if USE(JSVALUE64)
     260        JSValueRegs returnValueRegs(GPRInfo::returnValueGPR);
     261#else
     262        JSValueRegs returnValueRegs(GPRInfo::returnValueGPR2, GPRInfo::returnValueGPR);
     263#endif
    247264        switch (returnType) {
    248265        case WASMExpressionType::I32:
     
    268285            break;
    269286        case WASMExpressionType::Void:
    270             move(TrustedImm64(JSValue::encode(jsUndefined())), GPRInfo::returnValueGPR);
     287            moveTrustedValue(jsUndefined(), returnValueRegs);
    271288            break;
    272289        default:
     
    840857    }
    841858#else
     859    // EncodedJSValue in JSVALUE32_64 is a 64-bit integer. When being compiled in ARM EABI, it must be aligned even-numbered register (r0, r2 or [sp]).
     860    // To avoid assemblies from using wrong registers, let's occupy r1 or r3 with a dummy argument when necessary.
     861#if (COMPILER_SUPPORTS(EABI) && CPU(ARM)) || CPU(MIPS)
     862#define EABI_32BIT_DUMMY_ARG      TrustedImm32(0),
     863#else
     864#define EABI_32BIT_DUMMY_ARG
     865#endif
     866
    842867    void callOperation(Z_JITOperation_EJ operation, GPRReg srcTag, GPRReg srcPayload, GPRReg dst)
    843868    {
     
    907932        store64(GPRInfo::regT0, Address(stackPointerRegister, JSStack::Callee * static_cast<int>(sizeof(Register)) - sizeof(CallerFrameAndPC)));
    908933#else
    909         store32(regT0, Address(stackPointerRegister, JSStack::Callee * static_cast<int>(sizeof(Register)) + PayloadOffset - sizeof(CallerFrameAndPC)));
    910         store32(TrustedImm32(CellTag), Address(stackPointerRegister, JSStack::Callee * static_cast<int>(sizeof(Register)) + TagOffset - sizeof(CallerFrameAndPC)));
     934        store32(GPRInfo::regT0, Address(stackPointerRegister, JSStack::Callee * static_cast<int>(sizeof(Register)) + PayloadOffset - sizeof(CallerFrameAndPC)));
     935        store32(TrustedImm32(JSValue::CellTag), Address(stackPointerRegister, JSStack::Callee * static_cast<int>(sizeof(Register)) + TagOffset - sizeof(CallerFrameAndPC)));
    911936#endif
    912937
     
    10001025
    10011026        checkJSNumber.link(this);
    1002         unboxDouble(tempRegs.tagGPR(), tempRegs.payloadGPR(), dst, fpScratch)
     1027        unboxDouble(tempRegs.tagGPR(), tempRegs.payloadGPR(), dst, fpScratch);
    10031028        end.link(this);
    10041029    }
Note: See TracChangeset for help on using the changeset viewer.