@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.ir.backend.js
8
8
import org.jetbrains.kotlin.backend.common.linkage.issues.checkNoUnboundSymbols
9
9
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
10
10
import org.jetbrains.kotlin.backend.common.phaser.invokeToplevel
11
+ import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
11
12
import org.jetbrains.kotlin.config.CompilerConfiguration
12
13
import org.jetbrains.kotlin.ir.IrBuiltIns
13
14
import org.jetbrains.kotlin.ir.backend.js.lower.collectNativeImplementations
@@ -49,6 +50,8 @@ fun compile(
49
50
filesToLower : Set <String >? = null,
50
51
granularity : JsGenerationGranularity = JsGenerationGranularity .WHOLE_PROGRAM ,
51
52
): LoweredIr {
53
+ val performanceManager = depsDescriptors.compilerConfiguration[CLIConfigurationKeys .PERF_MANAGER ]
54
+ performanceManager?.notifyIRTranslationStarted()
52
55
53
56
val (moduleFragment: IrModuleFragment , dependencyModules, irBuiltIns, symbolTable, deserializer, moduleToName) =
54
57
loadIr(depsDescriptors, irFactory, verifySignatures, filesToLower, loadFunctionInterfacesIntoStdlib = true )
@@ -92,6 +95,7 @@ fun compileIr(
92
95
val moduleDescriptor = moduleFragment.descriptor
93
96
val irFactory = symbolTable.irFactory
94
97
val shouldGeneratePolyfills = configuration.getBoolean(JSConfigurationKeys .GENERATE_POLYFILLS )
98
+ val performanceManager = configuration[CLIConfigurationKeys .PERF_MANAGER ]
95
99
96
100
val allModules = when (mainModule) {
97
101
is MainModule .SourceFiles -> dependencyModules + listOf (moduleFragment)
@@ -130,10 +134,14 @@ fun compileIr(
130
134
131
135
// TODO should be done incrementally
132
136
generateJsTests(context, allModules.last())
137
+ performanceManager?.notifyIRTranslationFinished()
133
138
139
+ performanceManager?.notifyGenerationStarted()
140
+ performanceManager?.notifyIRLoweringStarted()
134
141
(irFactory.stageController as ? WholeWorldStageController )?.let {
135
142
lowerPreservingTags(allModules, context, phaseConfig, it)
136
143
} ? : jsPhases.invokeToplevel(phaseConfig, context, allModules)
137
144
145
+ performanceManager?.notifyIRLoweringFinished()
138
146
return LoweredIr (context, moduleFragment, allModules, moduleToName)
139
147
}
0 commit comments