1.1 --- a/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Wed Nov 12 14:12:01 2014 +0100 1.2 +++ b/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Wed Nov 12 17:19:04 2014 +0100 1.3 @@ -26,7 +26,6 @@ 1.4 package jdk.nashorn.internal.runtime; 1.5 1.6 import static jdk.nashorn.internal.lookup.Lookup.MH; 1.7 - 1.8 import java.io.IOException; 1.9 import java.lang.invoke.MethodHandle; 1.10 import java.lang.invoke.MethodHandles; 1.11 @@ -620,20 +619,25 @@ 1.12 return f; 1.13 } 1.14 1.15 - MethodHandle lookup(final FunctionInitializer fnInit) { 1.16 + private void logLookup(final boolean shouldLog, final MethodType targetType) { 1.17 + if (shouldLog && log.isEnabled()) { 1.18 + log.info("Looking up ", DebugLogger.quote(functionName), " type=", targetType); 1.19 + } 1.20 + } 1.21 + 1.22 + private MethodHandle lookup(final FunctionInitializer fnInit, final boolean shouldLog) { 1.23 final MethodType type = fnInit.getMethodType(); 1.24 + logLookup(shouldLog, type); 1.25 return lookupCodeMethod(fnInit.getCode(), type); 1.26 } 1.27 1.28 MethodHandle lookup(final FunctionNode fn) { 1.29 final MethodType type = new FunctionSignature(fn).getMethodType(); 1.30 + logLookup(true, type); 1.31 return lookupCodeMethod(fn.getCompileUnit().getCode(), type); 1.32 } 1.33 1.34 MethodHandle lookupCodeMethod(final Class<?> codeClass, final MethodType targetType) { 1.35 - if (log.isEnabled()) { 1.36 - log.info("Looking up ", DebugLogger.quote(functionName), " type=", targetType); 1.37 - } 1.38 return MH.findStatic(LOOKUP, codeClass, functionName, targetType); 1.39 } 1.40 1.41 @@ -649,7 +653,7 @@ 1.42 if(!code.isEmpty()) { 1.43 throw new IllegalStateException(name); 1.44 } 1.45 - addCode(lookup(initializer), null, null, initializer.getFlags()); 1.46 + addCode(lookup(initializer, true), null, null, initializer.getFlags()); 1.47 } 1.48 1.49 private CompiledFunction addCode(final MethodHandle target, final Map<Integer, Type> invalidatedProgramPoints, 1.50 @@ -671,10 +675,10 @@ 1.51 */ 1.52 private CompiledFunction addCode(final FunctionInitializer fnInit, final MethodType callSiteType) { 1.53 if (isVariableArity()) { 1.54 - return addCode(lookup(fnInit), fnInit.getInvalidatedProgramPoints(), callSiteType, fnInit.getFlags()); 1.55 + return addCode(lookup(fnInit, true), fnInit.getInvalidatedProgramPoints(), callSiteType, fnInit.getFlags()); 1.56 } 1.57 1.58 - final MethodHandle handle = lookup(fnInit); 1.59 + final MethodHandle handle = lookup(fnInit, true); 1.60 final MethodType fromType = handle.type(); 1.61 MethodType toType = needsCallee(fromType) ? callSiteType.changeParameterType(0, ScriptFunction.class) : callSiteType.dropParameterTypes(0, 1); 1.62 toType = toType.changeReturnType(fromType.returnType()); 1.63 @@ -699,7 +703,7 @@ 1.64 toType = toType.dropParameterTypes(fromCount, toCount); 1.65 } 1.66 1.67 - return addCode(lookup(fnInit).asType(toType), fnInit.getInvalidatedProgramPoints(), callSiteType, fnInit.getFlags()); 1.68 + return addCode(lookup(fnInit, false).asType(toType), fnInit.getInvalidatedProgramPoints(), callSiteType, fnInit.getFlags()); 1.69 } 1.70 1.71 /**