| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/simplified-operator.h" | 5 #include "src/compiler/simplified-operator.h" |
| 6 | 6 |
| 7 #include "src/base/lazy-instance.h" | 7 #include "src/base/lazy-instance.h" |
| 8 #include "src/compiler/opcodes.h" | 8 #include "src/compiler/opcodes.h" |
| 9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
| 10 #include "src/compiler/types.h" | 10 #include "src/compiler/types.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 switch (mode) { | 227 switch (mode) { |
| 228 case CheckForMinusZeroMode::kCheckForMinusZero: | 228 case CheckForMinusZeroMode::kCheckForMinusZero: |
| 229 return os << "check-for-minus-zero"; | 229 return os << "check-for-minus-zero"; |
| 230 case CheckForMinusZeroMode::kDontCheckForMinusZero: | 230 case CheckForMinusZeroMode::kDontCheckForMinusZero: |
| 231 return os << "dont-check-for-minus-zero"; | 231 return os << "dont-check-for-minus-zero"; |
| 232 } | 232 } |
| 233 UNREACHABLE(); | 233 UNREACHABLE(); |
| 234 return os; | 234 return os; |
| 235 } | 235 } |
| 236 | 236 |
| 237 std::ostream& operator<<(std::ostream& os, CheckMapsFlags flags) { |
| 238 bool empty = true; |
| 239 if (flags & CheckMapsFlag::kTryMigrateInstance) { |
| 240 os << "TryMigrateInstance"; |
| 241 empty = false; |
| 242 } |
| 243 if (empty) os << "None"; |
| 244 return os; |
| 245 } |
| 246 |
| 237 bool operator==(CheckMapsParameters const& lhs, | 247 bool operator==(CheckMapsParameters const& lhs, |
| 238 CheckMapsParameters const& rhs) { | 248 CheckMapsParameters const& rhs) { |
| 239 return lhs.maps() == rhs.maps(); | 249 return lhs.flags() == rhs.flags() && lhs.maps() == rhs.maps(); |
| 240 } | 250 } |
| 241 | 251 |
| 242 bool operator!=(CheckMapsParameters const& lhs, | 252 bool operator!=(CheckMapsParameters const& lhs, |
| 243 CheckMapsParameters const& rhs) { | 253 CheckMapsParameters const& rhs) { |
| 244 return !(lhs == rhs); | 254 return !(lhs == rhs); |
| 245 } | 255 } |
| 246 | 256 |
| 247 size_t hash_value(CheckMapsParameters const& p) { return hash_value(p.maps()); } | 257 size_t hash_value(CheckMapsParameters const& p) { |
| 258 return base::hash_combine(p.flags(), p.maps()); |
| 259 } |
| 248 | 260 |
| 249 std::ostream& operator<<(std::ostream& os, CheckMapsParameters const& p) { | 261 std::ostream& operator<<(std::ostream& os, CheckMapsParameters const& p) { |
| 250 ZoneHandleSet<Map> const& maps = p.maps(); | 262 ZoneHandleSet<Map> const& maps = p.maps(); |
| 263 os << p.flags(); |
| 251 for (size_t i = 0; i < maps.size(); ++i) { | 264 for (size_t i = 0; i < maps.size(); ++i) { |
| 252 if (i != 0) os << ", "; | 265 os << ", " << Brief(*maps[i]); |
| 253 os << Brief(*maps[i]); | |
| 254 } | 266 } |
| 255 return os; | 267 return os; |
| 256 } | 268 } |
| 257 | 269 |
| 258 CheckMapsParameters const& CheckMapsParametersOf(Operator const* op) { | 270 CheckMapsParameters const& CheckMapsParametersOf(Operator const* op) { |
| 259 DCHECK_EQ(IrOpcode::kCheckMaps, op->opcode()); | 271 DCHECK_EQ(IrOpcode::kCheckMaps, op->opcode()); |
| 260 return OpParameter<CheckMapsParameters>(op); | 272 return OpParameter<CheckMapsParameters>(op); |
| 261 } | 273 } |
| 262 | 274 |
| 263 size_t hash_value(CheckTaggedInputMode mode) { | 275 size_t hash_value(CheckTaggedInputMode mode) { |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 switch (mode) { | 747 switch (mode) { |
| 736 case CheckTaggedInputMode::kNumber: | 748 case CheckTaggedInputMode::kNumber: |
| 737 return &cache_.kCheckedTaggedToFloat64NumberOperator; | 749 return &cache_.kCheckedTaggedToFloat64NumberOperator; |
| 738 case CheckTaggedInputMode::kNumberOrOddball: | 750 case CheckTaggedInputMode::kNumberOrOddball: |
| 739 return &cache_.kCheckedTaggedToFloat64NumberOrOddballOperator; | 751 return &cache_.kCheckedTaggedToFloat64NumberOrOddballOperator; |
| 740 } | 752 } |
| 741 UNREACHABLE(); | 753 UNREACHABLE(); |
| 742 return nullptr; | 754 return nullptr; |
| 743 } | 755 } |
| 744 | 756 |
| 745 const Operator* SimplifiedOperatorBuilder::CheckMaps(ZoneHandleSet<Map> maps) { | 757 const Operator* SimplifiedOperatorBuilder::CheckMaps(CheckMapsFlags flags, |
| 746 CheckMapsParameters const parameters(maps); | 758 ZoneHandleSet<Map> maps) { |
| 759 CheckMapsParameters const parameters(flags, maps); |
| 747 return new (zone()) Operator1<CheckMapsParameters>( // -- | 760 return new (zone()) Operator1<CheckMapsParameters>( // -- |
| 748 IrOpcode::kCheckMaps, // opcode | 761 IrOpcode::kCheckMaps, // opcode |
| 749 Operator::kNoThrow | Operator::kNoWrite, // flags | 762 Operator::kNoThrow | Operator::kNoWrite, // flags |
| 750 "CheckMaps", // name | 763 "CheckMaps", // name |
| 751 1, 1, 1, 0, 1, 0, // counts | 764 1, 1, 1, 0, 1, 0, // counts |
| 752 parameters); // parameter | 765 parameters); // parameter |
| 753 } | 766 } |
| 754 | 767 |
| 755 const Operator* SimplifiedOperatorBuilder::CheckFloat64Hole( | 768 const Operator* SimplifiedOperatorBuilder::CheckFloat64Hole( |
| 756 CheckFloat64HoleMode mode) { | 769 CheckFloat64HoleMode mode) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 Operator::kNoDeopt | Operator::kNoThrow | properties, \ | 904 Operator::kNoDeopt | Operator::kNoThrow | properties, \ |
| 892 #Name, value_input_count, 1, control_input_count, \ | 905 #Name, value_input_count, 1, control_input_count, \ |
| 893 output_count, 1, 0, access); \ | 906 output_count, 1, 0, access); \ |
| 894 } | 907 } |
| 895 ACCESS_OP_LIST(ACCESS) | 908 ACCESS_OP_LIST(ACCESS) |
| 896 #undef ACCESS | 909 #undef ACCESS |
| 897 | 910 |
| 898 } // namespace compiler | 911 } // namespace compiler |
| 899 } // namespace internal | 912 } // namespace internal |
| 900 } // namespace v8 | 913 } // namespace v8 |
| OLD | NEW |