[JS IR] don't inline property accessors across files

This commit is contained in:
Anton Bannykh
2021-10-21 12:37:30 +03:00
committed by TeamCityServer
parent bdf31b8e52
commit 1f55dc73d2
@@ -19,22 +19,28 @@ class JsPropertyAccessorInlineLowering(
if (!isSafeToInlineInClosedWorld()) if (!isSafeToInlineInClosedWorld())
return false return false
if (isConst) // TODO: teach the deserializer to load constant property initializers
return true val accessFile = accessContainer.fileOrNull ?: return false
val file = fileOrNull ?: return false
return when (context.granularity) { return accessFile == file
JsGenerationGranularity.WHOLE_PROGRAM ->
true // if (isConst)
JsGenerationGranularity.PER_MODULE -> { // return true
val accessModule = accessContainer.fileOrNull?.module ?: return false //
val module = fileOrNull?.module ?: return false // return when (context.granularity) {
accessModule == module // JsGenerationGranularity.WHOLE_PROGRAM ->
} // true
JsGenerationGranularity.PER_FILE -> // JsGenerationGranularity.PER_MODULE -> {
// Not inlining because // val accessModule = accessContainer.fileOrNull?.module ?: return false
// 1. we need a way to distinguish per-file generation units // val module = fileOrNull?.module ?: return false
// 2. per-file mode intended for debug builds only at the moment // accessModule == module
false // }
} // JsGenerationGranularity.PER_FILE ->
// // Not inlining because
// // 1. we need a way to distinguish per-file generation units
// // 2. per-file mode intended for debug builds only at the moment
// false
// }
} }
} }