X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/tests/stress/math-pow-becomes-custom-function.js diff --git a/tests/stress/math-pow-becomes-custom-function.js b/tests/stress/math-pow-becomes-custom-function.js new file mode 100644 index 0000000..8893acc --- /dev/null +++ b/tests/stress/math-pow-becomes-custom-function.js @@ -0,0 +1,18 @@ +function mathPowWrapper(x, y) { + return Math.pow(x, y); +} +noInline(mathPowWrapper); + +function testChangingMathPow() { + var result = 0; + for (var i = 0; i < 10000; ++i) { + result += mathPowWrapper(3, 2); + } + Math.pow = function(a, b) { return a + b; } + for (var i = 0; i < 10000; ++i) { + result += mathPowWrapper(3, 2); + } + if (result !== 140000) + throw "Result = " + result + ", expected 140000"; +} +testChangingMathPow(); \ No newline at end of file