Commit 840e31a0 authored by ricow@chromium.org's avatar ricow@chromium.org

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
parent 1d53788e
......@@ -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));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment