13d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// Copyright 2013 the V8 project authors. All rights reserved.
23d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// Redistribution and use in source and binary forms, with or without
33d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// modification, are permitted provided that the following conditions are
43d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// met:
53d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//
63d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//     * Redistributions of source code must retain the above copyright
73d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//       notice, this list of conditions and the following disclaimer.
83d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//     * Redistributions in binary form must reproduce the above
93d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//       copyright notice, this list of conditions and the following
103d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//       disclaimer in the documentation and/or other materials provided
113d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//       with the distribution.
123d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//     * Neither the name of Google Inc. nor the names of its
133d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//       contributors may be used to endorse or promote products derived
143d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//       from this software without specific prior written permission.
153d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org//
163d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
173d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
183d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
193d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
203d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
213d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
223d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
233d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
243d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
253d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
263d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org
283d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org// Flags: --allow-natives-syntax
293d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org
303d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.orgfunction foo(x) {
313d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org  return Math.exp(x);
323d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org}
333d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org
343d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.orgfoo(12.3);
353d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.orgvar r1 = foo(12.3);
363d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org%OptimizeFunctionOnNextCall(foo);
373d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.orgvar r2 = foo(12.3);
383d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.org
393d079fe881245e49c7ba803b54b4fe6d4b46113cmachenbach@chromium.orgassertEquals(r1, r2);
40