[K/Wasm] Optimize range checks

This commit is contained in:
Artem Kobzar
2023-09-19 17:04:41 +00:00
committed by Space Team
parent 24e8c9c90d
commit 94eefba824
2 changed files with 8 additions and 1 deletions
@@ -115,6 +115,12 @@ private val lateinitUsageLoweringPhase = makeWasmModulePhase(
description = "Insert checks for lateinit field references" description = "Insert checks for lateinit field references"
) )
private val rangeContainsLoweringPhase = makeWasmModulePhase(
::RangeContainsLowering,
name = "RangeContainsLowering",
description = "[Optimization] Optimizes calls to contains() for ClosedRanges"
)
private val arrayConstructorReferencePhase = makeWasmModulePhase( private val arrayConstructorReferencePhase = makeWasmModulePhase(
::WasmArrayConstructorReferenceLowering, ::WasmArrayConstructorReferenceLowering,
name = "ArrayConstructorReference", name = "ArrayConstructorReference",
@@ -637,6 +643,7 @@ val wasmPhases = SameTypeNamedCompilerPhase(
lateinitNullableFieldsPhase then lateinitNullableFieldsPhase then
lateinitDeclarationLoweringPhase then lateinitDeclarationLoweringPhase then
lateinitUsageLoweringPhase then lateinitUsageLoweringPhase then
rangeContainsLoweringPhase then
arrayConstructorReferencePhase then arrayConstructorReferencePhase then
arrayConstructorPhase then arrayConstructorPhase then
sharedVariablesLoweringPhase then sharedVariablesLoweringPhase then
+1 -1
View File
@@ -1,6 +1,6 @@
// TARGET_BACKEND: WASM // TARGET_BACKEND: WASM
// WASM_DCE_EXPECTED_OUTPUT_SIZE: wasm 48_430 // WASM_DCE_EXPECTED_OUTPUT_SIZE: wasm 40_730
// WASM_DCE_EXPECTED_OUTPUT_SIZE: mjs 4_552 // WASM_DCE_EXPECTED_OUTPUT_SIZE: mjs 4_552
fun box(): String { fun box(): String {