OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/machine-operator.h" | 5 #include "src/compiler/machine-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 | 10 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 #undef STORE | 530 #undef STORE |
531 | 531 |
532 struct DebugBreakOperator : public Operator { | 532 struct DebugBreakOperator : public Operator { |
533 DebugBreakOperator() | 533 DebugBreakOperator() |
534 : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0, | 534 : Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0, |
535 0, 0, 0, 0, 0) {} | 535 0, 0, 0, 0, 0) {} |
536 }; | 536 }; |
537 DebugBreakOperator kDebugBreak; | 537 DebugBreakOperator kDebugBreak; |
538 }; | 538 }; |
539 | 539 |
| 540 struct CommentOperator : public Operator1<const char*> { |
| 541 explicit CommentOperator(const char* msg) |
| 542 : Operator1<const char*>(IrOpcode::kComment, Operator::kNoThrow, |
| 543 "Comment", 0, 0, 0, 0, 0, 0, msg) {} |
| 544 }; |
540 | 545 |
541 static base::LazyInstance<MachineOperatorGlobalCache>::type kCache = | 546 static base::LazyInstance<MachineOperatorGlobalCache>::type kCache = |
542 LAZY_INSTANCE_INITIALIZER; | 547 LAZY_INSTANCE_INITIALIZER; |
543 | 548 |
544 MachineOperatorBuilder::MachineOperatorBuilder( | 549 MachineOperatorBuilder::MachineOperatorBuilder( |
545 Zone* zone, MachineRepresentation word, Flags flags, | 550 Zone* zone, MachineRepresentation word, Flags flags, |
546 AlignmentRequirements alignmentRequirements) | 551 AlignmentRequirements alignmentRequirements) |
547 : cache_(kCache.Get()), | 552 : zone_(zone), |
| 553 cache_(kCache.Get()), |
548 word_(word), | 554 word_(word), |
549 flags_(flags), | 555 flags_(flags), |
550 alignment_requirements_(alignmentRequirements) { | 556 alignment_requirements_(alignmentRequirements) { |
551 DCHECK(word == MachineRepresentation::kWord32 || | 557 DCHECK(word == MachineRepresentation::kWord32 || |
552 word == MachineRepresentation::kWord64); | 558 word == MachineRepresentation::kWord64); |
553 } | 559 } |
554 | 560 |
555 | 561 |
556 #define PURE(Name, properties, value_input_count, control_input_count, \ | 562 #define PURE(Name, properties, value_input_count, control_input_count, \ |
557 output_count) \ | 563 output_count) \ |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 break; | 618 break; |
613 } | 619 } |
614 UNREACHABLE(); | 620 UNREACHABLE(); |
615 return nullptr; | 621 return nullptr; |
616 } | 622 } |
617 | 623 |
618 const Operator* MachineOperatorBuilder::DebugBreak() { | 624 const Operator* MachineOperatorBuilder::DebugBreak() { |
619 return &cache_.kDebugBreak; | 625 return &cache_.kDebugBreak; |
620 } | 626 } |
621 | 627 |
| 628 const Operator* MachineOperatorBuilder::Comment(const char* msg) { |
| 629 return new (zone_) CommentOperator(msg); |
| 630 } |
| 631 |
622 const Operator* MachineOperatorBuilder::CheckedLoad( | 632 const Operator* MachineOperatorBuilder::CheckedLoad( |
623 CheckedLoadRepresentation rep) { | 633 CheckedLoadRepresentation rep) { |
624 #define LOAD(Type) \ | 634 #define LOAD(Type) \ |
625 if (rep == MachineType::Type()) { \ | 635 if (rep == MachineType::Type()) { \ |
626 return &cache_.kCheckedLoad##Type; \ | 636 return &cache_.kCheckedLoad##Type; \ |
627 } | 637 } |
628 MACHINE_TYPE_LIST(LOAD) | 638 MACHINE_TYPE_LIST(LOAD) |
629 #undef LOAD | 639 #undef LOAD |
630 UNREACHABLE(); | 640 UNREACHABLE(); |
631 return nullptr; | 641 return nullptr; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } | 690 } |
681 ATOMIC_REPRESENTATION_LIST(STORE) | 691 ATOMIC_REPRESENTATION_LIST(STORE) |
682 #undef STORE | 692 #undef STORE |
683 UNREACHABLE(); | 693 UNREACHABLE(); |
684 return nullptr; | 694 return nullptr; |
685 } | 695 } |
686 | 696 |
687 } // namespace compiler | 697 } // namespace compiler |
688 } // namespace internal | 698 } // namespace internal |
689 } // namespace v8 | 699 } // namespace v8 |
OLD | NEW |