class FunctionRewriter extends java.lang.Object implements CompilerPass
Modifier and Type | Class and Description |
---|---|
private static class |
FunctionRewriter.EmptyFunctionReducer
Reduces return immutable constant literal methods declarations
with calls to a constant return method factory.
|
private static class |
FunctionRewriter.GetterReducer
Reduces property getter method declarations with calls to a
getter method factory.
|
private static class |
FunctionRewriter.IdentityReducer
Reduces property getter method declarations with calls to a
getter method factory.
|
(package private) static class |
FunctionRewriter.Reducer
Interface implemented by the strength-reduction optimizers below.
|
private class |
FunctionRewriter.Reduction
Information needed to apply a reduction.
|
private class |
FunctionRewriter.ReductionGatherer
Gathers a list of reductions to apply later by doing an in-order
AST traversal.
|
private static class |
FunctionRewriter.ReturnConstantReducer
Reduces return immutable constant literal methods declarations
with calls to a constant return method factory.
|
private static class |
FunctionRewriter.SetterReducer
Reduces property setter method declarations with calls to a
setter method factory.
|
(package private) static class |
FunctionRewriter.SingleReturnStatementReducer
Base class for reducers that match functions that contain a
single return statement.
|
Modifier and Type | Field and Description |
---|---|
private AbstractCompiler |
compiler |
private static int |
SAVINGS_THRESHOLD |
Constructor and Description |
---|
FunctionRewriter(AbstractCompiler compiler) |
Modifier and Type | Method and Description |
---|---|
private static boolean |
isReduceableFunctionExpression(Node n) |
Node |
parseHelperCode(FunctionRewriter.Reducer reducer)
Parse helper code needed by a reducer.
|
void |
process(Node externs,
Node root)
Process the JS with root node root.
|
private final AbstractCompiler compiler
private static final int SAVINGS_THRESHOLD
FunctionRewriter(AbstractCompiler compiler)
public void process(Node externs, Node root)
CompilerPass
process
in interface CompilerPass
externs
- Top of external JS treeroot
- Top of JS treepublic Node parseHelperCode(FunctionRewriter.Reducer reducer)
private static boolean isReduceableFunctionExpression(Node n)