| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 switch (mode) { | 222 switch (mode) { |
| 223 case CheckForMinusZeroMode::kCheckForMinusZero: | 223 case CheckForMinusZeroMode::kCheckForMinusZero: |
| 224 return os << "check-for-minus-zero"; | 224 return os << "check-for-minus-zero"; |
| 225 case CheckForMinusZeroMode::kDontCheckForMinusZero: | 225 case CheckForMinusZeroMode::kDontCheckForMinusZero: |
| 226 return os << "dont-check-for-minus-zero"; | 226 return os << "dont-check-for-minus-zero"; |
| 227 } | 227 } |
| 228 UNREACHABLE(); | 228 UNREACHABLE(); |
| 229 return os; | 229 return os; |
| 230 } | 230 } |
| 231 | 231 |
| 232 bool operator==(CheckMapsParameters const& lhs, |
| 233 CheckMapsParameters const& rhs) { |
| 234 return lhs.maps() == rhs.maps(); |
| 235 } |
| 236 |
| 237 bool operator!=(CheckMapsParameters const& lhs, |
| 238 CheckMapsParameters const& rhs) { |
| 239 return !(lhs == rhs); |
| 240 } |
| 241 |
| 242 size_t hash_value(CheckMapsParameters const& p) { |
| 243 return hash_value(p.maps()); |
| 244 } |
| 245 |
| 246 std::ostream& operator<<(std::ostream& os, CheckMapsParameters const& p) { |
| 247 ZoneHandleSet<Map> const& maps = p.maps(); |
| 248 for (size_t i = 0; i < maps.size(); ++i) { |
| 249 if (i != 0) os << ", "; |
| 250 os << Brief(*maps[i]); |
| 251 } |
| 252 return os; |
| 253 } |
| 254 |
| 255 CheckMapsParameters const& CheckMapsParametersOf(Operator const* op) { |
| 256 DCHECK_EQ(IrOpcode::kCheckMaps, op->opcode()); |
| 257 return OpParameter<CheckMapsParameters>(op); |
| 258 } |
| 259 |
| 232 size_t hash_value(CheckTaggedInputMode mode) { | 260 size_t hash_value(CheckTaggedInputMode mode) { |
| 233 return static_cast<size_t>(mode); | 261 return static_cast<size_t>(mode); |
| 234 } | 262 } |
| 235 | 263 |
| 236 std::ostream& operator<<(std::ostream& os, CheckTaggedInputMode mode) { | 264 std::ostream& operator<<(std::ostream& os, CheckTaggedInputMode mode) { |
| 237 switch (mode) { | 265 switch (mode) { |
| 238 case CheckTaggedInputMode::kNumber: | 266 case CheckTaggedInputMode::kNumber: |
| 239 return os << "Number"; | 267 return os << "Number"; |
| 240 case CheckTaggedInputMode::kNumberOrOddball: | 268 case CheckTaggedInputMode::kNumberOrOddball: |
| 241 return os << "NumberOrOddball"; | 269 return os << "NumberOrOddball"; |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 switch (mode) { | 690 switch (mode) { |
| 663 case CheckTaggedInputMode::kNumber: | 691 case CheckTaggedInputMode::kNumber: |
| 664 return &cache_.kCheckedTaggedToFloat64NumberOperator; | 692 return &cache_.kCheckedTaggedToFloat64NumberOperator; |
| 665 case CheckTaggedInputMode::kNumberOrOddball: | 693 case CheckTaggedInputMode::kNumberOrOddball: |
| 666 return &cache_.kCheckedTaggedToFloat64NumberOrOddballOperator; | 694 return &cache_.kCheckedTaggedToFloat64NumberOrOddballOperator; |
| 667 } | 695 } |
| 668 UNREACHABLE(); | 696 UNREACHABLE(); |
| 669 return nullptr; | 697 return nullptr; |
| 670 } | 698 } |
| 671 | 699 |
| 672 const Operator* SimplifiedOperatorBuilder::CheckMaps(int map_input_count) { | 700 const Operator* SimplifiedOperatorBuilder::CheckMaps(ZoneHandleSet<Map> maps) { |
| 673 // TODO(bmeurer): Cache the most important versions of this operator. | 701 CheckMapsParameters const parameters(maps); |
| 674 DCHECK_LT(0, map_input_count); | 702 return new (zone()) Operator1<CheckMapsParameters>( // -- |
| 675 int const value_input_count = 1 + map_input_count; | 703 IrOpcode::kCheckMaps, // opcode |
| 676 return new (zone()) Operator1<int>( // -- | 704 Operator::kNoThrow | Operator::kNoWrite, // flags |
| 677 IrOpcode::kCheckMaps, // opcode | 705 "CheckMaps", // name |
| 678 Operator::kNoThrow | Operator::kNoWrite, // flags | 706 1, 1, 1, 0, 1, 0, // counts |
| 679 "CheckMaps", // name | 707 parameters); // parameter |
| 680 value_input_count, 1, 1, 0, 1, 0, // counts | |
| 681 map_input_count); // parameter | |
| 682 } | 708 } |
| 683 | 709 |
| 684 const Operator* SimplifiedOperatorBuilder::CheckFloat64Hole( | 710 const Operator* SimplifiedOperatorBuilder::CheckFloat64Hole( |
| 685 CheckFloat64HoleMode mode) { | 711 CheckFloat64HoleMode mode) { |
| 686 switch (mode) { | 712 switch (mode) { |
| 687 case CheckFloat64HoleMode::kAllowReturnHole: | 713 case CheckFloat64HoleMode::kAllowReturnHole: |
| 688 return &cache_.kCheckFloat64HoleAllowReturnHoleOperator; | 714 return &cache_.kCheckFloat64HoleAllowReturnHoleOperator; |
| 689 case CheckFloat64HoleMode::kNeverReturnHole: | 715 case CheckFloat64HoleMode::kNeverReturnHole: |
| 690 return &cache_.kCheckFloat64HoleNeverReturnHoleOperator; | 716 return &cache_.kCheckFloat64HoleNeverReturnHoleOperator; |
| 691 } | 717 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 Operator::kNoDeopt | Operator::kNoThrow | properties, \ | 814 Operator::kNoDeopt | Operator::kNoThrow | properties, \ |
| 789 #Name, value_input_count, 1, control_input_count, \ | 815 #Name, value_input_count, 1, control_input_count, \ |
| 790 output_count, 1, 0, access); \ | 816 output_count, 1, 0, access); \ |
| 791 } | 817 } |
| 792 ACCESS_OP_LIST(ACCESS) | 818 ACCESS_OP_LIST(ACCESS) |
| 793 #undef ACCESS | 819 #undef ACCESS |
| 794 | 820 |
| 795 } // namespace compiler | 821 } // namespace compiler |
| 796 } // namespace internal | 822 } // namespace internal |
| 797 } // namespace v8 | 823 } // namespace v8 |
| OLD | NEW |