Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/graph-inl.h" | 5 #include "src/compiler/graph-inl.h" |
| 6 #include "src/compiler/js-operator.h" | 6 #include "src/compiler/js-operator.h" |
| 7 #include "src/compiler/node.h" | 7 #include "src/compiler/node.h" |
| 8 #include "src/compiler/node-properties-inl.h" | 8 #include "src/compiler/node-properties-inl.h" |
| 9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
| 10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 807 | 807 |
| 808 | 808 |
| 809 Bounds Typer::Visitor::TypeStoreElement(Node* node) { | 809 Bounds Typer::Visitor::TypeStoreElement(Node* node) { |
| 810 UNREACHABLE(); | 810 UNREACHABLE(); |
| 811 return Bounds(); | 811 return Bounds(); |
| 812 } | 812 } |
| 813 | 813 |
| 814 | 814 |
| 815 // Machine operators. | 815 // Machine operators. |
| 816 | 816 |
| 817 // TODO(rossberg): implement | 817 |
| 818 #define DEFINE_METHOD(x) \ | 818 Bounds Typer::Visitor::TypeLoad(Node* node) { |
| 819 Bounds Typer::Visitor::Type##x(Node* node) { return Bounds(Type::None()); } | 819 return Bounds::Unbounded(zone()); |
| 820 MACHINE_OP_LIST(DEFINE_METHOD) | 820 } |
| 821 #undef DEFINE_METHOD | 821 |
| 822 | |
| 823 Bounds Typer::Visitor::TypeStore(Node* node) { | |
| 824 UNREACHABLE(); | |
| 825 return Bounds(); | |
| 826 } | |
| 827 | |
| 828 | |
| 829 Bounds Typer::Visitor::TypeWord32And(Node* node) { | |
| 830 return Bounds(Type::Integral32()); | |
| 831 } | |
| 832 | |
| 833 | |
| 834 Bounds Typer::Visitor::TypeWord32Or(Node* node) { | |
| 835 return Bounds(Type::Integral32()); | |
| 836 } | |
| 837 | |
| 838 | |
| 839 Bounds Typer::Visitor::TypeWord32Xor(Node* node) { | |
| 840 return Bounds(Type::Integral32()); | |
| 841 } | |
| 842 | |
| 843 | |
| 844 Bounds Typer::Visitor::TypeWord32Shl(Node* node) { | |
| 845 return Bounds(Type::Integral32()); | |
| 846 } | |
| 847 | |
| 848 | |
| 849 Bounds Typer::Visitor::TypeWord32Shr(Node* node) { | |
| 850 return Bounds(Type::Integral32()); | |
| 851 } | |
| 852 | |
| 853 | |
| 854 Bounds Typer::Visitor::TypeWord32Sar(Node* node) { | |
| 855 return Bounds(Type::Integral32()); | |
| 856 } | |
| 857 | |
| 858 | |
| 859 Bounds Typer::Visitor::TypeWord32Ror(Node* node) { | |
| 860 return Bounds(Type::Integral32()); | |
| 861 } | |
| 862 | |
| 863 | |
| 864 Bounds Typer::Visitor::TypeWord32Equal(Node* node) { | |
| 865 return Bounds(Type::Boolean()); | |
| 866 } | |
| 867 | |
| 868 | |
| 869 Bounds Typer::Visitor::TypeWord64And(Node* node) { | |
| 870 return Bounds(Type::Internal()); | |
| 871 } | |
| 872 | |
| 873 | |
| 874 Bounds Typer::Visitor::TypeWord64Or(Node* node) { | |
| 875 return Bounds(Type::Internal()); | |
| 876 } | |
| 877 | |
| 878 | |
| 879 Bounds Typer::Visitor::TypeWord64Xor(Node* node) { | |
| 880 return Bounds(Type::Internal()); | |
| 881 } | |
| 882 | |
| 883 | |
| 884 Bounds Typer::Visitor::TypeWord64Shl(Node* node) { | |
| 885 return Bounds(Type::Internal()); | |
| 886 } | |
| 887 | |
| 888 | |
| 889 Bounds Typer::Visitor::TypeWord64Shr(Node* node) { | |
| 890 return Bounds(Type::Internal()); | |
| 891 } | |
| 892 | |
| 893 | |
| 894 Bounds Typer::Visitor::TypeWord64Sar(Node* node) { | |
| 895 return Bounds(Type::Internal()); | |
| 896 } | |
| 897 | |
| 898 | |
| 899 Bounds Typer::Visitor::TypeWord64Ror(Node* node) { | |
| 900 return Bounds(Type::Internal()); | |
| 901 } | |
| 902 | |
| 903 | |
| 904 Bounds Typer::Visitor::TypeWord64Equal(Node* node) { | |
| 905 return Bounds(Type::Boolean()); | |
| 906 } | |
| 907 | |
| 908 | |
| 909 Bounds Typer::Visitor::TypeInt32Add(Node* node) { | |
| 910 return Bounds(Type::Integral32()); | |
| 911 } | |
| 912 | |
| 913 | |
| 914 Bounds Typer::Visitor::TypeInt32AddWithOverflow(Node* node) { | |
| 915 return Bounds(Type::Integral32()); | |
|
rossberg
2014/10/14 12:20:06
I believe this actually returns a pair, so it curr
neis1
2014/10/14 12:26:57
Done.
| |
| 916 } | |
| 917 | |
| 918 | |
| 919 Bounds Typer::Visitor::TypeInt32Sub(Node* node) { | |
| 920 return Bounds(Type::Integral32()); | |
| 921 } | |
| 922 | |
| 923 | |
| 924 Bounds Typer::Visitor::TypeInt32SubWithOverflow(Node* node) { | |
| 925 return Bounds(Type::Integral32()); | |
|
rossberg
2014/10/14 12:20:06
Same here.
neis1
2014/10/14 12:26:57
Done.
| |
| 926 } | |
| 927 | |
| 928 | |
| 929 Bounds Typer::Visitor::TypeInt32Mul(Node* node) { | |
| 930 return Bounds(Type::Integral32()); | |
| 931 } | |
| 932 | |
| 933 | |
| 934 Bounds Typer::Visitor::TypeInt32Div(Node* node) { | |
| 935 return Bounds(Type::Integral32()); | |
| 936 } | |
| 937 | |
| 938 | |
| 939 Bounds Typer::Visitor::TypeInt32Mod(Node* node) { | |
| 940 return Bounds(Type::Integral32()); | |
| 941 } | |
| 942 | |
| 943 | |
| 944 Bounds Typer::Visitor::TypeInt32LessThan(Node* node) { | |
| 945 return Bounds(Type::Boolean()); | |
| 946 } | |
| 947 | |
| 948 | |
| 949 Bounds Typer::Visitor::TypeInt32LessThanOrEqual(Node* node) { | |
| 950 return Bounds(Type::Boolean()); | |
| 951 } | |
| 952 | |
| 953 | |
| 954 Bounds Typer::Visitor::TypeUint32Div(Node* node) { | |
| 955 return Bounds(Type::Unsigned32()); | |
| 956 } | |
| 957 | |
| 958 | |
| 959 Bounds Typer::Visitor::TypeUint32LessThan(Node* node) { | |
| 960 return Bounds(Type::Boolean()); | |
| 961 } | |
| 962 | |
| 963 | |
| 964 Bounds Typer::Visitor::TypeUint32LessThanOrEqual(Node* node) { | |
| 965 return Bounds(Type::Boolean()); | |
| 966 } | |
| 967 | |
| 968 | |
| 969 Bounds Typer::Visitor::TypeUint32Mod(Node* node) { | |
| 970 return Bounds(Type::Unsigned32()); | |
| 971 } | |
| 972 | |
| 973 | |
| 974 Bounds Typer::Visitor::TypeInt64Add(Node* node) { | |
| 975 return Bounds(Type::Internal()); | |
| 976 } | |
| 977 | |
| 978 | |
| 979 Bounds Typer::Visitor::TypeInt64Sub(Node* node) { | |
| 980 return Bounds(Type::Internal()); | |
| 981 } | |
| 982 | |
| 983 | |
| 984 Bounds Typer::Visitor::TypeInt64Mul(Node* node) { | |
| 985 return Bounds(Type::Internal()); | |
| 986 } | |
| 987 | |
| 988 | |
| 989 Bounds Typer::Visitor::TypeInt64Div(Node* node) { | |
| 990 return Bounds(Type::Internal()); | |
| 991 } | |
| 992 | |
| 993 | |
| 994 Bounds Typer::Visitor::TypeInt64Mod(Node* node) { | |
| 995 return Bounds(Type::Internal()); | |
| 996 } | |
| 997 | |
| 998 | |
| 999 Bounds Typer::Visitor::TypeInt64LessThan(Node* node) { | |
| 1000 return Bounds(Type::Boolean()); | |
| 1001 } | |
| 1002 | |
| 1003 | |
| 1004 Bounds Typer::Visitor::TypeInt64LessThanOrEqual(Node* node) { | |
| 1005 return Bounds(Type::Boolean()); | |
| 1006 } | |
| 1007 | |
| 1008 | |
| 1009 Bounds Typer::Visitor::TypeUint64Div(Node* node) { | |
| 1010 return Bounds(Type::Internal()); | |
| 1011 } | |
| 1012 | |
| 1013 | |
| 1014 Bounds Typer::Visitor::TypeUint64LessThan(Node* node) { | |
| 1015 return Bounds(Type::Boolean()); | |
| 1016 } | |
| 1017 | |
| 1018 | |
| 1019 Bounds Typer::Visitor::TypeUint64Mod(Node* node) { | |
| 1020 return Bounds(Type::Internal()); | |
| 1021 } | |
| 1022 | |
| 1023 | |
| 1024 Bounds Typer::Visitor::TypeChangeFloat32ToFloat64(Node* node) { | |
| 1025 return Bounds(Type::Intersect( | |
| 1026 Type::Number(), Type::UntaggedFloat64(), zone())); | |
| 1027 } | |
| 1028 | |
| 1029 | |
| 1030 Bounds Typer::Visitor::TypeChangeFloat64ToInt32(Node* node) { | |
| 1031 return Bounds(Type::Intersect( | |
| 1032 Type::Signed32(), Type::UntaggedInt32(), zone())); | |
| 1033 } | |
| 1034 | |
| 1035 | |
| 1036 Bounds Typer::Visitor::TypeChangeFloat64ToUint32(Node* node) { | |
| 1037 return Bounds(Type::Intersect( | |
| 1038 Type::Unsigned32(), Type::UntaggedInt32(), zone())); | |
| 1039 } | |
| 1040 | |
| 1041 | |
| 1042 Bounds Typer::Visitor::TypeChangeInt32ToFloat64(Node* node) { | |
| 1043 return Bounds(Type::Intersect( | |
| 1044 Type::Number(), Type::UntaggedFloat64(), zone())); | |
|
rossberg
2014/10/14 12:20:06
Signed32
neis1
2014/10/14 12:26:57
Done. Analogously below.
| |
| 1045 } | |
| 1046 | |
| 1047 | |
| 1048 Bounds Typer::Visitor::TypeChangeInt32ToInt64(Node* node) { | |
| 1049 return Bounds(Type::Internal()); | |
| 1050 } | |
| 1051 | |
| 1052 | |
| 1053 Bounds Typer::Visitor::TypeChangeUint32ToFloat64(Node* node) { | |
| 1054 return Bounds(Type::Intersect( | |
| 1055 Type::Number(), Type::UntaggedFloat64(), zone())); | |
| 1056 } | |
| 1057 | |
| 1058 | |
| 1059 Bounds Typer::Visitor::TypeChangeUint32ToUint64(Node* node) { | |
| 1060 return Bounds(Type::Internal()); | |
| 1061 } | |
| 1062 | |
| 1063 | |
| 1064 Bounds Typer::Visitor::TypeTruncateFloat64ToFloat32(Node* node) { | |
| 1065 return Bounds(Type::Intersect( | |
| 1066 Type::Number(), Type::UntaggedFloat32(), zone())); | |
| 1067 } | |
| 1068 | |
| 1069 | |
| 1070 Bounds Typer::Visitor::TypeTruncateFloat64ToInt32(Node* node) { | |
| 1071 return Bounds(Type::Intersect( | |
| 1072 Type::Signed32(), Type::UntaggedInt32(), zone())); | |
| 1073 } | |
| 1074 | |
| 1075 | |
| 1076 Bounds Typer::Visitor::TypeTruncateInt64ToInt32(Node* node) { | |
| 1077 return Bounds(Type::Intersect( | |
| 1078 Type::Signed32(), Type::UntaggedInt32(), zone())); | |
| 1079 } | |
| 1080 | |
| 1081 | |
| 1082 Bounds Typer::Visitor::TypeFloat64Add(Node* node) { | |
| 1083 return Bounds(Type::Number()); | |
| 1084 } | |
| 1085 | |
| 1086 | |
| 1087 Bounds Typer::Visitor::TypeFloat64Sub(Node* node) { | |
| 1088 return Bounds(Type::Number()); | |
| 1089 } | |
| 1090 | |
| 1091 | |
| 1092 Bounds Typer::Visitor::TypeFloat64Mul(Node* node) { | |
| 1093 return Bounds(Type::Number()); | |
| 1094 } | |
| 1095 | |
| 1096 | |
| 1097 Bounds Typer::Visitor::TypeFloat64Div(Node* node) { | |
| 1098 return Bounds(Type::Number()); | |
| 1099 } | |
| 1100 | |
| 1101 | |
| 1102 Bounds Typer::Visitor::TypeFloat64Mod(Node* node) { | |
| 1103 return Bounds(Type::Number()); | |
| 1104 } | |
| 1105 | |
| 1106 | |
| 1107 Bounds Typer::Visitor::TypeFloat64Sqrt(Node* node) { | |
| 1108 return Bounds(Type::Number()); | |
| 1109 } | |
| 1110 | |
| 1111 | |
| 1112 Bounds Typer::Visitor::TypeFloat64Equal(Node* node) { | |
| 1113 return Bounds(Type::Boolean()); | |
| 1114 } | |
| 1115 | |
| 1116 | |
| 1117 Bounds Typer::Visitor::TypeFloat64LessThan(Node* node) { | |
| 1118 return Bounds(Type::Boolean()); | |
| 1119 } | |
| 1120 | |
| 1121 | |
| 1122 Bounds Typer::Visitor::TypeFloat64LessThanOrEqual(Node* node) { | |
| 1123 return Bounds(Type::Boolean()); | |
| 1124 } | |
| 1125 | |
| 1126 | |
| 1127 Bounds Typer::Visitor::TypeLoadStackPointer(Node* node) { | |
| 1128 return Bounds(Type::Internal()); | |
| 1129 } | |
| 822 | 1130 |
| 823 | 1131 |
| 824 // Heap constants. | 1132 // Heap constants. |
| 825 | 1133 |
| 1134 | |
| 826 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1135 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
| 827 if (value->IsJSFunction()) { | 1136 if (value->IsJSFunction()) { |
| 828 if (JSFunction::cast(*value)->shared()->HasBuiltinFunctionId()) { | 1137 if (JSFunction::cast(*value)->shared()->HasBuiltinFunctionId()) { |
| 829 switch (JSFunction::cast(*value)->shared()->builtin_function_id()) { | 1138 switch (JSFunction::cast(*value)->shared()->builtin_function_id()) { |
| 830 // TODO(rossberg): can't express overloading | 1139 // TODO(rossberg): can't express overloading |
| 831 case kMathAbs: | 1140 case kMathAbs: |
| 832 return typer_->number_fun1_; | 1141 return typer_->number_fun1_; |
| 833 case kMathAcos: | 1142 case kMathAcos: |
| 834 return typer_->number_fun1_; | 1143 return typer_->number_fun1_; |
| 835 case kMathAsin: | 1144 case kMathAsin: |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 907 } | 1216 } |
| 908 | 1217 |
| 909 | 1218 |
| 910 void Typer::DecorateGraph(Graph* graph) { | 1219 void Typer::DecorateGraph(Graph* graph) { |
| 911 graph->AddDecorator(new (zone()) TyperDecorator(this)); | 1220 graph->AddDecorator(new (zone()) TyperDecorator(this)); |
| 912 } | 1221 } |
| 913 | 1222 |
| 914 } | 1223 } |
| 915 } | 1224 } |
| 916 } // namespace v8::internal::compiler | 1225 } // namespace v8::internal::compiler |
| OLD | NEW |