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