Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Side by Side Diff: pkg/compiler/lib/src/ssa/optimize.dart

Issue 1126063002: Recognize unmodifiable lists (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | sdk/lib/_internal/compiler/js_lib/js_array.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of ssa; 5 part of ssa;
6 6
7 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Run the simplifier to remove unneeded type checks inserted by 92 // Run the simplifier to remove unneeded type checks inserted by
93 // type propagation. 93 // type propagation.
94 new SsaInstructionSimplifier(constantSystem, backend, this, work), 94 new SsaInstructionSimplifier(constantSystem, backend, this, work),
95 ]; 95 ];
96 } 96 }
97 phases.forEach(runPhase); 97 phases.forEach(runPhase);
98 }); 98 });
99 } 99 }
100 } 100 }
101 101
102 bool isFixedLength(mask, Compiler compiler) { 102 bool isFixedLength(mask, Compiler compiler) {
floitsch 2015/05/06 06:28:32 Add comment in which direction this function is co
103 ClassWorld classWorld = compiler.world; 103 ClassWorld classWorld = compiler.world;
104 JavaScriptBackend backend = compiler.backend; 104 JavaScriptBackend backend = compiler.backend;
105 if (mask.isContainer && mask.length != null) { 105 if (mask.isContainer && mask.length != null) {
106 // A container on which we have inferred the length. 106 // A container on which we have inferred the length.
107 return true; 107 return true;
108 } else if (mask.containsOnly(backend.jsFixedArrayClass) 108 }
109 || mask.containsOnlyString(classWorld) 109 // TODO(sra): Recognize any combination of fixed length indexables.
110 || backend.isTypedArray(mask)) { 110 if (mask.containsOnly(backend.jsFixedArrayClass) ||
111 mask.containsOnly(backend.jsUnmodifiableArrayClass) ||
112 mask.containsOnlyString(classWorld) ||
113 backend.isTypedArray(mask)) {
111 return true; 114 return true;
112 } 115 }
113 return false; 116 return false;
114 } 117 }
115 118
116 /** 119 /**
117 * If both inputs to known operations are available execute the operation at 120 * If both inputs to known operations are available execute the operation at
118 * compile-time. 121 * compile-time.
119 */ 122 */
120 class SsaInstructionSimplifier extends HBaseVisitor 123 class SsaInstructionSimplifier extends HBaseVisitor
(...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 2282
2280 keyedValues.forEach((receiver, values) { 2283 keyedValues.forEach((receiver, values) {
2281 result.keyedValues[receiver] = 2284 result.keyedValues[receiver] =
2282 new Map<HInstruction, HInstruction>.from(values); 2285 new Map<HInstruction, HInstruction>.from(values);
2283 }); 2286 });
2284 2287
2285 result.nonEscapingReceivers.addAll(nonEscapingReceivers); 2288 result.nonEscapingReceivers.addAll(nonEscapingReceivers);
2286 return result; 2289 return result;
2287 } 2290 }
2288 } 2291 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | sdk/lib/_internal/compiler/js_lib/js_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698