OLD | NEW |
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_INT64_LOWERING_H_ | 5 #ifndef V8_COMPILER_INT64_LOWERING_H_ |
6 #define V8_COMPILER_INT64_LOWERING_H_ | 6 #define V8_COMPILER_INT64_LOWERING_H_ |
7 | 7 |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
11 #include "src/compiler/node-marker.h" | 11 #include "src/compiler/node-marker.h" |
12 #include "src/zone-containers.h" | 12 #include "src/zone-containers.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 class Int64Lowering { | 18 class Int64Lowering { |
19 public: | 19 public: |
20 Int64Lowering(Graph* graph, MachineOperatorBuilder* machine, | 20 Int64Lowering(Graph* graph, MachineOperatorBuilder* machine, |
21 CommonOperatorBuilder* common, Zone* zone, | 21 CommonOperatorBuilder* common, Zone* zone, |
22 Signature<MachineRepresentation>* signature); | 22 Signature<MachineRepresentation>* signature); |
23 | 23 |
24 void LowerGraph(); | 24 void LowerGraph(); |
25 | 25 |
26 static int GetParameterCountAfterLowering( | 26 static int GetParameterCountAfterLowering( |
27 Signature<MachineRepresentation>* signature); | 27 Signature<MachineRepresentation>* signature); |
28 | 28 |
| 29 static const int kLowerWordOffset; |
| 30 static const int kHigherWordOffset; |
| 31 |
29 private: | 32 private: |
30 enum class State : uint8_t { kUnvisited, kOnStack, kVisited }; | 33 enum class State : uint8_t { kUnvisited, kOnStack, kVisited }; |
31 | 34 |
32 struct Replacement { | 35 struct Replacement { |
33 Node* low; | 36 Node* low; |
34 Node* high; | 37 Node* high; |
35 }; | 38 }; |
36 | 39 |
37 Zone* zone() const { return zone_; } | 40 Zone* zone() const { return zone_; } |
38 Graph* graph() const { return graph_; } | 41 Graph* graph() const { return graph_; } |
39 MachineOperatorBuilder* machine() const { return machine_; } | 42 MachineOperatorBuilder* machine() const { return machine_; } |
40 CommonOperatorBuilder* common() const { return common_; } | 43 CommonOperatorBuilder* common() const { return common_; } |
41 Signature<MachineRepresentation>* signature() const { return signature_; } | 44 Signature<MachineRepresentation>* signature() const { return signature_; } |
42 | 45 |
43 void PrepareReplacements(Node* node); | 46 void PrepareReplacements(Node* node); |
44 void PushNode(Node* node); | 47 void PushNode(Node* node); |
45 void LowerNode(Node* node); | 48 void LowerNode(Node* node); |
46 bool DefaultLowering(Node* node); | 49 bool DefaultLowering(Node* node); |
47 void LowerComparison(Node* node, const Operator* signed_op, | 50 void LowerComparison(Node* node, const Operator* signed_op, |
48 const Operator* unsigned_op); | 51 const Operator* unsigned_op); |
49 void PrepareProjectionReplacements(Node* node); | 52 void PrepareProjectionReplacements(Node* node); |
50 | 53 |
51 void ReplaceNode(Node* old, Node* new_low, Node* new_high); | 54 void ReplaceNode(Node* old, Node* new_low, Node* new_high); |
52 bool HasReplacementLow(Node* node); | 55 bool HasReplacementLow(Node* node); |
53 Node* GetReplacementLow(Node* node); | 56 Node* GetReplacementLow(Node* node); |
54 bool HasReplacementHigh(Node* node); | 57 bool HasReplacementHigh(Node* node); |
55 Node* GetReplacementHigh(Node* node); | 58 Node* GetReplacementHigh(Node* node); |
56 void PreparePhiReplacement(Node* phi); | 59 void PreparePhiReplacement(Node* phi); |
| 60 void GetIndexNodes(Node* index, Node*& index_low, Node*& index_high); |
57 | 61 |
58 struct NodeState { | 62 struct NodeState { |
59 Node* node; | 63 Node* node; |
60 int input_index; | 64 int input_index; |
61 }; | 65 }; |
62 | 66 |
63 Zone* zone_; | 67 Zone* zone_; |
64 Graph* const graph_; | 68 Graph* const graph_; |
65 MachineOperatorBuilder* machine_; | 69 MachineOperatorBuilder* machine_; |
66 CommonOperatorBuilder* common_; | 70 CommonOperatorBuilder* common_; |
67 NodeMarker<State> state_; | 71 NodeMarker<State> state_; |
68 ZoneDeque<NodeState> stack_; | 72 ZoneDeque<NodeState> stack_; |
69 Replacement* replacements_; | 73 Replacement* replacements_; |
70 Signature<MachineRepresentation>* signature_; | 74 Signature<MachineRepresentation>* signature_; |
71 Node* placeholder_; | 75 Node* placeholder_; |
72 }; | 76 }; |
73 | 77 |
74 } // namespace compiler | 78 } // namespace compiler |
75 } // namespace internal | 79 } // namespace internal |
76 } // namespace v8 | 80 } // namespace v8 |
77 | 81 |
78 #endif // V8_COMPILER_INT64_LOWERING_H_ | 82 #endif // V8_COMPILER_INT64_LOWERING_H_ |
OLD | NEW |