@@ -545,8 +545,9 @@ public final void initWithTypedAstFilesystem(
545
545
ImmutableSet <SourceFile > files =
546
546
ImmutableSet .<SourceFile >builder ().addAll (externs ).addAll (sources ).build ();
547
547
548
- this .initTypedAstFilesystem ( files , typedAstListStream , options );
548
+ this .initOptions ( options );
549
549
this .init (externs , sources , options );
550
+ this .initTypedAstFilesystem (files , typedAstListStream , options );
550
551
}
551
552
552
553
/**
@@ -569,8 +570,9 @@ public void initModulesWithTypedAstFilesystem(
569
570
}
570
571
ImmutableSet <SourceFile > files = filesBuilder .build ();
571
572
572
- this .initTypedAstFilesystem ( files , typedAstListStream , options );
573
+ this .initOptions ( options );
573
574
this .initModules (externs , modules , options );
575
+ this .initTypedAstFilesystem (files , typedAstListStream , options );
574
576
}
575
577
576
578
@ GwtIncompatible
@@ -579,26 +581,38 @@ private void initTypedAstFilesystem(
579
581
InputStream typedAstListStream ,
580
582
CompilerOptions options ) {
581
583
checkState (this .typedAstFilesystem == null );
584
+ maybeSetTracker ();
582
585
583
586
options .setMergedPrecompiledLibraries (true );
584
587
585
588
this .setLifeCycleStage (LifeCycleStage .COLORS_AND_SIMPLIFIED_JSDOC );
586
589
// To speed up builds that don't run type-based optimizations, skip type deserialization
587
590
boolean deserializeTypes = options .requiresTypesForOptimization ();
591
+
588
592
TypedAstDeserializer .DeserializedAst astData =
589
- TypedAstDeserializer .deserializeFullAst (
590
- this ,
591
- SYNTHETIC_EXTERNS_FILE ,
592
- requiredInputFiles ,
593
- typedAstListStream ,
594
- deserializeTypes ,
595
- options .resolveSourceMapAnnotations ,
596
- options .parseInlineSourceMaps );
593
+ runInCompilerThread (
594
+ () -> {
595
+ Tracer tracer = newTracer ("deserializeTypedAst" );
596
+ try {
597
+ return TypedAstDeserializer .deserializeFullAst (
598
+ this ,
599
+ SYNTHETIC_EXTERNS_FILE ,
600
+ requiredInputFiles ,
601
+ typedAstListStream ,
602
+ deserializeTypes ,
603
+ options .resolveSourceMapAnnotations ,
604
+ options .parseInlineSourceMaps );
605
+ } finally {
606
+ stopTracer (tracer , "deserializeTypedAst" );
607
+ }
608
+ });
597
609
598
610
this .typedAstFilesystem = astData .getFilesystem ();
599
611
this .externProperties = astData .getExternProperties ();
600
612
this .colorRegistry = astData .getColorRegistry ().orNull ();
601
613
this .setTypeCheckingHasRun (deserializeTypes );
614
+
615
+ this .getSynthesizedExternsInput (); // Force lazy creation.
602
616
}
603
617
604
618
@ Override
@@ -789,10 +803,6 @@ private void initAST() {
789
803
jsRoot = IR .root ();
790
804
externsRoot = IR .root ();
791
805
externAndJsRoot = IR .root (externsRoot , jsRoot );
792
-
793
- if (this .typedAstFilesystem != null ) {
794
- this .getSynthesizedExternsInput (); // Force lazy creation.
795
- }
796
806
}
797
807
798
808
/** Compiles a single source file and a single externs file. */
@@ -1775,7 +1785,7 @@ StaticScope getTranspilationNamespace() {
1775
1785
}
1776
1786
1777
1787
public void maybeSetTracker () {
1778
- if (!options .getTracerMode ().isOn ()) {
1788
+ if (!options .getTracerMode ().isOn () || tracker != null ) {
1779
1789
return ;
1780
1790
}
1781
1791
0 commit comments