Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 439558
Collapse All | Expand All

(-)mozjs17.orig/js/src/assembler/assembler/MacroAssemblerX86_64.h (+5 lines)
Lines 44-51 Link Here
44
44
45
class MacroAssemblerX86_64 : public MacroAssemblerX86Common {
45
class MacroAssemblerX86_64 : public MacroAssemblerX86Common {
46
protected:
46
protected:
47
#ifdef __ILP32__
48
    static const intptr_t MinInt32 = 0x80000000;
49
    static const intptr_t MaxInt32 = 0x7FFFFFFF;
50
#else
47
    static const intptr_t MinInt32 = 0xFFFFFFFF80000000;
51
    static const intptr_t MinInt32 = 0xFFFFFFFF80000000;
48
    static const intptr_t MaxInt32 = 0x000000007FFFFFFF;
52
    static const intptr_t MaxInt32 = 0x000000007FFFFFFF;
53
#endif
49
54
50
public:
55
public:
51
    static const Scale ScalePtr = TimesEight;
56
    static const Scale ScalePtr = TimesEight;
(-)mozjs17.orig/js/src/configure (-1 / +21 lines)
Lines 8191-8197 Link Here
8191
EOF
8191
EOF
8192
8192
8193
    ;;
8193
    ;;
8194
x86_64*-*)
8194
x86_64*-*gnu | x86_64*-*solaris* | x86_64*-*mks | x86_64*-*bsd )
8195
    ENABLE_METHODJIT=1
8195
    ENABLE_METHODJIT=1
8196
    ENABLE_MONOIC=1
8196
    ENABLE_MONOIC=1
8197
    ENABLE_POLYIC=1
8197
    ENABLE_POLYIC=1
Lines 8211-8216 Link Here
8211
EOF
8211
EOF
8212
8212
8213
    ;;
8213
    ;;
8214
x86_64*-*x32)
8215
    ENABLE_METHODJIT=1
8216
    ENABLE_MONOIC=1
8217
    ENABLE_POLYIC=1
8218
    ENABLE_METHODJIT_TYPED_ARRAY=1
8219
    cat >> confdefs.pytmp <<\EOF
8220
        (''' JS_CPU_X32 ''', ' 1 ')
8221
EOF
8222
cat >> confdefs.h <<\EOF
8223
#define JS_CPU_X32 1
8224
EOF
8225
8226
    cat >> confdefs.pytmp <<\EOF
8227
        (''' JS_NUNBOX32 ''', ' 1 ')
8228
EOF
8229
cat >> confdefs.h <<\EOF
8230
#define JS_NUNBOX32 1
8231
EOF
8232
8233
    ;;
8214
arm*-*)
8234
arm*-*)
8215
    ENABLE_METHODJIT=1
8235
    ENABLE_METHODJIT=1
8216
    ENABLE_MONOIC=1
8236
    ENABLE_MONOIC=1
(-)mozjs17.orig/js/src/configure.in (-1 / +9 lines)
Lines 2215-2221 Link Here
2215
    AC_DEFINE(JS_CPU_X86)
2215
    AC_DEFINE(JS_CPU_X86)
2216
    AC_DEFINE(JS_NUNBOX32)
2216
    AC_DEFINE(JS_NUNBOX32)
2217
    ;;
2217
    ;;
2218
x86_64*-*)
2218
x86_64*-*gnu | x86_64*-*solaris* | x86_64*-*mks | x86_64*-*bsd )
2219
    ENABLE_METHODJIT=1
2219
    ENABLE_METHODJIT=1
2220
    ENABLE_MONOIC=1
2220
    ENABLE_MONOIC=1
2221
    ENABLE_POLYIC=1
2221
    ENABLE_POLYIC=1
Lines 2223-2228 Link Here
2223
    AC_DEFINE(JS_CPU_X64)
2223
    AC_DEFINE(JS_CPU_X64)
2224
    AC_DEFINE(JS_PUNBOX64)
2224
    AC_DEFINE(JS_PUNBOX64)
2225
    ;;
2225
    ;;
2226
x86_64*-*x32)
2227
    ENABLE_METHODJIT=1
2228
    ENABLE_MONOIC=1
2229
    ENABLE_POLYIC=1
2230
    ENABLE_METHODJIT_TYPED_ARRAY=1
2231
    AC_DEFINE(JS_CPU_X32)
2232
    AC_DEFINE(JS_NUNBOX32)
2233
    ;;
2226
arm*-*)
2234
arm*-*)
2227
    ENABLE_METHODJIT=1
2235
    ENABLE_METHODJIT=1
2228
    ENABLE_MONOIC=1
2236
    ENABLE_MONOIC=1
(-)mozjs17.orig/js/src/jstypes.h (-1 / +1 lines)
Lines 160-166 Link Here
160
# endif
160
# endif
161
#elif defined(__GNUC__)
161
#elif defined(__GNUC__)
162
/* Additional GCC defines are when running on Solaris, AIX, and HPUX */
162
/* Additional GCC defines are when running on Solaris, AIX, and HPUX */
163
# if defined(__x86_64__) || defined(__sparcv9) || \
163
# if ( defined(__x86_64__) && ! defined(__ILP32__) ) || defined(__sparcv9) || \
164
        defined(__64BIT__) || defined(__LP64__)
164
        defined(__64BIT__) || defined(__LP64__)
