1b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Copyright 2013 the V8 project authors. All rights reserved.
281362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// Redistribution and use in source and binary forms, with or without
381362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// modification, are permitted provided that the following conditions are
481362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// met:
581362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//
681362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//     * Redistributions of source code must retain the above copyright
781362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//       notice, this list of conditions and the following disclaimer.
881362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//     * Redistributions in binary form must reproduce the above
981362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//       copyright notice, this list of conditions and the following
1081362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//       disclaimer in the documentation and/or other materials provided
1181362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//       with the distribution.
1281362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//     * Neither the name of Google Inc. nor the names of its
1381362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//       contributors may be used to endorse or promote products derived
1481362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//       from this software without specific prior written permission.
1581362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen//
1681362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1781362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1881362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1981362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2081362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2181362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2281362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2381362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2481362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2581362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2681362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2781362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen
28b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Flags: --allow-natives-syntax
2981362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen
30b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochfunction foo(x) {
31b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  return Math.exp(x);
3281362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen}
33b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
34b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochfoo(12.3);
35b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochvar r1 = foo(12.3);
36b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch%OptimizeFunctionOnNextCall(foo);
37b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochvar r2 = foo(12.3);
38b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
39b8a8cc1952d61a2f3a2568848933943a543b5d3eBen MurdochassertEquals(r1, r2);
40