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

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

Issue 12211112: Start work on a non-complete type inferrer. Currently only analyzes return types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
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 HVisitor<R> { 7 abstract class HVisitor<R> {
8 R visitAdd(HAdd node); 8 R visitAdd(HAdd node);
9 R visitBailoutTarget(HBailoutTarget node); 9 R visitBailoutTarget(HBailoutTarget node);
10 R visitBitAnd(HBitAnd node); 10 R visitBitAnd(HBitAnd node);
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 && element == other.element; 1362 && element == other.element;
1363 } 1363 }
1364 1364
1365 HType computeDesiredTypeForInput(HInstruction input, 1365 HType computeDesiredTypeForInput(HInstruction input,
1366 HTypeMap types, 1366 HTypeMap types,
1367 Compiler compiler) { 1367 Compiler compiler) {
1368 return specializer.computeDesiredTypeForInput(this, input, types, compiler); 1368 return specializer.computeDesiredTypeForInput(this, input, types, compiler);
1369 } 1369 }
1370 1370
1371 HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) { 1371 HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
1372 return specializer.computeTypeFromInputTypes(this, types, compiler); 1372 HType type = specializer.computeTypeFromInputTypes(this, types, compiler);
1373 return type.isUnknown() ? guaranteedType : type;
1373 } 1374 }
1374 } 1375 }
1375 1376
1376 class HInvokeClosure extends HInvokeDynamic { 1377 class HInvokeClosure extends HInvokeDynamic {
1377 HInvokeClosure(Selector selector, List<HInstruction> inputs) 1378 HInvokeClosure(Selector selector, List<HInstruction> inputs)
1378 : super(selector, null, inputs) { 1379 : super(selector, null, inputs) {
1379 assert(selector.isClosureCall()); 1380 assert(selector.isClosureCall());
1380 } 1381 }
1381 accept(HVisitor visitor) => visitor.visitInvokeClosure(this); 1382 accept(HVisitor visitor) => visitor.visitInvokeClosure(this);
1382 } 1383 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 accept(HVisitor visitor) => visitor.visitSwitch(this); 1665 accept(HVisitor visitor) => visitor.visitSwitch(this);
1665 1666
1666 String toString() => "HSwitch cases = $inputs"; 1667 String toString() => "HSwitch cases = $inputs";
1667 } 1668 }
1668 1669
1669 // TODO(floitsch): Should HBinaryArithmetic really be the super class of 1670 // TODO(floitsch): Should HBinaryArithmetic really be the super class of
1670 // HBinaryBitOp? 1671 // HBinaryBitOp?
1671 abstract class HBinaryBitOp extends HBinaryArithmetic { 1672 abstract class HBinaryBitOp extends HBinaryArithmetic {
1672 HBinaryBitOp(HInstruction left, HInstruction right) : super(left, right); 1673 HBinaryBitOp(HInstruction left, HInstruction right) : super(left, right);
1673 HType get guaranteedType => HType.INTEGER; 1674 HType get guaranteedType => HType.INTEGER;
1675 HType computeTypeFromInputTypes(HTypeMap types, Compiler compiler) {
1676 return guaranteedType;
1677 }
1674 } 1678 }
1675 1679
1676 class HShiftLeft extends HBinaryBitOp { 1680 class HShiftLeft extends HBinaryBitOp {
1677 HShiftLeft(HInstruction left, HInstruction right) : super(left, right); 1681 HShiftLeft(HInstruction left, HInstruction right) : super(left, right);
1678 accept(HVisitor visitor) => visitor.visitShiftLeft(this); 1682 accept(HVisitor visitor) => visitor.visitShiftLeft(this);
1679 1683
1680 BinaryOperation operation(ConstantSystem constantSystem) 1684 BinaryOperation operation(ConstantSystem constantSystem)
1681 => constantSystem.shiftLeft; 1685 => constantSystem.shiftLeft;
1682 int typeCode() => HInstruction.SHIFT_LEFT_TYPECODE; 1686 int typeCode() => HInstruction.SHIFT_LEFT_TYPECODE;
1683 bool typeEquals(other) => other is HShiftLeft; 1687 bool typeEquals(other) => other is HShiftLeft;
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 HBasicBlock get start => expression.start; 2705 HBasicBlock get start => expression.start;
2702 HBasicBlock get end { 2706 HBasicBlock get end {
2703 // We don't create a switch block if there are no cases. 2707 // We don't create a switch block if there are no cases.
2704 assert(!statements.isEmpty); 2708 assert(!statements.isEmpty);
2705 return statements.last.end; 2709 return statements.last.end;
2706 } 2710 }
2707 2711
2708 bool accept(HStatementInformationVisitor visitor) => 2712 bool accept(HStatementInformationVisitor visitor) =>
2709 visitor.visitSwitchInfo(this); 2713 visitor.visitSwitchInfo(this);
2710 } 2714 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698