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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 12528004: Check for canBePrimitiveNumber when doing the intersection on a number type. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/types.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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // in the remaining optimizations. 432 // in the remaining optimizations.
433 return super.visitRelational(node); 433 return super.visitRelational(node);
434 } 434 }
435 435
436 HInstruction handleIdentityCheck(HRelational node) { 436 HInstruction handleIdentityCheck(HRelational node) {
437 HInstruction left = node.left; 437 HInstruction left = node.left;
438 HInstruction right = node.right; 438 HInstruction right = node.right;
439 HType leftType = left.instructionType; 439 HType leftType = left.instructionType;
440 HType rightType = right.instructionType; 440 HType rightType = right.instructionType;
441 441
442 // We don't optimize on numbers to preserve the runtime semantics. 442 // Intersection of int and double return conflicting, so
443 // we don't optimize on numbers to preserve the runtime semantics.
443 if (!(left.isNumberOrNull() && right.isNumberOrNull()) && 444 if (!(left.isNumberOrNull() && right.isNumberOrNull()) &&
444 leftType.intersection(rightType, compiler).isConflicting()) { 445 leftType.intersection(rightType, compiler).isConflicting()) {
445 return graph.addConstantBool(false, constantSystem); 446 return graph.addConstantBool(false, constantSystem);
446 } 447 }
447 448
448 if (left.isConstantBoolean() && right.isBoolean()) { 449 if (left.isConstantBoolean() && right.isBoolean()) {
449 HConstant constant = left; 450 HConstant constant = left;
450 if (constant.constant.isTrue()) { 451 if (constant.constant.isTrue()) {
451 return right; 452 return right;
452 } else { 453 } else {
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 HBasicBlock block = user.block; 1543 HBasicBlock block = user.block;
1543 block.addAfter(user, interceptor); 1544 block.addAfter(user, interceptor);
1544 block.rewrite(user, interceptor); 1545 block.rewrite(user, interceptor);
1545 block.remove(user); 1546 block.remove(user);
1546 1547
1547 // The interceptor will be removed in the dead code elimination 1548 // The interceptor will be removed in the dead code elimination
1548 // phase. Note that removing it here would not work because of how 1549 // phase. Note that removing it here would not work because of how
1549 // the [visitBasicBlock] is implemented. 1550 // the [visitBasicBlock] is implemented.
1550 } 1551 }
1551 } 1552 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/ssa/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698