OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "vm/flow_graph_type_propagator.h" | 5 #include "vm/flow_graph_type_propagator.h" |
6 | 6 |
7 #include "vm/cha.h" | 7 #include "vm/cha.h" |
8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
9 #include "vm/il_printer.h" | 9 #include "vm/il_printer.h" |
10 | 10 |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 | 638 |
639 if (result.IsNone()) { | 639 if (result.IsNone()) { |
640 ASSERT(Type()->IsNone()); | 640 ASSERT(Type()->IsNone()); |
641 return false; | 641 return false; |
642 } | 642 } |
643 | 643 |
644 return UpdateType(result); | 644 return UpdateType(result); |
645 } | 645 } |
646 | 646 |
647 | 647 |
| 648 CompileType RedefinitionInstr::ComputeType() const { |
| 649 return CompileType::None(); |
| 650 } |
| 651 |
| 652 |
| 653 bool RedefinitionInstr::RecomputeType() { |
| 654 return UpdateType(*value()->Type()); |
| 655 } |
| 656 |
| 657 |
648 CompileType IfThenElseInstr::ComputeType() const { | 658 CompileType IfThenElseInstr::ComputeType() const { |
649 ASSERT(InputCount() == 2); | 659 ASSERT(InputCount() == 2); |
650 return CompileType::FromCid(kSmiCid); | 660 return CompileType::FromCid(kSmiCid); |
651 } | 661 } |
652 | 662 |
653 | 663 |
654 CompileType ParameterInstr::ComputeType() const { | 664 CompileType ParameterInstr::ComputeType() const { |
655 // Note that returning the declared type of the formal parameter would be | 665 // Note that returning the declared type of the formal parameter would be |
656 // incorrect, because ParameterInstr is used as input to the type check | 666 // incorrect, because ParameterInstr is used as input to the type check |
657 // verifying the run time type of the passed-in parameter and this check would | 667 // verifying the run time type of the passed-in parameter and this check would |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 // TODO(vegorov): Incorporate type arguments into the returned type. | 882 // TODO(vegorov): Incorporate type arguments into the returned type. |
873 return CompileType::FromCid(cid_); | 883 return CompileType::FromCid(cid_); |
874 } | 884 } |
875 | 885 |
876 | 886 |
877 CompileType LoadUntaggedInstr::ComputeType() const { | 887 CompileType LoadUntaggedInstr::ComputeType() const { |
878 return CompileType::Dynamic(); | 888 return CompileType::Dynamic(); |
879 } | 889 } |
880 | 890 |
881 | 891 |
| 892 CompileType LoadClassIdInstr::ComputeType() const { |
| 893 return CompileType::FromCid(kSmiCid); |
| 894 } |
| 895 |
| 896 |
882 CompileType LoadFieldInstr::ComputeType() const { | 897 CompileType LoadFieldInstr::ComputeType() const { |
883 // Type may be null if the field is a VM field, e.g. context parent. | 898 // Type may be null if the field is a VM field, e.g. context parent. |
884 // Keep it as null for debug purposes and do not return dynamic in production | 899 // Keep it as null for debug purposes and do not return dynamic in production |
885 // mode, since misuse of the type would remain undetected. | 900 // mode, since misuse of the type would remain undetected. |
886 if (type().IsNull()) { | 901 if (type().IsNull()) { |
887 return CompileType::Dynamic(); | 902 return CompileType::Dynamic(); |
888 } | 903 } |
889 | 904 |
890 if (FLAG_enable_type_checks) { | 905 if (FLAG_enable_type_checks) { |
891 return CompileType::FromAbstractType(type()); | 906 return CompileType::FromAbstractType(type()); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 return CompileType::FromCid(kDoubleCid); | 1090 return CompileType::FromCid(kDoubleCid); |
1076 } | 1091 } |
1077 | 1092 |
1078 | 1093 |
1079 CompileType InvokeMathCFunctionInstr::ComputeType() const { | 1094 CompileType InvokeMathCFunctionInstr::ComputeType() const { |
1080 return CompileType::FromCid(kDoubleCid); | 1095 return CompileType::FromCid(kDoubleCid); |
1081 } | 1096 } |
1082 | 1097 |
1083 | 1098 |
1084 } // namespace dart | 1099 } // namespace dart |
OLD | NEW |