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