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/types.h" | 10 #include "src/types.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 UNREACHABLE(); | 243 UNREACHABLE(); |
244 return os; | 244 return os; |
245 } | 245 } |
246 | 246 |
247 CheckTaggedHoleMode CheckTaggedHoleModeOf(const Operator* op) { | 247 CheckTaggedHoleMode CheckTaggedHoleModeOf(const Operator* op) { |
248 DCHECK_EQ(IrOpcode::kCheckTaggedHole, op->opcode()); | 248 DCHECK_EQ(IrOpcode::kCheckTaggedHole, op->opcode()); |
249 return OpParameter<CheckTaggedHoleMode>(op); | 249 return OpParameter<CheckTaggedHoleMode>(op); |
250 } | 250 } |
251 | 251 |
| 252 std::ostream& operator<<(std::ostream& os, GrowFastElementsFlags flags) { |
| 253 bool empty = true; |
| 254 if (flags & GrowFastElementsFlag::kArrayObject) { |
| 255 os << "ArrayObject"; |
| 256 empty = false; |
| 257 } |
| 258 if (flags & GrowFastElementsFlag::kDoubleElements) { |
| 259 if (!empty) os << "|"; |
| 260 os << "DoubleElements"; |
| 261 empty = false; |
| 262 } |
| 263 if (flags & GrowFastElementsFlag::kHoleyElements) { |
| 264 if (!empty) os << "|"; |
| 265 os << "HoleyElements"; |
| 266 empty = false; |
| 267 } |
| 268 if (empty) os << "None"; |
| 269 return os; |
| 270 } |
| 271 |
| 272 GrowFastElementsFlags GrowFastElementsFlagsOf(const Operator* op) { |
| 273 DCHECK_EQ(IrOpcode::kMaybeGrowFastElements, op->opcode()); |
| 274 return OpParameter<GrowFastElementsFlags>(op); |
| 275 } |
| 276 |
252 size_t hash_value(ElementsTransition transition) { | 277 size_t hash_value(ElementsTransition transition) { |
253 return static_cast<uint8_t>(transition); | 278 return static_cast<uint8_t>(transition); |
254 } | 279 } |
255 | 280 |
256 std::ostream& operator<<(std::ostream& os, ElementsTransition transition) { | 281 std::ostream& operator<<(std::ostream& os, ElementsTransition transition) { |
257 switch (transition) { | 282 switch (transition) { |
258 case ElementsTransition::kFastTransition: | 283 case ElementsTransition::kFastTransition: |
259 return os << "fast-transition"; | 284 return os << "fast-transition"; |
260 case ElementsTransition::kSlowTransition: | 285 case ElementsTransition::kSlowTransition: |
261 return os << "slow-transition"; | 286 return os << "slow-transition"; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { | 650 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { |
626 return new (zone()) Operator(IrOpcode::kReferenceEqual, | 651 return new (zone()) Operator(IrOpcode::kReferenceEqual, |
627 Operator::kCommutative | Operator::kPure, | 652 Operator::kCommutative | Operator::kPure, |
628 "ReferenceEqual", 2, 0, 0, 1, 0, 0); | 653 "ReferenceEqual", 2, 0, 0, 1, 0, 0); |
629 } | 654 } |
630 | 655 |
631 const Operator* SimplifiedOperatorBuilder::EnsureWritableFastElements() { | 656 const Operator* SimplifiedOperatorBuilder::EnsureWritableFastElements() { |
632 return &cache_.kEnsureWritableFastElements; | 657 return &cache_.kEnsureWritableFastElements; |
633 } | 658 } |
634 | 659 |
| 660 const Operator* SimplifiedOperatorBuilder::MaybeGrowFastElements( |
| 661 GrowFastElementsFlags flags) { |
| 662 return new (zone()) Operator1<GrowFastElementsFlags>( // -- |
| 663 IrOpcode::kMaybeGrowFastElements, // opcode |
| 664 Operator::kNoThrow, // flags |
| 665 "MaybeGrowFastElements", // name |
| 666 4, 1, 1, 1, 1, 0, // counts |
| 667 flags); // parameter |
| 668 } |
| 669 |
635 const Operator* SimplifiedOperatorBuilder::TransitionElementsKind( | 670 const Operator* SimplifiedOperatorBuilder::TransitionElementsKind( |
636 ElementsTransition transition) { | 671 ElementsTransition transition) { |
637 return new (zone()) Operator1<ElementsTransition>( // -- | 672 return new (zone()) Operator1<ElementsTransition>( // -- |
638 IrOpcode::kTransitionElementsKind, // opcode | 673 IrOpcode::kTransitionElementsKind, // opcode |
639 Operator::kNoDeopt | Operator::kNoThrow, // flags | 674 Operator::kNoDeopt | Operator::kNoThrow, // flags |
640 "TransitionElementsKind", // name | 675 "TransitionElementsKind", // name |
641 3, 1, 1, 0, 1, 0, // counts | 676 3, 1, 1, 0, 1, 0, // counts |
642 transition); // parameter | 677 transition); // parameter |
643 } | 678 } |
644 | 679 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 Operator::kNoDeopt | Operator::kNoThrow | properties, \ | 764 Operator::kNoDeopt | Operator::kNoThrow | properties, \ |
730 #Name, value_input_count, 1, control_input_count, \ | 765 #Name, value_input_count, 1, control_input_count, \ |
731 output_count, 1, 0, access); \ | 766 output_count, 1, 0, access); \ |
732 } | 767 } |
733 ACCESS_OP_LIST(ACCESS) | 768 ACCESS_OP_LIST(ACCESS) |
734 #undef ACCESS | 769 #undef ACCESS |
735 | 770 |
736 } // namespace compiler | 771 } // namespace compiler |
737 } // namespace internal | 772 } // namespace internal |
738 } // namespace v8 | 773 } // namespace v8 |
OLD | NEW |