JD.java revision 1245:c55ce3738888
11541Srgrimes/*
21541Srgrimes * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
31541Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41541Srgrimes *
51541Srgrimes * This code is free software; you can redistribute it and/or modify it
61541Srgrimes * under the terms of the GNU General Public License version 2 only, as
71541Srgrimes * published by the Free Software Foundation.  Oracle designates this
81541Srgrimes * particular file as subject to the "Classpath" exception as provided
91541Srgrimes * by Oracle in the LICENSE file that accompanied this code.
101541Srgrimes *
111541Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT
121541Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
131541Srgrimes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
141541Srgrimes * version 2 for more details (a copy is included in the LICENSE file that
151541Srgrimes * accompanied this code).
161541Srgrimes *
171541Srgrimes * You should have received a copy of the GNU General Public License version
181541Srgrimes * 2 along with this work; if not, write to the Free Software Foundation,
191541Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
201541Srgrimes *
211541Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
221541Srgrimes * or visit www.oracle.com if you need additional information or have any
231541Srgrimes * questions.
241541Srgrimes */
251541Srgrimes
261541Srgrimespackage jdk.nashorn.internal.scripts;
271541Srgrimes
281541Srgrimesimport jdk.nashorn.internal.runtime.PropertyMap;
291541Srgrimesimport jdk.nashorn.internal.runtime.ScriptObject;
301541Srgrimes
311541Srgrimes/**
321541Srgrimes * Empty object class for dual primitive-object fields.
331541Srgrimes */
3450477Speterpublic class JD extends ScriptObject {
351541Srgrimes
361541Srgrimes    private static final PropertyMap map$ = PropertyMap.newMap(JD.class);
372169Spaul
382169Spaul    /**
392169Spaul     * Returns the initial property map to be used.
401541Srgrimes     * @return the initial property map.
411541Srgrimes     */
421541Srgrimes    public static PropertyMap getInitialMap() {
431541Srgrimes        return map$;
441541Srgrimes    }
451541Srgrimes
461541Srgrimes    /**
471541Srgrimes     * Constructor given an initial property map
481541Srgrimes     *
491541Srgrimes     * @param map the property map
501541Srgrimes     */
511541Srgrimes    public JD(final PropertyMap map) {
521541Srgrimes        super(map);
531541Srgrimes    }
541541Srgrimes
551541Srgrimes    /**
561541Srgrimes     * Constructor given an initial prototype and the default initial property map.
5728270Swollman     *
5828270Swollman     * @param proto the prototype object
5928270Swollman     */
6028270Swollman    public JD(final ScriptObject proto) {
6128270Swollman        super(proto, getInitialMap());
6228270Swollman    }
6328270Swollman
6428270Swollman    /**
6528270Swollman     * Constructor that takes a pre-initialized spill pool. Used by
6628270Swollman     * {@link jdk.nashorn.internal.codegen.SpillObjectCreator} and
671541Srgrimes     * {@link jdk.nashorn.internal.parser.JSONParser} for initializing object literals
681541Srgrimes     *
691541Srgrimes     * @param map            property map
701541Srgrimes     * @param primitiveSpill primitive spill pool
711541Srgrimes     * @param objectSpill    reference spill pool
7252904Sshin     */
731541Srgrimes    public JD(final PropertyMap map, final long[] primitiveSpill, final Object[] objectSpill) {
741541Srgrimes        super(map, primitiveSpill, objectSpill);
751541Srgrimes    }
761541Srgrimes
771541Srgrimes    /**
7816143Swollman     * A method handle of this method is passed to the ScriptFunction constructor.
791541Srgrimes     *
801541Srgrimes     * @param map  the property map to use for allocatorMap
8128270Swollman     *
8252904Sshin     * @return newly allocated ScriptObject
8352904Sshin     */
841541Srgrimes    public static ScriptObject allocate(final PropertyMap map) {
851541Srgrimes        return new JD(map);
861541Srgrimes    }
871541Srgrimes}
881541Srgrimes
891541Srgrimes