Chromium Code Reviews| 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 if (type().IsNull()) { |
| 929 return AbstractType::null(); | |
|
srdjan
2012/08/23 19:12:59
Please add comment why is that necessary, why we c
regis
2012/08/23 21:03:34
In production mode, the type of the local is not g
| |
| 930 } | |
| 931 if (FLAG_enable_type_checks) { | |
| 932 return type().raw(); | |
| 933 } | |
| 934 return Type::DynamicType(); | |
| 929 } | 935 } |
| 930 | 936 |
| 931 | 937 |
| 932 RawAbstractType* StoreVMFieldComp::CompileType() const { | 938 RawAbstractType* StoreVMFieldComp::CompileType() const { |
| 933 return value()->CompileType(); | 939 return value()->CompileType(); |
| 934 } | 940 } |
| 935 | 941 |
| 936 | 942 |
| 937 RawAbstractType* InstantiateTypeArgumentsComp::CompileType() const { | 943 RawAbstractType* InstantiateTypeArgumentsComp::CompileType() const { |
| 938 return AbstractType::null(); | 944 return AbstractType::null(); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 968 return AbstractType::null(); | 974 return AbstractType::null(); |
| 969 } | 975 } |
| 970 | 976 |
| 971 | 977 |
| 972 RawAbstractType* CheckStackOverflowComp::CompileType() const { | 978 RawAbstractType* CheckStackOverflowComp::CompileType() const { |
| 973 return AbstractType::null(); | 979 return AbstractType::null(); |
| 974 } | 980 } |
| 975 | 981 |
| 976 | 982 |
| 977 RawAbstractType* BinarySmiOpComp::CompileType() const { | 983 RawAbstractType* BinarySmiOpComp::CompileType() const { |
| 978 ObjectStore* object_store = Isolate::Current()->object_store(); | 984 return (op_kind() == Token::kSHL) ? Type::IntInterface() : Type::SmiType(); |
| 979 return (op_kind() == Token::kSHL) | |
| 980 ? Type::IntInterface() | |
| 981 : object_store->smi_type(); | |
| 982 } | 985 } |
| 983 | 986 |
| 984 | 987 |
| 985 intptr_t BinarySmiOpComp::ResultCid() const { | 988 intptr_t BinarySmiOpComp::ResultCid() const { |
| 986 return (op_kind() == Token::kSHL) ? kDynamicCid : kSmiCid; | 989 return (op_kind() == Token::kSHL) ? kDynamicCid : kSmiCid; |
| 987 } | 990 } |
| 988 | 991 |
| 989 | 992 |
| 990 bool BinarySmiOpComp::CanDeoptimize() const { | 993 bool BinarySmiOpComp::CanDeoptimize() const { |
| 991 switch (op_kind()) { | 994 switch (op_kind()) { |
| 992 case Token::kBIT_AND: | 995 case Token::kBIT_AND: |
| 993 case Token::kBIT_OR: | 996 case Token::kBIT_OR: |
| 994 case Token::kBIT_XOR: | 997 case Token::kBIT_XOR: |
| 995 return false; | 998 return false; |
| 996 default: | 999 default: |
| 997 return true; | 1000 return true; |
| 998 } | 1001 } |
| 999 } | 1002 } |
| 1000 | 1003 |
| 1001 | 1004 |
| 1002 RawAbstractType* BinaryMintOpComp::CompileType() const { | 1005 RawAbstractType* BinaryMintOpComp::CompileType() const { |
| 1003 ObjectStore* object_store = Isolate::Current()->object_store(); | 1006 return Type::MintType(); |
| 1004 return object_store->mint_type(); | |
| 1005 } | 1007 } |
| 1006 | 1008 |
| 1007 | 1009 |
| 1008 intptr_t BinaryMintOpComp::ResultCid() const { | 1010 intptr_t BinaryMintOpComp::ResultCid() const { |
| 1009 return kMintCid; | 1011 return kMintCid; |
| 1010 } | 1012 } |
| 1011 | 1013 |
| 1012 | 1014 |
| 1013 RawAbstractType* BinaryDoubleOpComp::CompileType() const { | 1015 RawAbstractType* BinaryDoubleOpComp::CompileType() const { |
| 1014 return Type::DoubleInterface(); | 1016 return Type::DoubleInterface(); |
| 1015 } | 1017 } |
| 1016 | 1018 |
| 1017 | 1019 |
| 1018 intptr_t BinaryDoubleOpComp::ResultCid() const { | 1020 intptr_t BinaryDoubleOpComp::ResultCid() const { |
| 1019 return kDoubleCid; | 1021 return kDoubleCid; |
| 1020 } | 1022 } |
| 1021 | 1023 |
| 1022 | 1024 |
| 1023 RawAbstractType* UnarySmiOpComp::CompileType() const { | 1025 RawAbstractType* UnarySmiOpComp::CompileType() const { |
| 1024 return Type::IntInterface(); | 1026 return Type::SmiType(); |
| 1025 } | 1027 } |
| 1026 | 1028 |
| 1027 | 1029 |
| 1028 RawAbstractType* NumberNegateComp::CompileType() const { | 1030 RawAbstractType* NumberNegateComp::CompileType() const { |
| 1029 // Implemented only for doubles. | 1031 // Implemented only for doubles. |
| 1030 return Type::DoubleInterface(); | 1032 return Type::DoubleInterface(); |
| 1031 } | 1033 } |
| 1032 | 1034 |
| 1033 | 1035 |
| 1034 RawAbstractType* DoubleToDoubleComp::CompileType() const { | 1036 RawAbstractType* DoubleToDoubleComp::CompileType() const { |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1530 ? UseDefinition(values()[i]->AsUse()->definition()) | 1532 ? UseDefinition(values()[i]->AsUse()->definition()) |
| 1531 : val); | 1533 : val); |
| 1532 } | 1534 } |
| 1533 return copy; | 1535 return copy; |
| 1534 } | 1536 } |
| 1535 | 1537 |
| 1536 | 1538 |
| 1537 #undef __ | 1539 #undef __ |
| 1538 | 1540 |
| 1539 } // namespace dart | 1541 } // namespace dart |
| OLD | NEW |