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

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

Issue 854703002: Reland "[turbofan] simplify gap ordering" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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>
11 #include <set> 11 #include <set>
12 12
13 #include "src/compiler/common-operator.h" 13 #include "src/compiler/common-operator.h"
14 #include "src/compiler/frame.h" 14 #include "src/compiler/frame.h"
15 #include "src/compiler/instruction-codes.h" 15 #include "src/compiler/instruction-codes.h"
16 #include "src/compiler/opcodes.h" 16 #include "src/compiler/opcodes.h"
17 #include "src/compiler/register-configuration.h" 17 #include "src/compiler/register-configuration.h"
18 #include "src/compiler/schedule.h" 18 #include "src/compiler/schedule.h"
19 #include "src/compiler/source-position.h" 19 #include "src/compiler/source-position.h"
20 #include "src/zone-allocator.h" 20 #include "src/zone-allocator.h"
21 21
22 namespace v8 { 22 namespace v8 {
23 namespace internal { 23 namespace internal {
24 namespace compiler { 24 namespace compiler {
25 25
26 // A couple of reserved opcodes are used for internal use. 26 // A couple of reserved opcodes are used for internal use.
27 const InstructionCode kGapInstruction = -1; 27 const InstructionCode kGapInstruction = -1;
28 const InstructionCode kBlockStartInstruction = -2; 28 const InstructionCode kSourcePositionInstruction = -2;
29 const InstructionCode kSourcePositionInstruction = -3;
30 29
31 #define INSTRUCTION_OPERAND_LIST(V) \ 30 #define INSTRUCTION_OPERAND_LIST(V) \
32 V(Constant, CONSTANT, 0) \ 31 V(Constant, CONSTANT, 0) \
33 V(Immediate, IMMEDIATE, 0) \ 32 V(Immediate, IMMEDIATE, 0) \
34 V(StackSlot, STACK_SLOT, 128) \ 33 V(StackSlot, STACK_SLOT, 128) \
35 V(DoubleStackSlot, DOUBLE_STACK_SLOT, 128) \ 34 V(DoubleStackSlot, DOUBLE_STACK_SLOT, 128) \
36 V(Register, REGISTER, RegisterConfiguration::kMaxGeneralRegisters) \ 35 V(Register, REGISTER, RegisterConfiguration::kMaxGeneralRegisters) \
37 V(DoubleRegister, DOUBLE_REGISTER, RegisterConfiguration::kMaxDoubleRegisters) 36 V(DoubleRegister, DOUBLE_REGISTER, RegisterConfiguration::kMaxDoubleRegisters)
38 37
39 class InstructionOperand : public ZoneObject { 38 class InstructionOperand : public ZoneObject {
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } 486 }
488 Instruction* MarkAsCall() { 487 Instruction* MarkAsCall() {
489 bit_field_ = IsCallField::update(bit_field_, true); 488 bit_field_ = IsCallField::update(bit_field_, true);
490 return this; 489 return this;
491 } 490 }
492 bool IsControl() const { return IsControlField::decode(bit_field_); } 491 bool IsControl() const { return IsControlField::decode(bit_field_); }
493 bool IsCall() const { return IsCallField::decode(bit_field_); } 492 bool IsCall() const { return IsCallField::decode(bit_field_); }
494 bool NeedsPointerMap() const { return IsCall(); } 493 bool NeedsPointerMap() const { return IsCall(); }
495 bool HasPointerMap() const { return pointer_map_ != NULL; } 494 bool HasPointerMap() const { return pointer_map_ != NULL; }
496 495
497 bool IsGapMoves() const { 496 bool IsGapMoves() const { return opcode() == kGapInstruction; }
498 return opcode() == kGapInstruction || opcode() == kBlockStartInstruction;
499 }
500 bool IsBlockStart() const { return opcode() == kBlockStartInstruction; }
501 bool IsSourcePosition() const { 497 bool IsSourcePosition() const {
502 return opcode() == kSourcePositionInstruction; 498 return opcode() == kSourcePositionInstruction;
503 } 499 }
504 500
505 bool ClobbersRegisters() const { return IsCall(); } 501 bool ClobbersRegisters() const { return IsCall(); }
506 bool ClobbersTemps() const { return IsCall(); } 502 bool ClobbersTemps() const { return IsCall(); }
507 bool ClobbersDoubleRegisters() const { return IsCall(); } 503 bool ClobbersDoubleRegisters() const { return IsCall(); }
508 PointerMap* pointer_map() const { return pointer_map_; } 504 PointerMap* pointer_map() const { return pointer_map_; }
509 505
510 void set_pointer_map(PointerMap* map) { 506 void set_pointer_map(PointerMap* map) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 parallel_moves_[AFTER] = NULL; 632 parallel_moves_[AFTER] = NULL;
637 } 633 }
638 634
639 private: 635 private:
640 friend std::ostream& operator<<(std::ostream& os, 636 friend std::ostream& operator<<(std::ostream& os,
641 const PrintableInstruction& instr); 637 const PrintableInstruction& instr);
642 ParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; 638 ParallelMove* parallel_moves_[LAST_INNER_POSITION + 1];
643 }; 639 };
644 640
645 641
646 // This special kind of gap move instruction represents the beginning of a
647 // block of code.
648 class BlockStartInstruction FINAL : public GapInstruction {
649 public:
650 static BlockStartInstruction* New(Zone* zone) {
651 void* buffer = zone->New(sizeof(BlockStartInstruction));
652 return new (buffer) BlockStartInstruction();
653 }
654
655 static BlockStartInstruction* cast(Instruction* instr) {
656 DCHECK(instr->IsBlockStart());
657 return static_cast<BlockStartInstruction*>(instr);
658 }
659
660 static const BlockStartInstruction* cast(const Instruction* instr) {
661 DCHECK(instr->IsBlockStart());
662 return static_cast<const BlockStartInstruction*>(instr);
663 }
664
665 private:
666 BlockStartInstruction() : GapInstruction(kBlockStartInstruction) {}
667 };
668
669
670 class SourcePositionInstruction FINAL : public Instruction { 642 class SourcePositionInstruction FINAL : public Instruction {
671 public: 643 public:
672 static SourcePositionInstruction* New(Zone* zone, SourcePosition position) { 644 static SourcePositionInstruction* New(Zone* zone, SourcePosition position) {
673 void* buffer = zone->New(sizeof(SourcePositionInstruction)); 645 void* buffer = zone->New(sizeof(SourcePositionInstruction));
674 return new (buffer) SourcePositionInstruction(position); 646 return new (buffer) SourcePositionInstruction(position);
675 } 647 }
676 648
677 SourcePosition source_position() const { return source_position_; } 649 SourcePosition source_position() const { return source_position_; }
678 650
679 static SourcePositionInstruction* cast(Instruction* instr) { 651 static SourcePositionInstruction* cast(Instruction* instr) {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 const InstructionBlock* GetInstructionBlock(int instruction_index) const; 948 const InstructionBlock* GetInstructionBlock(int instruction_index) const;
977 949
978 bool IsReference(int virtual_register) const; 950 bool IsReference(int virtual_register) const;
979 bool IsDouble(int virtual_register) const; 951 bool IsDouble(int virtual_register) const;
980 952
981 void MarkAsReference(int virtual_register); 953 void MarkAsReference(int virtual_register);
982 void MarkAsDouble(int virtual_register); 954 void MarkAsDouble(int virtual_register);
983 955
984 void AddGapMove(int index, InstructionOperand* from, InstructionOperand* to); 956 void AddGapMove(int index, InstructionOperand* from, InstructionOperand* to);
985 957
986 BlockStartInstruction* GetBlockStart(BasicBlock::RpoNumber rpo) const; 958 GapInstruction* GetBlockStart(BasicBlock::RpoNumber rpo) const;
987 959
988 typedef InstructionDeque::const_iterator const_iterator; 960 typedef InstructionDeque::const_iterator const_iterator;
989 const_iterator begin() const { return instructions_.begin(); } 961 const_iterator begin() const { return instructions_.begin(); }
990 const_iterator end() const { return instructions_.end(); } 962 const_iterator end() const { return instructions_.end(); }
991 const InstructionDeque& instructions() const { return instructions_; } 963 const InstructionDeque& instructions() const { return instructions_; }
992 964
993 GapInstruction* GapAt(int index) const { 965 GapInstruction* GapAt(int index) const {
994 return GapInstruction::cast(InstructionAt(index)); 966 return GapInstruction::cast(InstructionAt(index));
995 } 967 }
996 bool IsGapAt(int index) const { return InstructionAt(index)->IsGapMoves(); } 968 bool IsGapAt(int index) const { return InstructionAt(index)->IsGapMoves(); }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 1060
1089 1061
1090 std::ostream& operator<<(std::ostream& os, 1062 std::ostream& operator<<(std::ostream& os,
1091 const PrintableInstructionSequence& code); 1063 const PrintableInstructionSequence& code);
1092 1064
1093 } // namespace compiler 1065 } // namespace compiler
1094 } // namespace internal 1066 } // namespace internal
1095 } // namespace v8 1067 } // namespace v8
1096 1068
1097 #endif // V8_COMPILER_INSTRUCTION_H_ 1069 #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