test/script/basic/JDK-8060101.js

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

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 1051
5aac3287ea5d
permissions
-rw-r--r--

Merge

sundar@1051 1 /*
sundar@1051 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
sundar@1051 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
sundar@1051 4 *
sundar@1051 5 * This code is free software; you can redistribute it and/or modify it
sundar@1051 6 * under the terms of the GNU General Public License version 2 only, as
sundar@1051 7 * published by the Free Software Foundation.
sundar@1051 8 *
sundar@1051 9 * This code is distributed in the hope that it will be useful, but WITHOUT
sundar@1051 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
sundar@1051 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
sundar@1051 12 * version 2 for more details (a copy is included in the LICENSE file that
sundar@1051 13 * accompanied this code).
sundar@1051 14 *
sundar@1051 15 * You should have received a copy of the GNU General Public License version
sundar@1051 16 * 2 along with this work; if not, write to the Free Software Foundation,
sundar@1051 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
sundar@1051 18 *
sundar@1051 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
sundar@1051 20 * or visit www.oracle.com if you need additional information or have any
sundar@1051 21 * questions.
sundar@1051 22 */
sundar@1051 23
sundar@1051 24 /**
sundar@1051 25 * JDK-8060101: AssertionError: __noSuchProperty__ placeholder called from NativeJavaImporter
sundar@1051 26 *
sundar@1051 27 * @test
sundar@1051 28 * @run
sundar@1051 29 */
sundar@1051 30
sundar@1051 31 var constant = 0.50;
sundar@1051 32 var ind = 0.0;
sundar@1051 33
sundar@1051 34 // make sure callsites are exercised quite a few times
sundar@1051 35 // to induce megamorphic callsite for with/JavaImporter
sundar@1051 36 // combo - which triggered that AssertionError.
sundar@1051 37 for (var i = 0; i < 50; i++) {
sundar@1051 38 var math = new JavaImporter(java.lang.StrictMath);
sundar@1051 39 ind += 10.0;
sundar@1051 40 with (math) {
sundar@1051 41 StrictMath.exp(-constant*ind);
sundar@1051 42 }
sundar@1051 43 }
sundar@1051 44
sundar@1051 45 for (var i = 0; i < 50; i++) {
sundar@1051 46 var math = new JavaImporter(java.lang.StrictMath);
sundar@1051 47 try {
sundar@1051 48 math.Foo();
sundar@1051 49 } catch (e) {
sundar@1051 50 if (! (e instanceof TypeError)) {
sundar@1051 51 throw e;
sundar@1051 52 }
sundar@1051 53 }
sundar@1051 54 }

mercurial