using getter setters and joined objects makes possible many sick JS constructions: function bar() { var a = 3; foo(); print(a + 7 ); // will be 11 function foo() { a++; } } bar();
On Apr 20, 2010, at 2:11 AM, Kent Hansen wrote:
Hi, I don't see constant propagation mentioned at http://trac.webkit.org/wiki/SquirrelFishPerfIdeas . Has it been considered? (On a related note, is the above page up-to-date?)
With JSC as of r57470:
var a = 3; a + 7;
produces the bytecode
... [ 7] mov r-15, 3(@k1) [ 10] add r0, r-15, 7(@k2) ...
Worth pursuing? Reasonably feasible to implement in the compiler?
To do this well at the bytecode level, you need a control flow graph for each function and some way to do dataflow (perhaps by creating an SSA form of the bytecode).
Regards, Maciej