test/script/basic/JDK-8066669.js

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

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 1126
0a5ec176e9d8
permissions
-rw-r--r--

Merge

hannesw@1126 1 /*
hannesw@1126 2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
hannesw@1126 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@1126 4 *
hannesw@1126 5 * This code is free software; you can redistribute it and/or modify it
hannesw@1126 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@1126 7 * published by the Free Software Foundation.
hannesw@1126 8 *
hannesw@1126 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@1126 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@1126 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@1126 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@1126 13 * accompanied this code).
hannesw@1126 14 *
hannesw@1126 15 * You should have received a copy of the GNU General Public License version
hannesw@1126 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@1126 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@1126 18 *
hannesw@1126 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@1126 20 * or visit www.oracle.com if you need additional information or have any
hannesw@1126 21 * questions.
hannesw@1126 22 */
hannesw@1126 23
hannesw@1126 24 /**
hannesw@1126 25 * JDK-8066669: dust.js performance regression caused by primitive field conversion
hannesw@1126 26 *
hannesw@1126 27 * @test
hannesw@1126 28 * @run
hannesw@1126 29 */
hannesw@1126 30
hannesw@1126 31 // Make sure index access on Java objects is working as expected.
hannesw@1126 32 var map = new java.util.HashMap();
hannesw@1126 33
hannesw@1126 34 map["foo"] = "bar";
hannesw@1126 35 map[1] = 2;
hannesw@1126 36 map[false] = true;
hannesw@1126 37 map[null] = 0;
hannesw@1126 38
hannesw@1126 39 print(map);
hannesw@1126 40
hannesw@1126 41 var keys = map.keySet().iterator();
hannesw@1126 42
hannesw@1126 43 while(keys.hasNext()) {
hannesw@1126 44 var key = keys.next();
hannesw@1126 45 print(typeof key, key);
hannesw@1126 46 }
hannesw@1126 47
hannesw@1126 48 print(typeof map["foo"], map["foo"]);
hannesw@1126 49 print(typeof map[1], map[1]);
hannesw@1126 50 print(typeof map[false], map[false]);
hannesw@1126 51 print(typeof map[null], map[null]);
hannesw@1126 52
hannesw@1126 53 print(map.foo);
hannesw@1126 54 print(map.false);
hannesw@1126 55 print(map.null);
hannesw@1126 56
hannesw@1126 57 map.foo = "baz";
hannesw@1126 58 print(map);

mercurial