dillon1000/react
Commit
Browse files [rust] port inline_use_memo
Ports InlineUseMemo to Rust, this is the only missing transform pass on the pipeline up through constant propagation. I wanted to finish this so that we could do benchmarking of the early phase of compilation. UseMemo does a bunch of rewriting so it seemed worth comparing performance. Included: * Add swc -> estree and estree -> HIR conversions for arrow functions and call expressions * Add HIR definition for labeled terminals and call expressions * Utility for inlining one function into another — note that this requires remapping InstrIx operands since instruction indices will change. An alternative would be to store all the instructions for both outer/inner functions in the same array, in which case we wouldn't need to remap. * Helpers for mutably iterating the operands of an instruction or terminal. * The actual inline_use_memo() function. The overall logic is similar, i just had to slightly shuffle the order of operations to satisfy the borrow checker.
Changed paths13 files
First-parent comparisoncompiler/forget/crates/forget_build_hir/src/build.rs ModifiedM compiler/forget/crates/forget_build_hir/src/error.rs ModifiedM compiler/forget/crates/forget_estree_swc/src/lib.rs ModifiedA compiler/forget/crates/forget_fixtures/tests/fixtures/use-memo.js AddedM compiler/forget/crates/forget_fixtures/tests/fixtures_test.rs ModifiedA compiler/forget/crates/forget_fixtures/tests/snapshots/[email protected] AddedM compiler/forget/crates/forget_hir/src/function.rs ModifiedM compiler/forget/crates/forget_hir/src/initialize.rs ModifiedA compiler/forget/crates/forget_hir/src/inline_use_memo.rs AddedM compiler/forget/crates/forget_hir/src/instruction.rs ModifiedM compiler/forget/crates/forget_hir/src/lib.rs ModifiedM compiler/forget/crates/forget_hir/src/print.rs ModifiedM compiler/forget/crates/forget_hir/src/terminal.rs ModifiedPatch
Files changed
Rendering syntax-highlighted changes…