nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java
changeset 32434 769b3d81ae69
parent 27527 c2e4499ac40a
child 32524 bd52a0be10a5
equal deleted inserted replaced
32341:3c9f5bd909ae 32434:769b3d81ae69
   281         final TypeMap ptm = compiler.getTypeMap();
   281         final TypeMap ptm = compiler.getTypeMap();
   282         if (ptm.needsCallee()) {
   282         if (ptm.needsCallee()) {
   283             start++;
   283             start++;
   284         }
   284         }
   285 
   285 
   286         start++; //we always uses this
   286         start++; // we always use this
   287 
   287 
   288         final List<IdentNode> params    = functionNode.getParameters();
   288         assert functionNode.getNumOfParams() == 0 : "apply2call on function with named paramaters!";
   289         final List<IdentNode> newParams = new ArrayList<>();
   289         final List<IdentNode> newParams = new ArrayList<>();
   290         final long to = Math.max(params.size(), actualCallSiteType.parameterCount() - start);
   290         final long to = actualCallSiteType.parameterCount() - start;
   291         for (int i = 0; i < to; i++) {
   291         for (int i = 0; i < to; i++) {
   292             if (i >= params.size()) {
   292             newParams.add(new IdentNode(functionNode.getToken(), functionNode.getFinish(), EXPLODED_ARGUMENT_PREFIX.symbolName() + (i)));
   293                 newParams.add(new IdentNode(functionNode.getToken(), functionNode.getFinish(), EXPLODED_ARGUMENT_PREFIX.symbolName() + (i)));
       
   294             } else {
       
   295                 newParams.add(params.get(i));
       
   296             }
       
   297         }
   293         }
   298 
   294 
   299         callSiteTypes.push(actualCallSiteType);
   295         callSiteTypes.push(actualCallSiteType);
   300         explodedArguments.push(newParams);
   296         explodedArguments.push(newParams);
   301     }
   297     }
   311             assert !Global.isBuiltinFunctionPrototypeCall() : "call and apply should have the same SwitchPoint";
   307             assert !Global.isBuiltinFunctionPrototypeCall() : "call and apply should have the same SwitchPoint";
   312             return false;
   308             return false;
   313         }
   309         }
   314 
   310 
   315         if (!compiler.isOnDemandCompilation()) {
   311         if (!compiler.isOnDemandCompilation()) {
       
   312             return false;
       
   313         }
       
   314 
       
   315         if (functionNode.getNumOfParams() != 0) {
   316             return false;
   316             return false;
   317         }
   317         }
   318 
   318 
   319         if (functionNode.hasEval()) {
   319         if (functionNode.hasEval()) {
   320             return false;
   320             return false;