Merge

Fri, 05 Feb 2016 13:54:03 +0000

author
robm
date
Fri, 05 Feb 2016 13:54:03 +0000
changeset 1728
1e1f65348706
parent 1725
22e94f2a0e4f
parent 1727
18477de7c28f
child 1738
8ca52d10fc0d
child 1739
29603fdf59a8

Merge

     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/lines.js	Fri Feb 05 13:54:03 2016 +0000
     1.3 @@ -0,0 +1,41 @@
     1.4 +/*
     1.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     1.6 + *
     1.7 + * Redistribution and use in source and binary forms, with or without
     1.8 + * modification, are permitted provided that the following conditions
     1.9 + * are met:
    1.10 + *
    1.11 + *   - Redistributions of source code must retain the above copyright
    1.12 + *     notice, this list of conditions and the following disclaimer.
    1.13 + *
    1.14 + *   - Redistributions in binary form must reproduce the above copyright
    1.15 + *     notice, this list of conditions and the following disclaimer in the
    1.16 + *     documentation and/or other materials provided with the distribution.
    1.17 + *
    1.18 + *   - Neither the name of Oracle nor the names of its
    1.19 + *     contributors may be used to endorse or promote products derived
    1.20 + *     from this software without specific prior written permission.
    1.21 + *
    1.22 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    1.23 + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    1.24 + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    1.25 + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    1.26 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    1.27 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    1.28 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    1.29 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    1.30 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    1.31 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    1.32 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.33 + */
    1.34 +
    1.35 +var Files = java.nio.file.Files;
    1.36 +var File = java.io.File;
    1.37 +var d = arguments.length == 0? "." : arguments[0];
    1.38 +
    1.39 +// print total number of lines in all .java files under a
    1.40 +// given directory (recursively)
    1.41 +
    1.42 +print(Files.walk(new File(d).toPath()).
    1.43 +  filter(function(p) p.toString().endsWith(".java")).
    1.44 +  mapToInt(function(p) Files.lines(p).count()).sum())
     2.1 --- a/src/jdk/nashorn/internal/runtime/PropertyListeners.java	Mon Jan 25 15:49:28 2016 -0800
     2.2 +++ b/src/jdk/nashorn/internal/runtime/PropertyListeners.java	Fri Feb 05 13:54:03 2016 +0000
     2.3 @@ -54,7 +54,13 @@
     2.4       */
     2.5      PropertyListeners(final PropertyListeners listener) {
     2.6          if (listener != null && listener.listeners != null) {
     2.7 -            this.listeners = new WeakHashMap<>(listener.listeners);
     2.8 +            this.listeners = new WeakHashMap<>();
     2.9 +            // We need to copy the nested weak sets in order to avoid concurrent modification issues, see JDK-8146274
    2.10 +            synchronized (listener) {
    2.11 +                for (final Map.Entry<String, WeakPropertyMapSet> entry : listener.listeners.entrySet()) {
    2.12 +                    this.listeners.put(entry.getKey(), new WeakPropertyMapSet(entry.getValue()));
    2.13 +                }
    2.14 +            }
    2.15          }
    2.16      }
    2.17  
    2.18 @@ -228,7 +234,15 @@
    2.19  
    2.20      private static class WeakPropertyMapSet {
    2.21  
    2.22 -        private final WeakHashMap<PropertyMap, Boolean> map = new WeakHashMap<>();
    2.23 +        private final WeakHashMap<PropertyMap, Boolean> map;
    2.24 +
    2.25 +        WeakPropertyMapSet() {
    2.26 +            this.map = new WeakHashMap<>();
    2.27 +        }
    2.28 +
    2.29 +        WeakPropertyMapSet(final WeakPropertyMapSet set) {
    2.30 +            this.map = new WeakHashMap<>(set.map);
    2.31 +        }
    2.32  
    2.33          void add(final PropertyMap propertyMap) {
    2.34              map.put(propertyMap, Boolean.TRUE);
     3.1 --- a/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java	Mon Jan 25 15:49:28 2016 -0800
     3.2 +++ b/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java	Fri Feb 05 13:54:03 2016 +0000
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -238,8 +238,18 @@
    3.11          public void setTarget(final MethodHandle newTarget) {
    3.12              final MethodType type   = type();
    3.13              final boolean    isVoid = type.returnType() == void.class;
    3.14 +            final Class<?> newSelfType = newTarget.type().parameterType(0);
    3.15  
    3.16 -            MethodHandle methodHandle = MH.filterArguments(newTarget, 0, MH.bindTo(PROFILEENTRY, this));
    3.17 +            MethodHandle selfFilter = MH.bindTo(PROFILEENTRY, this);
    3.18 +            if (newSelfType != Object.class) {
    3.19 +                // new target uses a more precise 'self' type than Object.class. We need to
    3.20 +                // convert the filter type. Note that the profileEntry method returns "self"
    3.21 +                // argument "as is" and so the cast introduced will succeed for any type.
    3.22 +                MethodType selfFilterType = MethodType.methodType(newSelfType, newSelfType);
    3.23 +                selfFilter = selfFilter.asType(selfFilterType);
    3.24 +            }
    3.25 +
    3.26 +            MethodHandle methodHandle = MH.filterArguments(newTarget, 0, selfFilter);
    3.27  
    3.28              if (isVoid) {
    3.29                  methodHandle = MH.filterReturnValue(methodHandle, MH.bindTo(PROFILEVOIDEXIT, this));
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/test/script/nosecurity/JDK-8148926.js	Fri Feb 05 13:54:03 2016 +0000
     4.3 @@ -0,0 +1,34 @@
     4.4 +/*
     4.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 + *
     4.8 + * This code is free software; you can redistribute it and/or modify it
     4.9 + * under the terms of the GNU General Public License version 2 only, as
    4.10 + * published by the Free Software Foundation.
    4.11 + *
    4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.15 + * version 2 for more details (a copy is included in the LICENSE file that
    4.16 + * accompanied this code).
    4.17 + *
    4.18 + * You should have received a copy of the GNU General Public License version
    4.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.21 + *
    4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.23 + * or visit www.oracle.com if you need additional information or have any
    4.24 + * questions.
    4.25 + */
    4.26 +
    4.27 +/**
    4.28 + * JDK-8148926: Call site profiling fails on braces-wrapped anonymous function
    4.29 + *
    4.30 + * @test
    4.31 + * @option -pcs
    4.32 + * @run
    4.33 + */
    4.34 +
    4.35 +(function() {})() 
    4.36 +
    4.37 +var i = (function() { return 2 })()

mercurial