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

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

Issue 948033002: [turbofan] only use two gaps (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | src/compiler/instruction.cc » ('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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 move_operands_.Add(MoveOperands(from, to), zone); 393 move_operands_.Add(MoveOperands(from, to), zone);
394 } 394 }
395 395
396 bool IsRedundant() const; 396 bool IsRedundant() const;
397 397
398 ZoneList<MoveOperands>* move_operands() { return &move_operands_; } 398 ZoneList<MoveOperands>* move_operands() { return &move_operands_; }
399 const ZoneList<MoveOperands>* move_operands() const { 399 const ZoneList<MoveOperands>* move_operands() const {
400 return &move_operands_; 400 return &move_operands_;
401 } 401 }
402 402
403 // Prepare this ParallelMove to insert move as if it happened in a subsequent
404 // ParallelMove. move->source() may be changed. The MoveOperand returned
405 // must be Eliminated and, as it points directly into move_operands_, it must
406 // be Eliminated before any further mutation.
407 MoveOperands* PrepareInsertAfter(MoveOperands* move) const;
408
403 private: 409 private:
404 ZoneList<MoveOperands> move_operands_; 410 ZoneList<MoveOperands> move_operands_;
405 }; 411 };
406 412
407 413
408 struct PrintableParallelMove { 414 struct PrintableParallelMove {
409 const RegisterConfiguration* register_configuration_; 415 const RegisterConfiguration* register_configuration_;
410 const ParallelMove* parallel_move_; 416 const ParallelMove* parallel_move_;
411 }; 417 };
412 418
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 }; 595 };
590 std::ostream& operator<<(std::ostream& os, const PrintableInstruction& instr); 596 std::ostream& operator<<(std::ostream& os, const PrintableInstruction& instr);
591 597
592 598
593 // Represents moves inserted before an instruction due to register allocation. 599 // Represents moves inserted before an instruction due to register allocation.
594 // TODO(titzer): squash GapInstruction back into Instruction, since essentially 600 // TODO(titzer): squash GapInstruction back into Instruction, since essentially
595 // every instruction can possibly have moves inserted before it. 601 // every instruction can possibly have moves inserted before it.
596 class GapInstruction : public Instruction { 602 class GapInstruction : public Instruction {
597 public: 603 public:
598 enum InnerPosition { 604 enum InnerPosition {
599 BEFORE,
600 START, 605 START,
601 END, 606 END,
602 AFTER, 607 FIRST_INNER_POSITION = START,
603 FIRST_INNER_POSITION = BEFORE, 608 LAST_INNER_POSITION = END
604 LAST_INNER_POSITION = AFTER
605 }; 609 };
606 610
607 ParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) { 611 ParallelMove* GetOrCreateParallelMove(InnerPosition pos, Zone* zone) {
608 if (parallel_moves_[pos] == NULL) { 612 if (parallel_moves_[pos] == NULL) {
609 parallel_moves_[pos] = new (zone) ParallelMove(zone); 613 parallel_moves_[pos] = new (zone) ParallelMove(zone);
610 } 614 }
611 return parallel_moves_[pos]; 615 return parallel_moves_[pos];
612 } 616 }
613 617
614 ParallelMove* GetParallelMove(InnerPosition pos) { 618 ParallelMove* GetParallelMove(InnerPosition pos) {
(...skipping 18 matching lines...) Expand all
633 return static_cast<GapInstruction*>(instr); 637 return static_cast<GapInstruction*>(instr);
634 } 638 }
635 639
636 static const GapInstruction* cast(const Instruction* instr) { 640 static const GapInstruction* cast(const Instruction* instr) {
637 DCHECK(instr->IsGapMoves()); 641 DCHECK(instr->IsGapMoves());
638 return static_cast<const GapInstruction*>(instr); 642 return static_cast<const GapInstruction*>(instr);
639 } 643 }
640 644
641 protected: 645 protected:
642 explicit GapInstruction(InstructionCode opcode) : Instruction(opcode) { 646 explicit GapInstruction(InstructionCode opcode) : Instruction(opcode) {
643 parallel_moves_[BEFORE] = NULL;
644 parallel_moves_[START] = NULL; 647 parallel_moves_[START] = NULL;
645 parallel_moves_[END] = NULL; 648 parallel_moves_[END] = NULL;
646 parallel_moves_[AFTER] = NULL;
647 } 649 }
648 650
649 private: 651 private:
650 friend std::ostream& operator<<(std::ostream& os, 652 friend std::ostream& operator<<(std::ostream& os,
651 const PrintableInstruction& instr); 653 const PrintableInstruction& instr);
652 ParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; 654 ParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
653 }; 655 };
654 656
655 657
656 class SourcePositionInstruction FINAL : public Instruction { 658 class SourcePositionInstruction FINAL : public Instruction {
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 1062
1061 1063
1062 std::ostream& operator<<(std::ostream& os, 1064 std::ostream& operator<<(std::ostream& os,
1063 const PrintableInstructionSequence& code); 1065 const PrintableInstructionSequence& code);
1064 1066
1065 } // namespace compiler 1067 } // namespace compiler
1066 } // namespace internal 1068 } // namespace internal
1067 } // namespace v8 1069 } // namespace v8
1068 1070
1069 #endif // V8_COMPILER_INSTRUCTION_H_ 1071 #endif // V8_COMPILER_INSTRUCTION_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698