Bug 469177 - red/green analysis (cx->fp) doesn't actually run the analysis, r=jorendorff

This commit is contained in:
David Mandelin 2008-12-16 16:15:09 -05:00
Родитель f7edd5c9b6
Коммит 6156d61b84
1 изменённых файлов: 8 добавлений и 3 удалений

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

@ -99,8 +99,13 @@ function RedGreenCheck(fndecl, trace) {
// Using walk_tree to walk the isns is a little crazy but robust.
//
this.hasRed = false;
let self = this; // Allow our 'this' to be accessed inside closure
for (let bb in cfg_bb_iterator(cfg)) {
for (let isn in bb_isn_iterator(bb)) {
// Treehydra objects don't support reading never-defined properties
// as undefined, so we have to explicitly initialize anything we want
// to check for later.
isn.redInfo = undefined;
walk_tree(isn, function(t, stack) {
switch (TREE_CODE(t)) {
case FIELD_DECL:
@ -109,7 +114,7 @@ function RedGreenCheck(fndecl, trace) {
// location_of(t) is the location of the declaration.
isn.redInfo = ["cannot access JS_REQUIRES_STACK variable " + varName,
location_of(stack[stack.length - 1])];
this.hasRed = true;
self.hasRed = true;
}
break;
case CALL_EXPR:
@ -120,7 +125,7 @@ function RedGreenCheck(fndecl, trace) {
let calleeName = dehydra_convert(callee).name;
isn.redInfo = ["cannot call JS_REQUIRES_STACK function " + calleeName,
location_of(t)];
this.hasRed = true;
self.hasRed = true;
} else if (isTurnRed(callee)) {
isn.turnRed = true;
}
@ -156,7 +161,7 @@ RedGreenCheck.prototype.flowState = function(isn, state) {
let redInfo = isn.redInfo;
if (green && redInfo) {
error(redInfo[0], redInfo[1]);
delete isn.redInfo; // avoid duplicate messages about this instruction
isn.redInfo = undefined; // avoid duplicate messages about this instruction
}
// If we call a TURNS_RED function, it doesn't take effect until after the