src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
Print this page
*** 28,37 ****
--- 28,39 ----
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
import static jdk.nashorn.internal.runtime.linker.Lookup.MH;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
+
+ import jdk.nashorn.internal.codegen.ScriptFunctionData;
import jdk.nashorn.internal.codegen.objects.FunctionObjectCreator;
import jdk.nashorn.internal.runtime.GlobalFunctions;
import jdk.nashorn.internal.runtime.Property;
import jdk.nashorn.internal.runtime.PropertyMap;
import jdk.nashorn.internal.runtime.ScriptFunction;
*** 92,102 ****
* @param methodHandle handle for invocation
* @param map initial property map
* @param specs specialized versions of this method, if available, null otherwise
*/
ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final PropertyMap map, final MethodHandle[] specs) {
! super(name, methodHandle, (nasgenmap$ == map) ? nasgenmap$ : map.addAll(nasgenmap$), null, null, 0, false, specs);
this.setIsBuiltin();
init();
}
/**
--- 94,104 ----
* @param methodHandle handle for invocation
* @param map initial property map
* @param specs specialized versions of this method, if available, null otherwise
*/
ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final PropertyMap map, final MethodHandle[] specs) {
! super(name, methodHandle, (nasgenmap$ == map) ? nasgenmap$ : map.addAll(nasgenmap$), null, false, specs);
this.setIsBuiltin();
init();
}
/**
*** 122,155 ****
* Constructor
*
* Called by (compiler) generated code for {@link ScriptObject}s. Code is
* generated by {@link FunctionObjectCreator}
*
! * TODO this is a horrible constructor - can we do it with fewer args?
! *
! * @param name name of function
* @param methodHandle handle for invocation
* @param scope scope object
- * @param source source
- * @param token token
* @param allocator instance constructor for function
- * @param allocatorMap initial map that constructor will keep reference to for future instantiations
- * @param needCallee does the function use the {@code callee} variable
- * @param strict are we in strict mode
*/
! public ScriptFunctionImpl(
! final String name,
! final MethodHandle methodHandle,
! final ScriptObject scope,
! final Source source,
! final long token,
! final MethodHandle allocator,
! final PropertyMap allocatorMap,
! final boolean needCallee,
! final boolean strict) {
! super(name, methodHandle, getMap(strict), scope, source, token, allocator, allocatorMap, needCallee, null);
! if (strict) {
this.setIsStrict();
}
init();
}
--- 124,142 ----
* Constructor
*
* Called by (compiler) generated code for {@link ScriptObject}s. Code is
* generated by {@link FunctionObjectCreator}
*
! * @param data static function data
* @param methodHandle handle for invocation
* @param scope scope object
* @param allocator instance constructor for function
*/
! public ScriptFunctionImpl(final ScriptFunctionData data, final MethodHandle methodHandle,
! final ScriptObject scope, final MethodHandle allocator) {
! super(data, methodHandle, getMap(data.isStrict()), scope, allocator);
! if (data.isStrict()) {
this.setIsStrict();
}
init();
}
*** 167,177 ****
static synchronized ScriptFunction getTypeErrorThrower() {
if (typeErrorThrower == null) {
//name handle
final ScriptFunctionImpl func = new ScriptFunctionImpl("TypeErrorThrower", Lookup.TYPE_ERROR_THROWER_SETTER, null, false, null);
// clear constructor handle...
! func.constructHandle = null;
func.prototype = UNDEFINED;
typeErrorThrower = func;
}
return typeErrorThrower;
--- 154,164 ----
static synchronized ScriptFunction getTypeErrorThrower() {
if (typeErrorThrower == null) {
//name handle
final ScriptFunctionImpl func = new ScriptFunctionImpl("TypeErrorThrower", Lookup.TYPE_ERROR_THROWER_SETTER, null, false, null);
// clear constructor handle...
! func.constructor = null;
func.prototype = UNDEFINED;
typeErrorThrower = func;
}
return typeErrorThrower;