Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/compiler/instruction.h

Issue 1088993003: Replace OVERRIDE->override and FINAL->final since we now require C++11. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | src/compiler/instruction-selector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef V8_COMPILER_INSTRUCTION_H_ 5 #ifndef V8_COMPILER_INSTRUCTION_H_
6 #define V8_COMPILER_INSTRUCTION_H_ 6 #define V8_COMPILER_INSTRUCTION_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <iosfwd> 9 #include <iosfwd>
10 #include <map> 10 #include <map>
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 bool InstructionOperand::Is##SubKind() const { \ 394 bool InstructionOperand::Is##SubKind() const { \
395 return IsAllocated() && \ 395 return IsAllocated() && \
396 AllocatedOperand::cast(this)->allocated_kind() == \ 396 AllocatedOperand::cast(this)->allocated_kind() == \
397 AllocatedOperand::kOperandKind; \ 397 AllocatedOperand::kOperandKind; \
398 } 398 }
399 ALLOCATED_OPERAND_LIST(ALLOCATED_OPERAND_IS) 399 ALLOCATED_OPERAND_LIST(ALLOCATED_OPERAND_IS)
400 #undef ALLOCATED_OPERAND_IS 400 #undef ALLOCATED_OPERAND_IS
401 401
402 402
403 #define ALLOCATED_OPERAND_CLASS(SubKind, kOperandKind) \ 403 #define ALLOCATED_OPERAND_CLASS(SubKind, kOperandKind) \
404 class SubKind##Operand FINAL : public AllocatedOperand { \ 404 class SubKind##Operand final : public AllocatedOperand { \
405 public: \ 405 public: \
406 explicit SubKind##Operand(int index) \ 406 explicit SubKind##Operand(int index) \
407 : AllocatedOperand(kOperandKind, index) {} \ 407 : AllocatedOperand(kOperandKind, index) {} \
408 \ 408 \
409 static SubKind##Operand* New(Zone* zone, int index) { \ 409 static SubKind##Operand* New(Zone* zone, int index) { \
410 return InstructionOperand::New(zone, SubKind##Operand(index)); \ 410 return InstructionOperand::New(zone, SubKind##Operand(index)); \
411 } \ 411 } \
412 \ 412 \
413 static SubKind##Operand* cast(InstructionOperand* op) { \ 413 static SubKind##Operand* cast(InstructionOperand* op) { \
414 DCHECK_EQ(kOperandKind, AllocatedOperand::cast(op)->allocated_kind()); \ 414 DCHECK_EQ(kOperandKind, AllocatedOperand::cast(op)->allocated_kind()); \
415 return reinterpret_cast<SubKind##Operand*>(op); \ 415 return reinterpret_cast<SubKind##Operand*>(op); \
416 } \ 416 } \
417 \ 417 \
418 static const SubKind##Operand* cast(const InstructionOperand* op) { \ 418 static const SubKind##Operand* cast(const InstructionOperand* op) { \
419 DCHECK_EQ(kOperandKind, AllocatedOperand::cast(op)->allocated_kind()); \ 419 DCHECK_EQ(kOperandKind, AllocatedOperand::cast(op)->allocated_kind()); \
420 return reinterpret_cast<const SubKind##Operand*>(op); \ 420 return reinterpret_cast<const SubKind##Operand*>(op); \
421 } \ 421 } \
422 \ 422 \
423 static SubKind##Operand cast(const InstructionOperand& op) { \ 423 static SubKind##Operand cast(const InstructionOperand& op) { \
424 DCHECK_EQ(kOperandKind, AllocatedOperand::cast(op).allocated_kind()); \ 424 DCHECK_EQ(kOperandKind, AllocatedOperand::cast(op).allocated_kind()); \
425 return *static_cast<const SubKind##Operand*>(&op); \ 425 return *static_cast<const SubKind##Operand*>(&op); \
426 } \ 426 } \
427 }; 427 };
428 ALLOCATED_OPERAND_LIST(ALLOCATED_OPERAND_CLASS) 428 ALLOCATED_OPERAND_LIST(ALLOCATED_OPERAND_CLASS)
429 #undef ALLOCATED_OPERAND_CLASS 429 #undef ALLOCATED_OPERAND_CLASS
430 430
431 431
432 class MoveOperands FINAL : public ZoneObject { 432 class MoveOperands final : public ZoneObject {
433 public: 433 public:
434 MoveOperands(const InstructionOperand& source, 434 MoveOperands(const InstructionOperand& source,
435 const InstructionOperand& destination) 435 const InstructionOperand& destination)
436 : source_(source), destination_(destination) { 436 : source_(source), destination_(destination) {
437 DCHECK(!source.IsInvalid() && !destination.IsInvalid()); 437 DCHECK(!source.IsInvalid() && !destination.IsInvalid());
438 } 438 }
439 439
440 const InstructionOperand& source() const { return source_; } 440 const InstructionOperand& source() const { return source_; }
441 InstructionOperand& source() { return source_; } 441 InstructionOperand& source() { return source_; }
442 void set_source(const InstructionOperand& operand) { source_ = operand; } 442 void set_source(const InstructionOperand& operand) { source_ = operand; }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 struct PrintableMoveOperands { 484 struct PrintableMoveOperands {
485 const RegisterConfiguration* register_configuration_; 485 const RegisterConfiguration* register_configuration_;
486 const MoveOperands* move_operands_; 486 const MoveOperands* move_operands_;
487 }; 487 };
488 488
489 489
490 std::ostream& operator<<(std::ostream& os, const PrintableMoveOperands& mo); 490 std::ostream& operator<<(std::ostream& os, const PrintableMoveOperands& mo);
491 491
492 492
493 class ParallelMove FINAL : public ZoneVector<MoveOperands*>, public ZoneObject { 493 class ParallelMove final : public ZoneVector<MoveOperands*>, public ZoneObject {
494 public: 494 public:
495 explicit ParallelMove(Zone* zone) : ZoneVector<MoveOperands*>(zone) { 495 explicit ParallelMove(Zone* zone) : ZoneVector<MoveOperands*>(zone) {
496 reserve(4); 496 reserve(4);
497 } 497 }
498 498
499 MoveOperands* AddMove(const InstructionOperand& from, 499 MoveOperands* AddMove(const InstructionOperand& from,
500 const InstructionOperand& to) { 500 const InstructionOperand& to) {
501 auto zone = get_allocator().zone(); 501 auto zone = get_allocator().zone();
502 auto move = new (zone) MoveOperands(from, to); 502 auto move = new (zone) MoveOperands(from, to);
503 push_back(move); 503 push_back(move);
(...skipping 14 matching lines...) Expand all
518 518
519 struct PrintableParallelMove { 519 struct PrintableParallelMove {
520 const RegisterConfiguration* register_configuration_; 520 const RegisterConfiguration* register_configuration_;
521 const ParallelMove* parallel_move_; 521 const ParallelMove* parallel_move_;
522 }; 522 };
523 523
524 524
525 std::ostream& operator<<(std::ostream& os, const PrintableParallelMove& pm); 525 std::ostream& operator<<(std::ostream& os, const PrintableParallelMove& pm);
526 526
527 527
528 class ReferenceMap FINAL : public ZoneObject { 528 class ReferenceMap final : public ZoneObject {
529 public: 529 public:
530 explicit ReferenceMap(Zone* zone) 530 explicit ReferenceMap(Zone* zone)
531 : reference_operands_(8, zone), instruction_position_(-1) {} 531 : reference_operands_(8, zone), instruction_position_(-1) {}
532 532
533 const ZoneVector<InstructionOperand>& reference_operands() const { 533 const ZoneVector<InstructionOperand>& reference_operands() const {
534 return reference_operands_; 534 return reference_operands_;
535 } 535 }
536 int instruction_position() const { return instruction_position_; } 536 int instruction_position() const { return instruction_position_; }
537 537
538 void set_instruction_position(int pos) { 538 void set_instruction_position(int pos) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 }; 701 };
702 702
703 703
704 struct PrintableInstruction { 704 struct PrintableInstruction {
705 const RegisterConfiguration* register_configuration_; 705 const RegisterConfiguration* register_configuration_;
706 const Instruction* instr_; 706 const Instruction* instr_;
707 }; 707 };
708 std::ostream& operator<<(std::ostream& os, const PrintableInstruction& instr); 708 std::ostream& operator<<(std::ostream& os, const PrintableInstruction& instr);
709 709
710 710
711 class RpoNumber FINAL { 711 class RpoNumber final {
712 public: 712 public:
713 static const int kInvalidRpoNumber = -1; 713 static const int kInvalidRpoNumber = -1;
714 int ToInt() const { 714 int ToInt() const {
715 DCHECK(IsValid()); 715 DCHECK(IsValid());
716 return index_; 716 return index_;
717 } 717 }
718 size_t ToSize() const { 718 size_t ToSize() const {
719 DCHECK(IsValid()); 719 DCHECK(IsValid());
720 return static_cast<size_t>(index_); 720 return static_cast<size_t>(index_);
721 } 721 }
(...skipping 12 matching lines...) Expand all
734 734
735 private: 735 private:
736 explicit RpoNumber(int32_t index) : index_(index) {} 736 explicit RpoNumber(int32_t index) : index_(index) {}
737 int32_t index_; 737 int32_t index_;
738 }; 738 };
739 739
740 740
741 std::ostream& operator<<(std::ostream&, const RpoNumber&); 741 std::ostream& operator<<(std::ostream&, const RpoNumber&);
742 742
743 743
744 class Constant FINAL { 744 class Constant final {
745 public: 745 public:
746 enum Type { 746 enum Type {
747 kInt32, 747 kInt32,
748 kInt64, 748 kInt64,
749 kFloat32, 749 kFloat32,
750 kFloat64, 750 kFloat64,
751 kExternalReference, 751 kExternalReference,
752 kHeapObject, 752 kHeapObject,
753 kRpoNumber 753 kRpoNumber
754 }; 754 };
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 size_t locals_count_; 844 size_t locals_count_;
845 size_t stack_count_; 845 size_t stack_count_;
846 ZoneVector<MachineType> types_; 846 ZoneVector<MachineType> types_;
847 FrameStateDescriptor* outer_state_; 847 FrameStateDescriptor* outer_state_;
848 MaybeHandle<JSFunction> jsfunction_; 848 MaybeHandle<JSFunction> jsfunction_;
849 }; 849 };
850 850
851 std::ostream& operator<<(std::ostream& os, const Constant& constant); 851 std::ostream& operator<<(std::ostream& os, const Constant& constant);
852 852
853 853
854 class PhiInstruction FINAL : public ZoneObject { 854 class PhiInstruction final : public ZoneObject {
855 public: 855 public:
856 typedef ZoneVector<InstructionOperand> Inputs; 856 typedef ZoneVector<InstructionOperand> Inputs;
857 857
858 PhiInstruction(Zone* zone, int virtual_register, size_t input_count); 858 PhiInstruction(Zone* zone, int virtual_register, size_t input_count);
859 859
860 void SetInput(size_t offset, int virtual_register); 860 void SetInput(size_t offset, int virtual_register);
861 861
862 int virtual_register() const { return virtual_register_; } 862 int virtual_register() const { return virtual_register_; }
863 const IntVector& operands() const { return operands_; } 863 const IntVector& operands() const { return operands_; }
864 864
865 // TODO(dcarney): this has no real business being here, since it's internal to 865 // TODO(dcarney): this has no real business being here, since it's internal to
866 // the register allocator, but putting it here was convenient. 866 // the register allocator, but putting it here was convenient.
867 const InstructionOperand& output() const { return output_; } 867 const InstructionOperand& output() const { return output_; }
868 InstructionOperand& output() { return output_; } 868 InstructionOperand& output() { return output_; }
869 869
870 private: 870 private:
871 const int virtual_register_; 871 const int virtual_register_;
872 InstructionOperand output_; 872 InstructionOperand output_;
873 IntVector operands_; 873 IntVector operands_;
874 }; 874 };
875 875
876 876
877 // Analogue of BasicBlock for Instructions instead of Nodes. 877 // Analogue of BasicBlock for Instructions instead of Nodes.
878 class InstructionBlock FINAL : public ZoneObject { 878 class InstructionBlock final : public ZoneObject {
879 public: 879 public:
880 InstructionBlock(Zone* zone, RpoNumber rpo_number, RpoNumber loop_header, 880 InstructionBlock(Zone* zone, RpoNumber rpo_number, RpoNumber loop_header,
881 RpoNumber loop_end, bool deferred); 881 RpoNumber loop_end, bool deferred);
882 882
883 // Instruction indexes (used by the register allocator). 883 // Instruction indexes (used by the register allocator).
884 int first_instruction_index() const { 884 int first_instruction_index() const {
885 DCHECK(code_start_ >= 0); 885 DCHECK(code_start_ >= 0);
886 DCHECK(code_end_ > 0); 886 DCHECK(code_end_ > 0);
887 DCHECK(code_end_ >= code_start_); 887 DCHECK(code_end_ >= code_start_);
888 return code_start_; 888 return code_start_;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 typedef ZoneDeque<ReferenceMap*> ReferenceMapDeque; 949 typedef ZoneDeque<ReferenceMap*> ReferenceMapDeque;
950 typedef ZoneVector<FrameStateDescriptor*> DeoptimizationVector; 950 typedef ZoneVector<FrameStateDescriptor*> DeoptimizationVector;
951 typedef ZoneVector<InstructionBlock*> InstructionBlocks; 951 typedef ZoneVector<InstructionBlock*> InstructionBlocks;
952 952
953 struct PrintableInstructionSequence; 953 struct PrintableInstructionSequence;
954 954
955 955
956 // Represents architecture-specific generated code before, during, and after 956 // Represents architecture-specific generated code before, during, and after
957 // register allocation. 957 // register allocation.
958 // TODO(titzer): s/IsDouble/IsFloat64/ 958 // TODO(titzer): s/IsDouble/IsFloat64/
959 class InstructionSequence FINAL : public ZoneObject { 959 class InstructionSequence final : public ZoneObject {
960 public: 960 public:
961 static InstructionBlocks* InstructionBlocksFor(Zone* zone, 961 static InstructionBlocks* InstructionBlocksFor(Zone* zone,
962 const Schedule* schedule); 962 const Schedule* schedule);
963 // Puts the deferred blocks last. 963 // Puts the deferred blocks last.
964 static void ComputeAssemblyOrder(InstructionBlocks* blocks); 964 static void ComputeAssemblyOrder(InstructionBlocks* blocks);
965 965
966 InstructionSequence(Isolate* isolate, Zone* zone, 966 InstructionSequence(Isolate* isolate, Zone* zone,
967 InstructionBlocks* instruction_blocks); 967 InstructionBlocks* instruction_blocks);
968 968
969 int NextVirtualRegister(); 969 int NextVirtualRegister();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 1114
1115 1115
1116 std::ostream& operator<<(std::ostream& os, 1116 std::ostream& operator<<(std::ostream& os,
1117 const PrintableInstructionSequence& code); 1117 const PrintableInstructionSequence& code);
1118 1118
1119 } // namespace compiler 1119 } // namespace compiler
1120 } // namespace internal 1120 } // namespace internal
1121 } // namespace v8 1121 } // namespace v8
1122 1122
1123 #endif // V8_COMPILER_INSTRUCTION_H_ 1123 #endif // V8_COMPILER_INSTRUCTION_H_
OLDNEW
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | src/compiler/instruction-selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698