[JS IR] IC improvements

- Reuse a built fragment
  - Use cache for saving built JS code
This commit is contained in:
Alexander Korepanov
2022-03-30 18:19:28 +03:00
committed by Space
parent f8ae097e50
commit 9952d43252
137 changed files with 1280 additions and 899 deletions
@@ -0,0 +1,6 @@
fun foo() = 42
fun bar() = 24
fun baz(s: String) = s.length
fun baz(i: Int) = i + 2
fun baz(b: Boolean) = if (b) 10 else 1
@@ -0,0 +1,6 @@
STEP 0:
dependencies: stdlib
dirty: l1.kt
STEP 1..6:
dependencies: stdlib
flags: FP
@@ -0,0 +1,2 @@
fun qux() = foo() + 2
@@ -0,0 +1,2 @@
fun qux() = foo() + bar()
@@ -0,0 +1,2 @@
fun qux() = foo() - 2
@@ -0,0 +1,2 @@
fun qux() = baz(2) + baz("test") + baz(true)
@@ -0,0 +1,2 @@
fun qux() = baz("test") + baz(true)
@@ -0,0 +1,2 @@
fun qux() = baz("test") + 100
@@ -0,0 +1,31 @@
STEP 0:
dependencies: stdlib, lib1
dirty: l2.kt
STEP 1:
dependencies: stdlib, lib1
modifications:
U : l2.kt.1.txt -> l2.kt
dirty: l2.kt
STEP 2:
dependencies: stdlib, lib1
modifications:
U : l2.kt.2.txt -> l2.kt
dirty: l2.kt
STEP 3:
dependencies: stdlib, lib1
modifications:
U : l2.kt.3.txt -> l2.kt
dirty: l2.kt
STEP 4:
dependencies: stdlib, lib1
modifications:
U : l2.kt.4.txt -> l2.kt
dirty: l2.kt
STEP 5:
dependencies: stdlib, lib1
flags: FP
STEP 6:
dependencies: stdlib, lib1
modifications:
U : l2.kt.6.txt -> l2.kt
dirty: l2.kt
@@ -0,0 +1,12 @@
fun box(stepId: Int): String {
when (stepId) {
0 -> if (qux() != 44) return "Fail"
1 -> if (qux() != 66) return "Fail"
2 -> if (qux() != 40) return "Fail"
3 -> if (qux() != 18) return "Fail"
4 -> if (qux() != 14) return "Fail"
else -> return "Unknown"
}
return "OK"
}
@@ -0,0 +1,11 @@
fun box(stepId: Int): String {
when (stepId) {
5 -> if (qux() != 14) return "Fail"
6 -> if (qux() != 104) return "Fail"
else -> return "Unknown"
}
if (baz(77) != 79) return "Fail"
if (baz("test") != 4) return "Fail"
return "OK"
}
@@ -0,0 +1,12 @@
STEP 0:
dependencies: stdlib, lib1, lib2
dirty: m.kt
STEP 1..4:
dependencies: stdlib, lib1, lib2
STEP 5:
dependencies: stdlib, lib1, lib2
modifications:
U : m.kt.5.txt -> m.kt
dirty: m.kt
STEP 6:
dependencies: stdlib, lib1, lib2
@@ -0,0 +1,14 @@
MODULES: lib1, lib2, main
STEP 0:
libs: lib1, lib2, main
dirty js: stdlib, lib1, lib2, main
STEP 1..4:
libs: lib1, lib2, main
dirty js: lib1, lib2
STEP 5:
libs: lib1, lib2, main
dirty js: lib1, main
STEP 6:
libs: lib1, lib2, main
dirty js: lib1, lib2, main