diff --git a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt index 2c39ad9b1f20b..8b60099512075 100644 --- a/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt +++ b/compiler/cli/cli-js/src/org/jetbrains/kotlin/cli/js/K2JsIrCompiler.kt @@ -352,6 +352,8 @@ class K2JsIrCompiler : CLICompiler() { exportedDeclarations = setOf(FqName("main")), propertyLazyInitialization = arguments.irPropertyLazyInitialization, ) + + performanceManager?.notifyIRGenerationStarted() val dceDumpNameCache = DceDumpNameCache() if (arguments.irDce) { eliminateDeadDeclarations(allModules, backendContext, dceDumpNameCache) @@ -370,6 +372,8 @@ class K2JsIrCompiler : CLICompiler() { generateWat = configuration.get(JSConfigurationKeys.WASM_GENERATE_WAT, false), generateSourceMaps = generateSourceMaps ) + performanceManager?.notifyIRGenerationFinished() + performanceManager?.notifyGenerationFinished() writeCompilationResult( result = res, diff --git a/compiler/ir/backend.wasm/build.gradle.kts b/compiler/ir/backend.wasm/build.gradle.kts index 99d2c0940c4cd..f29d06d5c64a8 100644 --- a/compiler/ir/backend.wasm/build.gradle.kts +++ b/compiler/ir/backend.wasm/build.gradle.kts @@ -4,6 +4,7 @@ plugins { } dependencies { + implementation(project(":compiler:cli-base")) api(project(":compiler:util")) api(project(":compiler:frontend")) api(project(":compiler:backend-common")) diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt index 47b71f646f73c..44cbd148516c7 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/compiler.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.backend.wasm.ir2wasm.WasmModuleFragmentGenerator import org.jetbrains.kotlin.backend.wasm.ir2wasm.toJsStringLiteral import org.jetbrains.kotlin.backend.wasm.lower.markExportedDeclarations import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys import org.jetbrains.kotlin.ir.backend.js.MainModule import org.jetbrains.kotlin.ir.backend.js.ModulesStructure import org.jetbrains.kotlin.ir.backend.js.SourceMapsInfo @@ -51,6 +52,9 @@ fun compileToLoweredIr( ): Pair, WasmBackendContext> { val mainModule = depsDescriptors.mainModule val configuration = depsDescriptors.compilerConfiguration + val performanceManager = depsDescriptors.compilerConfiguration[CLIConfigurationKeys.PERF_MANAGER] + performanceManager?.notifyIRTranslationStarted() + val (moduleFragment, dependencyModules, irBuiltIns, symbolTable, irLinker) = loadIr( depsDescriptors, irFactory, @@ -83,7 +87,11 @@ fun compileToLoweredIr( for (file in module.files) markExportedDeclarations(context, file, exportedDeclarations) + performanceManager?.notifyIRTranslationFinished() + performanceManager?.notifyGenerationStarted() + performanceManager?.notifyIRLoweringStarted() wasmPhases.invokeToplevel(phaseConfig, context, allModules) + performanceManager?.notifyIRLoweringFinished() return Pair(allModules, context) } @@ -179,7 +187,7 @@ private fun generateSourceMap( prev = location location.apply { - // TODO resulting path goes too deep since temporary directory we compiled first is deeper than final destination. + // TODO resulting path goes too deep since temporary directory we compiled first is deeper than final destination. val relativePath = pathResolver.getPathRelativeToSourceRoots(File(file)).substring(3) sourceMapBuilder.addMapping(relativePath, null, { null }, line, column, null, mapping.offset) }