This mapping has 1 multi-map group: several pairings are equally correct there. The code view shows one arbitrary valid pairing, not the only one.

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–191 unchanged (191 lines)
192 /**
193 * For all variables in this scope, see if they are only used once.
194 * If it looks safe to do so, inline them.
195 */
196 private void doInlinesForScope(NodeTraversal t,
197 Map<Var, ReferenceCollection> referenceMap) {
198
199 for (Iterator<Var> it = t.getScope().getVars(); it.hasNext();) {
200 Var v = it.next();
201
202 ReferenceCollection referenceInfo = referenceMap.get(v);
203
204 // referenceInfo will be null if we're in constants-only mode
…lines 205–213 unchanged (9 lines)
214 staleVars.add(v);
215 } else if (mode == Mode.CONSTANTS_ONLY) {
216 // If we're in constants-only mode, don't run more aggressive
217 // inlining heuristics. See InlineConstantsTest.
218 continue;
219 } else {
220 inlineNonConstants(v, referenceInfo);
221 }
222 }
223 }
224
225 // Any reference that is not a read of the arguments property
226 // consider a escape of the arguments object.
227
228
229 private void inlineNonConstants(
230 Var v, ReferenceCollection referenceInfo) {
231 int refCount = referenceInfo.references.size();
232 Reference declaration = referenceInfo.references.get(0);
233 Reference init = referenceInfo.getInitializingReference();
234 int firstRefAfterInit = (declaration == init) ? 2 : 3;
235
236 if (refCount > 1 &&
…lines 237–269 unchanged (33 lines)
270
271 // If this variable was not inlined normally, check if we can
272 // inline an alias of it. (If the variable was inlined, then the
273 // reference data is out of sync. We're better off just waiting for
274 // the next pass.)
275 if (
276 !staleVars.contains(v) && referenceInfo.isWellDefined() &&
277 referenceInfo.isAssignedOnceInLifetime()) {
278 List<Reference> refs = referenceInfo.references;
279 for (int i = 1 /* start from a read */; i < refs.size(); i++) {
280 Node nameNode = refs.get(i).getNameNode();
281 if (aliasCandidates.containsKey(nameNode)) {
282 AliasCandidate candidate = aliasCandidates.get(nameNode);
…lines 283–694 unchanged (412 lines)

After

…lines 1–192 unchanged (192 lines)
193 * For all variables in this scope, see if they are only used once.
194 * If it looks safe to do so, inline them.
195 */
196 private void doInlinesForScope(NodeTraversal t,
197 Map<Var, ReferenceCollection> referenceMap) {
198
199 boolean maybeModifiedArguments =
200 maybeEscapedOrModifiedArguments(t.getScope(), referenceMap);
201 for (Iterator<Var> it = t.getScope().getVars(); it.hasNext();) {
202 Var v = it.next();
203
204 ReferenceCollection referenceInfo = referenceMap.get(v);
205
206 // referenceInfo will be null if we're in constants-only mode
…lines 207–215 unchanged (9 lines)
216 staleVars.add(v);
217 } else if (mode == Mode.CONSTANTS_ONLY) {
218 // If we're in constants-only mode, don't run more aggressive
219 // inlining heuristics. See InlineConstantsTest.
220 continue;
221 } else {
222 inlineNonConstants(v, referenceInfo, maybeModifiedArguments);
223 }
224 }
225 }
226
227 private boolean maybeEscapedOrModifiedArguments(
228 Scope scope, Map<Var, ReferenceCollection> referenceMap) {
229 if (scope.isLocal()) {
230 Var arguments = scope.getArgumentsVar();
231 ReferenceCollection refs = referenceMap.get(arguments);
232 if (refs != null && !refs.references.isEmpty()) {
233 for (Reference ref : refs.references) {
234 Node refNode = ref.getNameNode();
235 Node refParent = ref.getParent();
236 // Any reference that is not a read of the arguments property
237 // consider a escape of the arguments object.
238 if (!(NodeUtil.isGet(refParent)
239 && refNode == ref.getParent().getFirstChild()
240 && !isLValue(refParent))) {
241 return true;
242 }
243 }
244 }
245 }
246 return false;
247 }
248
249 private boolean isLValue(Node n) {
250 Node parent = n.getParent();
251 return (parent.getType() == Token.INC
252 || parent.getType() == Token.DEC
253 || (NodeUtil.isAssignmentOp(parent)
254 && parent.getFirstChild() == n));
255 }
256
257 private void inlineNonConstants(
258 Var v, ReferenceCollection referenceInfo,
259 boolean maybeModifiedArguments) {
260 int refCount = referenceInfo.references.size();
261 Reference declaration = referenceInfo.references.get(0);
262 Reference init = referenceInfo.getInitializingReference();
263 int firstRefAfterInit = (declaration == init) ? 2 : 3;
264
265 if (refCount > 1 &&
…lines 266–297 unchanged (32 lines)
298 }
299
300 // If this variable was not inlined normally, check if we can
301 // inline an alias of it. (If the variable was inlined, then the
302 // reference data is out of sync. We're better off just waiting for
303 // the next pass.)
304 if (!maybeModifiedArguments &&
305 !staleVars.contains(v) && referenceInfo.isWellDefined() &&
306 referenceInfo.isAssignedOnceInLifetime()) {
307 List<Reference> refs = referenceInfo.references;
308 for (int i = 1 /* start from a read */; i < refs.size(); i++) {
309 Node nameNode = refs.get(i).getNameNode();
310 if (aliasCandidates.containsKey(nameNode)) {
…lines 311–723 unchanged (413 lines)

Before

program
block_comment "/*\n * Copyright 2008 The Closure Compiler Authors.\n *\n * Lic"...
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 "Preconditions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Predicate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Predicates"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Maps"
; ";"
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 "CodingConvention"
. "."
identifier "SubclassRelationship"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ReferenceCollectingCallback"
. "."
identifier "Behavior"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ReferenceCollectingCallback"
. "."
identifier "Reference"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ReferenceCollectingCallback"
. "."
identifier "ReferenceCollection"
; ";"
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
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 "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * Using the infrastructure provided by VariableReferenc"...
class_declaration
class "class"
identifier "InlineVariables"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
enum_declaration
enum "enum"
identifier "Mode"
enum_body
{ "{"
line_comment "// Only inline things explicitly marked as constant."
enum_constant
identifier "CONSTANTS_ONLY"
, ","
line_comment "// Locals only"
enum_constant
identifier "LOCALS_ONLY"
, ","
enum_constant
identifier "ALL"
} "}"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Mode"
variable_declarator
identifier "mode"
; ";"
line_comment "// Inlines all strings, even if they increase the size of th"...
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "inlineAllStrings"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "IdentifyConstants"
variable_declarator
identifier "identifyConstants"
= "="
object_creation_expression
new "new"
type_identifier "IdentifyConstants"
argument_list
( "("
) ")"
; ";"
constructor_declaration (+46 nodes collapsed)
method_declaration (+59 nodes collapsed)
method_declaration (+85 nodes collapsed)
block_comment "/**\n * Filters variables declared as \"constant\", and decla"...
class_declaration (+44 nodes collapsed)
block_comment "/**\n * Filters non-global variables.\n */"
class_declaration (+47 nodes collapsed)
class_declaration (+58 nodes collapsed)
block_comment "/**\n * Builds up information about nodes in each scope. Wh"...
class_declaration
modifiers
private "private"
class "class"
identifier "InliningBehavior"
super_interfaces
implements "implements"
type_list
type_identifier "Behavior"
class_body
{ "{"
block_comment "/**\n * A list of variables that should not be inlined, b"...
field_declaration (+21 nodes collapsed)
block_comment "/**\n * Stored possible aliases of variables that never c"...
field_declaration (+22 nodes collapsed)
method_declaration (+48 nodes collapsed)
block_comment "/**\n * If any of the variables are well-defined and alia"...
method_declaration (+227 nodes collapsed)
block_comment "/**\n * For all variables in this scope, see if they are "...
method_declaration
modifiers
private "private"
void_type "void"
identifier "doInlinesForScope"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
, ","
formal_parameter
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "Var"
, ","
type_identifier "ReferenceCollection"
> ">"
identifier "referenceMap"
) ")"
block
{ "{"
for_statement
for "for"
( "("
local_variable_declaration (+24 nodes collapsed)
method_invocation
identifier "it"
. "."
identifier "hasNext"
argument_list
( "("
) ")"
; ";"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Var"
variable_declarator
identifier "v"
= "="
method_invocation
identifier "it"
. "."
identifier "next"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "ReferenceCollection"
variable_declarator
identifier "referenceInfo"
= "="
method_invocation
identifier "referenceMap"
. "."
identifier "get"
argument_list
( "("
identifier "v"
) ")"
; ";"
line_comment "// referenceInfo will be null if we're in constants-only mod"...
line_comment "// and the variable is not a constant."
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "referenceInfo"
== "=="
null_literal "null"
|| "||"
method_invocation
identifier "isVarInlineForbidden"
argument_list
( "("
identifier "v"
) ")"
) ")"
block
{ "{"
line_comment "// Never try to inline exported variables or variables that"
line_comment "// were not collected or variables that have already been in"...
continue_statement
continue "continue"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "isInlineableDeclaredConstant"
argument_list
( "("
identifier "v"
, ","
identifier "referenceInfo"
) ")"
) ")"
block (+54 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "mode"
== "=="
field_access
identifier "Mode"
. "."
identifier "CONSTANTS_ONLY"
) ")"
block
{ "{"
line_comment "// If we're in constants-only mode, don't run more aggressiv"...
line_comment "// inlining heuristics. See InlineConstantsTest."
continue_statement
continue "continue"
; ";"
} "}"
else "else"
block
{ "{"
expression_statement
method_invocation
identifier "inlineNonConstants"
argument_list
( "("
identifier "v"
, ","
identifier "referenceInfo"
) ")"
; ";"
} "}"
} "}"
} "}"
line_comment "// Any reference that is not a read of the arguments propert"...
line_comment "// consider a escape of the arguments object."
method_declaration
modifiers
private "private"
void_type "void"
identifier "inlineNonConstants"
formal_parameters
( "("
formal_parameter
type_identifier "Var"
identifier "v"
, ","
formal_parameter
type_identifier "ReferenceCollection"
identifier "referenceInfo"
) ")"
block
{ "{"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "refCount"
= "="
method_invocation
field_access
identifier "referenceInfo"
. "."
identifier "references"
. "."
identifier "size"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Reference"
variable_declarator
identifier "declaration"
= "="
method_invocation
field_access
identifier "referenceInfo"
. "."
identifier "references"
. "."
identifier "get"
argument_list
( "("
decimal_integer_literal "0"
) ")"
; ";"
local_variable_declaration
type_identifier "Reference"
variable_declarator
identifier "init"
= "="
method_invocation
identifier "referenceInfo"
. "."
identifier "getInitializingReference"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "firstRefAfterInit"
= "="
ternary_expression
parenthesized_expression
( "("
binary_expression
identifier "declaration"
== "=="
identifier "init"
) ")"
? "?"
decimal_integer_literal "2"
: ":"
decimal_integer_literal "3"
; ";"
if_statement (+287 nodes collapsed)
line_comment "// If this variable was not inlined normally, check if we ca"...
line_comment "// inline an alias of it. (If the variable was inlined, then"...
line_comment "// reference data is out of sync. We're better off just wait"...
line_comment "// the next pass.)"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression any 2:3
binary_expression any 2:3
unary_expression
! "!"
method_invocation
identifier "staleVars"
. "."
identifier "contains"
argument_list
( "("
identifier "v"
) ")"
&& "&&"
method_invocation
identifier "referenceInfo"
. "."
identifier "isWellDefined"
argument_list
( "("
) ")"
&& "&&"
method_invocation
identifier "referenceInfo"
. "."
identifier "isAssignedOnceInLifetime"
argument_list
( "("
) ")"
) ")"
block (+209 nodes collapsed)
} "}"
block_comment "/**\n * If there are any variable references in the given"...
method_declaration (+107 nodes collapsed)
block_comment "/**\n * Whether the given variable is forbidden from bein"...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Do the actual work of inlining a single declarati"...
method_declaration (+183 nodes collapsed)
block_comment "/**\n * Inline an immutable variable into all of its refe"...
method_declaration (+103 nodes collapsed)
block_comment "/**\n * Inline a declared constant.\n */"
method_declaration (+106 nodes collapsed)
block_comment "/**\n * Remove the given VAR declaration.\n */"
method_declaration (+117 nodes collapsed)
block_comment "/**\n * Replace the given reference with the given value "...
method_declaration (+112 nodes collapsed)
block_comment "/**\n * Determines whether the given variable is declared"...
method_declaration (+175 nodes collapsed)
block_comment "/**\n * Compute whether the given string is worth inlinin"...
method_declaration (+171 nodes collapsed)
block_comment "/**\n * @return true if the provided reference and declar"...
method_declaration (+373 nodes collapsed)
block_comment "/**\n * If the value is a literal, we can cross more boun"...
method_declaration (+44 nodes collapsed)
block_comment "/**\n * If the value of a variable is not constant, then "...
method_declaration (+303 nodes collapsed)
block_comment "/**\n * @return true if the reference is a normal VAR or "...
method_declaration (+76 nodes collapsed)
block_comment "/**\n * @return Whether there is a initial value.\n */"
method_declaration (+144 nodes collapsed)
block_comment "/**\n * @return true if the reference is a candidate for "...
method_declaration (+37 nodes collapsed)
block_comment "/**\n * Determines whether the reference collection descr"...
method_declaration (+378 nodes collapsed)
} "}"
} "}"

After

program
block_comment "/*\n * Copyright 2008 The Closure Compiler Authors.\n *\n * Lic"...
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 "Preconditions"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Predicate"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "base"
. "."
identifier "Predicates"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "common"
. "."
identifier "collect"
. "."
identifier "Maps"
; ";"
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 "CodingConvention"
. "."
identifier "SubclassRelationship"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ReferenceCollectingCallback"
. "."
identifier "Behavior"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ReferenceCollectingCallback"
. "."
identifier "Reference"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "google"
. "."
identifier "javascript"
. "."
identifier "jscomp"
. "."
identifier "ReferenceCollectingCallback"
. "."
identifier "ReferenceCollection"
; ";"
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
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 "Iterator"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "List"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Set"
; ";"
block_comment "/**\n * Using the infrastructure provided by VariableReferenc"...
class_declaration
class "class"
identifier "InlineVariables"
super_interfaces
implements "implements"
type_list
type_identifier "CompilerPass"
class_body
{ "{"
field_declaration
modifiers
private "private"
final "final"
type_identifier "AbstractCompiler"
variable_declarator
identifier "compiler"
; ";"
enum_declaration
enum "enum"
identifier "Mode"
enum_body
{ "{"
line_comment "// Only inline things explicitly marked as constant."
enum_constant
identifier "CONSTANTS_ONLY"
, ","
line_comment "// Locals only"
enum_constant
identifier "LOCALS_ONLY"
, ","
enum_constant
identifier "ALL"
} "}"
field_declaration
modifiers
private "private"
final "final"
type_identifier "Mode"
variable_declarator
identifier "mode"
; ";"
line_comment "// Inlines all strings, even if they increase the size of th"...
field_declaration
modifiers
private "private"
final "final"
boolean_type "boolean"
variable_declarator
identifier "inlineAllStrings"
; ";"
field_declaration
modifiers
private "private"
final "final"
type_identifier "IdentifyConstants"
variable_declarator
identifier "identifyConstants"
= "="
object_creation_expression
new "new"
type_identifier "IdentifyConstants"
argument_list
( "("
) ")"
; ";"
constructor_declaration (+46 nodes collapsed)
method_declaration (+59 nodes collapsed)
method_declaration (+85 nodes collapsed)
block_comment "/**\n * Filters variables declared as \"constant\", and decla"...
class_declaration (+44 nodes collapsed)
block_comment "/**\n * Filters non-global variables.\n */"
class_declaration (+47 nodes collapsed)
class_declaration (+58 nodes collapsed)
block_comment "/**\n * Builds up information about nodes in each scope. Wh"...
class_declaration
modifiers
private "private"
class "class"
identifier "InliningBehavior"
super_interfaces
implements "implements"
type_list
type_identifier "Behavior"
class_body
{ "{"
block_comment "/**\n * A list of variables that should not be inlined, b"...
field_declaration (+21 nodes collapsed)
block_comment "/**\n * Stored possible aliases of variables that never c"...
field_declaration (+22 nodes collapsed)
method_declaration (+48 nodes collapsed)
block_comment "/**\n * If any of the variables are well-defined and alia"...
method_declaration (+227 nodes collapsed)
block_comment "/**\n * For all variables in this scope, see if they are "...
method_declaration
modifiers
private "private"
void_type "void"
identifier "doInlinesForScope"
formal_parameters
( "("
formal_parameter
type_identifier "NodeTraversal"
identifier "t"
, ","
formal_parameter
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "Var"
, ","
type_identifier "ReferenceCollection"
> ">"
identifier "referenceMap"
) ")"
block
{ "{"
local_variable_declaration
boolean_type "boolean"
variable_declarator
identifier "maybeModifiedArguments"
= "="
method_invocation
identifier "maybeEscapedOrModifiedArguments"
argument_list
( "("
method_invocation
identifier "t"
. "."
identifier "getScope"
argument_list
( "("
) ")"
, ","
identifier "referenceMap"
) ")"
; ";"
for_statement
for "for"
( "("
local_variable_declaration (+24 nodes collapsed)
method_invocation
identifier "it"
. "."
identifier "hasNext"
argument_list
( "("
) ")"
; ";"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Var"
variable_declarator
identifier "v"
= "="
method_invocation
identifier "it"
. "."
identifier "next"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "ReferenceCollection"
variable_declarator
identifier "referenceInfo"
= "="
method_invocation
identifier "referenceMap"
. "."
identifier "get"
argument_list
( "("
identifier "v"
) ")"
; ";"
line_comment "// referenceInfo will be null if we're in constants-only mod"...
line_comment "// and the variable is not a constant."
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "referenceInfo"
== "=="
null_literal "null"
|| "||"
method_invocation
identifier "isVarInlineForbidden"
argument_list
( "("
identifier "v"
) ")"
) ")"
block
{ "{"
line_comment "// Never try to inline exported variables or variables that"
line_comment "// were not collected or variables that have already been in"...
continue_statement
continue "continue"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "isInlineableDeclaredConstant"
argument_list
( "("
identifier "v"
, ","
identifier "referenceInfo"
) ")"
) ")"
block (+54 nodes collapsed)
else "else"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "mode"
== "=="
field_access
identifier "Mode"
. "."
identifier "CONSTANTS_ONLY"
) ")"
block
{ "{"
line_comment "// If we're in constants-only mode, don't run more aggressiv"...
line_comment "// inlining heuristics. See InlineConstantsTest."
continue_statement
continue "continue"
; ";"
} "}"
else "else"
block
{ "{"
expression_statement
method_invocation
identifier "inlineNonConstants"
argument_list
( "("
identifier "v"
, ","
identifier "referenceInfo"
, ","
identifier "maybeModifiedArguments"
) ")"
; ";"
} "}"
} "}"
} "}"
method_declaration
modifiers
private "private"
boolean_type "boolean"
identifier "maybeEscapedOrModifiedArguments"
formal_parameters
( "("
formal_parameter
type_identifier "Scope"
identifier "scope"
, ","
formal_parameter
generic_type
type_identifier "Map"
type_arguments
< "<"
type_identifier "Var"
, ","
type_identifier "ReferenceCollection"
> ">"
identifier "referenceMap"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "scope"
. "."
identifier "isLocal"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Var"
variable_declarator
identifier "arguments"
= "="
method_invocation
identifier "scope"
. "."
identifier "getArgumentsVar"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "ReferenceCollection"
variable_declarator
identifier "refs"
= "="
method_invocation
identifier "referenceMap"
. "."
identifier "get"
argument_list
( "("
identifier "arguments"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "refs"
!= "!="
null_literal "null"
&& "&&"
unary_expression
! "!"
method_invocation
field_access
identifier "refs"
. "."
identifier "references"
. "."
identifier "isEmpty"
argument_list
( "("
) ")"
) ")"
block
{ "{"
enhanced_for_statement
for "for"
( "("
type_identifier "Reference"
identifier "ref"
: ":"
field_access
identifier "refs"
. "."
identifier "references"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "refNode"
= "="
method_invocation
identifier "ref"
. "."
identifier "getNameNode"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "refParent"
= "="
method_invocation
identifier "ref"
. "."
identifier "getParent"
argument_list
( "("
) ")"
; ";"
line_comment "// Any reference that is not a read of the arguments propert"...
line_comment "// consider a escape of the arguments object."
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
parenthesized_expression
( "("
binary_expression
binary_expression
method_invocation
identifier "NodeUtil"
. "."
identifier "isGet"
argument_list
( "("
identifier "refParent"
) ")"
&& "&&"
binary_expression
identifier "refNode"
== "=="
method_invocation
method_invocation
identifier "ref"
. "."
identifier "getParent"
argument_list
( "("
) ")"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
&& "&&"
unary_expression
! "!"
method_invocation
identifier "isLValue"
argument_list
( "("
identifier "refParent"
) ")"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
true "true"
; ";"
} "}"
} "}"
} "}"
} "}"
return_statement
return "return"
false "false"
; ";"
} "}"
method_declaration
modifiers
private "private"
boolean_type "boolean"
identifier "isLValue"
formal_parameters
( "("
formal_parameter
type_identifier "Node"
identifier "n"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "Node"
variable_declarator
identifier "parent"
= "="
method_invocation
identifier "n"
. "."
identifier "getParent"
argument_list
( "("
) ")"
; ";"
return_statement
return "return"
parenthesized_expression
( "("
binary_expression
binary_expression
binary_expression
method_invocation
identifier "parent"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "INC"
|| "||"
binary_expression
method_invocation
identifier "parent"
. "."
identifier "getType"
argument_list
( "("
) ")"
== "=="
field_access
identifier "Token"
. "."
identifier "DEC"
|| "||"
parenthesized_expression
( "("
binary_expression
method_invocation
identifier "NodeUtil"
. "."
identifier "isAssignmentOp"
argument_list
( "("
identifier "parent"
) ")"
&& "&&"
binary_expression
method_invocation
identifier "parent"
. "."
identifier "getFirstChild"
argument_list
( "("
) ")"
== "=="
identifier "n"
) ")"
) ")"
; ";"
} "}"
method_declaration
modifiers
private "private"
void_type "void"
identifier "inlineNonConstants"
formal_parameters
( "("
formal_parameter
type_identifier "Var"
identifier "v"
, ","
formal_parameter
type_identifier "ReferenceCollection"
identifier "referenceInfo"
, ","
formal_parameter
boolean_type "boolean"
identifier "maybeModifiedArguments"
) ")"
block
{ "{"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "refCount"
= "="
method_invocation
field_access
identifier "referenceInfo"
. "."
identifier "references"
. "."
identifier "size"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
type_identifier "Reference"
variable_declarator
identifier "declaration"
= "="
method_invocation
field_access
identifier "referenceInfo"
. "."
identifier "references"
. "."
identifier "get"
argument_list
( "("
decimal_integer_literal "0"
) ")"
; ";"
local_variable_declaration
type_identifier "Reference"
variable_declarator
identifier "init"
= "="
method_invocation
identifier "referenceInfo"
. "."
identifier "getInitializingReference"
argument_list
( "("
) ")"
; ";"
local_variable_declaration
integral_type
int "int"
variable_declarator
identifier "firstRefAfterInit"
= "="
ternary_expression
parenthesized_expression
( "("
binary_expression
identifier "declaration"
== "=="
identifier "init"
) ")"
? "?"
decimal_integer_literal "2"
: ":"
decimal_integer_literal "3"
; ";"
if_statement (+287 nodes collapsed)
line_comment "// If this variable was not inlined normally, check if we ca"...
line_comment "// inline an alias of it. (If the variable was inlined, then"...
line_comment "// reference data is out of sync. We're better off just wait"...
line_comment "// the next pass.)"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression any 2:3
binary_expression any 2:3
binary_expression any 2:3
unary_expression
! "!"
identifier "maybeModifiedArguments"
&& "&&"
unary_expression
! "!"
method_invocation
identifier "staleVars"
. "."
identifier "contains"
argument_list
( "("
identifier "v"
) ")"
&& "&&"
method_invocation
identifier "referenceInfo"
. "."
identifier "isWellDefined"
argument_list
( "("
) ")"
&& "&&"
method_invocation
identifier "referenceInfo"
. "."
identifier "isAssignedOnceInLifetime"
argument_list
( "("
) ")"
) ")"
block (+209 nodes collapsed)
} "}"
block_comment "/**\n * If there are any variable references in the given"...
method_declaration (+107 nodes collapsed)
block_comment "/**\n * Whether the given variable is forbidden from bein"...
method_declaration (+66 nodes collapsed)
block_comment "/**\n * Do the actual work of inlining a single declarati"...
method_declaration (+183 nodes collapsed)
block_comment "/**\n * Inline an immutable variable into all of its refe"...
method_declaration (+103 nodes collapsed)
block_comment "/**\n * Inline a declared constant.\n */"
method_declaration (+106 nodes collapsed)
block_comment "/**\n * Remove the given VAR declaration.\n */"
method_declaration (+117 nodes collapsed)
block_comment "/**\n * Replace the given reference with the given value "...
method_declaration (+112 nodes collapsed)
block_comment "/**\n * Determines whether the given variable is declared"...
method_declaration (+175 nodes collapsed)
block_comment "/**\n * Compute whether the given string is worth inlinin"...
method_declaration (+171 nodes collapsed)
block_comment "/**\n * @return true if the provided reference and declar"...
method_declaration (+373 nodes collapsed)
block_comment "/**\n * If the value is a literal, we can cross more boun"...
method_declaration (+44 nodes collapsed)
block_comment "/**\n * If the value of a variable is not constant, then "...
method_declaration (+303 nodes collapsed)
block_comment "/**\n * @return true if the reference is a normal VAR or "...
method_declaration (+76 nodes collapsed)
block_comment "/**\n * @return Whether there is a initial value.\n */"
method_declaration (+144 nodes collapsed)
block_comment "/**\n * @return true if the reference is a candidate for "...
method_declaration (+37 nodes collapsed)
block_comment "/**\n * Determines whether the reference collection descr"...
method_declaration (+378 nodes collapsed)
} "}"
} "}"