Backed out changeset 188cf7548d85 (bug 521881).

This commit is contained in:
Andreas Gal 2009-10-12 17:59:40 -07:00
Родитель de8229ea69
Коммит 3218a9bd9e
4 изменённых файлов: 17 добавлений и 33 удалений

Просмотреть файл

@ -2462,7 +2462,7 @@ TraceRecorder::~TraceRecorder()
TrashTree(cx, whichTreesToTrash[i]);
/* Purge the tempAlloc used during recording. */
tempAlloc.reset(true);
tempAlloc.reset();
traceMonitor->lirbuf->clear();
forgetGuardedShapes();
@ -7482,8 +7482,8 @@ js_InitJIT(JSTraceMonitor *tm)
JS_ASSERT(!tm->dataAlloc && !tm->traceAlloc && !tm->codeAlloc);
tm->dataAlloc = new VMAllocator();
tm->traceAlloc = new VMAllocator();
tm->tempAlloc = new VMAllocator(65536);
tm->reTempAlloc = new VMAllocator(65536);
tm->tempAlloc = new VMAllocator();
tm->reTempAlloc = new VMAllocator();
tm->codeAlloc = new CodeAlloc();
tm->frameCache = new FrameInfoCache(tm->dataAlloc);
tm->flush();

Просмотреть файл

@ -495,9 +495,7 @@ class VMAllocator : public nanojit::Allocator
{
public:
/* Use a chunk size slightly smaller than a page in case malloc wants a header. */
VMAllocator(size_t minChunk = 4088) :
nanojit::Allocator(minChunk), mOutOfMemory(false), mSize(0)
VMAllocator() : mOutOfMemory(false), mSize(0)
{}
size_t size() {
@ -755,6 +753,7 @@ struct InterpState
// Used to communicate the location of the return value in case of a deep bail.
double* deepBailSp;
// Used when calling natives from trace to root the vp vector.
uintN nativeVpLen;
jsval *nativeVp;

Просмотреть файл

@ -43,9 +43,8 @@
namespace nanojit
{
Allocator::Allocator(size_t minChunk)
: minChunk(minChunk)
, current_chunk(NULL)
Allocator::Allocator()
: current_chunk(NULL)
, current_top(NULL)
, current_limit(NULL)
{ }
@ -55,17 +54,17 @@ namespace nanojit
reset();
}
void Allocator::reset(bool keepFirst)
void Allocator::reset()
{
Chunk *c = current_chunk;
while (c) {
Chunk *prev = c->prev;
if (keepFirst && !prev)
break;
freeChunk(c);
c = prev;
}
setChunk(c);
current_chunk = NULL;
current_top = NULL;
current_limit = NULL;
postReset();
}
@ -79,28 +78,18 @@ namespace nanojit
return p;
}
void Allocator::setChunk(Chunk* chunk)
{
if (chunk) {
current_chunk = chunk;
current_top = (char*)chunk->data;
current_limit = (char*)chunk + chunk->size;
} else {
current_chunk = NULL;
current_top = current_limit = NULL;
}
}
void Allocator::fill(size_t nbytes)
{
const size_t minChunk = 2000;
if (nbytes < minChunk)
nbytes = minChunk;
size_t chunkbytes = sizeof(Chunk) + nbytes - sizeof(int64_t);
void* mem = allocChunk(chunkbytes);
Chunk* chunk = (Chunk*) mem;
chunk->prev = current_chunk;
chunk->size = chunkbytes;
setChunk(chunk);
current_chunk = chunk;
current_top = (char*)chunk->data;
current_limit = (char*)mem + chunkbytes;
}
}

Просмотреть файл

@ -51,11 +51,10 @@ namespace nanojit
* proceed.
*/
class Allocator {
size_t minChunk;
public:
Allocator(size_t minChunk = 2000);
Allocator();
~Allocator();
void reset(bool keepFirst = false);
void reset();
/** alloc memory, never return null. */
void* alloc(size_t nbytes) {
@ -75,12 +74,9 @@ namespace nanojit
class Chunk {
public:
Chunk* prev;
size_t size;
int64_t data[1]; // int64_t forces 8-byte alignment.
};
void setChunk(Chunk* chunk);
Chunk* current_chunk;
char* current_top;
char* current_limit;