Use a single lirbuf for the tracer and rewind lirbuf during GC (471821, r=danderson).
This commit is contained in:
Родитель
25ae14d820
Коммит
2042b723d7
|
@ -122,6 +122,7 @@ typedef struct JSTraceMonitor {
|
||||||
* JS_ReportOutOfMemory when failing due to runtime limits.
|
* JS_ReportOutOfMemory when failing due to runtime limits.
|
||||||
*/
|
*/
|
||||||
JSBool onTrace;
|
JSBool onTrace;
|
||||||
|
CLS(nanojit::LirBuffer) lirbuf;
|
||||||
CLS(nanojit::Fragmento) fragmento;
|
CLS(nanojit::Fragmento) fragmento;
|
||||||
CLS(TraceRecorder) recorder;
|
CLS(TraceRecorder) recorder;
|
||||||
uint32 globalShape;
|
uint32 globalShape;
|
||||||
|
|
|
@ -2364,6 +2364,7 @@ class RegExpNativeCompiler {
|
||||||
fail:
|
fail:
|
||||||
if (lirbuf->outOMem() || oom) {
|
if (lirbuf->outOMem() || oom) {
|
||||||
fragmento->clearFrags();
|
fragmento->clearFrags();
|
||||||
|
lirbuf->rewind();
|
||||||
} else {
|
} else {
|
||||||
if (!guard) insertGuard(re_chars, re_length);
|
if (!guard) insertGuard(re_chars, re_length);
|
||||||
fragment->blacklist();
|
fragment->blacklist();
|
||||||
|
|
|
@ -2699,9 +2699,6 @@ nanojit::LirNameMap::formatGuard(LIns *i, char *out)
|
||||||
void
|
void
|
||||||
nanojit::Fragment::onDestroy()
|
nanojit::Fragment::onDestroy()
|
||||||
{
|
{
|
||||||
if (root == this && lirbuf && !lirbuf->shared) {
|
|
||||||
delete lirbuf;
|
|
||||||
}
|
|
||||||
delete (TreeInfo *)vmprivate;
|
delete (TreeInfo *)vmprivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3011,13 +3008,7 @@ js_RecordTree(JSContext* cx, JSTraceMonitor* tm, Fragment* f, Fragment* outer, u
|
||||||
|
|
||||||
f->recordAttempts++;
|
f->recordAttempts++;
|
||||||
f->root = f;
|
f->root = f;
|
||||||
/* allocate space to store the LIR for this tree */
|
f->lirbuf = tm->lirbuf;
|
||||||
if (!f->lirbuf) {
|
|
||||||
f->lirbuf = new (&gc) LirBuffer(tm->fragmento, NULL);
|
|
||||||
#ifdef DEBUG
|
|
||||||
f->lirbuf->names = new (&gc) LirNameMap(&gc, NULL, tm->fragmento->labels);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (f->lirbuf->outOMem()) {
|
if (f->lirbuf->outOMem()) {
|
||||||
js_FlushJITCache(cx);
|
js_FlushJITCache(cx);
|
||||||
|
@ -4026,6 +4017,10 @@ js_InitJIT(JSTraceMonitor *tm)
|
||||||
Fragmento* fragmento = new (&gc) Fragmento(core, 24);
|
Fragmento* fragmento = new (&gc) Fragmento(core, 24);
|
||||||
verbose_only(fragmento->labels = new (&gc) LabelMap(core, NULL);)
|
verbose_only(fragmento->labels = new (&gc) LabelMap(core, NULL);)
|
||||||
tm->fragmento = fragmento;
|
tm->fragmento = fragmento;
|
||||||
|
tm->lirbuf = new (&gc) LirBuffer(fragmento, NULL);
|
||||||
|
#ifdef DEBUG
|
||||||
|
tm->lirbuf->names = new (&gc) LirNameMap(&gc, NULL, tm->fragmento->labels);
|
||||||
|
#endif
|
||||||
tm->globalSlots = new (&gc) SlotList();
|
tm->globalSlots = new (&gc) SlotList();
|
||||||
tm->globalTypeMap = new (&gc) TypeMap();
|
tm->globalTypeMap = new (&gc) TypeMap();
|
||||||
tm->recoveryDoublePoolPtr = tm->recoveryDoublePool = new jsval[MAX_NATIVE_STACK_SLOTS];
|
tm->recoveryDoublePoolPtr = tm->recoveryDoublePool = new jsval[MAX_NATIVE_STACK_SLOTS];
|
||||||
|
@ -4035,7 +4030,6 @@ js_InitJIT(JSTraceMonitor *tm)
|
||||||
verbose_only(fragmento->labels = new (&gc) LabelMap(core, NULL);)
|
verbose_only(fragmento->labels = new (&gc) LabelMap(core, NULL);)
|
||||||
tm->reFragmento = fragmento;
|
tm->reFragmento = fragmento;
|
||||||
tm->reLirBuf = new (&gc) LirBuffer(fragmento, NULL);
|
tm->reLirBuf = new (&gc) LirBuffer(fragmento, NULL);
|
||||||
tm->reLirBuf->shared = true;
|
|
||||||
}
|
}
|
||||||
InitIMacroCode();
|
InitIMacroCode();
|
||||||
#if !defined XP_WIN
|
#if !defined XP_WIN
|
||||||
|
@ -4063,6 +4057,12 @@ js_FinishJIT(JSTraceMonitor *tm)
|
||||||
if (tm->fragmento != NULL) {
|
if (tm->fragmento != NULL) {
|
||||||
JS_ASSERT(tm->globalSlots && tm->globalTypeMap && tm->recoveryDoublePool);
|
JS_ASSERT(tm->globalSlots && tm->globalTypeMap && tm->recoveryDoublePool);
|
||||||
verbose_only(delete tm->fragmento->labels;)
|
verbose_only(delete tm->fragmento->labels;)
|
||||||
|
#ifdef DEBUG
|
||||||
|
delete tm->lirbuf->names;
|
||||||
|
tm->lirbuf->names = NULL;
|
||||||
|
#endif
|
||||||
|
delete tm->lirbuf;
|
||||||
|
tm->lirbuf = NULL;
|
||||||
delete tm->fragmento;
|
delete tm->fragmento;
|
||||||
tm->fragmento = NULL;
|
tm->fragmento = NULL;
|
||||||
delete tm->globalSlots;
|
delete tm->globalSlots;
|
||||||
|
@ -4132,6 +4132,7 @@ js_FlushJITCache(JSContext* cx)
|
||||||
delete fragmento->labels;
|
delete fragmento->labels;
|
||||||
fragmento->labels = new (&gc) LabelMap(core, NULL);
|
fragmento->labels = new (&gc) LabelMap(core, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
tm->lirbuf->rewind();
|
||||||
}
|
}
|
||||||
if (cx->fp) {
|
if (cx->fp) {
|
||||||
tm->globalShape = OBJ_SHAPE(JS_GetGlobalForObject(cx, cx->fp->scopeChain));
|
tm->globalShape = OBJ_SHAPE(JS_GetGlobalForObject(cx, cx->fp->scopeChain));
|
||||||
|
|
|
@ -88,20 +88,13 @@ namespace nanojit
|
||||||
|
|
||||||
// LCompressedBuffer
|
// LCompressedBuffer
|
||||||
LirBuffer::LirBuffer(Fragmento* frago, const CallInfo* functions)
|
LirBuffer::LirBuffer(Fragmento* frago, const CallInfo* functions)
|
||||||
: _frago(frago), _pages(frago->core()->GetGC()), _functions(functions), abi(ABI_FASTCALL), shared(false)
|
: _frago(frago), _pages(frago->core()->GetGC()), _functions(functions), abi(ABI_FASTCALL)
|
||||||
{
|
{
|
||||||
clear();
|
rewind();
|
||||||
Page* start = pageAlloc();
|
|
||||||
if (start)
|
|
||||||
_unused = &start->lir[0];
|
|
||||||
//buffer_count++;
|
|
||||||
//fprintf(stderr, "LirBuffer %x unused %x\n", (int)this, (int)_unused);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LirBuffer::~LirBuffer()
|
LirBuffer::~LirBuffer()
|
||||||
{
|
{
|
||||||
//buffer_count--;
|
|
||||||
//fprintf(stderr, "~LirBuffer %x start %x\n", (int)this, (int)_start);
|
|
||||||
clear();
|
clear();
|
||||||
verbose_only(if (names) NJ_DELETE(names);)
|
verbose_only(if (names) NJ_DELETE(names);)
|
||||||
_frago = 0;
|
_frago = 0;
|
||||||
|
@ -123,6 +116,13 @@ namespace nanojit
|
||||||
NanoAssert(_nextPage || _noMem);
|
NanoAssert(_nextPage || _noMem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LirBuffer::rewind()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
Page* start = pageAlloc();
|
||||||
|
_unused = start ? &start->lir[0] : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t LirBuffer::insCount()
|
int32_t LirBuffer::insCount()
|
||||||
{
|
{
|
||||||
// doesn't include embedded constants nor LIR_skip payload
|
// doesn't include embedded constants nor LIR_skip payload
|
||||||
|
|
|
@ -693,6 +693,7 @@ namespace nanojit
|
||||||
LirBuffer(Fragmento* frago, const CallInfo* functions);
|
LirBuffer(Fragmento* frago, const CallInfo* functions);
|
||||||
virtual ~LirBuffer();
|
virtual ~LirBuffer();
|
||||||
void clear();
|
void clear();
|
||||||
|
void rewind();
|
||||||
LInsp next();
|
LInsp next();
|
||||||
bool outOMem() { return _noMem != 0; }
|
bool outOMem() { return _noMem != 0; }
|
||||||
|
|
||||||
|
@ -714,8 +715,6 @@ namespace nanojit
|
||||||
LInsp state,param1,sp,rp;
|
LInsp state,param1,sp,rp;
|
||||||
LInsp savedRegs[NumSavedRegs];
|
LInsp savedRegs[NumSavedRegs];
|
||||||
bool explicitSavedRegs;
|
bool explicitSavedRegs;
|
||||||
|
|
||||||
bool shared;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class LirBufWriter;
|
friend class LirBufWriter;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче