1 // Copyright 2010 the V8 project authors. All rights reserved. 2 // Redistribution and use in source and binary forms, with or without 3 // modification, are permitted provided that the following conditions are 4 // met: 5 // 6 // * Redistributions of source code must retain the above copyright 7 // notice, this list of conditions and the following disclaimer. 8 // * Redistributions in binary form must reproduce the above 9 // copyright notice, this list of conditions and the following 10 // disclaimer in the documentation and/or other materials provided 11 // with the distribution. 12 // * Neither the name of Google Inc. nor the names of its 13 // contributors may be used to endorse or promote products derived 14 // from this software without specific prior written permission. 15 // 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 28 // Test for a broken fast-smi-loop that does not save the incremented value 29 // of the loop index. If this test fails, it loops forever, and times out. 30 31 // Flags: --nofull-compiler 32 33 // Calling foo() spills the virtual frame. 34 function foo() { 35 return; 36 } 37 38 function bar() { 39 var x1 = 3; 40 var x2 = 3; 41 var x3 = 3; 42 var x4 = 3; 43 var x5 = 3; 44 var x6 = 3; 45 var x7 = 3; 46 var x8 = 3; 47 var x9 = 3; 48 var x10 = 3; 49 var x11 = 3; 50 var x12 = 3; 51 var x13 = 3; 52 53 foo(); 54 55 x1 = 257; 56 x2 = 258; 57 x3 = 259; 58 x4 = 260; 59 x5 = 261; 60 x6 = 262; 61 x7 = 263; 62 x8 = 264; 63 x9 = 265; 64 x10 = 266; 65 x11 = 267; 66 x12 = 268; 67 x13 = 269; 68 69 // The loop variable x7 is initialized to 3, 70 // and then MakeMergeable is called on the virtual frame. 71 // MakeMergeable has forced the loop variable x7 to be spilled, 72 // so it is marked as synced 73 // The back edge then merges its virtual frame, which incorrectly 74 // claims that x7 is synced, and does not save the modified 75 // value. 76 for (x7 = 3; x7 < 10; ++x7) { 77 foo(); 78 } 79 } 80 81 bar(); 82 83 function aliasing() { 84 var x = 3; 85 var j; 86 for (j = 7; j < 11; ++j) { 87 x = j; 88 } 89 90 assertEquals(10, x); 91 assertEquals(11, j); 92 } 93 94 aliasing(); 95