| 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_SIMPLIFIED_LOWERING_H_ | 5 #ifndef V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| 6 #define V8_COMPILER_SIMPLIFIED_LOWERING_H_ | 6 #define V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| 7 | 7 |
| 8 #include "src/compiler/graph-reducer.h" | |
| 9 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
| 11 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| 12 #include "src/compiler/simplified-operator.h" | 11 #include "src/compiler/simplified-operator.h" |
| 13 | 12 |
| 14 namespace v8 { | 13 namespace v8 { |
| 15 namespace internal { | 14 namespace internal { |
| 16 namespace compiler { | 15 namespace compiler { |
| 17 | 16 |
| 18 class SimplifiedLowering : public Reducer { | 17 class SimplifiedLowering { |
| 19 public: | 18 public: |
| 20 explicit SimplifiedLowering(JSGraph* jsgraph) | 19 explicit SimplifiedLowering(JSGraph* jsgraph) |
| 21 : jsgraph_(jsgraph), machine_(jsgraph->zone()) {} | 20 : jsgraph_(jsgraph), machine_(jsgraph->zone()) {} |
| 22 virtual ~SimplifiedLowering() {} | 21 virtual ~SimplifiedLowering() {} |
| 23 | 22 |
| 24 void LowerAllNodes(); | 23 void LowerAllNodes(); |
| 25 | 24 |
| 26 virtual Reduction Reduce(Node* node); | |
| 27 void LowerChange(Node* node, Node* effect, Node* control); | |
| 28 | |
| 29 // TODO(titzer): These are exposed for direct testing. Use a friend class. | 25 // TODO(titzer): These are exposed for direct testing. Use a friend class. |
| 30 void DoLoadField(Node* node); | 26 void DoLoadField(Node* node); |
| 31 void DoStoreField(Node* node); | 27 void DoStoreField(Node* node); |
| 32 void DoLoadElement(Node* node); | 28 void DoLoadElement(Node* node); |
| 33 void DoStoreElement(Node* node); | 29 void DoStoreElement(Node* node); |
| 34 | 30 |
| 35 private: | 31 private: |
| 36 JSGraph* jsgraph_; | 32 JSGraph* jsgraph_; |
| 37 MachineOperatorBuilder machine_; | 33 MachineOperatorBuilder machine_; |
| 38 | 34 |
| 39 Node* SmiTag(Node* node); | 35 Node* SmiTag(Node* node); |
| 40 Node* IsTagged(Node* node); | 36 Node* IsTagged(Node* node); |
| 41 Node* Untag(Node* node); | 37 Node* Untag(Node* node); |
| 42 Node* OffsetMinusTagConstant(int32_t offset); | 38 Node* OffsetMinusTagConstant(int32_t offset); |
| 43 Node* ComputeIndex(const ElementAccess& access, Node* index); | 39 Node* ComputeIndex(const ElementAccess& access, Node* index); |
| 44 | 40 |
| 45 void DoChangeTaggedToUI32(Node* node, Node* effect, Node* control, | |
| 46 bool is_signed); | |
| 47 void DoChangeUI32ToTagged(Node* node, Node* effect, Node* control, | |
| 48 bool is_signed); | |
| 49 void DoChangeTaggedToFloat64(Node* node, Node* effect, Node* control); | |
| 50 void DoChangeFloat64ToTagged(Node* node, Node* effect, Node* control); | |
| 51 void DoChangeBoolToBit(Node* node, Node* effect, Node* control); | |
| 52 void DoChangeBitToBool(Node* node, Node* effect, Node* control); | |
| 53 | |
| 54 friend class RepresentationSelector; | 41 friend class RepresentationSelector; |
| 55 | 42 |
| 56 Zone* zone() { return jsgraph_->zone(); } | 43 Zone* zone() { return jsgraph_->zone(); } |
| 57 JSGraph* jsgraph() { return jsgraph_; } | 44 JSGraph* jsgraph() { return jsgraph_; } |
| 58 Graph* graph() { return jsgraph()->graph(); } | 45 Graph* graph() { return jsgraph()->graph(); } |
| 59 CommonOperatorBuilder* common() { return jsgraph()->common(); } | 46 CommonOperatorBuilder* common() { return jsgraph()->common(); } |
| 60 MachineOperatorBuilder* machine() { return &machine_; } | 47 MachineOperatorBuilder* machine() { return &machine_; } |
| 61 }; | 48 }; |
| 62 | 49 |
| 63 } // namespace compiler | 50 } // namespace compiler |
| 64 } // namespace internal | 51 } // namespace internal |
| 65 } // namespace v8 | 52 } // namespace v8 |
| 66 | 53 |
| 67 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ | 54 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| OLD | NEW |