165
#  define JS_64BIT
165
#  define JS_64BIT
166
# endif
166
# endif
(-)mozjs17.orig/js/src/methodjit/BaseAssembler.h (-3 / +3 lines)
Lines 263-269 Link Here
263
    }
263
    }
264
264
265
    /* Register pair storing returned type/data for calls. */
265
    /* Register pair storing returned type/data for calls. */
266
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
266
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_X32)
267
static const JSC::MacroAssembler::RegisterID JSReturnReg_Type  = JSC::X86Registers::edi;
267
static const JSC::MacroAssembler::RegisterID JSReturnReg_Type  = JSC::X86Registers::edi;
268
static const JSC::MacroAssembler::RegisterID JSReturnReg_Data  = JSC::X86Registers::esi;
268
static const JSC::MacroAssembler::RegisterID JSReturnReg_Data  = JSC::X86Registers::esi;
269
static const JSC::MacroAssembler::RegisterID JSParamReg_Argc   = JSC::X86Registers::ecx;
269
static const JSC::MacroAssembler::RegisterID JSParamReg_Argc   = JSC::X86Registers::ecx;
Lines 384-390 Link Here
384
384
385
    void negateDouble(FPRegisterID fpreg)
385
    void negateDouble(FPRegisterID fpreg)
386
    {
386
    {
387
#if defined JS_CPU_X86 || defined JS_CPU_X64
387
#if defined JS_CPU_X86 || defined JS_CPU_X64 || defined(JS_CPU_X32)
388
        static const uint64_t DoubleNegMask = 0x8000000000000000ULL;
388
        static const uint64_t DoubleNegMask = 0x8000000000000000ULL;
389
        loadDouble(&DoubleNegMask, Registers::FPConversionTemp);
389
        loadDouble(&DoubleNegMask, Registers::FPConversionTemp);
390
        xorDouble(Registers::FPConversionTemp, fpreg);
390
        xorDouble(Registers::FPConversionTemp, fpreg);
Lines 477-483 Link Here
477
#endif
477
#endif
478
478
479
    static inline uint32_t alignForCall(uint32_t stackBytes) {
479
    static inline uint32_t alignForCall(uint32_t stackBytes) {
480
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_MIPS)
480
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_X32) || defined(JS_CPU_MIPS)
481
        // If StackAlignment is a power of two, % is just two shifts.
481
        // If StackAlignment is a power of two, % is just two shifts.
482
        // 16 - (x % 16) gives alignment, extra % 16 handles total == 0.
482
        // 16 - (x % 16) gives alignment, extra % 16 handles total == 0.
483
        return align(stackBytes, StackAlignment);
483
        return align(stackBytes, StackAlignment);
(-)mozjs17.orig/js/src/methodjit/FastArithmetic.cpp (-2 / +2 lines)
Lines 901-907 Link Here
901
bool
901
bool
902
mjit::Compiler::jsop_mod()
902
mjit::Compiler::jsop_mod()
903
{
903
{
904
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
904
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_X32)
905
    JSValueType type = knownPushedType(0);
905
    JSValueType type = knownPushedType(0);
906
    FrameEntry *lhs = frame.peek(-2);
906
    FrameEntry *lhs = frame.peek(-2);
907
    FrameEntry *rhs = frame.peek(-1);
907
    FrameEntry *rhs = frame.peek(-1);
Lines 931-937 Link Here
931
        return true;
931
        return true;
932
    }
932
    }
933
933
934
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
934
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_X32)
935
    if (!lhs->isTypeKnown()) {
935
    if (!lhs->isTypeKnown()) {
936
        Jump j = frame.testInt32(Assembler::NotEqual, lhs);
936
        Jump j = frame.testInt32(Assembler::NotEqual, lhs);
937
        stubcc.linkExit(j, Uses(2));
937
        stubcc.linkExit(j, Uses(2));
(-)mozjs17.orig/js/src/methodjit/FastOps.cpp (-1 / +1 lines)
Lines 303-309 Link Here
303
            stubcc.rejoin(Changes(1));
303
            stubcc.rejoin(Changes(1));
304
            return;
304
            return;
305
        }
305
        }
306
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
306
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_X32)
307
        /* Grosssssss! RHS _must_ be in ECX, on x86 */
307
        /* Grosssssss! RHS _must_ be in ECX, on x86 */
308
        RegisterID rr = frame.tempRegInMaskForData(rhs,
308
        RegisterID rr = frame.tempRegInMaskForData(rhs,
309
                                                   Registers::maskReg(JSC::X86Registers::ecx)).reg();
309
                                                   Registers::maskReg(JSC::X86Registers::ecx)).reg();
(-)mozjs17.orig/js/src/methodjit/ICRepatcher.h (-3 / +3 lines)
Lines 37-43 Link Here
37
37
38
    /* Patch a stub call. */
38
    /* Patch a stub call. */
