Joe Savona dce5371763 Constant propagation/folding
Implements constant propagation/constant folding for a conservative subset of 
the language. The approach is described in detail in the comments in the file 
itself, a key note here is that this pass currently emits what looks like 
garbage: 

``` 

// input 

const x = 1; 

const y = x + 1; 

// output 

const x = 1; 

2; // <---- you'll see a bunch of lines like this 

const y = 2; 

``` 

These useless lines occur where previously there was a temporary getting 
calculated that was used later (so we saved it until it was used), but now it 
isn't used later so we just emit it in-place. Dead code elimination (DCE) can 
eliminate these and other useless statements later. 

Note that a key motivation for implementing this pass is to reduce memoization 
blocks to what is strictly required for dynamic computations. Why memoize at 
runtime when we compute at build time?
2023-01-09 15:30:20 -08:00
2023-01-09 15:30:20 -08:00
S
Description
No description provided
MIT 1.8 GiB
Languages
JavaScript 67.1%
TypeScript 29.4%
HTML 1.5%
CSS 1.1%
C++ 0.6%
Other 0.2%