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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { | 672 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { |
648 return new (zone()) Operator(IrOpcode::kReferenceEqual, | 673 return new (zone()) Operator(IrOpcode::kReferenceEqual, |
649 Operator::kCommutative | Operator::kPure, | 674 Operator::kCommutative | Operator::kPure, |
650 "ReferenceEqual", 2, 0, 0, 1, 0, 0); | 675 "ReferenceEqual", 2, 0, 0, 1, 0, 0); |
651 } | 676 } |
652 | 677 |
653 const Operator* SimplifiedOperatorBuilder::EnsureWritableFastElements() { | 678 const Operator* SimplifiedOperatorBuilder::EnsureWritableFastElements() { |
654 return &cache_.kEnsureWritableFastElements; | 679 return &cache_.kEnsureWritableFastElements; |
655 } | 680 } |
656 | 681 |
| 682 const Operator* SimplifiedOperatorBuilder::MaybeGrowFastElements( |
| 683 GrowFastElementsFlags flags) { |
| 684 return new (zone()) Operator1<GrowFastElementsFlags>( // -- |
| 685 IrOpcode::kMaybeGrowFastElements, // opcode |
| 686 Operator::kNoThrow, // flags |
| 687 "MaybeGrowFastElements", // name |
| 688 4, 1, 1, 1, 1, 0, // counts |
| 689 flags); // parameter |
| 690 } |
| 691 |
657 const Operator* SimplifiedOperatorBuilder::TransitionElementsKind( | 692 const Operator* SimplifiedOperatorBuilder::TransitionElementsKind( |
658 ElementsTransition transition) { | 693 ElementsTransition transition) { |
659 return new (zone()) Operator1<ElementsTransition>( // -- | 694 return new (zone()) Operator1<ElementsTransition>( // -- |
660 IrOpcode::kTransitionElementsKind, // opcode | 695 IrOpcode::kTransitionElementsKind, // opcode |
661 Operator::kNoDeopt | Operator::kNoThrow, // flags | 696 Operator::kNoDeopt | Operator::kNoThrow, // flags |
662 "TransitionElementsKind", // name | 697 "TransitionElementsKind", // name |
663 3, 1, 1, 0, 1, 0, // counts | 698 3, 1, 1, 0, 1, 0, // counts |
664 transition); // parameter | 699 transition); // parameter |
665 } | 700 } |
666 | 701 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 Operator::kNoDeopt | Operator::kNoThrow | properties, \ | 768 Operator::kNoDeopt | Operator::kNoThrow | properties, \ |
734 #Name, value_input_count, 1, control_input_count, \ | 769 #Name, value_input_count, 1, control_input_count, \ |
735 output_count, 1, 0, access); \ | 770 output_count, 1, 0, access); \ |
736 } | 771 } |
737 ACCESS_OP_LIST(ACCESS) | 772 ACCESS_OP_LIST(ACCESS) |
738 #undef ACCESS | 773 #undef ACCESS |
739 | 774 |
740 } // namespace compiler | 775 } // namespace compiler |
741 } // namespace internal | 776 } // namespace internal |
742 } // namespace v8 | 777 } // namespace v8 |
OLD | NEW |