39
    void relink(CodeLocationCall call, FunctionPtr stub) {
39
    void relink(CodeLocationCall call, FunctionPtr stub) {
40
#if defined JS_CPU_X64 || defined JS_CPU_X86 || defined JS_CPU_SPARC
40
#if defined JS_CPU_X64 || defined JS_CPU_X32 || defined JS_CPU_X86 || defined JS_CPU_SPARC
41
        JSC::RepatchBuffer::relink(call, stub);
41
        JSC::RepatchBuffer::relink(call, stub);
42
#elif defined JS_CPU_ARM
42
#elif defined JS_CPU_ARM
43
        /*
43
        /*
Lines 77-83 Link Here
77
77
78
    /* Patch the offset of a Value load emitted by loadValueWithAddressOffsetPatch. */
78
    /* Patch the offset of a Value load emitted by loadValueWithAddressOffsetPatch. */
79
    void patchAddressOffsetForValueLoad(CodeLocationLabel label, uint32_t offset) {
79
    void patchAddressOffsetForValueLoad(CodeLocationLabel label, uint32_t offset) {
80
#if defined JS_CPU_X64 || defined JS_CPU_ARM || defined JS_CPU_SPARC || defined JS_CPU_MIPS
80
#if defined JS_CPU_X64 || defined JS_CPU_X32 || defined JS_CPU_ARM || defined JS_CPU_SPARC || defined JS_CPU_MIPS
81
        repatch(label.dataLabel32AtOffset(0), offset);
81
        repatch(label.dataLabel32AtOffset(0), offset);
82
#elif defined JS_CPU_X86
82
#elif defined JS_CPU_X86
83
        static const unsigned LOAD_TYPE_OFFSET = 6;
83
        static const unsigned LOAD_TYPE_OFFSET = 6;
Lines 97-103 Link Here
97
    }
97
    }
98
98
99
    void patchAddressOffsetForValueStore(CodeLocationLabel label, uint32_t offset, bool typeConst) {
99
    void patchAddressOffsetForValueStore(CodeLocationLabel label, uint32_t offset, bool typeConst) {
100
#if defined JS_CPU_ARM || defined JS_CPU_X64 || defined JS_CPU_SPARC || defined JS_CPU_MIPS
100
#if defined JS_CPU_ARM || defined JS_CPU_X64 || defined JS_CPU_X32 || defined JS_CPU_SPARC || defined JS_CPU_MIPS
101
        (void) typeConst;
101
        (void) typeConst;
102
        repatch(label.dataLabel32AtOffset(0), offset);
102
        repatch(label.dataLabel32AtOffset(0), offset);
103
#elif defined JS_CPU_X86
103
#elif defined JS_CPU_X86
(-)mozjs17.orig/js/src/methodjit/MachineRegs.h (-14 / +14 lines)
Lines 74-80 Link Here
74
    typedef JSC::MacroAssembler::RegisterID RegisterID;
74
    typedef JSC::MacroAssembler::RegisterID RegisterID;
75
75
76
    // Homed and scratch registers for working with Values on x64.
76
    // Homed and scratch registers for working with Values on x64.
77
#if defined(JS_CPU_X64)
77
#if defined(JS_CPU_X64) || defined(JS_CPU_X32)
78
    static const RegisterID TypeMaskReg = JSC::X86Registers::r13;
78
    static const RegisterID TypeMaskReg = JSC::X86Registers::r13;
79
    static const RegisterID PayloadMaskReg = JSC::X86Registers::r14;
79
    static const RegisterID PayloadMaskReg = JSC::X86Registers::r14;
80
    static const RegisterID ValueReg = JSC::X86Registers::r10;
80
    static const RegisterID ValueReg = JSC::X86Registers::r10;
Lines 84-90 Link Here
84
    // Register that homes the current JSStackFrame.
84
    // Register that homes the current JSStackFrame.
85
#if defined(JS_CPU_X86)
85
#if defined(JS_CPU_X86)
86
    static const RegisterID JSFrameReg = JSC::X86Registers::ebp;
86
    static const RegisterID JSFrameReg = JSC::X86Registers::ebp;
87
#elif defined(JS_CPU_X64)
87
#elif defined(JS_CPU_X64) || defined(JS_CPU_X32)
88
    static const RegisterID JSFrameReg = JSC::X86Registers::ebx;
88
    static const RegisterID JSFrameReg = JSC::X86Registers::ebx;
89
#elif defined(JS_CPU_ARM)
89
#elif defined(JS_CPU_ARM)
90
    static const RegisterID JSFrameReg = JSC::ARMRegisters::r10;
90
    static const RegisterID JSFrameReg = JSC::ARMRegisters::r10;
Lines 94-105 Link Here
94
    static const RegisterID JSFrameReg = JSC::MIPSRegisters::s0;
94
    static const RegisterID JSFrameReg = JSC::MIPSRegisters::s0;
95
#endif
95
#endif
96
96
97
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
97
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_X32)
98
    static const RegisterID ReturnReg = JSC::X86Registers::eax;
98
    static const RegisterID ReturnReg = JSC::X86Registers::eax;
99
# if defined(JS_CPU_X86) || defined(_WIN64)
99
# if defined(JS_CPU_X86) || defined(_WIN64)
100
    static const RegisterID ArgReg0 = JSC::X86Registers::ecx;
100
    static const RegisterID ArgReg0 = JSC::X86Registers::ecx;
101
    static const RegisterID ArgReg1 = JSC::X86Registers::edx;
101
    static const RegisterID ArgReg1 = JSC::X86Registers::edx;
102
#  if defined(JS_CPU_X64)
102
#  if defined(JS_CPU_X64) || defined(JS_CPU_X32)
103
    static const RegisterID ArgReg2 = JSC::X86Registers::r8;
103
    static const RegisterID ArgReg2 = JSC::X86Registers::r8;
104
    static const RegisterID ArgReg3 = JSC::X86Registers::r9;
104
    static const RegisterID ArgReg3 = JSC::X86Registers::r9;
105
#  endif
105
#  endif
Lines 144-150 Link Here
144
        return maskReg(reg1) | maskReg(reg2) | maskReg(reg3);
144
        return maskReg(reg1) | maskReg(reg2) | maskReg(reg3);
145
    }
145
    }
146
146
147
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
147
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_X32)
148
    static const uint32_t TempRegs =
