Don't assume calls with ignored return values will produce undefined, bug 786491. r=luke

This commit is contained in:
Brian Hackett 2012-08-28 17:39:01 -06:00
parent 5ac27a163f
commit fc9cc3f103

View File

@ -3893,10 +3893,6 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset,
if (op == JSOP_FUNCALL || op == JSOP_FUNAPPLY)
cx->compartment->types.monitorBytecode(cx, script, pc - script->code);
/* Speculate that calls whose result is ignored may return undefined. */
if (JSOP_POP == *(pc + GetBytecodeLength(pc)))
seen->addType(cx, Type::UndefinedType());
poppedTypes(pc, argCount + 1)->addCall(cx, callsite);
break;
}
@ -5112,7 +5108,9 @@ TypeDynamicResult(JSContext *cx, JSScript *script, jsbytecode *pc, Type type)
*/
jsbytecode *ignorePC = pc + GetBytecodeLength(pc);
if (*ignorePC == JSOP_INT8 && GET_INT8(ignorePC) == -1) {
if (*ignorePC == JSOP_POP) {
/* Value is ignored. */
} if (*ignorePC == JSOP_INT8 && GET_INT8(ignorePC) == -1) {
ignorePC += JSOP_INT8_LENGTH;
if (*ignorePC != JSOP_BITAND)
ignorePC = NULL;