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

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

Issue 1896813003: [turbofan] store block id with instruction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « 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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 708
709 private: 709 private:
710 friend std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm); 710 friend std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm);
711 711
712 ZoneVector<InstructionOperand> reference_operands_; 712 ZoneVector<InstructionOperand> reference_operands_;
713 int instruction_position_; 713 int instruction_position_;
714 }; 714 };
715 715
716 std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm); 716 std::ostream& operator<<(std::ostream& os, const ReferenceMap& pm);
717 717
718 class InstructionBlock;
719
718 class Instruction final { 720 class Instruction final {
719 public: 721 public:
720 size_t OutputCount() const { return OutputCountField::decode(bit_field_); } 722 size_t OutputCount() const { return OutputCountField::decode(bit_field_); }
721 const InstructionOperand* OutputAt(size_t i) const { 723 const InstructionOperand* OutputAt(size_t i) const {
722 DCHECK(i < OutputCount()); 724 DCHECK(i < OutputCount());
723 return &operands_[i]; 725 return &operands_[i];
724 } 726 }
725 InstructionOperand* OutputAt(size_t i) { 727 InstructionOperand* OutputAt(size_t i) {
726 DCHECK(i < OutputCount()); 728 DCHECK(i < OutputCount());
727 return &operands_[i]; 729 return &operands_[i];
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 852
851 const ParallelMove* GetParallelMove(GapPosition pos) const { 853 const ParallelMove* GetParallelMove(GapPosition pos) const {
852 return parallel_moves_[pos]; 854 return parallel_moves_[pos];
853 } 855 }
854 856
855 bool AreMovesRedundant() const; 857 bool AreMovesRedundant() const;
856 858
857 ParallelMove* const* parallel_moves() const { return &parallel_moves_[0]; } 859 ParallelMove* const* parallel_moves() const { return &parallel_moves_[0]; }
858 ParallelMove** parallel_moves() { return &parallel_moves_[0]; } 860 ParallelMove** parallel_moves() { return &parallel_moves_[0]; }
859 861
862 // The block_id may be invalidated in JumpThreading. It is only important for
863 // register allocation, to avoid searching for blocks from instruction
864 // indexes.
865 InstructionBlock* block() const { return block_; }
866 void set_block(InstructionBlock* block) {
867 DCHECK_NOT_NULL(block);
868 block_ = block;
869 }
870
860 void Print(const RegisterConfiguration* config) const; 871 void Print(const RegisterConfiguration* config) const;
861 void Print() const; 872 void Print() const;
862 873
863 private: 874 private:
864 explicit Instruction(InstructionCode opcode); 875 explicit Instruction(InstructionCode opcode);
865 876
866 Instruction(InstructionCode opcode, size_t output_count, 877 Instruction(InstructionCode opcode, size_t output_count,
867 InstructionOperand* outputs, size_t input_count, 878 InstructionOperand* outputs, size_t input_count,
868 InstructionOperand* inputs, size_t temp_count, 879 InstructionOperand* inputs, size_t temp_count,
869 InstructionOperand* temps); 880 InstructionOperand* temps);
870 881
871 typedef BitField<size_t, 0, 8> OutputCountField; 882 typedef BitField<size_t, 0, 8> OutputCountField;
872 typedef BitField<size_t, 8, 16> InputCountField; 883 typedef BitField<size_t, 8, 16> InputCountField;
873 typedef BitField<size_t, 24, 6> TempCountField; 884 typedef BitField<size_t, 24, 6> TempCountField;
874 typedef BitField<bool, 30, 1> IsCallField; 885 typedef BitField<bool, 30, 1> IsCallField;
875 886
876 InstructionCode opcode_; 887 InstructionCode opcode_;
877 uint32_t bit_field_; 888 uint32_t bit_field_;
878 ParallelMove* parallel_moves_[2]; 889 ParallelMove* parallel_moves_[2];
879 ReferenceMap* reference_map_; 890 ReferenceMap* reference_map_;
891 InstructionBlock* block_;
880 InstructionOperand operands_[1]; 892 InstructionOperand operands_[1];
881 893
882 DISALLOW_COPY_AND_ASSIGN(Instruction); 894 DISALLOW_COPY_AND_ASSIGN(Instruction);
883 }; 895 };
884 896
885 897
886 struct PrintableInstruction { 898 struct PrintableInstruction {
887 const RegisterConfiguration* register_configuration_; 899 const RegisterConfiguration* register_configuration_;
888 const Instruction* instr_; 900 const Instruction* instr_;
889 }; 901 };
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 private: 1399 private:
1388 friend std::ostream& operator<<(std::ostream& os, 1400 friend std::ostream& operator<<(std::ostream& os,
1389 const PrintableInstructionSequence& code); 1401 const PrintableInstructionSequence& code);
1390 1402
1391 typedef ZoneMap<const Instruction*, SourcePosition> SourcePositionMap; 1403 typedef ZoneMap<const Instruction*, SourcePosition> SourcePositionMap;
1392 1404
1393 Isolate* isolate_; 1405 Isolate* isolate_;
1394 Zone* const zone_; 1406 Zone* const zone_;
1395 InstructionBlocks* const instruction_blocks_; 1407 InstructionBlocks* const instruction_blocks_;
1396 SourcePositionMap source_positions_; 1408 SourcePositionMap source_positions_;
1397 IntVector block_starts_;
1398 ConstantMap constants_; 1409 ConstantMap constants_;
1399 Immediates immediates_; 1410 Immediates immediates_;
1400 InstructionDeque instructions_; 1411 InstructionDeque instructions_;
1401 int next_virtual_register_; 1412 int next_virtual_register_;
1402 ReferenceMapDeque reference_maps_; 1413 ReferenceMapDeque reference_maps_;
1403 ZoneVector<MachineRepresentation> representations_; 1414 ZoneVector<MachineRepresentation> representations_;
1404 DeoptimizationVector deoptimization_entries_; 1415 DeoptimizationVector deoptimization_entries_;
1405 1416
1417 // Used at construction time
1418 InstructionBlock* current_block_;
1419
1406 DISALLOW_COPY_AND_ASSIGN(InstructionSequence); 1420 DISALLOW_COPY_AND_ASSIGN(InstructionSequence);
1407 }; 1421 };
1408 1422
1409 1423
1410 struct PrintableInstructionSequence { 1424 struct PrintableInstructionSequence {
1411 const RegisterConfiguration* register_configuration_; 1425 const RegisterConfiguration* register_configuration_;
1412 const InstructionSequence* sequence_; 1426 const InstructionSequence* sequence_;
1413 }; 1427 };
1414 1428
1415 1429
1416 std::ostream& operator<<(std::ostream& os, 1430 std::ostream& operator<<(std::ostream& os,
1417 const PrintableInstructionSequence& code); 1431 const PrintableInstructionSequence& code);
1418 1432
1419 } // namespace compiler 1433 } // namespace compiler
1420 } // namespace internal 1434 } // namespace internal
1421 } // namespace v8 1435 } // namespace v8
1422 1436
1423 #endif // V8_COMPILER_INSTRUCTION_H_ 1437 #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