Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–101 unchanged (101 lines)
102 LiveVariablesAnalysis liveness =
103 new LiveVariablesAnalysis(cfg, scope, compiler);
104 // If the function has exactly 2 params, mark them as escaped. This is
105 // a work-around for an IE bug where it throws an exception if you
106 // write to the parameters of the callback in a sort(). See:
107 // http://code.google.com/p/closure-compiler/issues/detail?id=58
108 liveness.analyze();
109
110 UndiGraph<Var, Void> interferenceGraph =
111 computeVariableNamesInterferenceGraph(
112 t, cfg, liveness.getEscapedLocals());
113
114 GraphColoring<Var, Void> coloring =
…lines 115–455 unchanged (341 lines)

After

…lines 1–101 unchanged (101 lines)
102 LiveVariablesAnalysis liveness =
103 new LiveVariablesAnalysis(cfg, scope, compiler);
104 // If the function has exactly 2 params, mark them as escaped. This is
105 // a work-around for an IE bug where it throws an exception if you
106 // write to the parameters of the callback in a sort(). See:
107 // http://code.google.com/p/closure-compiler/issues/detail?id=58
108 if (scope.getRootNode().getFirstChild().getNext().getChildCount() == 2) {
109 liveness.markAllParametersEscaped();
110 }
111 liveness.analyze();
112
113 UndiGraph<Var, Void> interferenceGraph =
114 computeVariableNamesInterferenceGraph(
115 t, cfg, liveness.getEscapedLocals());
116
…lines 117–458 unchanged (342 lines)

Before

