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

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

Issue 1148093005: Fix a bug when narrowing the result type of a field get. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
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
« no previous file with comments | « no previous file | no next file » | 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 HConstant constantInput = actualReceiver; 257 HConstant constantInput = actualReceiver;
258 StringConstantValue constant = constantInput.constant; 258 StringConstantValue constant = constantInput.constant;
259 return graph.addConstantInt(constant.length, compiler); 259 return graph.addConstantInt(constant.length, compiler);
260 } else if (actualReceiver.isConstantList()) { 260 } else if (actualReceiver.isConstantList()) {
261 HConstant constantInput = actualReceiver; 261 HConstant constantInput = actualReceiver;
262 ListConstantValue constant = constantInput.constant; 262 ListConstantValue constant = constantInput.constant;
263 return graph.addConstantInt(constant.length, compiler); 263 return graph.addConstantInt(constant.length, compiler);
264 } 264 }
265 Element element = backend.jsIndexableLength; 265 Element element = backend.jsIndexableLength;
266 bool isFixed = isFixedLength(actualReceiver.instructionType, compiler); 266 bool isFixed = isFixedLength(actualReceiver.instructionType, compiler);
267 TypeMask actualType = node.instructionType;
268 ClassWorld classWorld = compiler.world;
269 TypeMask resultType = backend.positiveIntType;
270 // If we already have computed a more specific type, keep that type.
271 if (actualType.satisfies(backend.jsUInt31Class, classWorld)) {
272 resultType = backend.uint31Type;
273 } else if (actualType.satisfies(backend.jsUInt32Class, classWorld)) {
274 resultType = backend.uint32Type;
275 }
267 HFieldGet result = new HFieldGet( 276 HFieldGet result = new HFieldGet(
268 element, actualReceiver, backend.positiveIntType, 277 element, actualReceiver, resultType,
269 isAssignable: !isFixed); 278 isAssignable: !isFixed);
270 return result; 279 return result;
271 } else if (actualReceiver.isConstantMap()) { 280 } else if (actualReceiver.isConstantMap()) {
272 HConstant constantInput = actualReceiver; 281 HConstant constantInput = actualReceiver;
273 MapConstantValue constant = constantInput.constant; 282 MapConstantValue constant = constantInput.constant;
274 return graph.addConstantInt(constant.length, compiler); 283 return graph.addConstantInt(constant.length, compiler);
275 } 284 }
276 return null; 285 return null;
277 } 286 }
278 287
(...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 2295
2287 keyedValues.forEach((receiver, values) { 2296 keyedValues.forEach((receiver, values) {
2288 result.keyedValues[receiver] = 2297 result.keyedValues[receiver] =
2289 new Map<HInstruction, HInstruction>.from(values); 2298 new Map<HInstruction, HInstruction>.from(values);
2290 }); 2299 });
2291 2300
2292 result.nonEscapingReceivers.addAll(nonEscapingReceivers); 2301 result.nonEscapingReceivers.addAll(nonEscapingReceivers);
2293 return result; 2302 return result;
2294 } 2303 }
2295 } 2304 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698