Package com.google.gwt.dev.cfg

Examples of com.google.gwt.dev.cfg.PermProps


    ResolveRuntimeTypeReferences.exec(jProgram, typeMapper, TypeOrder.FREQUENCY);

    Map<StandardSymbolData, JsName> symbolTable =
        new TreeMap<StandardSymbolData, JsName>(new SymbolData.ClassIdentComparator());

    PermProps props = new PermProps(Arrays.asList(
        new BindingProps(orderedProps, orderedPropValues, config)
    ));
    return GenerateJavaScriptAST.exec(logger, jProgram, jsProgram, compilerContext,
        typeMapper, symbolTable, props);
  }
View Full Code Here


        new TreeMap<StandardSymbolData, JsName>(new SymbolData.ClassIdentComparator());

    BindingProperty stackMode = new BindingProperty("compiler.stackMode");
    stackMode.addDefinedValue(new ConditionNone(), "EMULATED");

    PermProps props = new PermProps(Arrays.asList(
        new BindingProps(new BindingProperty[]{stackMode}, new String[]{"EMULATED"}, config)
    ));

    JsProgram jsProgram = new JsProgram();
    JavaToJavaScriptMap jjsmap = GenerateJavaScriptAST.exec(
View Full Code Here

      try {
        Event javaEvent = SpeedTracerLogger.start(CompilerEventType.PERMUTATION_JAVA);

        // (1) Initialize local state.
        long startTimeMs = System.currentTimeMillis();
        PermProps props = permutation.getProps();
        int permutationId = permutation.getId();
        AST ast = unifiedAst.getFreshAst();
        jprogram = ast.getJProgram();
        jsProgram = ast.getJsProgram();
        Map<StandardSymbolData, JsName> symbolTable =
            new TreeMap<StandardSymbolData, JsName>(new SymbolData.ClassIdentComparator());

        // TODO(stalcup): hide metrics gathering in a callback or subclass
        if (compilerContext.shouldCompileMonolithic() && logger.isLoggable(TreeLogger.INFO)) {
          logger.log(TreeLogger.INFO, "Compiling permutation " + permutationId + "...");
        }
        printPermutationTrace(permutation);

        // (2) Transform unresolved Java AST to resolved Java AST
        ResolveRebinds.exec(jprogram, permutation.getGwtCreateAnswers());

        // TODO(stalcup): hide metrics gathering in a callback or subclass
        // This has to happen before optimizations because functions might
        // be optimized out; we want those marked as "not executed", not "not
        // instrumentable".
        Multimap<String, Integer> instrumentableLines = null;
        if (System.getProperty("gwt.coverage") != null) {
          instrumentableLines = BaselineCoverageGatherer.exec(jprogram);
        }

        // TypeOracle needs this to make decisions in several optimization passes
        jprogram.typeOracle.setJsInteropMode(compilerContext.getOptions().getJsInteropMode());

        // Record initial set of type->type references.
        // type->type references need to be collected in two phases, 1) before any process to the
        // AST has happened (to record for example reference to types declaring compile-time
        // constants) and 2) after all normalizations to collect synthetic references (e.g. to
        // record references to runtime classes like LongLib).
        maybeRecordTypeReferences(false);

        // Replace compile time constants by their values.
        // TODO(rluble): eventually move to normizeSemantics.
        CompileTimeConstantsReplacer.exec(jprogram);

        // TODO(stalcup): move to after normalize.
        // (3) Optimize the resolved Java AST
        optimizeJava();

        // TODO(stalcup): move to before optimize.
        // (4) Normalize the resolved Java AST
        TypeMapper<?> typeMapper = normalizeSemantics();

        // TODO(stalcup): this stage shouldn't exist, move into optimize.
        postNormalizationOptimizeJava();

        // Now that the AST has stopped mutating update with the final references.
        maybeRecordTypeReferences(true);

        jprogram.typeOracle.recomputeAfterOptimizations(jprogram.getDeclaredTypes());

        javaEvent.end();

        Event javaScriptEvent = SpeedTracerLogger.start(CompilerEventType.PERMUTATION_JAVASCRIPT);

        // (5) Construct the Js AST
        Pair<? extends JavaToJavaScriptMap, Set<JsNode>> jjsMapAndInlineableFunctions =
            GenerateJavaScriptAST.exec(logger, jprogram, jsProgram,
                compilerContext, typeMapper, symbolTable, props);
        JavaToJavaScriptMap jjsmap = jjsMapAndInlineableFunctions.getLeft();

        // TODO(stalcup): hide metrics gathering in a callback or subclass
        if (System.getProperty("gwt.coverage") != null) {
          CoverageInstrumentor.exec(jsProgram, instrumentableLines);
        }

        // (6) Normalize the Js AST
        JsNormalizer.exec(jsProgram);

        // TODO(stalcup): move to AST construction
        JsSymbolResolver.exec(jsProgram);
        if (options.getNamespace() == JsNamespaceOption.PACKAGE) {
          JsNamespaceChooser.exec(jsProgram, jjsmap);
        }

        // TODO(stalcup): move to normalization
        EvalFunctionsAtTopScope.exec(jsProgram, jjsmap);

        // (7) Optimize the JS AST.
        final Set<JsNode> inlinableJsFunctions = jjsMapAndInlineableFunctions.getRight();
        optimizeJs(inlinableJsFunctions);

        // TODO(stalcup): move to normalization
        // Must run before code splitter and namer.
        JsStackEmulator.exec(jprogram, jsProgram, props, jjsmap);

        // TODO(stalcup): move to normalization
        Pair<SyntheticArtifact, MultipleDependencyGraphRecorder> dependenciesAndRecorder =
            splitJsIntoFragments(props, permutationId, jjsmap);

        // TODO(stalcup): move to optimize.
        Map<JsName, JsLiteral> internedLiteralByVariableName = renameJsSymbols(props);

        // TODO(stalcup): move to normalization
        JsBreakUpLargeVarStatements.exec(jsProgram, props.getConfigProps());

        // (8) Generate Js source
        List<JsSourceMap> sourceInfoMaps = new ArrayList<JsSourceMap>();
        boolean isSourceMapsEnabled = props.isTrueInAnyPermutation("compiler.useSourceMaps");
        String[] jsFragments = new String[jsProgram.getFragmentCount()];
        StatementRanges[] ranges = new StatementRanges[jsFragments.length];
        SizeBreakdown[] sizeBreakdowns = options.isJsonSoycEnabled() || options.isSoycEnabled()
            || options.isCompilerMetricsEnabled() ? new SizeBreakdown[jsFragments.length] : null;
        generateJavaScriptCode(jjsmap, jsFragments, ranges, sizeBreakdowns, sourceInfoMaps,
View Full Code Here

  /**
   * Returns the properties to be used for generating this (hard) permutation.
   */
  public PermProps getProps() {
    return new PermProps(orderedProps);
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.cfg.PermProps

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.