| 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 private: | 26 private: |
| 27 enum class State : uint8_t { kUnvisited, kOnStack, kInputsPushed, kVisited }; | 27 enum class State : uint8_t { kUnvisited, kOnStack, kVisited }; |
| 28 | 28 |
| 29 struct Replacement { | 29 struct Replacement { |
| 30 Node* low; | 30 Node* low; |
| 31 Node* high; | 31 Node* high; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 Zone* zone() const { return zone_; } | 34 Zone* zone() const { return zone_; } |
| 35 Graph* graph() const { return graph_; } | 35 Graph* graph() const { return graph_; } |
| 36 MachineOperatorBuilder* machine() const { return machine_; } | 36 MachineOperatorBuilder* machine() const { return machine_; } |
| 37 CommonOperatorBuilder* common() const { return common_; } | 37 CommonOperatorBuilder* common() const { return common_; } |
| 38 Signature<MachineRepresentation>* signature() const { return signature_; } | 38 Signature<MachineRepresentation>* signature() const { return signature_; } |
| 39 | 39 |
| 40 void LowerNode(Node* node); | 40 void LowerNode(Node* node); |
| 41 bool DefaultLowering(Node* node); | 41 bool DefaultLowering(Node* node); |
| 42 void LowerComparison(Node* node, const Operator* signed_op, | 42 void LowerComparison(Node* node, const Operator* signed_op, |
| 43 const Operator* unsigned_op); | 43 const Operator* unsigned_op); |
| 44 | 44 |
| 45 void ReplaceNode(Node* old, Node* new_low, Node* new_high); | 45 void ReplaceNode(Node* old, Node* new_low, Node* new_high); |
| 46 bool HasReplacementLow(Node* node); | 46 bool HasReplacementLow(Node* node); |
| 47 Node* GetReplacementLow(Node* node); | 47 Node* GetReplacementLow(Node* node); |
| 48 bool HasReplacementHigh(Node* node); | 48 bool HasReplacementHigh(Node* node); |
| 49 Node* GetReplacementHigh(Node* node); | 49 Node* GetReplacementHigh(Node* node); |
| 50 | 50 |
| 51 struct NodeState { |
| 52 Node* node; |
| 53 int input_index; |
| 54 }; |
| 55 |
| 51 Zone* zone_; | 56 Zone* zone_; |
| 52 Graph* const graph_; | 57 Graph* const graph_; |
| 53 MachineOperatorBuilder* machine_; | 58 MachineOperatorBuilder* machine_; |
| 54 CommonOperatorBuilder* common_; | 59 CommonOperatorBuilder* common_; |
| 55 NodeMarker<State> state_; | 60 NodeMarker<State> state_; |
| 56 ZoneStack<Node*> stack_; | 61 ZoneStack<NodeState> stack_; |
| 57 Replacement* replacements_; | 62 Replacement* replacements_; |
| 58 Signature<MachineRepresentation>* signature_; | 63 Signature<MachineRepresentation>* signature_; |
| 59 }; | 64 }; |
| 60 | 65 |
| 61 } // namespace compiler | 66 } // namespace compiler |
| 62 } // namespace internal | 67 } // namespace internal |
| 63 } // namespace v8 | 68 } // namespace v8 |
| 64 | 69 |
| 65 #endif // V8_COMPILER_INT64_LOWERING_H_ | 70 #endif // V8_COMPILER_INT64_LOWERING_H_ |
| OLD | NEW |