[JS IC] Support //RECOMPILE directive in js box tests

- change test runner to production mode when sources are being compiled
 into klib and then klib is being translated into js, not directly from
 kt to js
 - fix IC cache format
 - support IC tests
This commit is contained in:
Roman Artemev
2021-09-09 15:44:14 +03:00
committed by teamcityserver
parent 6b2fee7143
commit a2e4ebd820
8 changed files with 225 additions and 118 deletions
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.ir.IrBuiltIns
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.backend.js.ic.ICCache
import org.jetbrains.kotlin.ir.backend.js.ic.SerializedIcData
import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsIrLinker
import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsIrModuleSerializer
@@ -396,7 +397,7 @@ fun prepareAnalyzedSourceModule(
analyzer: AbstractAnalyzerWithCompilerReport,
icUseGlobalSignatures: Boolean = false,
icUseStdlibCache: Boolean = false,
icCache: Map<String, SerializedIcData> = emptyMap(),
icCache: Map<String, ICCache> = emptyMap(),
errorPolicy: ErrorTolerancePolicy = configuration.get(JSConfigurationKeys.ERROR_TOLERANCE_POLICY) ?: ErrorTolerancePolicy.DEFAULT,
): ModulesStructure {
val mainModule = MainModule.SourceFiles(files)
@@ -490,12 +491,12 @@ class ModulesStructure(
friendDependenciesPaths: Collection<String>,
val icUseGlobalSignatures: Boolean,
val icUseStdlibCache: Boolean,
val icCache: Map<String, SerializedIcData>,
val icCache: Map<String, ICCache>,
) {
val loweringsCacheProvider: LoweringsCacheProvider = when {
icUseStdlibCache -> object : LoweringsCacheProvider {
override fun cacheByPath(path: String): SerializedIcData? {
return icCache[path]
return icCache[path]?.serializedIcData
}
}
icUseGlobalSignatures -> EmptyLoweringsCacheProvider