program
block_comment "/*\n * Copyright 2008 Google Inc.\n *\n * Licensed under the Ap"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Joiner"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Lists"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Sets"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ControlFlowGraph"
. "."
identifier "AbstractCfgNodeTraversalCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ControlFlowGraph"
. "."
identifier "Branch"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "DataFlowAnalysis"
. "."
identifier "FlowState"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "LiveVariablesAnalysis"
. "."
identifier "LiveVariableLattice"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "AbstractPostOrderCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "ScopedCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "Scope"
. "."
identifier "Var"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "GraphColoring"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "GraphNode"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "LinkedUndirectedGraph"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "UndiGraph"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Comparator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Deque"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * Reuse variable names if possible.\n *\n * <p>For exampl"...
class_declaration
class "class"
identifier "CoalesceVariableNames"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
, ","
type_identifier "ScopedCallback"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Deque"
type_arguments
< "<"
generic_type
type_identifier "GraphColoring"
type_arguments
< "<"
type_identifier "Var"
, ","
type_identifier "Void"
> ">"
> ">"
variable_declarator
identifier "colorings"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "usePseudoNames"
; ";"
field_declaration (+61 nodes collapsed)
block_comment "/**\n * @param usePseudoNames For debug purposes, when merg"...
constructor_declaration (+45 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
void_type "void"
identifier "enterScope"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
) ")"
block
{ "{"
line_comment "// TODO(user): We CAN do this in the global scope, just need"...
line_comment "// careful when something is exported. Liveness uses bit-vec"...
line_comment "// sets so I don't see compilation time will be a problem fo"...
line_comment "// pass in the global scope."
local_variable_declaration
type_identifier "Scope"
variable_declarator
identifier "scope"
= "="
method_invocation
identifier "t"
. "."
identifier "getScope"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "scope"
. "."
identifier "isGlobal"
argument_list
( "("
) ")"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
local_variable_declaration
generic_type
type_identifier "ControlFlowGraph"
type_arguments
< "<"
type_identifier "Node"
> ">"
variable_declarator
identifier "cfg"
= "="
method_invocation
identifier "t"
. "."
identifier "getControlFlowGraph"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "LiveVariablesAnalysis"
variable_declarator
identifier "liveness"
= "="
object_creation_expression
new "new"
type_identifier "LiveVariablesAnalysis"
argument_list
( "("
identifier "cfg"
, ","
identifier "scope"
, ","
identifier "compiler"
) ")"
; ";"
line_comment "// If the function has exactly 2 params, mark them as escape"...
line_comment "// a work-around for an IE bug where it throws an exception "...
line_comment "// write to the parameters of the callback in a sort(). See:"
line_comment "// http://code.google.com/p/closure-compiler/issues/detail?i"...
expression_statement
method_invocation
identifier "liveness"
. "."
identifier "analyze"
argument_list
( "("
) ")"
; ";"
local_variable_declaration (+29 nodes collapsed)
local_variable_declaration (+29 nodes collapsed)
expression_statement
method_invocation
identifier "coloring"
. "."
identifier "color"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "colorings"
. "."
identifier "push"
argument_list
( "("
identifier "coloring"
) ")"
; ";"
} "}"
method_declaration (+44 nodes collapsed)
method_declaration (+538 nodes collapsed)
method_declaration (+691 nodes collapsed)
block_comment "/**\n * Check if the live ranges of the given pairs of vari"...
method_declaration (+50 nodes collapsed)
block_comment "/**\n * A simple wrapper calls to call two AbstractCfgNodeT"...
class_declaration (+116 nodes collapsed)
block_comment "/**\n * A simple wrapper calls to call two AbstractCfgNodeT"...
class_declaration (+218 nodes collapsed)
block_comment "/**\n * Tries to remove variable declaration if the variabl"...
method_declaration (+254 nodes collapsed)
class_declaration (+508 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Copyright 2008 Google Inc.\n *\n * Licensed under the Ap"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Joiner"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Lists"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Sets"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ControlFlowGraph"
. "."
identifier "AbstractCfgNodeTraversalCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ControlFlowGraph"
. "."
identifier "Branch"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "DataFlowAnalysis"
. "."
identifier "FlowState"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "LiveVariablesAnalysis"
. "."
identifier "LiveVariableLattice"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "AbstractPostOrderCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "NodeTraversal"
. "."
identifier "ScopedCallback"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "Scope"
. "."
identifier "Var"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "GraphColoring"
; ";"
import_declaration (+22 nodes collapsed)
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "GraphNode"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "LinkedUndirectedGraph"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "graph"
. "."
identifier "UndiGraph"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Node"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "rhino"
. "."
identifier "Token"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "ArrayList"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Comparator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Deque"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * Reuse variable names if possible.\n *\n * <p>For exampl"...
class_declaration
class "class"
identifier "CoalesceVariableNames"
superclass
extends "extends"
type_identifier "AbstractPostOrderCallback"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
, ","
type_identifier "ScopedCallback"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
field_declaration
modifiers
private "private"
final "final"
generic_type
type_identifier "Deque"
type_arguments
< "<"
generic_type
type_identifier "GraphColoring"
type_arguments
< "<"
type_identifier "Var"
, ","
type_identifier "Void"
> ">"
> ">"
variable_declarator
identifier "colorings"
; ";"
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "usePseudoNames"
; ";"
field_declaration (+61 nodes collapsed)
block_comment "/**\n * @param usePseudoNames For debug purposes, when merg"...
constructor_declaration (+45 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration
modifiers
marker_annotation
@ "@"
identifier "Override"
public "public"
void_type "void"
identifier "enterScope"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
) ")"
block
{ "{"
line_comment "// TODO(user): We CAN do this in the global scope, just need"...
line_comment "// careful when something is exported. Liveness uses bit-vec"...
line_comment "// sets so I don't see compilation time will be a problem fo"...
line_comment "// pass in the global scope."
local_variable_declaration
type_identifier "Scope"
variable_declarator
identifier "scope"
= "="
method_invocation
identifier "t"
. "."
identifier "getScope"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "scope"
. "."
identifier "isGlobal"
argument_list
( "("
) ")"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
local_variable_declaration
generic_type
type_identifier "ControlFlowGraph"
type_arguments
< "<"
type_identifier "Node"
> ">"
variable_declarator
identifier "cfg"
= "="
method_invocation
identifier "t"
. "."
identifier "getControlFlowGraph"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "LiveVariablesAnalysis"
variable_declarator
identifier "liveness"
= "="
object_creation_expression
new "new"
type_identifier "LiveVariablesAnalysis"
argument_list
( "("
identifier "cfg"
, ","
identifier "scope"
, ","
identifier "compiler"
) ")"
; ";"
line_comment "// If the function has exactly 2 params, mark them as escape"...
line_comment "// a work-around for an IE bug where it throws an exception "...
line_comment "// write to the parameters of the callback in a sort(). See:"
line_comment "// http://code.google.com/p/closure-compiler/issues/detail?i"...
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
method_invocation
method_invocation
method_invocation
method_invocation
identifier "scope"
. "."
identifier "getRootNode"
argument_list
( "("
) ")"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
. "."
identifier "getNext"
argument_list
( "("
) ")"
. "."
identifier "getChildCount"
argument_list
( "("
) ")"
== "=="
decimal_integer_literal "2"
) ")"
block
{ "{"
expression_statement
method_invocation
identifier "liveness"
. "."
identifier "markAllParametersEscaped"
argument_list
( "("
) ")"
; ";"
} "}"
expression_statement
method_invocation
identifier "liveness"
. "."
identifier "analyze"
argument_list
( "("
) ")"
; ";"
local_variable_declaration (+29 nodes collapsed)
local_variable_declaration (+29 nodes collapsed)
expression_statement
method_invocation
identifier "coloring"
. "."
identifier "color"
argument_list
( "("
) ")"
; ";"
expression_statement
method_invocation
identifier "colorings"
. "."
identifier "push"
argument_list
( "("
identifier "coloring"
) ")"
; ";"
} "}"
method_declaration (+44 nodes collapsed)
method_declaration (+538 nodes collapsed)
method_declaration (+691 nodes collapsed)
block_comment "/**\n * Check if the live ranges of the given pairs of vari"...
method_declaration (+50 nodes collapsed)
block_comment "/**\n * A simple wrapper calls to call two AbstractCfgNodeT"...
class_declaration (+116 nodes collapsed)
block_comment "/**\n * A simple wrapper calls to call two AbstractCfgNodeT"...
class_declaration (+218 nodes collapsed)
block_comment "/**\n * Tries to remove variable declaration if the variabl"...
method_declaration (+254 nodes collapsed)
class_declaration (+508 nodes collapsed)
} "}"