| 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/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| 11 #include "src/compiler/simplified-operator.h" | 11 #include "src/compiler/simplified-operator.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 // Forward declarations. | 16 // Forward declarations. |
| 17 class TypeCache; | 17 class TypeCache; |
| 18 | 18 |
| 19 | 19 |
| 20 namespace compiler { | 20 namespace compiler { |
| 21 | 21 |
| 22 // Forward declarations. | 22 // Forward declarations. |
| 23 class RepresentationChanger; | 23 class RepresentationChanger; |
| 24 class RepresentationSelector; |
| 24 class SourcePositionTable; | 25 class SourcePositionTable; |
| 25 | 26 |
| 26 class SimplifiedLowering final { | 27 class SimplifiedLowering final { |
| 27 public: | 28 public: |
| 28 SimplifiedLowering(JSGraph* jsgraph, Zone* zone, | 29 SimplifiedLowering(JSGraph* jsgraph, Zone* zone, |
| 29 SourcePositionTable* source_positions); | 30 SourcePositionTable* source_positions); |
| 30 ~SimplifiedLowering() {} | 31 ~SimplifiedLowering() {} |
| 31 | 32 |
| 32 void LowerAllNodes(); | 33 void LowerAllNodes(); |
| 33 | 34 |
| 35 void DoJSToNumberTruncatesToFloat64(Node* node, |
| 36 RepresentationSelector* selector); |
| 37 void DoJSToNumberTruncatesToWord32(Node* node, |
| 38 RepresentationSelector* selector); |
| 34 // TODO(turbofan): The representation can be removed once the result of the | 39 // TODO(turbofan): The representation can be removed once the result of the |
| 35 // representation analysis is stored in the node bounds. | 40 // representation analysis is stored in the node bounds. |
| 36 void DoLoadBuffer(Node* node, MachineRepresentation rep, | 41 void DoLoadBuffer(Node* node, MachineRepresentation rep, |
| 37 RepresentationChanger* changer); | 42 RepresentationChanger* changer); |
| 38 void DoStoreBuffer(Node* node); | 43 void DoStoreBuffer(Node* node); |
| 39 void DoShift(Node* node, Operator const* op, Type* rhs_type); | 44 void DoShift(Node* node, Operator const* op, Type* rhs_type); |
| 40 | 45 |
| 41 private: | 46 private: |
| 42 JSGraph* const jsgraph_; | 47 JSGraph* const jsgraph_; |
| 43 Zone* const zone_; | 48 Zone* const zone_; |
| 44 TypeCache const& type_cache_; | 49 TypeCache const& type_cache_; |
| 50 SetOncePointer<Node> to_number_code_; |
| 51 SetOncePointer<Operator const> to_number_operator_; |
| 45 | 52 |
| 46 // TODO(danno): SimplifiedLowering shouldn't know anything about the source | 53 // TODO(danno): SimplifiedLowering shouldn't know anything about the source |
| 47 // positions table, but must for now since there currently is no other way to | 54 // positions table, but must for now since there currently is no other way to |
| 48 // pass down source position information to nodes created during | 55 // pass down source position information to nodes created during |
| 49 // lowering. Once this phase becomes a vanilla reducer, it should get source | 56 // lowering. Once this phase becomes a vanilla reducer, it should get source |
| 50 // position information via the SourcePositionWrapper like all other reducers. | 57 // position information via the SourcePositionWrapper like all other reducers. |
| 51 SourcePositionTable* source_positions_; | 58 SourcePositionTable* source_positions_; |
| 52 | 59 |
| 53 Node* Float64Ceil(Node* const node); | 60 Node* Float64Ceil(Node* const node); |
| 54 Node* Float64Floor(Node* const node); | 61 Node* Float64Floor(Node* const node); |
| 55 Node* Float64Round(Node* const node); | 62 Node* Float64Round(Node* const node); |
| 56 Node* Float64Trunc(Node* const node); | 63 Node* Float64Trunc(Node* const node); |
| 57 Node* Int32Div(Node* const node); | 64 Node* Int32Div(Node* const node); |
| 58 Node* Int32Mod(Node* const node); | 65 Node* Int32Mod(Node* const node); |
| 59 Node* Uint32Div(Node* const node); | 66 Node* Uint32Div(Node* const node); |
| 60 Node* Uint32Mod(Node* const node); | 67 Node* Uint32Mod(Node* const node); |
| 61 | 68 |
| 69 Node* ToNumberCode(); |
| 70 Operator const* ToNumberOperator(); |
| 71 |
| 62 friend class RepresentationSelector; | 72 friend class RepresentationSelector; |
| 63 | 73 |
| 64 Isolate* isolate() { return jsgraph_->isolate(); } | 74 Isolate* isolate() { return jsgraph_->isolate(); } |
| 65 Zone* zone() { return jsgraph_->zone(); } | 75 Zone* zone() { return jsgraph_->zone(); } |
| 66 JSGraph* jsgraph() { return jsgraph_; } | 76 JSGraph* jsgraph() { return jsgraph_; } |
| 67 Graph* graph() { return jsgraph()->graph(); } | 77 Graph* graph() { return jsgraph()->graph(); } |
| 68 CommonOperatorBuilder* common() { return jsgraph()->common(); } | 78 CommonOperatorBuilder* common() { return jsgraph()->common(); } |
| 69 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } | 79 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
| 80 SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); } |
| 70 }; | 81 }; |
| 71 | 82 |
| 72 } // namespace compiler | 83 } // namespace compiler |
| 73 } // namespace internal | 84 } // namespace internal |
| 74 } // namespace v8 | 85 } // namespace v8 |
| 75 | 86 |
| 76 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ | 87 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| OLD | NEW |