Commit ef64387
[dart2wasm] Avoid using deep array copy in places where we only want to copy shallow
The `jsArrayFromDartList` method is a deep array copy: It will call out
to JS to allocate an array and initialize it by calling back to Dart for
each dart list element and `jsify()` each element (which may - if the
element is a list - call `jsArrayFromDartList` again).
For the use cases changed in this CL we know we have a `List<JSAny>` so
there's actually no reason to do this recursively, we only need to
allocate a JS array and fill in the elements from the dart list (without
any processing such as `jsify(0)`ing the elements).
We also add some fast cases to `List<JSAny?>.toJS` for
length=0/1/2/3
Change-Id: Idf82e104a743b883c8af0bd1b3b3234dff6e3d5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414780
Reviewed-by: Srujan Gaddam <[email protected]>
Commit-Queue: Martin Kustermann <[email protected]>1 parent 54c8719 commit ef64387
File tree
3 files changed
+48
-12
lines changed- sdk/lib/_internal/wasm/lib
3 files changed
+48
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
| 546 | + | |
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | 86 | | |
92 | 87 | | |
93 | 88 | | |
| |||
533 | 528 | | |
534 | 529 | | |
535 | 530 | | |
536 | | - | |
| 531 | + | |
537 | 532 | | |
538 | 533 | | |
539 | 534 | | |
| |||
571 | 566 | | |
572 | 567 | | |
573 | 568 | | |
574 | | - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
575 | 611 | | |
576 | 612 | | |
577 | 613 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
0 commit comments