27 |
27 |
28 import static jdk.nashorn.internal.lookup.Lookup.MH; |
28 import static jdk.nashorn.internal.lookup.Lookup.MH; |
29 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; |
29 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; |
30 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; |
30 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED; |
31 |
31 |
|
32 import java.io.Serializable; |
32 import java.lang.invoke.MethodHandle; |
33 import java.lang.invoke.MethodHandle; |
33 import java.lang.invoke.MethodHandles; |
34 import java.lang.invoke.MethodHandles; |
34 import java.lang.invoke.MethodType; |
35 import java.lang.invoke.MethodType; |
35 import jdk.nashorn.internal.objects.Global; |
|
36 import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory; |
36 import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory; |
37 |
37 |
38 /** |
38 /** |
39 * A container for data needed to instantiate a specific {@link ScriptFunction} at runtime. |
39 * A container for data needed to instantiate a specific {@link ScriptFunction} at runtime. |
40 * Instances of this class are created during codegen and stored in script classes' |
40 * Instances of this class are created during codegen and stored in script classes' |
41 * constants array to reduce function instantiation overhead during runtime. |
41 * constants array to reduce function instantiation overhead during runtime. |
42 */ |
42 */ |
43 public abstract class ScriptFunctionData { |
43 public abstract class ScriptFunctionData implements Serializable { |
44 |
44 |
45 /** Name of the function or "" for anonynous functions */ |
45 /** Name of the function or "" for anonynous functions */ |
46 protected final String name; |
46 protected final String name; |
47 |
47 |
48 /** All versions of this function that have been generated to code */ |
48 /** All versions of this function that have been generated to code */ |
71 public static final int IS_STRICT_OR_BUILTIN = IS_STRICT | IS_BUILTIN; |
71 public static final int IS_STRICT_OR_BUILTIN = IS_STRICT | IS_BUILTIN; |
72 /** Flag for built-in constructors */ |
72 /** Flag for built-in constructors */ |
73 public static final int IS_BUILTIN_CONSTRUCTOR = IS_BUILTIN | IS_CONSTRUCTOR; |
73 public static final int IS_BUILTIN_CONSTRUCTOR = IS_BUILTIN | IS_CONSTRUCTOR; |
74 /** Flag for strict constructors */ |
74 /** Flag for strict constructors */ |
75 public static final int IS_STRICT_CONSTRUCTOR = IS_STRICT | IS_CONSTRUCTOR; |
75 public static final int IS_STRICT_CONSTRUCTOR = IS_STRICT | IS_CONSTRUCTOR; |
|
76 |
|
77 private static final long serialVersionUID = 4252901245508769114L; |
76 |
78 |
77 /** |
79 /** |
78 * Constructor |
80 * Constructor |
79 * |
81 * |
80 * @param name script function name |
82 * @param name script function name |