[JS IR] Simple memory optimizations
- Use hash maps and hash sets instead of linked implementations - Use weak hash maps for caches with IR elements as keys - Intern JS function signatures
This commit is contained in:
committed by
Space Team
parent
731dd9c3e8
commit
95e305be3a
+4
-3
@@ -13,14 +13,15 @@ import org.jetbrains.kotlin.ir.util.IdSignature
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import java.util.*
|
||||
|
||||
class IrFactoryImplForJsIC(override val stageController: StageController) : AbstractIrFactoryImpl(), IdSignatureRetriever {
|
||||
private val declarationToSignature = mutableMapOf<IrDeclaration, IdSignature>()
|
||||
private val declarationToSignature = WeakHashMap<IrDeclaration, IdSignature>()
|
||||
|
||||
private fun <T : IrDeclaration> T.register(): T {
|
||||
val parentSig = stageController.currentDeclaration?.let { declarationSignature(it) } ?: return this
|
||||
|
||||
stageController.createSignature(parentSig)?.let { declarationToSignature[this] = it}
|
||||
stageController.createSignature(parentSig)?.let { declarationToSignature[this] = it }
|
||||
|
||||
return this
|
||||
}
|
||||
@@ -392,4 +393,4 @@ class IrFactoryImplForJsIC(override val stageController: StageController) : Abst
|
||||
isAssignable,
|
||||
).register()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user