abstract class AbstractPeepholeOptimization
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private AbstractCompiler |
compiler |
Constructor and Description |
---|
AbstractPeepholeOptimization() |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
areDeclaredGlobalExternsOnWindow() |
protected boolean |
areNodesEqualForInlining(Node n1,
Node n2)
Are the nodes equal for the purpose of inlining?
If type aware optimizations are on, type equality is checked.
|
(package private) void |
beginTraversal(AbstractCompiler compiler)
Informs the optimization that a traversal will begin.
|
(package private) void |
endTraversal(AbstractCompiler compiler)
Informs the optimization that a traversal has completed.
|
(package private) CodingConvention |
getCodingConvention() |
protected boolean |
isASTNormalized()
Is the current AST normalized? (e.g.
|
(package private) boolean |
isEcmaScript5OrGreater() |
(package private) boolean |
mayEffectMutableState(Node n) |
(package private) boolean |
mayHaveSideEffects(Node n) |
(package private) boolean |
nodeTypeMayHaveSideEffects(Node n)
Returns true if the current node's type implies side effects.
|
(package private) abstract Node |
optimizeSubtree(Node subtree)
Given a node to optimize and a traversal, optimize the node.
|
protected void |
report(DiagnosticType diagnostic,
Node n)
Helper method for reporting an error to the compiler when applying a
peephole optimization.
|
protected void |
reportCodeChange()
Helper method for telling the compiler that something has changed.
|
private AbstractCompiler compiler
abstract Node optimizeSubtree(Node subtree)
subtree
- The subtree that will be optimized.subtree
.protected void report(DiagnosticType diagnostic, Node n)
diagnostic
- The error typen
- The node for which the error should be reportedprotected void reportCodeChange()
protected boolean areNodesEqualForInlining(Node n1, Node n2)
protected boolean isASTNormalized()
void beginTraversal(AbstractCompiler compiler)
void endTraversal(AbstractCompiler compiler)
compiler
- The current compiler.boolean mayEffectMutableState(Node n)
boolean mayHaveSideEffects(Node n)
boolean nodeTypeMayHaveSideEffects(Node n)
boolean isEcmaScript5OrGreater()
CodingConvention getCodingConvention()
final boolean areDeclaredGlobalExternsOnWindow()