MCPcopy Create free account
hub / github.com/dynjs/dynjs / JSCompiler

Method JSCompiler

src/main/java/org/dynjs/compiler/JSCompiler.java:26–47  ·  view source on GitHub ↗
(Config config)

Source from the content-addressed store, hash-verified

24 private BasicBlockCompiler basicBlockCompiler;
25
26 public JSCompiler(Config config) {
27 CodeGeneratingVisitorFactory factory = new CodeGeneratingVisitorFactory(config.isInvokeDynamicEnabled());
28 InterpretingVisitorFactory interpFactory = new InterpretingVisitorFactory( config.isInvokeDynamicEnabled() );
29
30 switch ( config.getCompileMode() ) {
31 case OFF:
32 this.basicBlockCompiler = new InterpretingBasicBlockCompiler( interpFactory );
33 this.functionCompiler = new InterpretingFunctionCompiler( interpFactory );
34 this.programCompiler = new InterpretingProgramCompiler( interpFactory );
35 break;
36 case FORCE:
37 this.basicBlockCompiler = new BytecodeBasicBlockCompiler(config, factory);
38 this.functionCompiler = new ByteCodeFunctionCompiler();
39 this.programCompiler = new BytecodeProgramCompiler();
40 break;
41 case JIT: // FIXME: this should go away when IR becomes default (config.isJitEnabled())
42 this.basicBlockCompiler = new JITBasicBlockCompiler(config, interpFactory, factory);
43 this.functionCompiler = new ByteCodeFunctionCompiler(); // FIXME: Add JIT
44 this.programCompiler = new BytecodeProgramCompiler(); // FIXME: Add JIT
45 break;
46 }
47 }
48
49 public JSProgram compileProgram(CompilationContext context, ProgramTree program, boolean forceStrict) {
50 return this.programCompiler.compile(context, program, forceStrict);

Callers

nothing calls this directly

Calls 2

getCompileModeMethod · 0.80

Tested by

no test coverage detected