test/script/basic/JDK-8047365.js

Tue, 21 Mar 2017 13:41:57 -0700

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 1357
201b37681668
permissions
-rw-r--r--

Merge

hannesw@1357 1 /*
hannesw@1357 2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
hannesw@1357 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@1357 4 *
hannesw@1357 5 * This code is free software; you can redistribute it and/or modify it
hannesw@1357 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@1357 7 * published by the Free Software Foundation.
hannesw@1357 8 *
hannesw@1357 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@1357 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@1357 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@1357 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@1357 13 * accompanied this code).
hannesw@1357 14 *
hannesw@1357 15 * You should have received a copy of the GNU General Public License version
hannesw@1357 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@1357 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@1357 18 *
hannesw@1357 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@1357 20 * or visit www.oracle.com if you need additional information or have any
hannesw@1357 21 * questions.
hannesw@1357 22 */
hannesw@1357 23
hannesw@1357 24 /**
hannesw@1357 25 * JDK-8047365: Very long function names break codegen
hannesw@1357 26 *
hannesw@1357 27 * @test
hannesw@1357 28 * @run
hannesw@1357 29 */
hannesw@1357 30
hannesw@1357 31 // string of length 131071, twice the limit of UTF8 strings in ASM
hannesw@1357 32 var longId = Array(0x20000).join("a");
hannesw@1357 33 print(longId.length);
hannesw@1357 34
hannesw@1357 35 eval("function " + longId + "(){ print('hello world'); }");
hannesw@1357 36 eval("print(typeof " + longId + ")");
hannesw@1357 37 eval("print(" + longId + ".name === longId)");
hannesw@1357 38 eval("print(/a+/.exec(" + longId + ".toString())[0] === longId)");
hannesw@1357 39 eval(longId + "()");

mercurial