| OLD | NEW |
| 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 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flow_graph_allocator.h" | 9 #include "vm/flow_graph_allocator.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 | 918 |
| 919 | 919 |
| 920 RawAbstractType* AllocateObjectWithBoundsCheckComp::CompileType() const { | 920 RawAbstractType* AllocateObjectWithBoundsCheckComp::CompileType() const { |
| 921 // TODO(regis): Be more specific. | 921 // TODO(regis): Be more specific. |
| 922 return Type::DynamicType(); | 922 return Type::DynamicType(); |
| 923 } | 923 } |
| 924 | 924 |
| 925 | 925 |
| 926 RawAbstractType* LoadVMFieldComp::CompileType() const { | 926 RawAbstractType* LoadVMFieldComp::CompileType() const { |
| 927 // Type may be null if the field is a VM field, e.g. context parent. | 927 // Type may be null if the field is a VM field, e.g. context parent. |
| 928 return type().raw(); | 928 // Keep it as null for debug purposes and do not return Dynamic in production |
| 929 // mode, since misuse of the type would remain undetected. |
| 930 if (type().IsNull()) { |
| 931 return AbstractType::null(); |
| 932 } |
| 933 if (FLAG_enable_type_checks) { |
| 934 return type().raw(); |
| 935 } |
| 936 return Type::DynamicType(); |
| 929 } | 937 } |
| 930 | 938 |
| 931 | 939 |
| 932 RawAbstractType* StoreVMFieldComp::CompileType() const { | 940 RawAbstractType* StoreVMFieldComp::CompileType() const { |
| 933 return value()->CompileType(); | 941 return value()->CompileType(); |
| 934 } | 942 } |
| 935 | 943 |
| 936 | 944 |
| 937 RawAbstractType* InstantiateTypeArgumentsComp::CompileType() const { | 945 RawAbstractType* InstantiateTypeArgumentsComp::CompileType() const { |
| 938 return AbstractType::null(); | 946 return AbstractType::null(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 968 return AbstractType::null(); | 976 return AbstractType::null(); |
| 969 } | 977 } |
| 970 | 978 |
| 971 | 979 |
| 972 RawAbstractType* CheckStackOverflowComp::CompileType() const { | 980 RawAbstractType* CheckStackOverflowComp::CompileType() const { |
| 973 return AbstractType::null(); | 981 return AbstractType::null(); |
| 974 } | 982 } |
| 975 | 983 |
| 976 | 984 |
| 977 RawAbstractType* BinarySmiOpComp::CompileType() const { | 985 RawAbstractType* BinarySmiOpComp::CompileType() const { |
| 978 ObjectStore* object_store = Isolate::Current()->object_store(); | 986 return (op_kind() == Token::kSHL) ? Type::IntInterface() : Type::SmiType(); |
| 979 return (op_kind() == Token::kSHL) | |
| 980 ? Type::IntInterface() | |
| 981 : object_store->smi_type(); | |
| 982 } | 987 } |
| 983 | 988 |
| 984 | 989 |
| 985 intptr_t BinarySmiOpComp::ResultCid() const { | 990 intptr_t BinarySmiOpComp::ResultCid() const { |
| 986 return (op_kind() == Token::kSHL) ? kDynamicCid : kSmiCid; | 991 return (op_kind() == Token::kSHL) ? kDynamicCid : kSmiCid; |
| 987 } | 992 } |
| 988 | 993 |
| 989 | 994 |
| 990 bool BinarySmiOpComp::CanDeoptimize() const { | 995 bool BinarySmiOpComp::CanDeoptimize() const { |
| 991 switch (op_kind()) { | 996 switch (op_kind()) { |
| 992 case Token::kBIT_AND: | 997 case Token::kBIT_AND: |
| 993 case Token::kBIT_OR: | 998 case Token::kBIT_OR: |
| 994 case Token::kBIT_XOR: | 999 case Token::kBIT_XOR: |
| 995 return false; | 1000 return false; |
| 996 default: | 1001 default: |
| 997 return true; | 1002 return true; |
| 998 } | 1003 } |
| 999 } | 1004 } |
| 1000 | 1005 |
| 1001 | 1006 |
| 1002 RawAbstractType* BinaryMintOpComp::CompileType() const { | 1007 RawAbstractType* BinaryMintOpComp::CompileType() const { |
| 1003 ObjectStore* object_store = Isolate::Current()->object_store(); | 1008 return Type::MintType(); |
| 1004 return object_store->mint_type(); | |
| 1005 } | 1009 } |
| 1006 | 1010 |
| 1007 | 1011 |
| 1008 intptr_t BinaryMintOpComp::ResultCid() const { | 1012 intptr_t BinaryMintOpComp::ResultCid() const { |
| 1009 return kMintCid; | 1013 return kMintCid; |
| 1010 } | 1014 } |
| 1011 | 1015 |
| 1012 | 1016 |
| 1013 RawAbstractType* BinaryDoubleOpComp::CompileType() const { | 1017 RawAbstractType* BinaryDoubleOpComp::CompileType() const { |
| 1014 return Type::DoubleInterface(); | 1018 return Type::DoubleInterface(); |
| 1015 } | 1019 } |
| 1016 | 1020 |
| 1017 | 1021 |
| 1018 intptr_t BinaryDoubleOpComp::ResultCid() const { | 1022 intptr_t BinaryDoubleOpComp::ResultCid() const { |
| 1019 return kDoubleCid; | 1023 return kDoubleCid; |
| 1020 } | 1024 } |
| 1021 | 1025 |
| 1022 | 1026 |
| 1023 RawAbstractType* UnarySmiOpComp::CompileType() const { | 1027 RawAbstractType* UnarySmiOpComp::CompileType() const { |
| 1024 return Type::IntInterface(); | 1028 return Type::SmiType(); |
| 1025 } | 1029 } |
| 1026 | 1030 |
| 1027 | 1031 |
| 1028 RawAbstractType* NumberNegateComp::CompileType() const { | 1032 RawAbstractType* NumberNegateComp::CompileType() const { |
| 1029 // Implemented only for doubles. | 1033 // Implemented only for doubles. |
| 1030 return Type::DoubleInterface(); | 1034 return Type::DoubleInterface(); |
| 1031 } | 1035 } |
| 1032 | 1036 |
| 1033 | 1037 |
| 1034 RawAbstractType* DoubleToDoubleComp::CompileType() const { | 1038 RawAbstractType* DoubleToDoubleComp::CompileType() const { |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 ? UseDefinition(values()[i]->AsUse()->definition()) | 1534 ? UseDefinition(values()[i]->AsUse()->definition()) |
| 1531 : val); | 1535 : val); |
| 1532 } | 1536 } |
| 1533 return copy; | 1537 return copy; |
| 1534 } | 1538 } |
| 1535 | 1539 |
| 1536 | 1540 |
| 1537 #undef __ | 1541 #undef __ |
| 1538 | 1542 |
| 1539 } // namespace dart | 1543 } // namespace dart |
| OLD | NEW |