Skip to content

Commit

Permalink
Automated partial rollback.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Test failure in release with this included, still under investigation.

*** Original change description ***

Change hoisting of externs and 'nocompile' files to use faster DependencyInfo parsing.

- Added PrebuildAST to bundle generation as some builds were hitting StackOverflows.

- Set module resolution mode and roots in JsMessageExtractorRunner, as it was failing for some targets when parsing some ES6 imports.

- Remove tests that tested bad requires, etc., as the dependency parsing will output an error before it hits any error in the rest of jscomp.

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=233802109
  • Loading branch information
blickly authored and EatingW committed Feb 14, 2019
1 parent d9a18d7 commit cfe387a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Expand Up @@ -2052,11 +2052,6 @@ void printManifestTo(Iterable<CompilerInput> inputs, Appendable out) throws IOEx
@VisibleForTesting
@GwtIncompatible("Unnecessary")
void printBundleTo(Iterable<CompilerInput> inputs, Appendable out) throws IOException {
// Prebuild ASTs before they're needed in getLoadFlags, for performance and because
// StackOverflowErrors can be hit if not prebuilt.
if (compiler.getOptions().numParallelThreads > 1) {
new PrebuildAst(compiler, compiler.getOptions().numParallelThreads).prebuild(inputs);
}
if (!compiler.getOptions().preventLibraryInjection) {
// ES6 modules will need a runtime in a bundle. Skip appending this runtime if there are no
// ES6 modules to cut down on size.
Expand Down
13 changes: 9 additions & 4 deletions src/com/google/javascript/jscomp/Compiler.java
Expand Up @@ -59,6 +59,7 @@
import com.google.javascript.rhino.ErrorReporter;
import com.google.javascript.rhino.IR;
import com.google.javascript.rhino.InputId;
import com.google.javascript.rhino.JSDocInfo;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.Token;
import com.google.javascript.rhino.jstype.JSTypeRegistry;
Expand Down Expand Up @@ -1924,10 +1925,12 @@ void hoistExterns() {
* Return whether or not the given input was hoisted.
*/
private boolean hoistIfExtern(CompilerInput input) {
if (input.getHasExternsAnnotation()) {
Node n = input.getAstRoot(this);
JSDocInfo info = n.getJSDocInfo();
if (info != null && info.isExterns()) {
// If the input file is explicitly marked as an externs file, then move it out of the main
// JS root and put it with the other externs.
externsRoot.addChildToBack(input.getAstRoot(this));
externsRoot.addChildToBack(n);
input.setIsExtern();

input.getModule().remove(input);
Expand All @@ -1946,7 +1949,9 @@ void hoistNoCompileFiles() {
maybeDoThreadedParsing();
// Iterate a copy because hoisting modifies what we're iterating over.
for (CompilerInput input : ImmutableList.copyOf(moduleGraph.getAllInputs())) {
if (input.getHasNoCompileAnnotation()) {
Node n = input.getAstRoot(this);
JSDocInfo info = n.getJSDocInfo();
if (info != null && info.isNoCompile()) {
input.getModule().remove(input);
staleInputs = true;
}
Expand All @@ -1959,7 +1964,7 @@ void hoistNoCompileFiles() {

private void maybeDoThreadedParsing() {
if (options.numParallelThreads > 1) {
new PrebuildDependencyInfo(options.numParallelThreads).prebuild(moduleGraph.getAllInputs());
new PrebuildAst(this, options.numParallelThreads).prebuild(moduleGraph.getAllInputs());
}
}

Expand Down

0 comments on commit cfe387a

Please sign in to comment.