Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / v8 / src / arm64 / lithium-gap-resolver-arm64.h
1 // Copyright 2013 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_ARM64_LITHIUM_GAP_RESOLVER_ARM64_H_
6 #define V8_ARM64_LITHIUM_GAP_RESOLVER_ARM64_H_
7
8 #include "v8.h"
9
10 #include "lithium.h"
11
12 namespace v8 {
13 namespace internal {
14
15 class LCodeGen;
16 class LGapResolver;
17
18 class LGapResolver BASE_EMBEDDED {
19  public:
20   explicit LGapResolver(LCodeGen* owner);
21
22   // Resolve a set of parallel moves, emitting assembler instructions.
23   void Resolve(LParallelMove* parallel_move);
24
25  private:
26   // Build the initial list of moves.
27   void BuildInitialMoveList(LParallelMove* parallel_move);
28
29   // Perform the move at the moves_ index in question (possibly requiring
30   // other moves to satisfy dependencies).
31   void PerformMove(int index);
32
33   // If a cycle is found in the series of moves, save the blocking value to
34   // a scratch register.  The cycle must be found by hitting the root of the
35   // depth-first search.
36   void BreakCycle(int index);
37
38   // After a cycle has been resolved, restore the value from the scratch
39   // register to its proper destination.
40   void RestoreValue();
41
42   // Emit a move and remove it from the move graph.
43   void EmitMove(int index);
44
45   // Emit a move from one stack slot to another.
46   void EmitStackSlotMove(int index);
47
48   // Verify the move list before performing moves.
49   void Verify();
50
51   LCodeGen* cgen_;
52
53   // List of moves not yet resolved.
54   ZoneList<LMoveOperands> moves_;
55
56   int root_index_;
57   bool in_cycle_;
58   LOperand* saved_destination_;
59
60   // We use the root register as a scratch in a few places. When that happens,
61   // this flag is set to indicate that it needs to be restored.
62   bool need_to_restore_root_;
63 };
64
65 } }  // namespace v8::internal
66
67 #endif  // V8_ARM64_LITHIUM_GAP_RESOLVER_ARM64_H_