]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/math-pow-becomes-custom-function.js
8893acc5075ff9ecf803a6ca60222556bfad1801
[apple/javascriptcore.git] / tests / stress / math-pow-becomes-custom-function.js
1 function mathPowWrapper(x, y) {
2 return Math.pow(x, y);
3 }
4 noInline(mathPowWrapper);
5
6 function testChangingMathPow() {
7 var result = 0;
8 for (var i = 0; i < 10000; ++i) {
9 result += mathPowWrapper(3, 2);
10 }
11 Math.pow = function(a, b) { return a + b; }
12 for (var i = 0; i < 10000; ++i) {
13 result += mathPowWrapper(3, 2);
14 }
15 if (result !== 140000)
16 throw "Result = " + result + ", expected 140000";
17 }
18 testChangingMathPow();