Add regression test for optimized version of Math.abs.

This issue was already fixed on bleeding edge, but adding regression
test to get coverage and to make sure it works on the branches.
Review URL: http://codereview.chromium.org/7237022

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8402 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ricow@chromium.org 2011-06-24 07:46:57 +00:00
parent 1d53788e7e
commit 840e31a0b3

View File

@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --max-new-space-size=256
// Flags: --max-new-space-size=256 --allow-natives-syntax
function zero() {
var x = 0.5;
@ -96,3 +96,16 @@ function test() {
for (var i = 0; i < 500; i++) {
test();
}
// Regression test for optimized version of Math.abs, see:
// http://codereview.chromium.org/6875002.
function foo(x) {
return Math.abs(x);
}
// Get some smi type feedback.
for(var i = 0; i < 1000; i++) {
foo(-i);
}
assertEquals(42, foo(-42));
%OptimizeFunctionOnNextCall(foo)
assertEquals(42, foo(-42));