blob: 847b3d46f4660f61a0810b1256ce68fcc0a90ad1 [file] [log] [blame]
description(
"This tests that speculation recovery of destructive additions on unboxed integers works."
);
function destructiveAddForBoxedInteger(a,b,c) {
var a_ = a.x;
var d = a_ + b;
return c + d + b;
}
// warm-up foo to be integer
for (var i = 0; i < 100; ++i) {
destructiveAddForBoxedInteger({x:1}, 2, 3);
}
shouldBe("destructiveAddForBoxedInteger({x:1}, 2, 4)", "9");
shouldBe("destructiveAddForBoxedInteger({x:2147483647}, 2, 4)", "2147483655");
shouldBe("destructiveAddForBoxedInteger({x:2}, 2147483647, 4)", "4294967300");
shouldBe("destructiveAddForBoxedInteger({x:2147483647}, 2147483647, 4)", "6442450945");
shouldBe("destructiveAddForBoxedInteger({x:1}, 2, 2147483647)", "2147483652");