public void compiledFunction( final String identifier, final String[] formalParams, final Statement block, final boolean strict) { int statementNumber = block.getStatementNumber(); Entry entry = blockManager.retrieve(statementNumber); // Stash statement if required if (entry.statement == null) { entry.statement = block; } // ---------------------------------------- // ---------------------------------------- aload(Arities.EXECUTION_CONTEXT); // context ldc(statementNumber); // context statement-number invokevirtual(p(ExecutionContext.class), "retrieveBlockEntry", sig(Entry.class, int.class)); // entry aload(Arities.EXECUTION_CONTEXT); // entry context invokevirtual(p(ExecutionContext.class), "getCompiler", sig(JSCompiler.class)); // entry compiler swap(); // compiler entry getfield(p(Entry.class), "statement", ci(Statement.class)); // compiler statement aload(Arities.EXECUTION_CONTEXT); // compiler statement context swap(); // compiler context statement if (identifier != null) { ldc(identifier); } else { aconst_null(); } // compiler context statement identifier swap(); // compiler context identifier statement checkcast(p(BlockStatement.class)); bipush(formalParams.length); // compiler context identifier statement params-en anewarray(p(String.class)); // compiler context identifier statement params for (int i = 0; i < formalParams.length; ++i) { dup(); bipush(i); ldc(formalParams[i]); aastore(); } // compiler context identifier statement params swap(); // compiler context identifier params statement if (strict) { iconst_1(); } else { iconst_0(); } // compiler context identifer params statement bool invokevirtual( p(JSCompiler.class), "compileFunction", sig( JSFunction.class, ExecutionContext.class, String.class, String[].class, Statement.class, boolean.class)); // fn }
public void compiledStatementBlock( final String grist, final Statement block, final boolean strict) { int statementNumber = block.getStatementNumber(); Entry entry = blockManager.retrieve(statementNumber); // Stash statement if required if (entry.statement == null) { entry.statement = block; } // ---------------------------------------- // ---------------------------------------- aload(Arities.EXECUTION_CONTEXT); // context ldc(statementNumber); // context statement-num invokevirtual(p(ExecutionContext.class), "retrieveBlockEntry", sig(Entry.class, int.class)); // entry aload(Arities.EXECUTION_CONTEXT); // entry context invokevirtual(p(ExecutionContext.class), "getCompiler", sig(JSCompiler.class)); // entry compiler swap(); // compiler entry aload(Arities.EXECUTION_CONTEXT); // compiler entry context swap(); // compiler context entry ldc(grist); // compiler context entry grist swap(); // compiler context grist entry getfield(p(Entry.class), "statement", ci(Statement.class)); // compiler context grist statement if (strict) { iconst_1(); } else { iconst_0(); } // compiler context grist statement strict invokevirtual( p(JSCompiler.class), "compileBasicBlock", sig( BasicBlock.class, ExecutionContext.class, String.class, Statement.class, boolean.class)); // basic-block }