1 /* 2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /** 25 * JDK-8193508: Expressions in split literals must never be optimistic 26 * 27 * @test 28 * @run 29 * @option -Dnashorn.compiler.splitter.threshold=100 30 * @fork 31 */ 32 33 function f() { 34 return 'a'; 35 } 36 37 var o = { 38 a: f(), 39 b: 1, 40 c: 2, 41 d: 3, 42 e: 4, 43 f: 5, 44 g: f(), 45 h: 1, 46 i: 2, 47 j: 3, 48 k: 4, 49 l: 5, 50 m: f(), 51 n: 1, 52 o: 2, 53 p: 3, 54 q: 4, 55 r: 5, 56 s: f(), 57 t: 1, 58 u: 2, 59 v: 3, 60 w: 4, 61 x: 5, 62 y: f(), 63 z: 1, 64 A: 2, 65 B: 3, 66 C: 4, 67 D: 5, 68 E: f(), 69 F: 1, 70 G: 2, 71 H: 3, 72 I: 4, 73 J: 5, 74 K: f(), 75 L: 1, 76 M: 2, 77 N: 3, 78 O: 4, 79 P: 5, 80 Q: f(), 81 R: 1, 82 S: 2, 83 T: 3, 84 U: 4, 85 V: 5, 86 W: f(), 87 X: 1, 88 Y: 2, 89 Z: 3 90 }; 91 92 Assert.assertTrue(o.a === 'a'); 93