[Wasm] Add an option to dump declaration IR sizes to file
This commit is contained in:
+14
@@ -308,6 +308,20 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(
|
||||
value = "-Xir-dump-declaration-ir-sizes-to-file",
|
||||
valueDescription = "<path>",
|
||||
description = "Dump the IR size of each declaration to a file. " +
|
||||
"The format will be chosen automatically depending on the file extension. " +
|
||||
"Supported output formats include JSON for .json, JS const initialized with a plain object containing information for .js, " +
|
||||
"and plain text for all other file types."
|
||||
)
|
||||
var irDceDumpDeclarationIrSizesToFile: String? = null
|
||||
set(value) {
|
||||
checkFrozen()
|
||||
field = value
|
||||
}
|
||||
|
||||
@Argument(value = "-Xir-property-lazy-initialization", description = "Perform lazy initialization for properties")
|
||||
var irPropertyLazyInitialization = true
|
||||
set(value) {
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.jetbrains.kotlin.incremental.js.IncrementalNextRoundChecker
|
||||
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumer
|
||||
import org.jetbrains.kotlin.ir.backend.js.*
|
||||
import org.jetbrains.kotlin.ir.backend.js.codegen.JsGenerationGranularity
|
||||
import org.jetbrains.kotlin.ir.backend.js.dce.dumpDeclarationIrSizesIfNeed
|
||||
import org.jetbrains.kotlin.ir.backend.js.ic.*
|
||||
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.CompilationOutputsBuilt
|
||||
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.IrModuleToJsTransformer
|
||||
@@ -354,6 +355,8 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
eliminateDeadDeclarations(allModules, backendContext)
|
||||
}
|
||||
|
||||
dumpDeclarationIrSizesIfNeed(arguments.irDceDumpDeclarationIrSizesToFile, allModules)
|
||||
|
||||
val generateSourceMaps = configuration.getBoolean(JSConfigurationKeys.SOURCE_MAP)
|
||||
|
||||
val res = compileWasm(
|
||||
|
||||
Reference in New Issue
Block a user