lagergren@1028: /* lagergren@1028: * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. lagergren@1028: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. lagergren@1028: * lagergren@1028: * This code is free software; you can redistribute it and/or modify it lagergren@1028: * under the terms of the GNU General Public License version 2 only, as lagergren@1028: * published by the Free Software Foundation. lagergren@1028: * lagergren@1028: * This code is distributed in the hope that it will be useful, but WITHOUT lagergren@1028: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or lagergren@1028: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License lagergren@1028: * version 2 for more details (a copy is included in the LICENSE file that lagergren@1028: * accompanied this code). lagergren@1028: * lagergren@1028: * You should have received a copy of the GNU General Public License version lagergren@1028: * 2 along with this work; if not, write to the Free Software Foundation, lagergren@1028: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. lagergren@1028: * lagergren@1028: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA lagergren@1028: * or visit www.oracle.com if you need additional information or have any lagergren@1028: * questions. lagergren@1028: */ lagergren@1028: lagergren@1028: /** lagergren@1028: * fastpushpop.js: make sure guards work for fast push implementation lagergren@1028: * and normal one lagergren@1028: * lagergren@1028: * @test lagergren@1028: * @run lagergren@1028: */ lagergren@1028: lagergren@1028: var a = [1,2,3]; lagergren@1028: a.push(4); lagergren@1028: a.push(5); lagergren@1028: a.push(6); lagergren@1028: print(a); lagergren@1028: lagergren@1028: var a2 = Object.defineProperty(a,"length", { writable: false }); lagergren@1028: try { lagergren@1028: a2.push(7); lagergren@1028: } catch (e) { lagergren@1028: print("first: " + (e instanceof TypeError)); lagergren@1028: } lagergren@1028: lagergren@1028: print(a2); lagergren@1028: lagergren@1028: var b = [1,2,3,,,,4711.17,"dingo!"]; lagergren@1028: b.push(4); lagergren@1028: b.push(5); lagergren@1028: b.push(6); lagergren@1028: print(b); lagergren@1028: lagergren@1028: var b2 = Object.defineProperty(b,"length", { writable: false }); lagergren@1028: try { lagergren@1028: b2.push(7); lagergren@1028: } catch (e) { lagergren@1028: print("second: " + (e instanceof TypeError)); lagergren@1028: } lagergren@1028: lagergren@1028: print(b2); lagergren@1028: