Commit 89c20f8
authored
Scala.js: Emit
Although there is a *correct* implementation of `sr.Arrays.newArray`, it
is not efficient when creating 1-dimensional arrays. The JVM backend
special-cases it to emit `newarray` bytecode instructions.
We now also special-case it in the JS backend. In the Scala.js IR
however, `js.NewArray` only accepts a single dimension. For multiple
dimensions, the right thing to do is to emit a direct call to
`jlr.Array.newInstance`.js.NewArray IR nodes when possible. (#22446)File tree
2 files changed
+28
-3
lines changed- compiler/src/dotty/tools/backend/sjs
2 files changed
+28
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2569 | 2569 | | |
2570 | 2570 | | |
2571 | 2571 | | |
| 2572 | + | |
| 2573 | + | |
2572 | 2574 | | |
2573 | 2575 | | |
2574 | 2576 | | |
| |||
3038 | 3040 | | |
3039 | 3041 | | |
3040 | 3042 | | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
3041 | 3061 | | |
3042 | 3062 | | |
3043 | 3063 | | |
| |||
4846 | 4866 | | |
4847 | 4867 | | |
4848 | 4868 | | |
4849 | | - | |
| 4869 | + | |
4850 | 4870 | | |
4851 | 4871 | | |
4852 | 4872 | | |
| |||
4856 | 4876 | | |
4857 | 4877 | | |
4858 | 4878 | | |
| 4879 | + | |
| 4880 | + | |
| 4881 | + | |
4859 | 4882 | | |
4860 | 4883 | | |
4861 | 4884 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
51 | 52 | | |
52 | | - | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| 139 | + | |
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
| |||
0 commit comments