зеркало из https://github.com/mozilla/gecko-dev.git
Bug 845175 - Lazily allocate the bytecode and srcnote Vectors' storage. r=jorendorff.
--HG-- extra : rebase_source : f39db7bf439b9f86419cb9fdf4f899c052ae7638
This commit is contained in:
Родитель
9de23a845f
Коммит
f0d83aff80
|
@ -124,15 +124,15 @@ BytecodeEmitter::init()
|
|||
return atomIndices.ensureMap(sc->context);
|
||||
}
|
||||
|
||||
BytecodeEmitter::~BytecodeEmitter()
|
||||
{
|
||||
}
|
||||
|
||||
static ptrdiff_t
|
||||
EmitCheck(JSContext *cx, BytecodeEmitter *bce, ptrdiff_t delta)
|
||||
{
|
||||
ptrdiff_t offset = bce->code().length();
|
||||
|
||||
// Start it off moderately large to avoid repeated resizings early on.
|
||||
if (bce->code().capacity() == 0 && !bce->code().reserve(1024))
|
||||
return -1;
|
||||
|
||||
jsbytecode dummy = 0;
|
||||
if (!bce->code().appendN(dummy, delta)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
|
@ -5897,6 +5897,10 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
|||
static int
|
||||
AllocSrcNote(JSContext *cx, SrcNotesVector ¬es)
|
||||
{
|
||||
// Start it off moderately large to avoid repeated resizings early on.
|
||||
if (notes.capacity() == 0 && !notes.reserve(1024))
|
||||
return -1;
|
||||
|
||||
jssrcnote dummy = 0;
|
||||
if (!notes.append(dummy)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
|
|
|
@ -84,12 +84,7 @@ struct BytecodeEmitter
|
|||
|
||||
EmitSection(JSContext *cx, unsigned lineno)
|
||||
: code(cx), notes(cx), lastNoteOffset(0), currentLine(lineno), lastColumn(0)
|
||||
{
|
||||
// Start them off moderately large, to avoid repeated resizings
|
||||
// early on.
|
||||
code.reserve(1024);
|
||||
notes.reserve(1024);
|
||||
}
|
||||
{}
|
||||
};
|
||||
EmitSection prolog, main, *current;
|
||||
|
||||
|
@ -149,8 +144,6 @@ struct BytecodeEmitter
|
|||
unsigned lineno, bool selfHostingMode = false);
|
||||
bool init();
|
||||
|
||||
~BytecodeEmitter();
|
||||
|
||||
bool isAliasedName(ParseNode *pn);
|
||||
|
||||
JS_ALWAYS_INLINE
|
||||
|
|
Загрузка…
Ссылка в новой задаче