148
    static const uint32_t TempRegs =
149
          (1 << JSC::X86Registers::eax)
149
          (1 << JSC::X86Registers::eax)
150
# if defined(JS_CPU_X86)
150
# if defined(JS_CPU_X86)
Lines 152-158 Link Here
152
# endif
152
# endif
153
        | (1 << JSC::X86Registers::ecx)
153
        | (1 << JSC::X86Registers::ecx)
154
        | (1 << JSC::X86Registers::edx)
154
        | (1 << JSC::X86Registers::edx)
155
# if defined(JS_CPU_X64)
155
# if defined(JS_CPU_X64) || defined(JS_CPU_X32)
156
        | (1 << JSC::X86Registers::r8)
156
        | (1 << JSC::X86Registers::r8)
157
        | (1 << JSC::X86Registers::r9)
157
        | (1 << JSC::X86Registers::r9)
158
#  if !defined(_WIN64)
158
#  if !defined(_WIN64)
Lines 162-168 Link Here
162
# endif
162
# endif
163
        ;
163
        ;
164
164
165
# if defined(JS_CPU_X64)
165
# if defined(JS_CPU_X64) || defined(JS_CPU_X32)
166
    static const uint32_t SavedRegs =
166
    static const uint32_t SavedRegs =
167
        /* r11 is scratchRegister, used by JSC. */
167
        /* r11 is scratchRegister, used by JSC. */
168
          (1 << JSC::X86Registers::r12)
168
          (1 << JSC::X86Registers::r12)
Lines 186-192 Link Here
186
          (1 << JSC::X86Registers::edi) |
186
          (1 << JSC::X86Registers::edi) |
187
          (1 << JSC::X86Registers::ebp) |
187
          (1 << JSC::X86Registers::ebp) |
188
          (1 << JSC::X86Registers::esp));
188
          (1 << JSC::X86Registers::esp));
189
# elif defined(JS_CPU_X64)
189
# elif defined(JS_CPU_X64) || defined(JS_CPU_X32)
190
    static const uint32_t SingleByteRegs = TempRegs | SavedRegs;
190
    static const uint32_t SingleByteRegs = TempRegs | SavedRegs;
191
# endif
191
# endif
192
192
Lines 280-286 Link Here
280
# else
280
# else
281
        return (convention == FastCall) ? 2 : 0;
281
        return (convention == FastCall) ? 2 : 0;
282
# endif
282
# endif
283
#elif defined(JS_CPU_X64)
283
#elif defined(JS_CPU_X64) || defined(JS_CPU_X32)
284
# ifdef _WIN64
284
# ifdef _WIN64
285
        return 4;
285
        return 4;
286
# else
286
# else
Lines 308-314 Link Here
308
        if (conv == NormalCall)
308
        if (conv == NormalCall)
309
            return false;
309
            return false;
310
# endif
310
# endif
311
#elif defined(JS_CPU_X64)
311
#elif defined(JS_CPU_X64) || defined(JS_CPU_X32)
312
# ifdef _WIN64
312
# ifdef _WIN64
313
        static const RegisterID regs[] = {
313
        static const RegisterID regs[] = {
314
            JSC::X86Registers::ecx,
314
            JSC::X86Registers::ecx,
Lines 361-367 Link Here
361
361
362
    typedef JSC::MacroAssembler::FPRegisterID FPRegisterID;
362
    typedef JSC::MacroAssembler::FPRegisterID FPRegisterID;
363
363
364
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
364
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_X32)
365
#ifdef _WIN64
365
#ifdef _WIN64
366
    /* xmm0-xmm5 are scratch register on Win64 ABI */
366
    /* xmm0-xmm5 are scratch register on Win64 ABI */
367
    static const uint32_t TotalFPRegisters = 5;
367
    static const uint32_t TotalFPRegisters = 5;
Lines 416-422 Link Here
416
#endif
416
#endif
417
417
418
    /* Temp reg that can be clobbered when setting up a fallible fast or ABI call. */
418
    /* Temp reg that can be clobbered when setting up a fallible fast or ABI call. */
419
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
419
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_X32)
420
    static const RegisterID ClobberInCall = JSC::X86Registers::ecx;
420
    static const RegisterID ClobberInCall = JSC::X86Registers::ecx;
421
#elif defined(JS_CPU_ARM)
421
#elif defined(JS_CPU_ARM)
422
    static const RegisterID ClobberInCall = JSC::ARMRegisters::r2;
422
    static const RegisterID ClobberInCall = JSC::ARMRegisters::r2;
Lines 457-463 Link Here
457
        regs.takeReg(ArgReg0);
457
        regs.takeReg(ArgReg0);
458
        regs.takeReg(ArgReg1);
458
        regs.takeReg(ArgReg1);
459
        regs.takeReg(ArgReg2);
459
        regs.takeReg(ArgReg2);
460
#if defined(JS_CPU_SPARC) || defined(JS_CPU_X64)
460
#if defined(JS_CPU_SPARC) || defined(JS_CPU_X64) || defined(JS_CPU_X32)
461
        regs.takeReg(ArgReg3);
