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