| 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 namespace compiler { | 15 namespace compiler { |
| 16 | 16 |
| 17 // Forward declarations. | 17 // Forward declarations. |
| 18 class RepresentationChanger; | 18 class RepresentationChanger; |
| 19 | 19 class SourcePositionTable; |
| 20 | 20 |
| 21 class SimplifiedLowering FINAL { | 21 class SimplifiedLowering FINAL { |
| 22 public: | 22 public: |
| 23 SimplifiedLowering(JSGraph* jsgraph, Zone* zone) | 23 SimplifiedLowering(JSGraph* jsgraph, Zone* zone, |
| 24 : jsgraph_(jsgraph), zone_(zone) {} | 24 SourcePositionTable* source_positions) |
| 25 : jsgraph_(jsgraph), zone_(zone), source_positions_(source_positions) {} |
| 25 ~SimplifiedLowering() {} | 26 ~SimplifiedLowering() {} |
| 26 | 27 |
| 27 void LowerAllNodes(); | 28 void LowerAllNodes(); |
| 28 | 29 |
| 29 // TODO(titzer): These are exposed for direct testing. Use a friend class. | 30 // TODO(titzer): These are exposed for direct testing. Use a friend class. |
| 30 void DoLoadField(Node* node); | 31 void DoLoadField(Node* node); |
| 31 void DoStoreField(Node* node); | 32 void DoStoreField(Node* node); |
| 32 // TODO(turbofan): The output_type can be removed once the result of the | 33 // TODO(turbofan): The output_type can be removed once the result of the |
| 33 // representation analysis is stored in the node bounds. | 34 // representation analysis is stored in the node bounds. |
| 34 void DoLoadBuffer(Node* node, MachineType output_type, | 35 void DoLoadBuffer(Node* node, MachineType output_type, |
| 35 RepresentationChanger* changer); | 36 RepresentationChanger* changer); |
| 36 void DoStoreBuffer(Node* node); | 37 void DoStoreBuffer(Node* node); |
| 37 void DoLoadElement(Node* node); | 38 void DoLoadElement(Node* node); |
| 38 void DoStoreElement(Node* node); | 39 void DoStoreElement(Node* node); |
| 39 void DoStringAdd(Node* node); | 40 void DoStringAdd(Node* node); |
| 40 void DoStringEqual(Node* node); | 41 void DoStringEqual(Node* node); |
| 41 void DoStringLessThan(Node* node); | 42 void DoStringLessThan(Node* node); |
| 42 void DoStringLessThanOrEqual(Node* node); | 43 void DoStringLessThanOrEqual(Node* node); |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 JSGraph* const jsgraph_; | 46 JSGraph* const jsgraph_; |
| 46 Zone* const zone_; | 47 Zone* const zone_; |
| 47 | 48 |
| 49 // TODO(danno): SimplifiedLowering shouldn't know anything about the source |
| 50 // positions table, but must for now since there currently is no other way to |
| 51 // pass down source position information to nodes created during |
| 52 // lowering. Once this phase becomes a vanilla reducer, it should get source |
| 53 // position information via the SourcePositionWrapper like all other reducers. |
| 54 SourcePositionTable* source_positions_; |
| 55 |
| 48 Node* SmiTag(Node* node); | 56 Node* SmiTag(Node* node); |
| 49 Node* IsTagged(Node* node); | 57 Node* IsTagged(Node* node); |
| 50 Node* Untag(Node* node); | 58 Node* Untag(Node* node); |
| 51 Node* OffsetMinusTagConstant(int32_t offset); | 59 Node* OffsetMinusTagConstant(int32_t offset); |
| 52 Node* ComputeIndex(const ElementAccess& access, Node* const key); | 60 Node* ComputeIndex(const ElementAccess& access, Node* const key); |
| 53 Node* StringComparison(Node* node, bool requires_ordering); | 61 Node* StringComparison(Node* node, bool requires_ordering); |
| 54 Node* Int32Div(Node* const node); | 62 Node* Int32Div(Node* const node); |
| 55 Node* Int32Mod(Node* const node); | 63 Node* Int32Mod(Node* const node); |
| 56 Node* Uint32Div(Node* const node); | 64 Node* Uint32Div(Node* const node); |
| 57 Node* Uint32Mod(Node* const node); | 65 Node* Uint32Mod(Node* const node); |
| 58 | 66 |
| 59 friend class RepresentationSelector; | 67 friend class RepresentationSelector; |
| 60 | 68 |
| 61 Zone* zone() { return jsgraph_->zone(); } | 69 Zone* zone() { return jsgraph_->zone(); } |
| 62 JSGraph* jsgraph() { return jsgraph_; } | 70 JSGraph* jsgraph() { return jsgraph_; } |
| 63 Graph* graph() { return jsgraph()->graph(); } | 71 Graph* graph() { return jsgraph()->graph(); } |
| 64 CommonOperatorBuilder* common() { return jsgraph()->common(); } | 72 CommonOperatorBuilder* common() { return jsgraph()->common(); } |
| 65 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } | 73 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
| 66 }; | 74 }; |
| 67 | 75 |
| 68 } // namespace compiler | 76 } // namespace compiler |
| 69 } // namespace internal | 77 } // namespace internal |
| 70 } // namespace v8 | 78 } // namespace v8 |
| 71 | 79 |
| 72 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ | 80 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| OLD | NEW |