OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 HCheckMaps* mapcheck, | 1006 HCheckMaps* mapcheck, |
1007 bool is_js_array, | 1007 bool is_js_array, |
1008 ElementsKind elements_kind, | 1008 ElementsKind elements_kind, |
1009 bool is_store, | 1009 bool is_store, |
1010 KeyedAccessStoreMode store_mode, | 1010 KeyedAccessStoreMode store_mode, |
1011 Representation checked_index_representation = Representation::None()); | 1011 Representation checked_index_representation = Representation::None()); |
1012 | 1012 |
1013 HInstruction* BuildStoreMap(HValue* object, HValue* map); | 1013 HInstruction* BuildStoreMap(HValue* object, HValue* map); |
1014 HInstruction* BuildStoreMap(HValue* object, Handle<Map> map); | 1014 HInstruction* BuildStoreMap(HValue* object, Handle<Map> map); |
1015 | 1015 |
1016 class CheckBuilder { | |
1017 public: | |
1018 explicit CheckBuilder(HGraphBuilder* builder); | |
1019 ~CheckBuilder() { | |
1020 if (!finished_) End(); | |
1021 } | |
1022 | |
1023 HValue* CheckNotUndefined(HValue* value); | |
1024 HValue* CheckIntegerCompare(HValue* left, HValue* right, Token::Value op); | |
1025 HValue* CheckIntegerEq(HValue* left, HValue* right); | |
1026 void End(); | |
1027 | |
1028 private: | |
1029 Zone* zone() { return builder_->zone(); } | |
1030 | |
1031 HGraphBuilder* builder_; | |
1032 bool finished_; | |
1033 HBasicBlock* failure_block_; | |
1034 HBasicBlock* merge_block_; | |
1035 }; | |
1036 | |
1037 class IfBuilder { | 1016 class IfBuilder { |
1038 public: | 1017 public: |
1039 explicit IfBuilder(HGraphBuilder* builder, | 1018 explicit IfBuilder(HGraphBuilder* builder, |
1040 int position = RelocInfo::kNoPosition); | 1019 int position = RelocInfo::kNoPosition); |
1041 IfBuilder(HGraphBuilder* builder, | 1020 IfBuilder(HGraphBuilder* builder, |
1042 HIfContinuation* continuation); | 1021 HIfContinuation* continuation); |
1043 | 1022 |
1044 ~IfBuilder() { | 1023 ~IfBuilder() { |
1045 if (!finished_) End(); | 1024 if (!finished_) End(); |
1046 } | 1025 } |
(...skipping 13 matching lines...) Expand all Loading... |
1060 return compare; | 1039 return compare; |
1061 } | 1040 } |
1062 | 1041 |
1063 template<class Condition, class P2> | 1042 template<class Condition, class P2> |
1064 HInstruction* If(HValue* p1, P2 p2) { | 1043 HInstruction* If(HValue* p1, P2 p2) { |
1065 HControlInstruction* compare = new(zone()) Condition(p1, p2); | 1044 HControlInstruction* compare = new(zone()) Condition(p1, p2); |
1066 AddCompare(compare); | 1045 AddCompare(compare); |
1067 return compare; | 1046 return compare; |
1068 } | 1047 } |
1069 | 1048 |
| 1049 template<class Condition, class P2> |
| 1050 HInstruction* IfNot(HValue* p1, P2 p2) { |
| 1051 HControlInstruction* compare = new(zone()) Condition(p1, p2); |
| 1052 AddCompare(compare); |
| 1053 HBasicBlock* block0 = compare->SuccessorAt(0); |
| 1054 HBasicBlock* block1 = compare->SuccessorAt(1); |
| 1055 compare->SetSuccessorAt(0, block1); |
| 1056 compare->SetSuccessorAt(1, block0); |
| 1057 return compare; |
| 1058 } |
| 1059 |
1070 HInstruction* OrIfCompare( | 1060 HInstruction* OrIfCompare( |
1071 HValue* p1, | 1061 HValue* p1, |
1072 HValue* p2, | 1062 HValue* p2, |
1073 Token::Value token, | 1063 Token::Value token, |
1074 Representation input_representation = Representation::Integer32()) { | 1064 Representation input_representation = Representation::Integer32()) { |
1075 Or(); | 1065 Or(); |
1076 return IfCompare(p1, p2, token, input_representation); | 1066 return IfCompare(p1, p2, token, input_representation); |
1077 } | 1067 } |
1078 | 1068 |
1079 HInstruction* OrIfCompareMap(HValue* left, Handle<Map> map) { | 1069 HInstruction* OrIfCompareMap(HValue* left, Handle<Map> map) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 void Or(); | 1112 void Or(); |
1123 void And(); | 1113 void And(); |
1124 | 1114 |
1125 void CaptureContinuation(HIfContinuation* continuation); | 1115 void CaptureContinuation(HIfContinuation* continuation); |
1126 | 1116 |
1127 void Then(); | 1117 void Then(); |
1128 void Else(); | 1118 void Else(); |
1129 void End(); | 1119 void End(); |
1130 | 1120 |
1131 void Deopt(); | 1121 void Deopt(); |
| 1122 void ElseDeopt() { |
| 1123 Else(); |
| 1124 Deopt(); |
| 1125 End(); |
| 1126 } |
1132 | 1127 |
1133 private: | 1128 private: |
1134 void AddCompare(HControlInstruction* compare); | 1129 void AddCompare(HControlInstruction* compare); |
1135 | 1130 |
1136 Zone* zone() { return builder_->zone(); } | 1131 Zone* zone() { return builder_->zone(); } |
1137 | 1132 |
1138 HGraphBuilder* builder_; | 1133 HGraphBuilder* builder_; |
1139 int position_; | 1134 int position_; |
1140 bool finished_ : 1; | 1135 bool finished_ : 1; |
1141 bool did_then_ : 1; | 1136 bool did_then_ : 1; |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 EmbeddedVector<char, 64> filename_; | 1931 EmbeddedVector<char, 64> filename_; |
1937 HeapStringAllocator string_allocator_; | 1932 HeapStringAllocator string_allocator_; |
1938 StringStream trace_; | 1933 StringStream trace_; |
1939 int indent_; | 1934 int indent_; |
1940 }; | 1935 }; |
1941 | 1936 |
1942 | 1937 |
1943 } } // namespace v8::internal | 1938 } } // namespace v8::internal |
1944 | 1939 |
1945 #endif // V8_HYDROGEN_H_ | 1940 #endif // V8_HYDROGEN_H_ |
OLD | NEW |