157ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// Copyright 2013 the V8 project authors. All rights reserved.
257ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// Redistribution and use in source and binary forms, with or without
357ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// modification, are permitted provided that the following conditions are
457ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// met:
557ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//
657ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//     * Redistributions of source code must retain the above copyright
757ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//       notice, this list of conditions and the following disclaimer.
857ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//     * Redistributions in binary form must reproduce the above
957ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//       copyright notice, this list of conditions and the following
1057ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//       disclaimer in the documentation and/or other materials provided
1157ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//       with the distribution.
1257ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//     * Neither the name of Google Inc. nor the names of its
1357ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//       contributors may be used to endorse or promote products derived
1457ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//       from this software without specific prior written permission.
1557ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org//
1657ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1757ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1857ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1957ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2057ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2157ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2257ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2357ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2457ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2557ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2657ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2757ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org
2857ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org// Flags: --allow-natives-syntax
2957ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org
3057ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.orgvar y;
3157ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.orgfunction f() {
3257ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org  var a = [];
3357ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org  a[20] = 0;
3457ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org  y = 3;
3557ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org  var i = 7 * (y + -0);
3657ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org  a[i] = 1/y;
3757ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org  assertFalse(isNaN(a[i]));
3857ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org}
3957ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org
4057ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.orgf();
4157ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.orgf();
4257ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.orgf();
4357ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.org%OptimizeFunctionOnNextCall(f);
4457ff881caeb2e15b46ac9e4dfc00e378f7c5f929ulan@chromium.orgf();
45