Bug 617244 - nanojit: remove AvmCore (TM-specific part). r=gal.

This commit is contained in:
Nicholas Nethercote 2011-03-02 20:00:45 -08:00
parent 242009535f
commit 1126a1d66d
4 changed files with 25 additions and 23 deletions

View File

@ -556,9 +556,6 @@ InitJITStatsClass(JSContext *cx, JSObject *glob)
#define AUDIT(x) ((void)0) #define AUDIT(x) ((void)0)
#endif /* JS_JIT_SPEW */ #endif /* JS_JIT_SPEW */
static avmplus::AvmCore s_core = avmplus::AvmCore();
static avmplus::AvmCore* core = &s_core;
#ifdef JS_JIT_SPEW #ifdef JS_JIT_SPEW
static void static void
DumpPeerStability(TraceMonitor* tm, const void* ip, JSObject* globalObj, uint32 globalShape, uint32 argc); DumpPeerStability(TraceMonitor* tm, const void* ip, JSObject* globalObj, uint32 globalShape, uint32 argc);
@ -573,6 +570,8 @@ DumpPeerStability(TraceMonitor* tm, const void* ip, JSObject* globalObj, uint32
*/ */
static bool did_we_check_processor_features = false; static bool did_we_check_processor_features = false;
nanojit::Config NJConfig;
/* ------ Debug logging control ------ */ /* ------ Debug logging control ------ */
/* /*
@ -2365,7 +2364,7 @@ TraceRecorder::TraceRecorder(JSContext* cx, TraceMonitor *tm,
#endif #endif
/* This creates the LIR writer pipeline. */ /* This creates the LIR writer pipeline. */
w.init(&LogController); w.init(&LogController, &NJConfig);
w.start(); w.start();
@ -2855,8 +2854,8 @@ TraceMonitor::flush()
globalStates[i].globalSlots = new (*dataAlloc) SlotList(dataAlloc); globalStates[i].globalSlots = new (*dataAlloc) SlotList(dataAlloc);
} }
assembler = new (*dataAlloc) Assembler(*codeAlloc, *dataAlloc, *dataAlloc, core, assembler = new (*dataAlloc) Assembler(*codeAlloc, *dataAlloc, *dataAlloc,
&LogController, avmplus::AvmCore::config); &LogController, NJConfig);
verbose_only( branches = NULL; ) verbose_only( branches = NULL; )
PodArrayZero(vmfragments); PodArrayZero(vmfragments);
@ -7704,9 +7703,8 @@ InitJIT(TraceMonitor *tm)
if (!did_we_check_processor_features) { if (!did_we_check_processor_features) {
#if defined NANOJIT_IA32 #if defined NANOJIT_IA32
avmplus::AvmCore::config.i386_use_cmov = NJConfig.i386_use_cmov = NJConfig.i386_sse2 = CheckForSSE2();
avmplus::AvmCore::config.i386_sse2 = CheckForSSE2(); NJConfig.i386_fixed_esp = true;
avmplus::AvmCore::config.i386_fixed_esp = true;
#endif #endif
#if defined NANOJIT_ARM #if defined NANOJIT_ARM
@ -7717,9 +7715,9 @@ InitJIT(TraceMonitor *tm)
enable_debugger_exceptions(); enable_debugger_exceptions();
avmplus::AvmCore::config.arm_vfp = arm_vfp; NJConfig.arm_vfp = arm_vfp;
avmplus::AvmCore::config.soft_float = !arm_vfp; NJConfig.soft_float = !arm_vfp;
avmplus::AvmCore::config.arm_arch = arm_arch; NJConfig.arm_arch = arm_arch;
// Sanity-check the configuration detection. // Sanity-check the configuration detection.
// * We don't understand architectures prior to ARMv4. // * We don't understand architectures prior to ARMv4.

View File

@ -236,6 +236,9 @@ static void debug_only_printf(int mask, const char *fmt, ...) JS_BEGIN_MACRO JS_
#elif defined(JS_JIT_SPEW) #elif defined(JS_JIT_SPEW)
// Top level Nanojit config object.
extern nanojit::Config NJConfig;
// Top level logging controller object. // Top level logging controller object.
extern nanojit::LogControl LogController; extern nanojit::LogControl LogController;

View File

@ -91,14 +91,15 @@ public:
}; };
void void
Writer::init(LogControl *logc_) Writer::init(LogControl *logc_, Config *njConfig_)
{ {
JS_ASSERT(logc_); JS_ASSERT(logc_ && njConfig_);
logc = logc_; logc = logc_;
njConfig = njConfig_;
LirWriter *&lir = InitConst(this->lir); LirWriter *&lir = InitConst(this->lir);
CseFilter *&cse = InitConst(this->cse); CseFilter *&cse = InitConst(this->cse);
lir = new (alloc) LirBufWriter(lirbuf, AvmCore::config); lir = new (alloc) LirBufWriter(lirbuf);
#ifdef DEBUG #ifdef DEBUG
ValidateWriter *validate2; ValidateWriter *validate2;
lir = validate2 = lir = validate2 =
@ -108,11 +109,11 @@ Writer::init(LogControl *logc_)
if (logc->lcbits & LC_TMRecorder) if (logc->lcbits & LC_TMRecorder)
lir = new (alloc) VerboseWriter(*alloc, lir, lirbuf->printer, logc); lir = new (alloc) VerboseWriter(*alloc, lir, lirbuf->printer, logc);
#endif #endif
if (avmplus::AvmCore::config.cseopt) { // CseFilter must be downstream of SoftFloatFilter (see bug 527754 for why).
if (njConfig->cseopt)
cse = new (alloc) CseFilter(lir, TM_NUM_USED_ACCS, *alloc); cse = new (alloc) CseFilter(lir, TM_NUM_USED_ACCS, *alloc);
if (!cse->initOOM) if (!cse->initOOM)
lir = cse; // Skip CseFilter if we OOM'd when creating it. lir = cse; // Skip CseFilter if we OOM'd when creating it.
}
lir = new (alloc) ExprFilter(lir); lir = new (alloc) ExprFilter(lir);
lir = new (alloc) FuncFilter(lir); lir = new (alloc) FuncFilter(lir);
#ifdef DEBUG #ifdef DEBUG
@ -222,8 +223,7 @@ couldBeObjectOrString(LIns *ins)
ret = couldBeObjectOrString(ins->oprnd2()) && ret = couldBeObjectOrString(ins->oprnd2()) &&
couldBeObjectOrString(ins->oprnd3()); couldBeObjectOrString(ins->oprnd3());
} else if (!avmplus::AvmCore::use_cmov() && } else if (ins->isop(LIR_ori) &&
ins->isop(LIR_ori) &&
ins->oprnd1()->isop(LIR_andi) && ins->oprnd1()->isop(LIR_andi) &&
ins->oprnd2()->isop(LIR_andi)) ins->oprnd2()->isop(LIR_andi))
{ {

View File

@ -339,12 +339,13 @@ class Writer
nj::CseFilter *const cse; // created in this class nj::CseFilter *const cse; // created in this class
nj::LogControl *logc; // passed in from outside nj::LogControl *logc; // passed in from outside
nj::Config *njConfig; // passed in from outside
public: public:
Writer(nj::Allocator *alloc, nj::LirBuffer *lirbuf) Writer(nj::Allocator *alloc, nj::LirBuffer *lirbuf)
: alloc(alloc), lirbuf(lirbuf), lir(NULL), cse(NULL), logc(NULL) {} : alloc(alloc), lirbuf(lirbuf), lir(NULL), cse(NULL), logc(NULL), njConfig(NULL) {}
void init(nj::LogControl *logc); void init(nj::LogControl *logc, nj::Config *njConfig);
nj::LIns *name(nj::LIns *ins, const char *name) const { nj::LIns *name(nj::LIns *ins, const char *name) const {
#ifdef JS_JIT_SPEW #ifdef JS_JIT_SPEW
@ -1071,13 +1072,13 @@ class Writer
nj::LIns *cmovi(nj::LIns *cond, nj::LIns *t, nj::LIns *f) const { nj::LIns *cmovi(nj::LIns *cond, nj::LIns *t, nj::LIns *f) const {
/* We can only use cmovi if the configuration says we can. */ /* We can only use cmovi if the configuration says we can. */
NanoAssert(t->isI() && f->isI()); NanoAssert(t->isI() && f->isI());
return lir->insChoose(cond, t, f, avmplus::AvmCore::use_cmov()); return lir->insChoose(cond, t, f, njConfig->use_cmov());
} }
nj::LIns *cmovp(nj::LIns *cond, nj::LIns *t, nj::LIns *f) const { nj::LIns *cmovp(nj::LIns *cond, nj::LIns *t, nj::LIns *f) const {
/* We can only use cmovp if the configuration says we can. */ /* We can only use cmovp if the configuration says we can. */
NanoAssert(t->isP() && f->isP()); NanoAssert(t->isP() && f->isP());
return lir->insChoose(cond, t, f, avmplus::AvmCore::use_cmov()); return lir->insChoose(cond, t, f, njConfig->use_cmov());
} }
nj::LIns *cmovd(nj::LIns *cond, nj::LIns *t, nj::LIns *f) const { nj::LIns *cmovd(nj::LIns *cond, nj::LIns *t, nj::LIns *f) const {