461
        regs.takeReg(ArgReg3);
462
#endif
462
#endif
463
#endif
463
#endif
Lines 573-579 Link Here
573
const char *
573
const char *
574
AnyRegisterID::name()
574
AnyRegisterID::name()
575
{
575
{
576
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
576
#if defined(JS_CPU_X86) || defined(JS_CPU_X64) || defined(JS_CPU_X32)
577
    return isReg() ? JSC::X86Registers::nameIReg(reg()) : JSC::X86Registers::nameFPReg(fpreg());
577
    return isReg() ? JSC::X86Registers::nameIReg(reg()) : JSC::X86Registers::nameFPReg(fpreg());
578
#elif defined(JS_CPU_ARM)
578
#elif defined(JS_CPU_ARM)
579
    return isReg() ? JSC::ARMAssembler::nameGpReg(reg()) : JSC::ARMAssembler::nameFpRegD(fpreg());
579
    return isReg() ? JSC::ARMAssembler::nameGpReg(reg()) : JSC::ARMAssembler::nameFpRegD(fpreg());
(-)mozjs17/js/src/methodjit/MethodJIT.h.orig (-1 / +2 lines)
Lines 19-24 Link Here
19
#include "assembler/assembler/CodeLocation.h"
19
#include "assembler/assembler/CodeLocation.h"
20
20
21
#if !defined JS_CPU_X64 && \
21
#if !defined JS_CPU_X64 && \
22
    !defined JS_CPU_X32 && \
22
    !defined JS_CPU_X86 && \
23
    !defined JS_CPU_X86 && \
23
    !defined JS_CPU_SPARC && \
24
    !defined JS_CPU_SPARC && \
24
    !defined JS_CPU_ARM && \
25
    !defined JS_CPU_ARM && \
Lines 139-145 Link Here
139
    /* The gap between ebp and esp in JaegerTrampoline frames on X86 platforms. */
140
    /* The gap between ebp and esp in JaegerTrampoline frames on X86 platforms. */
140
    static const uint32_t STACK_BASE_DIFFERENCE = 0x38;
141
    static const uint32_t STACK_BASE_DIFFERENCE = 0x38;
141
142
142
#elif defined(JS_CPU_X64)
143
#elif defined(JS_CPU_X64) || defined(JS_CPU_X32)
143
    void *savedRBX;
144
    void *savedRBX;
144
# ifdef _WIN64
145
# ifdef _WIN64
145
    void *savedRSI;
146
    void *savedRSI;
(-)mozjs17/js/src/methodjit/MethodJIT.cpp.orig (-2 / +196 lines)
Lines 47-56 Link Here
47
StackFrame::methodjitStaticAsserts()
47
StackFrame::methodjitStaticAsserts()
48
{
48
{
49
        /* Static assert for x86 trampolines in MethodJIT.cpp. */
49
        /* Static assert for x86 trampolines in MethodJIT.cpp. */
50
#if defined(JS_CPU_X86)
50
#if defined(JS_CPU_X86) || defined(JS_CPU_X32)
51
        JS_STATIC_ASSERT(offsetof(StackFrame, rval_)     == 0x18);
51
        JS_STATIC_ASSERT(offsetof(StackFrame, rval_)     == 0x18);
52
        JS_STATIC_ASSERT(offsetof(StackFrame, rval_) + 4 == 0x1C);
52
        JS_STATIC_ASSERT(offsetof(StackFrame, rval_) + 4 == 0x1C);
53
        JS_STATIC_ASSERT(offsetof(StackFrame, ncode_)    == 0x14);
53
        JS_STATIC_ASSERT(offsetof(StackFrame, ncode_)    == 0x14);
54
#elif defined(JS_CPU_ARM)
54
        /* ARM uses decimal literals. */
55
        /* ARM uses decimal literals. */
55
        JS_STATIC_ASSERT(offsetof(StackFrame, rval_)     == 24);
56
        JS_STATIC_ASSERT(offsetof(StackFrame, rval_)     == 24);
56
        JS_STATIC_ASSERT(offsetof(StackFrame, rval_) + 4 == 28);
57
        JS_STATIC_ASSERT(offsetof(StackFrame, rval_) + 4 == 28);
Lines 135-141 Link Here
135
136
136
JS_STATIC_ASSERT(offsetof(FrameRegs, sp) == 0);
137
JS_STATIC_ASSERT(offsetof(FrameRegs, sp) == 0);
137
138
138
#if defined(__linux__) && defined(JS_CPU_X64)
139
#if defined(__linux__) && ( defined(JS_CPU_X64) || defined(JS_CPU_X32) )
140
139
# define SYMBOL_STRING_RELOC(name) #name "@plt"
141
# define SYMBOL_STRING_RELOC(name) #name "@plt"
140
#else
142
#else
141
# define SYMBOL_STRING_RELOC(name) SYMBOL_STRING(name)
143
# define SYMBOL_STRING_RELOC(name) SYMBOL_STRING(name)
Lines 427-432 Link Here
427
    "jmp " SYMBOL_STRING_RELOC(JaegerInterpoline)   "\n"
429
    "jmp " SYMBOL_STRING_RELOC(JaegerInterpoline)   "\n"
428
    CFI(".cfi_endproc"                              "\n")
430
    CFI(".cfi_endproc"                              "\n")
429
);
431
);
432
433
# elif defined(JS_CPU_X32)
434
435
/*
436
 *    *** DANGER ***
437
 * If these assertions break, update the constants below.
438
 *    *** DANGER ***
439
 */
440
JS_STATIC_ASSERT(offsetof(VMFrame, savedRBX) == 0x34);
441
JS_STATIC_ASSERT(offsetof(VMFrame, scratch) == 0xC);
442
JS_STATIC_ASSERT(VMFrame::offsetOfFp == 0x1C);
443
444
asm (
445
".text\n"
446
".globl " SYMBOL_STRING(JaegerTrampoline) "\n"
447
SYMBOL_STRING(JaegerTrampoline) ":"       "\n"
448
    /* Prologue. */
449
    CFI(".cfi_startproc"                 "\n")
450
    CFI(".cfi_def_cfa rsp, 8"            "\n")
451
    "pushq %rbp"                         "\n"
452
    CFI(".cfi_def_cfa_offset 16"         "\n")
453
    CFI(".cfi_offset rbp, -16"           "\n")
454
    "movq %rsp, %rbp"                    "\n"
455
    CFI(".cfi_def_cfa_register rbp"      "\n")
456
    /* Save non-volatile registers. */
457
    "pushq %r12"                         "\n"
458
    CFI(".cfi_offset r12, -24"           "\n")
459
    "pushq %r13"                         "\n"
460
    CFI(".cfi_offset r13, -32"           "\n")
461
    "pushq %r14"                         "\n"
462
    CFI(".cfi_offset r14, -40"           "\n")
463
    "pushq %r15"                         "\n"
464
    CFI(".cfi_offset r15, -48"           "\n")
465
    "pushq %rbx"                         "\n"
466
    CFI(".cfi_offset rbx, -56"           "\n")
467
468
    /* Build the JIT frame.
469
     * rdi = cx
470
     * rsi = fp
471
     * rcx = inlineCallCount
472
     * fp must go into rbx
473
     */
474
    "pushq $0x0"                         "\n" /* stubRejoin */
475
    "pushq %rsi"                         "\n" /* entryncode */
476
    "pushq %rsi"                         "\n" /* entryfp */
477
    "pushq %rcx"                         "\n" /* inlineCallCount */
478
    "pushq %rdi"                         "\n" /* cx */
479
    "pushq %rsi"                         "\n" /* fp */
480
    "movq  %rsi, %rbx"                   "\n"
481
482
    /* Space for the rest of the VMFrame. */
483
    "subq  $0x28, %rsp"                  "\n"
484
485
    /* This is actually part of the VMFrame. */
486
    "pushq %r8"                          "\n"
487
488
    /* Set cx->regs and set the active frame. Save rdx and align frame in one. */
489
    "pushq %rdx"                         "\n"
490
    "movq  %rsp, %rdi"                   "\n"
491
    "call " SYMBOL_STRING_VMFRAME(PushActiveVMFrame) "\n"
492
493
    /* Jump into the JIT'd code. */
494
    "jmp *0(%rsp)"                      "\n"
495
    CFI(".cfi_endproc"                  "\n")
496
);
497
498
asm (
499
".text\n"
500
    /* See "Special rules for JaegerThrowpoline and friends", above. */
501
    CFI(".cfi_startproc"                 "\n")
502
    CFI(".cfi_def_cfa rbp, 16"           "\n")
503
    CFI(".cfi_offset rbp, -16"           "\n")
504
    CFI(".cfi_offset r12, -24"           "\n")
505
    CFI(".cfi_offset r13, -32"           "\n")
506
    CFI(".cfi_offset r14, -40"           "\n")
507
    CFI(".cfi_offset r15, -48"           "\n")
508
    CFI(".cfi_offset rbx, -56"           "\n")
509
    CFI("nop"                            "\n")
510
".globl " SYMBOL_STRING(JaegerTrampolineReturn) "\n"
511
SYMBOL_STRING(JaegerTrampolineReturn) ":"       "\n"
512
    "or   %rdi, %rsi"                    "\n"
513
    "movq %rsi, 0x30(%rbx)"              "\n"
514
    "movq %rsp, %rdi"                    "\n"
515
    "call " SYMBOL_STRING_VMFRAME(PopActiveVMFrame) "\n"
516
517
    "addq $0x34, %rsp"                   "\n"
518
    "popq %rbx"                          "\n"
519
    "popq %r15"                          "\n"
520
    "popq %r14"                          "\n"
521
    "popq %r13"                          "\n"
522
    "popq %r12"                          "\n"
523
    "popq %rbp"                          "\n"
524
    CFI(".cfi_def_cfa rsp, 8"            "\n")
525
    "movq $1, %rax"                      "\n"
526
    "ret"                                "\n"
527
    CFI(".cfi_endproc"                   "\n")
528
);
529
530
asm (
531
".text\n"
532
    /* See "Special rules for JaegerThrowpoline and friends", above. */
533
    CFI(".cfi_startproc"                    "\n")
534
    CFI(".cfi_def_cfa rbp, 16"              "\n")
535
    CFI(".cfi_offset rbp, -16"              "\n")
536
    CFI(".cfi_offset r12, -24"              "\n")
537
    CFI(".cfi_offset r13, -32"              "\n")
538
    CFI(".cfi_offset r14, -40"              "\n")
539
    CFI(".cfi_offset r15, -48"              "\n")
540
    CFI(".cfi_offset rbx, -56"              "\n")
541
    CFI("nop"                               "\n")
542
".globl " SYMBOL_STRING(JaegerThrowpoline)  "\n"
543
SYMBOL_STRING(JaegerThrowpoline) ":"        "\n"
544
    "movq %rsp, %rdi"                       "\n"
545
    "call " SYMBOL_STRING_RELOC(js_InternalThrow) "\n"
546
    "testq %rax, %rax"                      "\n"
547
    "je   throwpoline_exit"                 "\n"
548
    "jmp  *%rax"                            "\n"
549
  "throwpoline_exit:"                       "\n"
550
    "movq %rsp, %rdi"                       "\n"
551
    "call " SYMBOL_STRING_VMFRAME(PopActiveVMFrame) "\n"
552
    "addq $0x34, %rsp"                      "\n"
553
    "popq %rbx"                             "\n"
554
    "popq %r15"                             "\n"
555
    "popq %r14"                             "\n"
556
    "popq %r13"                             "\n"
557
    "popq %r12"                             "\n"
558
    "popq %rbp"                             "\n"
559
    CFI(".cfi_def_cfa rsp, 8"               "\n")
560
    "xorq %rax,%rax"                        "\n"
561
    "ret"                                   "\n"
562
    CFI(".cfi_endproc"                      "\n")
563
);
564
565
asm (
566
".text\n"
567
    /* See "Special rules for JaegerThrowpoline and friends", above. */
568
    CFI(".cfi_startproc"                    "\n")
569
    CFI(".cfi_def_cfa rbp, 16"              "\n")
570
    CFI(".cfi_offset rbp, -16"              "\n")
571
    CFI(".cfi_offset r12, -24"              "\n")
572
    CFI(".cfi_offset r13, -32"              "\n")
573
    CFI(".cfi_offset r14, -40"              "\n")
574
    CFI(".cfi_offset r15, -48"              "\n")
575
    CFI(".cfi_offset rbx, -56"              "\n")
576
    CFI("nop"                               "\n")
577
".globl " SYMBOL_STRING(JaegerInterpoline)  "\n"
578
SYMBOL_STRING(JaegerInterpoline) ":"        "\n"
579
    "movq %rsp, %rcx"                       "\n"
580
    "movq %rax, %rdx"                       "\n"
581
    "call " SYMBOL_STRING_RELOC(js_InternalInterpret) "\n"
582
    "movq 0x1C(%rsp), %rbx"                 "\n" /* Load frame */
583
    "movq 0x30(%rbx), %rsi"                 "\n" /* Load rval payload */
584
    "movq 0x30(%rbx), %rdi"                 "\n" /* Load rval type */
585
    "movq 0xC(%rsp), %rcx"                 "\n" /* Load scratch -> argc */
586
    "testq %rax, %rax"                      "\n"
587
    "je   interpoline_exit"                 "\n"
588
    "jmp  *%rax"                            "\n"
589
  "interpoline_exit:"                       "\n"
590
    "movq %rsp, %rdi"                       "\n"
591
    "call " SYMBOL_STRING_VMFRAME(PopActiveVMFrame) "\n"
592
    "addq $0x34, %rsp"                      "\n"
593
    "popq %rbx"                             "\n"
594
    "popq %r15"                             "\n"
595
    "popq %r14"                             "\n"
596
    "popq %r13"                             "\n"
597
    "popq %r12"                             "\n"
598
    "popq %rbp"                             "\n"
599
    CFI(".cfi_def_cfa rsp, 8"               "\n")
600
    "xorq %rax,%rax"                        "\n"
601
    "ret"                                   "\n"
602
    CFI(".cfi_endproc"                      "\n")
603
);
604
605
asm (
606
".text\n"
607
    /* See "Special rules for JaegerThrowpoline and friends", above. */
608
    CFI(".cfi_startproc"                            "\n")
609
    CFI(".cfi_def_cfa rbp, 16"                      "\n")
610
    CFI(".cfi_offset rbp, -16"                      "\n")
611
    CFI(".cfi_offset r12, -24"                      "\n")
612
    CFI(".cfi_offset r13, -32"                      "\n")
613
    CFI(".cfi_offset r14, -40"                      "\n")
614
    CFI(".cfi_offset r15, -48"                      "\n")
615
    CFI(".cfi_offset rbx, -56"                      "\n")
616
    CFI("nop"                                       "\n")
617
".globl " SYMBOL_STRING(JaegerInterpolineScripted)  "\n"
618
SYMBOL_STRING(JaegerInterpolineScripted) ":"        "\n"
619
    "movq 0x20(%rbx), %rbx"                         "\n" /* load prev */
620
    "movq %rbx, 0x1C(%rsp)"                         "\n"
621
    "jmp " SYMBOL_STRING_RELOC(JaegerInterpoline)   "\n"
622
    CFI(".cfi_endproc"                              "\n")
623
);
430
624
431
# elif defined(JS_CPU_X86)
625
# elif defined(JS_CPU_X86)
432
626
(-)mozjs17/js/src/methodjit/NunboxAssembler.h.orig (-6 / +11 lines)
Lines 153-159 Link Here
153
        JS_ASSERT(address.base != treg); /* treg is clobbered first. */
153
        JS_ASSERT(address.base != treg); /* treg is clobbered first. */
154
154
155
        Label start = label();
155
        Label start = label();
156
#if defined JS_CPU_X86
156
#if defined JS_CPU_X86 || defined JS_CPU_X32
157
        /*
157
        /*
158
         * On x86 there are two loads to patch and they both encode the offset
158
         * On x86 there are two loads to patch and they both encode the offset
159
         * in-line.
159
         * in-line.
Lines 191-197 Link Here
191
     */
191
     */
192
    DataLabel32 storeValueWithAddressOffsetPatch(RegisterID treg, RegisterID dreg, Address address) {
192
    DataLabel32 storeValueWithAddressOffsetPatch(RegisterID treg, RegisterID dreg, Address address) {
193
        DataLabel32 start = dataLabel32();
193
        DataLabel32 start = dataLabel32();
194
#if defined JS_CPU_X86
194
#if defined JS_CPU_X86 || defined JS_CPU_X32
195
        /*
195
        /*
196
         * On x86 there are two stores to patch and they both encode the offset
196
         * On x86 there are two stores to patch and they both encode the offset
197
         * in-line.
197
         * in-line.
Lines 217-223 Link Here
217
    /* Overloaded for storing a constant type. */
217
    /* Overloaded for storing a constant type. */
218
    DataLabel32 storeValueWithAddressOffsetPatch(ImmType type, RegisterID dreg, Address address) {
218
    DataLabel32 storeValueWithAddressOffsetPatch(ImmType type, RegisterID dreg, Address address) {
219
        DataLabel32 start = dataLabel32();
219
        DataLabel32 start = dataLabel32();
220
#if defined JS_CPU_X86
220
#if defined JS_CPU_X86 || defined JS_CPU_X32
221
        storeTypeTag(type, address);
221
        storeTypeTag(type, address);
222
        DBGLABEL_NOMASM(endType);
222
        DBGLABEL_NOMASM(endType);
223
        storePayload(dreg, address);
223
        storePayload(dreg, address);
Lines 242-248 Link Here
242
        ImmTag type(jv.s.tag);
242
        ImmTag type(jv.s.tag);
243
        Imm32 payload(jv.s.payload.u32);
243
        Imm32 payload(jv.s.payload.u32);
244
        DataLabel32 start = dataLabel32();
244
        DataLabel32 start = dataLabel32();
245
#if defined JS_CPU_X86
245
#if defined JS_CPU_X86 || defined JS_CPU_X32
246
        store32(type, tagOf(address));
246
        store32(type, tagOf(address));
247
        DBGLABEL_NOMASM(endType);
247
        DBGLABEL_NOMASM(endType);
248
        store32(payload, payloadOf(address));
248
        store32(payload, payloadOf(address));
Lines 439-445 Link Here
439
        mismatches->append(branch32(NotEqual, T1, payloadOf(two)));
439
        mismatches->append(branch32(NotEqual, T1, payloadOf(two)));
440
    }
440
    }
441
441
442
#ifdef JS_CPU_X86
442
#if defined JS_CPU_X86 || defined JS_CPU_X32
443
    void fastLoadDouble(RegisterID lo, RegisterID hi, FPRegisterID fpReg) {
443
    void fastLoadDouble(RegisterID lo, RegisterID hi, FPRegisterID fpReg) {
444
        if (MacroAssemblerX86Common::getSSEState() >= HasSSE4_1) {
444
        if (MacroAssemblerX86Common::getSSEState() >= HasSSE4_1) {
445
            m_assembler.movd_rr(lo, fpReg);
445
            m_assembler.movd_rr(lo, fpReg);
Lines 453-465 Link Here
453
#endif
453
#endif
454
454
455
    void breakDouble(FPRegisterID srcDest, RegisterID typeReg, RegisterID dataReg) {
455
    void breakDouble(FPRegisterID srcDest, RegisterID typeReg, RegisterID dataReg) {
456
#ifdef JS_CPU_X86
456
#if defined JS_CPU_X86
457
        // Move the low 32-bits of the 128-bit XMM register into dataReg.
457
        // Move the low 32-bits of the 128-bit XMM register into dataReg.
458
        // Then, right shift the 128-bit XMM register by 4 bytes.
458
        // Then, right shift the 128-bit XMM register by 4 bytes.
459
        // Finally, move the new low 32-bits of the 128-bit XMM register into typeReg.
459
        // Finally, move the new low 32-bits of the 128-bit XMM register into typeReg.
460
        m_assembler.movd_rr(srcDest, dataReg);
460
        m_assembler.movd_rr(srcDest, dataReg);
461
        m_assembler.psrldq_rr(srcDest, 4);
461
        m_assembler.psrldq_rr(srcDest, 4);
462
        m_assembler.movd_rr(srcDest, typeReg);
462
        m_assembler.movd_rr(srcDest, typeReg);
463
#elif defined JS_CPU_X32
464
        m_assembler.movq_rr(srcDest, typeReg);
465
        move(Registers::PayloadMaskReg, dataReg);
466
        andPtr(typeReg, dataReg);
467
        xorPtr(dataReg, typeReg);
463
#elif defined JS_CPU_SPARC
468
#elif defined JS_CPU_SPARC
464
        breakDoubleTo32(srcDest, typeReg, dataReg);
469
        breakDoubleTo32(srcDest, typeReg, dataReg);
465
#elif defined JS_CPU_ARM
470
#elif defined JS_CPU_ARM

Return to bug 439558