Path: blob/aarch64-shenandoah-jdk8u272-b10/nashorn/test/script/basic/JDK-8007060.js
32281 views
/*1* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* JDK-8007060 : Primitive wrap filter throws ClassCastException in test262parallel25*26* @test27* @run28*/2930Object.prototype.T = function() {31print(this, typeof this);32};3334function F() {35print(this, typeof this);36}373839function test(obj) {40obj.T();41}4243// Ordinary callsite - call often so we go to megamorphic44test(1);45test({});46test("hello");47test(1);48test({});49test("hello");50test(1);51test({});52test("hello");53test(1);54test({});55test("hello");56test(1);57test({});58test("hello");59test(1);60test({});61test("hello");62test(1);63test({});64test("hello");65test(1);66test({});67test("hello");6869// Dynamic invoker callsite used by NativeArray70[1, 2, 3].filter(F, 1);71[1, 2, 3].filter(F, {});72[1, 2, 3].filter(F, "hello");73[1, 2, 3].filter(F, 1);74[1, 2, 3].filter(F, {});75[1, 2, 3].filter(F, "hello");76[1, 2, 3].filter(F, 1);77[1, 2, 3].filter(F, {});78[1, 2, 3].filter(F, "hello");79[1, 2, 3].filter(F, 1);80[1, 2, 3].filter(F, {});81[1, 2, 3].filter(F, "hello");82[1, 2, 3].filter(F, 1);83[1, 2, 3].filter(F, {});84[1, 2, 3].filter(F, "hello");85[1, 2, 3].filter(F, 1);86[1, 2, 3].filter(F, {});87[1, 2, 3].filter(F, "hello");88[1, 2, 3].filter(F, 1);89[1, 2, 3].filter(F, {});90[1, 2, 3].filter(F, "hello");91[1, 2, 3].filter(F, 1);92[1, 2, 3].filter(F, {});93[1, 2, 3].filter(F, "hello");949596