Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(277)

Issue 2241042: An optimization pass that annotates array acceses so that the validating rewriter can skip checks (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 9 months ago by MikeSamuel
Modified:
15 years, 8 months ago
Reviewers:
Jasvir, MarkM
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Implements an optimization pass between ConsolidateCode and ValidateJavascript that folds converts foo[bar] to foo[+bar] when bar is provably a publicly accessible array member regardless of what foo is. This was derived from http://codereview.appspot.com/8703/ and depends on Jasvir's recent work to make negative array indices on function and arguments instances inaccessible. Submitted @ r4313

Patch Set 1 #

Total comments: 7

Patch Set 2 : An optimization pass that annotates array acceses so that the validating rewriter can skip checks #

Patch Set 3 : An optimization pass that annotates array acceses so that the validating rewriter can skip checks #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1138 lines, -2 lines) Patch
M src/com/google/caja/parser/js/CajoledModule.java View 1 2 chunks +7 lines, -2 lines 0 comments Download
A src/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimization.java View 1 1 chunk +293 lines, -0 lines 0 comments Download
A src/com/google/caja/parser/quasiliteral/opt/ScopeTree.java View 1 chunk +198 lines, -0 lines 0 comments Download
M src/com/google/caja/plugin/PipelineMaker.java View 1 2 chunks +2 lines, -0 lines 0 comments Download
A src/com/google/caja/plugin/stages/OptimizeJavascriptStage.java View 1 chunk +32 lines, -0 lines 0 comments Download
M tests/com/google/caja/browser-expectations.html View 1 1 chunk +2 lines, -0 lines 0 comments Download
A tests/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimizationTest.java View 1 chunk +267 lines, -0 lines 0 comments Download
A tests/com/google/caja/parser/quasiliteral/opt/ScopeTreeTest.java View 1 chunk +140 lines, -0 lines 0 comments Download
A tests/com/google/caja/parser/quasiliteral/opt/array-opt-operator-test.js View 1 chunk +64 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/PipelineMakerTest.java View 5 chunks +5 lines, -0 lines 0 comments Download
A tests/com/google/caja/plugin/stages/OptimizeJavascriptStageTest.java View 1 2 1 chunk +121 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/stages/PipelineStageTestCase.java View 1 3 chunks +7 lines, -0 lines 0 comments Download

Messages

Total messages: 5
MikeSamuel
15 years, 9 months ago (2010-09-20 16:33:52 UTC) #1
Jasvir
http://codereview.appspot.com/2241042/diff/1/src/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimization.java File src/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimization.java (right): http://codereview.appspot.com/2241042/diff/1/src/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimization.java#newcode40 src/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimization.java:40: * <p>The CajitaRewriter will optimize reads of properties where ...
15 years, 9 months ago (2010-10-07 21:05:11 UTC) #2
Jasvir
http://codereview.appspot.com/2241042/diff/1/tests/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimizationTest.java File tests/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimizationTest.java (right): http://codereview.appspot.com/2241042/diff/1/tests/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimizationTest.java#newcode138 tests/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimizationTest.java:138: + "function map(f, arr) {\n" Ah ah ah - ...
15 years, 9 months ago (2010-10-07 21:05:51 UTC) #3
MikeSamuel
http://codereview.appspot.com/2241042/diff/1/src/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimization.java File src/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimization.java (right): http://codereview.appspot.com/2241042/diff/1/src/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimization.java#newcode40 src/com/google/caja/parser/quasiliteral/opt/ArrayIndexOptimization.java:40: * <p>The CajitaRewriter will optimize reads of properties where ...
15 years, 8 months ago (2010-10-26 00:01:59 UTC) #4
Jasvir
15 years, 8 months ago (2010-10-26 18:15:33 UTC) #5
LGTM

http://codereview.appspot.com/2241042/diff/1/src/com/google/caja/plugin/Pipel...
File src/com/google/caja/plugin/PipelineMaker.java (right):

http://codereview.appspot.com/2241042/diff/1/src/com/google/caja/plugin/Pipel...
src/com/google/caja/plugin/PipelineMaker.java:236: out.add(new
OptimizeJavascriptStage());
.given(JS).produces(CAJOLED_MODULE_UNOPTIMIZED)?

Else any client that requests CAJOLED_MODULE given JS always gets optimized
javascript.  Given that the only optimization currently available is array
optimization which produces code that is as understandable as the original, its
not critical.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b