Backed out changeset 1b5584a4eba4. Accidentally committed some unreviewed changes.

This commit is contained in:
Andreas Gal 2009-06-19 09:42:34 +01:00
parent 7ecc26f135
commit ac13e56ffd
6 changed files with 32 additions and 22 deletions

View File

@ -5428,9 +5428,9 @@ js_InitJIT(JSTraceMonitor *tm)
if (!tm->fragmento) { if (!tm->fragmento) {
JS_ASSERT(!tm->reservedDoublePool); JS_ASSERT(!tm->reservedDoublePool);
Fragmento* fragmento = new (&gc) Fragmento(core, 32); Fragmento* fragmento = new (&gc) Fragmento(core, 32);
verbose_only(fragmento->labels = new (&gc) LabelMap(core);) verbose_only(fragmento->labels = new (&gc) LabelMap(core, NULL);)
tm->fragmento = fragmento; tm->fragmento = fragmento;
tm->lirbuf = new (&gc) LirBuffer(fragmento); tm->lirbuf = new (&gc) LirBuffer(fragmento, NULL);
#ifdef DEBUG #ifdef DEBUG
tm->lirbuf->names = new (&gc) LirNameMap(&gc, tm->fragmento->labels); tm->lirbuf->names = new (&gc) LirNameMap(&gc, tm->fragmento->labels);
#endif #endif
@ -5444,9 +5444,9 @@ js_InitJIT(JSTraceMonitor *tm)
} }
if (!tm->reFragmento) { if (!tm->reFragmento) {
Fragmento* fragmento = new (&gc) Fragmento(core, 32); Fragmento* fragmento = new (&gc) Fragmento(core, 32);
verbose_only(fragmento->labels = new (&gc) LabelMap(core);) verbose_only(fragmento->labels = new (&gc) LabelMap(core, NULL);)
tm->reFragmento = fragmento; tm->reFragmento = fragmento;
tm->reLirBuf = new (&gc) LirBuffer(fragmento); tm->reLirBuf = new (&gc) LirBuffer(fragmento, NULL);
} }
#if !defined XP_WIN #if !defined XP_WIN
debug_only(memset(&jitstats, 0, sizeof(jitstats))); debug_only(memset(&jitstats, 0, sizeof(jitstats)));

View File

