[Webkit-unassigned] [Bug 19408] Constant folding in parser

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 17 01:24:16 PDT 2008


------- Comment #8 from loki at inf.u-szeged.hu  2008-06-17 01:24 PDT -------
> 1) Instead of introducing new OP_WHATEVER enums for some of the operations, why
> not just use the existing op_ constants from the bytecode?

OpcodeID enum has so many enumerators. If I use those GCC will generate a
bigger and less effective code for switch statement. The GCC generated
tablejumps are very effective construction if the cases in a switch check for
continuous (or almost continuous) numbers (like: 0,1,2,...,n).

> 2) Is it really helpful to have a single foldConstant function which takes an
> opcode enum and then switches on it? Why not just a function for each type of
> fold?

I am not sure which variant is better. With functions for each type of fold
the tablejump can be saved. I will check it.

> 3) Constant folds should be doable even if operand types aren't exactly what is
> expected, boolean string and number constants should be safely convertible.

What did I miss?

> 4) We've discussed the possibility of doing constant folding at codegen time. 

You are right about not every constant can be handled quick in parse-time, but
IMHO this should not be the only priority.

If the AST is smaller the codegen will be also quicker.

In addition if you like have a lightweight constant propagation, it is better
to have constant folding in AST instead of in codegen. time. Of course,
codegen. can have its own separate constant folding.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list