deps: update v8 to 4.3.61.21
[platform/upstream/nodejs.git] / deps / v8 / src / compiler / register-allocator-verifier.h
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
3 // found in the LICENSE file.
4
5 #ifndef V8_REGISTER_ALLOCATOR_VERIFIER_H_
6 #define V8_REGISTER_ALLOCATOR_VERIFIER_H_
7
8 #include "src/zone-containers.h"
9
10 namespace v8 {
11 namespace internal {
12 namespace compiler {
13
14 class InstructionOperand;
15 class InstructionSequence;
16
17 class RegisterAllocatorVerifier FINAL : public ZoneObject {
18  public:
19   RegisterAllocatorVerifier(Zone* zone, const RegisterConfiguration* config,
20                             const InstructionSequence* sequence);
21
22   void VerifyAssignment();
23   void VerifyGapMoves();
24
25  private:
26   enum ConstraintType {
27     kConstant,
28     kImmediate,
29     kRegister,
30     kFixedRegister,
31     kDoubleRegister,
32     kFixedDoubleRegister,
33     kSlot,
34     kDoubleSlot,
35     kFixedSlot,
36     kNone,
37     kNoneDouble,
38     kSameAsFirst
39   };
40
41   struct OperandConstraint {
42     ConstraintType type_;
43     int value_;  // subkind index when relevant
44     int virtual_register_;
45   };
46
47   struct InstructionConstraint {
48     const Instruction* instruction_;
49     size_t operand_constaints_size_;
50     OperandConstraint* operand_constraints_;
51   };
52
53   class BlockMaps;
54
55   typedef ZoneVector<InstructionConstraint> Constraints;
56
57   Zone* zone() const { return zone_; }
58   const RegisterConfiguration* config() { return config_; }
59   const InstructionSequence* sequence() const { return sequence_; }
60   Constraints* constraints() { return &constraints_; }
61
62   static void VerifyInput(const OperandConstraint& constraint);
63   static void VerifyTemp(const OperandConstraint& constraint);
64   static void VerifyOutput(const OperandConstraint& constraint);
65
66   void BuildConstraint(const InstructionOperand* op,
67                        OperandConstraint* constraint);
68   void CheckConstraint(const InstructionOperand* op,
69                        const OperandConstraint* constraint);
70
71   void VerifyGapMoves(BlockMaps* outgoing_mappings, bool initial_pass);
72
73   Zone* const zone_;
74   const RegisterConfiguration* config_;
75   const InstructionSequence* const sequence_;
76   Constraints constraints_;
77
78   DISALLOW_COPY_AND_ASSIGN(RegisterAllocatorVerifier);
79 };
80
81 }  // namespace compiler
82 }  // namespace internal
83 }  // namespace v8
84
85 #endif