(Config config)
| 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); |
nothing calls this directly
no test coverage detected