11510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// Copyright 2013 the V8 project authors. All rights reserved. 21510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 31510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// 41510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// Redistribution and use in source and binary forms, with or without 51510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// modification, are permitted provided that the following conditions 61510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// are met: 71510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// 1. Redistributions of source code must retain the above copyright 81510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// notice, this list of conditions and the following disclaimer. 91510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// 2. Redistributions in binary form must reproduce the above copyright 101510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// notice, this list of conditions and the following disclaimer in the 111510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// documentation and/or other materials provided with the distribution. 121510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// 131510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 141510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 151510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 161510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 171510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 181510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 191510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 201510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 211510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 221510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 231510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org 241510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.orgdescription( 251510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org"Tests that the specific value optimization does not break when the relevant structure is a dictionary." 261510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org) 271510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org 281510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.orgfunction foo() { 291510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org return x; 301510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org} 311510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org 321510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.orgx = function() { }; 331510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org 341510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.orgvar expected = "\"function () { }\""; 351510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org 361510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.orgfor (var i = 0; i < 1000; ++i) { 371510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org eval("i" + i + " = " + i); 381510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org if (i == 200) { 391510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org x = 42; 401510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org expected = "\"42\""; 411510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org } 421510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org shouldBe("\"\" + foo()", expected); 431510d58cbcf57c82a10e7d390bfe21a7ae68ba43mstarzinger@chromium.org} 44