[JS IR] Cache JsLocation objects and js function signatures

Memory consumption optimization
This commit is contained in:
Alexander Korepanov
2022-08-25 17:00:12 +02:00
committed by Space
parent ff2f16190d
commit bf53273b84
5 changed files with 52 additions and 30 deletions
@@ -19,12 +19,14 @@ package org.jetbrains.kotlin.js.backend.ast
import java.io.Reader
data class JsLocation(
override val file: String,
override val startLine: Int,
override val startChar: Int
override val file: String,
override val startLine: Int,
override val startChar: Int
) : JsLocationWithSource {
override val identityObject: Any? = null
override val sourceProvider: () -> Reader? = { null }
override val identityObject: Any?
get() = null
override val sourceProvider: () -> Reader?
get() = { null }
override fun asSimpleLocation(): JsLocation = this
}
@@ -40,7 +42,7 @@ interface JsLocationWithSource {
}
class JsLocationWithEmbeddedSource(
private val location: JsLocation,
override val identityObject: Any?,
override val sourceProvider: () -> Reader?
) : JsLocationWithSource by location
private val location: JsLocation,
override val identityObject: Any?,
override val sourceProvider: () -> Reader?
) : JsLocationWithSource by location