@ -59,6 +59,8 @@ namespace nanojit
class DeadCodeFilter: public LirFilter class DeadCodeFilter: public LirFilter
{ {
const CallInfo *functions;
bool ignoreInstruction(LInsp ins) bool ignoreInstruction(LInsp ins)
{ {
LOpcode op = ins->opcode(); LOpcode op = ins->opcode();
@ -73,12 +75,12 @@ namespace nanojit
} }
public: public:
DeadCodeFilter(LirFilter *in) : LirFilter(in) {} DeadCodeFilter(LirFilter *in, const CallInfo *f) : LirFilter(in), functions(f) {}
LInsp read() { LInsp read() {
for (;;) { for (;;) {
LInsp i = in->read(); LInsp i = in->read();
if (!i || i->isGuard() || i->isBranch() if (!i || i->isGuard() || i->isBranch()
|| (i->isCall() && !i->isCse()) || (i->isCall() && !i->isCse(functions))
|| !ignoreInstruction(i)) || !ignoreInstruction(i))
return i; return i;
} }
@ -771,7 +773,7 @@ namespace nanojit
avmplus::GC *gc = core->gc; avmplus::GC *gc = core->gc;
StackFilter storefilter1(&bufreader, gc, frag->lirbuf, frag->lirbuf->sp); StackFilter storefilter1(&bufreader, gc, frag->lirbuf, frag->lirbuf->sp);
StackFilter storefilter2(&storefilter1, gc, frag->lirbuf, frag->lirbuf->rp); StackFilter storefilter2(&storefilter1, gc, frag->lirbuf, frag->lirbuf->rp);
DeadCodeFilter deadfilter(&storefilter2); DeadCodeFilter deadfilter(&storefilter2, frag->lirbuf->_functions);
LirFilter* rdr = &deadfilter; LirFilter* rdr = &deadfilter;
verbose_only( verbose_only(
VerboseBlockReader vbr(rdr, this, frag->lirbuf->names); VerboseBlockReader vbr(rdr, this, frag->lirbuf->names);

View File

@ -98,12 +98,12 @@ namespace nanojit
#endif /* NJ_PROFILE */ #endif /* NJ_PROFILE */
// LCompressedBuffer // LCompressedBuffer
LirBuffer::LirBuffer(Fragmento* frago) LirBuffer::LirBuffer(Fragmento* frago, const CallInfo* functions)
: _frago(frago), : _frago(frago),
#ifdef NJ_VERBOSE #ifdef NJ_VERBOSE
names(NULL), names(NULL),
#endif #endif
abi(ABI_FASTCALL), _functions(functions), abi(ABI_FASTCALL),
state(NULL), param1(NULL), sp(NULL), rp(NULL), state(NULL), param1(NULL), sp(NULL), rp(NULL),
_pages(frago->core()->GetGC()) _pages(frago->core()->GetGC())
{ {
@ -531,7 +531,7 @@ namespace nanojit
#endif #endif
} }
bool LIns::isCse() const bool LIns::isCse(const CallInfo *functions) const
{ {
return nanojit::isCseOpcode(firstWord.code) || (isCall() && callInfo()->_cse); return nanojit::isCseOpcode(firstWord.code) || (isCall() && callInfo()->_cse);
} }
@ -1530,7 +1530,7 @@ namespace nanojit
total++; total++;
// first handle side-effect instructions // first handle side-effect instructions
if (!i->isCse()) if (!i->isCse(lirbuf->_functions))
{ {
live.add(i,0); live.add(i,0);
if (i->isGuard()) if (i->isGuard())
@ -1981,15 +1981,15 @@ namespace nanojit
return out->insCall(ci, args); return out->insCall(ci, args);
} }
CseReader::CseReader(LirFilter *in, LInsHashSet *exprs) CseReader::CseReader(LirFilter *in, LInsHashSet *exprs, const CallInfo *functions)
: LirFilter(in), exprs(exprs) : LirFilter(in), exprs(exprs), functions(functions)
{} {}
LInsp CseReader::read() LInsp CseReader::read()
{ {
LInsp i = in->read(); LInsp i = in->read();
if (i) { if (i) {
if (i->isCse()) if (i->isCse(functions))
exprs->replace(i); exprs->replace(i);
} }
return i; return i;

View File

@ -288,7 +288,7 @@ namespace nanojit
#endif #endif
} }
bool isCse() const; bool isCse(const CallInfo *functions) const;
bool isRet() const { return nanojit::isRetOpcode(firstWord.code); } bool isRet() const { return nanojit::isRetOpcode(firstWord.code); }
bool isop(LOpcode o) const { return firstWord.code == o; } bool isop(LOpcode o) const { return firstWord.code == o; }
#if defined(_DEBUG) #if defined(_DEBUG)
@ -372,10 +372,11 @@ namespace nanojit
{ {
public: public:
LirWriter *out; LirWriter *out;
const CallInfo *_functions;
virtual ~LirWriter() {} virtual ~LirWriter() {}
LirWriter(LirWriter* out) LirWriter(LirWriter* out)
: out(out) {} : out(out), _functions(out?out->_functions : 0) {}
virtual LInsp ins0(LOpcode v) { virtual LInsp ins0(LOpcode v) {
return out->ins0(v); return out->ins0(v);
@ -474,7 +475,7 @@ namespace nanojit
void formatAddr(const void *p, char *buf); void formatAddr(const void *p, char *buf);
public: public:
avmplus::AvmCore *core; avmplus::AvmCore *core;
LabelMap(avmplus::AvmCore *, LabelMap* parent = NULL); LabelMap(avmplus::AvmCore *, LabelMap* parent);
~LabelMap(); ~LabelMap();
void add(const void *p, size_t size, size_t align, const char *name); void add(const void *p, size_t size, size_t align, const char *name);
void add(const void *p, size_t size, size_t align, avmplus::String*); void add(const void *p, size_t size, size_t align, avmplus::String*);
@ -677,7 +678,7 @@ namespace nanojit
{ {
public: public:
DWB(Fragmento*) _frago; DWB(Fragmento*) _frago;
LirBuffer(Fragmento* frago); LirBuffer(Fragmento* frago, const CallInfo* functions);
virtual ~LirBuffer(); virtual ~LirBuffer();
void clear(); void clear();
void rewind(); void rewind();
@ -698,6 +699,7 @@ namespace nanojit
} }
_stats; _stats;
const CallInfo* _functions;
AbiKind abi; AbiKind abi;
LInsp state,param1,sp,rp; LInsp state,param1,sp,rp;
LInsp savedRegs[NumSavedRegs]; LInsp savedRegs[NumSavedRegs];
@ -720,6 +722,7 @@ namespace nanojit
public: public:
LirBufWriter(LirBuffer* buf) LirBufWriter(LirBuffer* buf)
: LirWriter(0), _buf(buf) { : LirWriter(0), _buf(buf) {
_functions = buf->_functions;
} }
// LirWriter interface // LirWriter interface
@ -795,8 +798,9 @@ namespace nanojit
class CseReader: public LirFilter class CseReader: public LirFilter
{ {
LInsHashSet *exprs; LInsHashSet *exprs;
const CallInfo *functions;
public: public:
CseReader(LirFilter *in, LInsHashSet *exprs); CseReader(LirFilter *in, LInsHashSet *exprs, const CallInfo*);
LInsp read(); LInsp read();
}; };

View File

@ -44,7 +44,11 @@
#ifdef NANOJIT_IA32 #ifdef NANOJIT_IA32
#include "Nativei386.h" #include "Nativei386.h"
#elif defined(NANOJIT_ARM) #elif defined(NANOJIT_ARM)
#ifdef THUMB
#include "NativeThumb.h"
#else
#include "NativeARM.h" #include "NativeARM.h"
#endif
#elif defined(NANOJIT_PPC) #elif defined(NANOJIT_PPC)
#include "NativePpc.h" #include "NativePpc.h"
#elif defined(NANOJIT_SPARC) #elif defined(NANOJIT_SPARC)

View File

@ -38,8 +38,8 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifndef __nanojit_NativeARM__ #ifndef __nanojit_NativeArm__
#define __nanojit_NativeARM__ #define __nanojit_NativeArm__
#ifdef PERFM #ifdef PERFM
@ -884,4 +884,4 @@ enum {
asm_output("fcpyd %s,%s", gpn(_Dd), gpn(_Dm)); \ asm_output("fcpyd %s,%s", gpn(_Dd), gpn(_Dm)); \
} while (0) } while (0)
} }
#endif // __nanojit_NativeARM__ #endif // __nanojit_NativeThumb__