Bug 587962 - [JAEGER] JaegerMonkey build and check failed on Solaris x86 with Sun Studio 12. r=dvander

This commit is contained in:
Leon Sha 2010-08-20 01:09:34 -07:00
parent b3d6402311
commit a50abcb41c
9 changed files with 47 additions and 14 deletions

View File

@ -100,6 +100,10 @@
#define WTF_COMPILER_WINSCW 1
#endif
/* COMPILER(SUNPRO) - Sun Studio for Solaris */
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#define WTF_COMPILER_SUNPRO 1
#endif
/* ==== CPU() - the target CPU architecture ==== */

View File

@ -235,6 +235,10 @@ namespace mjit {
{
void (* forceReturn)();
JSC::ExecutablePool *forceReturnPool;
#if defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)
void (* forceReturnFast)();
JSC::ExecutablePool *forceReturnFastPool;
#endif
};
struct ThreadData

View File

@ -1365,7 +1365,11 @@ stubs::Debugger(VMFrame &f, jsbytecode *pc)
f.cx->throwing = JS_FALSE;
f.cx->fp->setReturnValue(rval);
*f.returnAddressLocation() = JS_FUNC_TO_DATA_PTR(void *,
#if defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)
JS_METHODJIT_DATA(f.cx).trampolines.forceReturnFast);
#else
JS_METHODJIT_DATA(f.cx).trampolines.forceReturn);
#endif
break;
case JSTRAP_ERROR:
@ -1400,7 +1404,11 @@ stubs::Trap(VMFrame &f, jsbytecode *pc)
f.cx->throwing = JS_FALSE;
f.cx->fp->setReturnValue(rval);
*f.returnAddressLocation() = JS_FUNC_TO_DATA_PTR(void *,
#if defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)
JS_METHODJIT_DATA(f.cx).trampolines.forceReturnFast);
#else
JS_METHODJIT_DATA(f.cx).trampolines.forceReturn);
#endif
break;
case JSTRAP_ERROR:

View File

@ -62,6 +62,9 @@ TrampolineCompiler::compile()
#endif
COMPILE(trampolines->forceReturn, trampolines->forceReturnPool, generateForceReturn);
#if defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)
COMPILE(trampolines->forceReturnFast, trampolines->forceReturnFastPool, generateForceReturnFast);
#endif
return true;
}
@ -70,6 +73,9 @@ void
TrampolineCompiler::release(Trampolines *tramps)
{
RELEASE(tramps->forceReturn, tramps->forceReturnPool);
#if defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)
RELEASE(tramps->forceReturnFast, tramps->forceReturnFastPool);
#endif
}
bool
@ -104,11 +110,6 @@ TrampolineCompiler::compileTrampoline(void **where, JSC::ExecutablePool **pool,
bool
TrampolineCompiler::generateForceReturn(Assembler &masm)
{
#if defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)
// In case of no fast call, when we change the return address,
// we need to make sure add esp by 8.
masm.addPtr(Imm32(8), Registers::StackPointer);
#endif
/* if (!callobj) stubs::PutCallObject */
Jump noCallObj = masm.branchPtr(Assembler::Equal,
Address(JSFrameReg, JSStackFrame::offsetCallObj()),
@ -148,6 +149,17 @@ TrampolineCompiler::generateForceReturn(Assembler &masm)
return true;
}
#if defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)
bool
TrampolineCompiler::generateForceReturnFast(Assembler &masm)
{
// In case of no fast call, when we change the return address,
// we need to make sure add esp by 8.
masm.addPtr(Imm32(8), Registers::StackPointer);
return generateForceReturn(masm);
}
#endif
} /* namespace mjit */
} /* namespace js */

View File

@ -71,6 +71,10 @@ private:
/* Generators for trampolines. */
static bool generateForceReturn(Assembler &masm);
#if defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)
static bool generateForceReturnFast(Assembler &masm);
#endif
JSC::ExecutableAllocator *execPool;
Trampolines *trampolines;
};

View File

@ -52,11 +52,12 @@ JaegerTrampoline:
/* Build the JIT frame. Push fields in order, */
/* then align the stack to form esp == VMFrame. */
pushl 20(%ebp)
movl 12(%ebp), %ebx /* fp */
pushl %ebx /* entryFp */
pushl 20(%ebp) /* inlineCallCount */
pushl 8(%ebp)
pushl 12(%ebp)
movl 12(%ebp), %ebx
subl $0x1c, %esp
pushl %ebx
subl $0x18, %esp
/* Jump into the JIT'd code. */
pushl 16(%ebp)
@ -133,6 +134,6 @@ JaegerFromTracer:
/* We add the stack by 8 before. */
addl $0x8, %esp
/* Restore frame regs. */
movl 0x20(%esp), %ebx
movl 0x1C(%esp), %ebx
ret
.size JaegerFromTracer, . - JaegerFromTracer

View File

@ -52,7 +52,7 @@ the JavaScript specification. There are also some supporting functions. */
using namespace WTF;
#ifndef WTF_COMPILER_MSVC
#if !WTF_COMPILER_MSVC && !WTF_COMPILER_SUNPRO
#define USE_COMPUTED_GOTO_FOR_MATCH_RECURSION
#endif

View File

@ -1410,7 +1410,7 @@ class RegexGenerator : private MacroAssembler {
push(X86Registers::edi);
push(X86Registers::esi);
// load output into edi (2 = saved ebp + return address).
#if WTF_COMPILER_MSVC
#if WTF_COMPILER_MSVC || WTF_COMPILER_SUNPRO
loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), input);
loadPtr(Address(X86Registers::ebp, 3 * sizeof(void*)), index);
loadPtr(Address(X86Registers::ebp, 4 * sizeof(void*)), length);

View File

@ -37,7 +37,7 @@
#include "yarr/pcre/pcre.h"
struct JSRegExp; // temporary, remove when fallback is removed.
#if WTF_CPU_X86 && !WTF_COMPILER_MSVC
#if WTF_CPU_X86 && !WTF_COMPILER_MSVC && !WTF_COMPILER_SUNPRO
#define YARR_CALL __attribute__ ((regparm (3)))
#else
#define YARR_CALL
@ -74,7 +74,7 @@ public:
int execute(const UChar* input, unsigned start, unsigned length, int* output)
{
return JS_EXTENSION(reinterpret_cast<RegexJITCode>(m_ref.m_code.executableAddress())(input, start, length, output));
return JS_EXTENSION((reinterpret_cast<RegexJITCode>(m_ref.m_code.executableAddress()))(input, start, length, output));
}
private: