1// Copyright 2014 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5// Flags: --allow-natives-syntax 6 7var dummy = new Int32Array(100); 8array = new Int32Array(100); 9var dummy2 = new Int32Array(100); 10 11array[-17] = 0; 12function fun(base,cond) { 13 array[base - 1] = 1; 14 array[base - 2] = 2; 15 if (cond) { 16 array[base - 4] = 3; 17 array[base - 5] = 4; 18 } else { 19 array[base - 6] = 5; 20 array[base - 100] = 777; 21 } 22} 23fun(5,true); 24fun(7,false); 25%OptimizeFunctionOnNextCall(fun); 26fun(7,false); 27 28for (var i = 0; i < dummy.length; i++) { 29 assertEquals(0, dummy[i]); 30} 31for (var i = 0; i < dummy2.length; i++) { 32 assertEquals(0, dummy2[i]); 33} 34