test/nashorn/script/basic/JDK-8069338.js
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 48247 fa5a47cad0c9
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48247
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
     1
/*
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
     4
 * 
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
     7
 * published by the Free Software Foundation.
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
     8
 * 
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    13
 * accompanied this code).
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    14
 * 
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    18
 * 
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    21
 * questions.
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    22
 */
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    23
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    24
/**
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    25
 * JDK-8069338: Implement sharedScopeCall for optimistic types
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    26
 *
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    27
 * @test
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    28
 * @run
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    29
 */
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    30
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    31
var c = 0;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    32
var n = 1;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    33
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    34
function f() {
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    35
    return c++ > 10 ? 'f' : 1;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    36
}
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    37
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    38
function h() {
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    39
    var x = 0;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    40
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    41
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    42
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    43
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    44
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    45
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    46
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    47
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    48
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    49
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    50
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    51
    n = 'b';
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    52
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    53
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    54
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    55
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    56
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    57
    x += n;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    58
    return x;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    59
}
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    60
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    61
function g() {
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    62
    var x = 0;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    63
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    64
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    65
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    66
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    67
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    68
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    69
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    70
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    71
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    72
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    73
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    74
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    75
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    76
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    77
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    78
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    79
    x += f();
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    80
    return x;
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    81
}
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    82
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    83
Assert.assertEquals(h(), '11bbbbbb');
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    84
Assert.assertEquals(g(), '11ffffff');
fa5a47cad0c9 8069338: Implement sharedScopeCall for optimistic types
hannesw
parents:
diff changeset
    85