test/script/basic/JDK-8062381.js

Mon, 03 Nov 2014 12:34:39 +0100

author
lagergren
date
Mon, 03 Nov 2014 12:34:39 +0100
changeset 1083
dba2a3939f4c
permissions
-rw-r--r--

8062381: Wrong index was used for linking charCodeAt specializations
Reviewed-by: attila, hannesw

lagergren@1083 1 /*
lagergren@1083 2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
lagergren@1083 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
lagergren@1083 4 *
lagergren@1083 5 * This code is free software; you can redistribute it and/or modify it
lagergren@1083 6 * under the terms of the GNU General Public License version 2 only, as
lagergren@1083 7 * published by the Free Software Foundation.
lagergren@1083 8 *
lagergren@1083 9 * This code is distributed in the hope that it will be useful, but WITHOUT
lagergren@1083 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
lagergren@1083 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
lagergren@1083 12 * version 2 for more details (a copy is included in the LICENSE file that
lagergren@1083 13 * accompanied this code).
lagergren@1083 14 *
lagergren@1083 15 * You should have received a copy of the GNU General Public License version
lagergren@1083 16 * 2 along with this work; if not, write to the Free Software Foundation,
lagergren@1083 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
lagergren@1083 18 *
lagergren@1083 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
lagergren@1083 20 * or visit www.oracle.com if you need additional information or have any
lagergren@1083 21 * questions.
lagergren@1083 22 */
lagergren@1083 23
lagergren@1083 24 /**
lagergren@1083 25 * JDK-8062381 wrong argument chosen for charCodeAt in linker logic
lagergren@1083 26 *
lagergren@1083 27 * @test
lagergren@1083 28 * @run
lagergren@1083 29 */
lagergren@1083 30
lagergren@1083 31 var s = "abcdef";
lagergren@1083 32 var len = s.length + 1;
lagergren@1083 33
lagergren@1083 34 function f1() {
lagergren@1083 35 for (var i = 0; i < len; i++) {
lagergren@1083 36 print(s.charCodeAt(i));
lagergren@1083 37 }
lagergren@1083 38 print(s.charCodeAt());
lagergren@1083 39 }
lagergren@1083 40
lagergren@1083 41 function f2() {
lagergren@1083 42 for (var i = 0; i < len; i++) {
lagergren@1083 43 print(s.charCodeAt("" + i));
lagergren@1083 44 }
lagergren@1083 45 print(s.charCodeAt());
lagergren@1083 46 }
lagergren@1083 47
lagergren@1083 48 f1();
lagergren@1083 49 f2();
lagergren@1083 50 f1();
lagergren@1083 51 f2();
lagergren@1083 52
lagergren@1083 53

mercurial