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) {
JS_ASSERT(!tm->reservedDoublePool);
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->lirbuf = new (&gc) LirBuffer(fragmento);
tm->lirbuf = new (&gc) LirBuffer(fragmento, NULL);
#ifdef DEBUG
tm->lirbuf->names = new (&gc) LirNameMap(&gc, tm->fragmento->labels);
#endif
@ -5444,9 +5444,9 @@ js_InitJIT(JSTraceMonitor *tm)
}
if (!tm->reFragmento) {
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->reLirBuf = new (&gc) LirBuffer(fragmento);
tm->reLirBuf = new (&gc) LirBuffer(fragmento, NULL);
}
#if !defined XP_WIN
debug_only(memset(&jitstats, 0, sizeof(jitstats)));

View File

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

View File

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

View File

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

View File

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

View File

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