|
|
For my current testcase, this is about a 10% speedup to the cajoler.
- The rewriter relies extensively on a marker "synthetic", which
is stored as a key-value pair in a HashMap. The map lookups
have a noticeable cost.
This change adds a boolean "synthetic" to AbstractParseTreeNode
and uses that instead of the HashMap. This is the largest
speedup in this change.
- Rewriter#expand will pre-filter rules in a ruleset based on
specific nodetype. So, it knows that when it's examining a
Declaration node, it doesn't have to try running a rule that
can only match AssignOperation. It determines a rule's
matchable nodetype by parsing the rule's "matches" attribute.
Some rules do not have a parseable "matches", because the match
condition is not expressible with quasi syntax, so these rules
are always checked against every nodetype, even though they
might apply to just a specific nodetype.
This change adds another attribute "matchNode", which lets us
specify a nodetype that the rule must match.
- The nodetype SpecialOperation represents several semantically
different javascript operators, and this interferes with the
rule filtering in Rewriter#expand. For instance, a rule that
matches "@v.@p" is a SpecialOperation nodetype, which means the
rule is also tried against the "delete" operator, the comma
operator, etc.
This change adds another type of rule pre-filter that looks at
the specific operator being matched.
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+398 lines, -149 lines) |
Patch |
 |
M |
build.xml
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/com/google/caja/lang/css/Partitions.java
|
View
|
|
4 chunks |
+4 lines, -6 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/AbstractParseTreeNode.java
|
View
|
|
3 chunks |
+11 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/js/Operator.java
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/js/ReturnStmt.java
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/js/SyntheticNodes.java
|
View
|
|
4 chunks |
+15 lines, -11 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/ES53Rewriter.java
|
View
|
|
14 chunks |
+46 lines, -10 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/IllegalReferenceCheckRewriter.java
|
View
|
|
1 chunk |
+1 line, -2 lines |
0 comments
|
Download
|
 |
A |
src/com/google/caja/parser/quasiliteral/NodeTypeFilter.java
|
View
|
|
1 chunk |
+34 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/NonAsciiCheckVisitor.java
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/QuasiBuilder.java
|
View
|
|
2 chunks |
+23 lines, -0 lines |
0 comments
|
Download
|
 |
A |
src/com/google/caja/parser/quasiliteral/QuasiCache.java
|
View
|
|
1 chunk |
+46 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/Rewriter.java
|
View
|
|
2 chunks |
+1 line, -3 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/Rule.java
|
View
|
|
6 chunks |
+37 lines, -3 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/RuleChain.java
|
View
|
|
2 chunks |
+13 lines, -88 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/RuleDescription.java
|
View
|
|
3 chunks |
+14 lines, -6 lines |
0 comments
|
Download
|
 |
A |
src/com/google/caja/parser/quasiliteral/RuleFilter.java
|
View
|
|
1 chunk |
+81 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/Scope.java
|
View
|
|
4 chunks |
+12 lines, -14 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/SimpleQuasiNode.java
|
View
|
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
 |
A |
src/com/google/caja/parser/quasiliteral/SpecialOpFilter.java
|
View
|
|
1 chunk |
+48 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/SyntheticRuleSet.java
|
View
|
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/com/google/caja/parser/quasiliteral/TrailingUnderscoresHole.java
|
View
|
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
tests/com/google/caja/parser/ParseTreeNodeTest.java
|
View
|
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
Total messages: 3
|