15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright 2013 the V8 project authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Redistribution and use in source and binary forms, with or without 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// modification, are permitted provided that the following conditions 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// are met: 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 1. Redistributions of source code must retain the above copyright 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// notice, this list of conditions and the following disclaimer. 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 2. Redistributions in binary form must reproduce the above copyright 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// notice, this list of conditions and the following disclaimer in the 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// documentation and/or other materials provided with the distribution. 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)description( 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)"Tests that DFG silent spill and fill of WeakJSConstants does not result in nonsense." 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)); 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)function foo(a, b, c, d) 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){ 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) a.f = 42; // WeakJSConstants corresponding to the o.f transition get created here. 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) var x = !d; // Silent spilling and filling happens here. 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) b.f = x; // The WeakJSConstants get reused here. 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) var y = !d; // Silent spilling and filling happens here. 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) c.f = y; // The WeakJSConstants get reused here. 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)var Empty = ""; 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)for (var i = 0; i < 1000; ++i) { 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) var o1 = new Object(); 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) var o2 = new Object(); 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) var o3 = new Object(); 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) eval(Empty + "foo(o1, o2, o3, \"stuff\")"); 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) shouldBe("o1.f", "42"); 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) shouldBe("o2.f", "false"); 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) shouldBe("o3.f", "false"); 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)