From 6156d61b8498178d37d76e73c1b1e49215f8412e Mon Sep 17 00:00:00 2001 From: David Mandelin Date: Tue, 16 Dec 2008 16:15:09 -0500 Subject: [PATCH] Bug 469177 - red/green analysis (cx->fp) doesn't actually run the analysis, r=jorendorff --- js/src/jsstack.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/src/jsstack.js b/js/src/jsstack.js index cd89087d067d..e56b69424ecc 100644 --- a/js/src/jsstack.js +++ b/js/src/jsstack.js @@ -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