| Index: sdk/lib/_internal/compiler/implementation/ssa/variable_allocator.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/variable_allocator.dart b/sdk/lib/_internal/compiler/implementation/ssa/variable_allocator.dart
|
| index 0f887b1a416f76e381a8dbb6a5bf45165e10b750..b416c3fecbb98e23be5d2912a7a242f4bf5e2ac1 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/ssa/variable_allocator.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/variable_allocator.dart
|
| @@ -287,7 +287,9 @@ class SsaLiveIntervalBuilder extends HBaseVisitor {
|
|
|
| // If the block is a loop header, we can remove the loop marker,
|
| // because it will just recompute the loop phis.
|
| - if (block.isLoopHeader()) {
|
| + // We also check if this loop header has any back edges. If not,
|
| + // we know there is no loop marker for it.
|
| + if (block.isLoopHeader() && block.predecessors.length > 1) {
|
| updateLoopMarker(block);
|
| }
|
| }
|
| @@ -507,16 +509,15 @@ class VariableNamer {
|
| name = names.ownName[temp];
|
| } while (name == null && temp is HCheck);
|
| if (name != null) return addAllocatedName(instruction, name);
|
| - } else if (instruction is HParameterValue) {
|
| - HParameterValue parameter = instruction;
|
| - name = parameterNames[parameter.sourceElement];
|
| - if (name == null) {
|
| - name = allocateWithHint(parameter.sourceElement.name.slowToString());
|
| - }
|
| - return addAllocatedName(instruction, name);
|
| }
|
|
|
| - if (instruction.sourceElement != null) {
|
| + // The dom/html libraries have inline JS code that reference
|
| + // parameter names directly. Long-term such code will be rejected.
|
| + // Now, just don't mangle the parameter name.
|
| + if (instruction is HParameterValue
|
| + && instruction.sourceElement.enclosingElement.isNative()) {
|
| + name = instruction.sourceElement.name.slowToString();
|
| + } else if (instruction.sourceElement != null) {
|
| name = allocateWithHint(instruction.sourceElement.name.slowToString());
|
| } else {
|
| // We could not find an element for the instruction. If the
|
| @@ -534,6 +535,9 @@ class VariableNamer {
|
| }
|
|
|
| String addAllocatedName(HInstruction instruction, String name) {
|
| + if (instruction is HParameterValue) {
|
| + parameterNames[instruction.sourceElement] = name;
|
| + }
|
| usedNames.add(name);
|
| names.addNameUsed(name);
|
| names.ownName[instruction] = name;
|
| @@ -611,11 +615,11 @@ class SsaVariableAllocator extends HBaseVisitor {
|
| * have no users or that are generated at use site does not need a name.
|
| */
|
| bool needsName(HInstruction instruction) {
|
| - if (instruction.usedBy.isEmpty) return false;
|
| // TODO(ngeoffray): locals/parameters are being generated at use site,
|
| // but we need a name for them. We should probably not make
|
| // them generate at use site to make things simpler.
|
| if (instruction is HLocalValue && instruction is !HThis) return true;
|
| + if (instruction.usedBy.isEmpty) return false;
|
| if (generateAtUseSite.contains(instruction)) return false;
|
| // A [HCheck] instruction that has control flow needs a name only if its
|
| // checked input needs a name (e.g. a check [HConstant] does not
|
|
|