Bug 825966 part 2 - Mark JSOP_CASE/JSOP_DEFAULT targets as safepoint. r=bhackett

This commit is contained in:
Jan de Mooij 2013-01-03 18:35:54 +01:00
parent e31b84cd0b
commit e8ac71ce39
2 changed files with 23 additions and 9 deletions

View File

@ -0,0 +1,18 @@
datediff = function(date1, date2, interval) {
var delta = 1;
switch(interval) {
case "day":
delta /= 24;
case "minute":
delta /= 60;
case Math:
break;
}
return delta;
};
var diff = datediff(new Date("2012-04-28T14:30:00Z"), new Date("2012-04-29T14:30:00Z"), "day");
for (var i = 0; i < 50; i++) {
diff = datediff(new Date("2012-04-28T17:00:00Z"), new Date("2012-04-28T17:30:00Z"), "minute");
assertEq(diff, 1/60);
}

View File

@ -600,21 +600,17 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
/* Check basic jump opcodes, which may or may not have a fallthrough. */ /* Check basic jump opcodes, which may or may not have a fallthrough. */
if (jump) { if (jump) {
/* Some opcodes behave differently on their branching path. */
unsigned newStackDepth = stackDepth;
switch (op) {
case JSOP_CASE:
/* Case instructions do not push the lvalue back when branching. */ /* Case instructions do not push the lvalue back when branching. */
unsigned newStackDepth = stackDepth;
if (op == JSOP_CASE)
newStackDepth--; newStackDepth--;
break;
default:;
}
unsigned targetOffset = offset + GET_JUMP_OFFSET(pc); unsigned targetOffset = offset + GET_JUMP_OFFSET(pc);
if (!addJump(cx, targetOffset, &nextOffset, &forwardJump, &forwardLoop, newStackDepth)) if (!addJump(cx, targetOffset, &nextOffset, &forwardJump, &forwardLoop, newStackDepth))
return; return;
if (op == JSOP_CASE || op == JSOP_DEFAULT)
getCode(targetOffset).safePoint = true;
} }
/* Handle any fallthrough from this opcode. */ /* Handle any fallthrough from this opcode. */