[WASM] Function call codegen refactoring

This commit is contained in:
Igor Yakovlev
2022-08-16 18:31:48 +02:00
committed by teamcity
parent 95396eb61a
commit 5169d96acd
@@ -269,16 +269,17 @@ class BodyGenerator(
} }
// Some intrinsics are a special case because we want to remove them completely, including their arguments. // Some intrinsics are a special case because we want to remove them completely, including their arguments.
val removableIntrinsics = buildList { if (!backendContext.configuration.getNotNull(JSConfigurationKeys.WASM_ENABLE_ARRAY_RANGE_CHECKS)) {
if (backendContext.configuration.getNotNull(JSConfigurationKeys.WASM_ENABLE_ARRAY_RANGE_CHECKS) == false) if (call.symbol == wasmSymbols.rangeCheck) {
add(wasmSymbols.rangeCheck) body.buildGetUnit()
if (backendContext.configuration.getNotNull(JSConfigurationKeys.WASM_ENABLE_ASSERTS) == false) return
addAll(wasmSymbols.assertFuncs) }
} }
if (!backendContext.configuration.getNotNull(JSConfigurationKeys.WASM_ENABLE_ASSERTS)) {
if (call.symbol in removableIntrinsics) { if (call.symbol in wasmSymbols.assertFuncs) {
body.buildGetUnit() body.buildGetUnit()
return return
}
} }
val function: IrFunction = call.symbol.owner.realOverrideTarget val function: IrFunction = call.symbol.owner.realOverrideTarget