Fix span-dependent instruction selection to work with incremental compilation (324650, r=mrbkap).

This commit is contained in:
brendan%mozilla.org 2006-01-26 21:05:40 +00:00
parent 56a4c9f4c4
commit 0e7b56bdb0
2 changed files with 13 additions and 1 deletions

View File

@ -546,7 +546,7 @@ BuildSpanDepTable(JSContext *cx, JSCodeGenerator *cg)
const JSCodeSpec *cs;
ptrdiff_t len, off;
pc = CG_BASE(cg);
pc = CG_BASE(cg) + cg->spanDepTodo;
end = CG_NEXT(cg);
while (pc < end) {
op = (JSOp)*pc;
@ -611,6 +611,7 @@ BuildSpanDepTable(JSContext *cx, JSCodeGenerator *cg)
#endif /* JS_HAS_SWITCH_STATEMENT */
}
JS_ASSERT(len > 0);
pc += len;
}
@ -1037,6 +1038,7 @@ OptimizeSpanDeps(JSContext *cx, JSCodeGenerator *cg)
}
}
}
cg->main.lastNoteOffset += growth;
/*
* Fix try/catch notes (O(numTryNotes * log2(numSpanDeps)), but it's
@ -1130,6 +1132,7 @@ OptimizeSpanDeps(JSContext *cx, JSCodeGenerator *cg)
FreeJumpTargets(cg, cg->jumpTargets);
cg->jumpTargets = NULL;
cg->numSpanDeps = cg->numJumpTargets = 0;
cg->spanDepTodo = CG_OFFSET(cg);
return JS_TRUE;
}

View File

@ -186,11 +186,13 @@ struct JSJumpTarget {
struct JSCodeGenerator {
JSTreeContext treeContext; /* base state: statement info stack, etc. */
JSArenaPool *codePool; /* pointer to thread code arena pool */
JSArenaPool *notePool; /* pointer to thread srcnote arena pool */
void *codeMark; /* low watermark in cg->codePool */
void *noteMark; /* low watermark in cg->notePool */
void *tempMark; /* low watermark in cx->tempPool */
struct {
jsbytecode *base; /* base of JS bytecode vector */
jsbytecode *limit; /* one byte beyond end of bytecode */
@ -201,20 +203,27 @@ struct JSCodeGenerator {
ptrdiff_t lastNoteOffset; /* code offset for last source note */
uintN currentLine; /* line number for tree-based srcnote gen */
} prolog, main, *current;
const char *filename; /* null or weak link to source filename */
uintN firstLine; /* first line, for js_NewScriptFromCG */
JSPrincipals *principals; /* principals for constant folding eval */
JSAtomList atomList; /* literals indexed for mapping */
intN stackDepth; /* current stack depth in script frame */
uintN maxStackDepth; /* maximum stack depth so far */
JSTryNote *tryBase; /* first exception handling note */
JSTryNote *tryNext; /* next available note */
size_t tryNoteSpace; /* # of bytes allocated at tryBase */
JSSpanDep *spanDeps; /* span dependent instruction records */
JSJumpTarget *jumpTargets; /* AVL tree of jump target offsets */
JSJumpTarget *jtFreeList; /* JT_LEFT-linked list of free structs */
uintN numSpanDeps; /* number of span dependencies */
uintN numJumpTargets; /* number of jump targets */
ptrdiff_t spanDepTodo; /* offset from main.base of potentially
unoptimized spandeps */
uintN emitLevel; /* js_EmitTree recursion level */
JSAtomList constList; /* compile time constants */
JSCodeGenerator *parent; /* Enclosing function or global context */