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? Regards, Kent
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
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
On Apr 20, 2010, at 2:27 AM, Zoltan Herczeg wrote:
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();
That's why you need dataflow information - you have to assume locals may be killed when you have any nested functions and you call a function. If you also do free variable analysis then you could figure out a subset of locals that might be killed. - Maciej
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
_______________________________________________ squirrelfish-dev mailing list squirrelfish-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/squirrelfish-dev
On k, 2010-04-20 at 02:39 -0700, Maciej Stachowiak wrote:
On Apr 20, 2010, at 2:27 AM, Zoltan Herczeg wrote:
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();
That's why you need dataflow information - you have to assume locals may be killed when you have any nested functions and you call a function. If you also do free variable analysis then you could figure out a subset of locals that might be killed.
That is true, but I think that there are still too many barriers to implement a cost efficient constant propagation at byte-code level. Probably a simple peephole optimization can be used for that kind of sequences. Btw, you can see our old patch about this topic: https://bugs.webkit.org/show_bug.cgi?id=20764 --Gabor
On Apr 20, 2010, at 2:43 AM, Gabor Loki wrote:
On k, 2010-04-20 at 02:39 -0700, Maciej Stachowiak wrote:
On Apr 20, 2010, at 2:27 AM, Zoltan Herczeg wrote:
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();
That's why you need dataflow information - you have to assume locals may be killed when you have any nested functions and you call a function. If you also do free variable analysis then you could figure out a subset of locals that might be killed.
That is true, but I think that there are still too many barriers to implement a cost efficient constant propagation at byte-code level.
Probably a simple peephole optimization can be used for that kind of sequences.
I think the problem is that there's not enough real performance- critical code that would benefit. So the most likely path to this optimization is if it gets done as part of a broader optimization, or reuses dataflow analysis done for a greater variety of optimizations.
Btw, you can see our old patch about this topic: https://bugs.webkit.org/show_bug.cgi?id=20764
Regards, Maciej
participants (4)
-
Gabor Loki
-
Kent Hansen
-
Maciej Stachowiak
-
Zoltan Herczeg