Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| 6 | #define V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
| 7 | |
| 8 | #include "src/compiler/js-graph.h" |
| 9 | #include "src/compiler/machine-operator.h" |
| 10 | #include "src/compiler/node.h" |
| 11 | #include "src/compiler/simplified-operator.h" |
| 12 | |
| 13 | namespace v8 { |
| 14 | namespace internal { |
| 15 | namespace compiler { |
| 16 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 17 | // Forward declarations. |
| 18 | class RepresentationChanger; |
| 19 | |
| 20 | |
| 21 | class SimplifiedLowering FINAL { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 22 | public: |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 23 | SimplifiedLowering(JSGraph* jsgraph, Zone* zone) |
| 24 | : jsgraph_(jsgraph), zone_(zone) {} |
| 25 | ~SimplifiedLowering() {} |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 26 | |
| 27 | void LowerAllNodes(); |
| 28 | |
| 29 | // TODO(titzer): These are exposed for direct testing. Use a friend class. |
| 30 | void DoLoadField(Node* node); |
| 31 | void DoStoreField(Node* node); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 32 | // TODO(turbofan): The output_type can be removed once the result of the |
| 33 | // representation analysis is stored in the node bounds. |
| 34 | void DoLoadBuffer(Node* node, MachineType output_type, |
| 35 | RepresentationChanger* changer); |
| 36 | void DoStoreBuffer(Node* node); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 37 | void DoLoadElement(Node* node); |
| 38 | void DoStoreElement(Node* node); |
| 39 | void DoStringAdd(Node* node); |
| 40 | void DoStringEqual(Node* node); |
| 41 | void DoStringLessThan(Node* node); |
| 42 | void DoStringLessThanOrEqual(Node* node); |
| 43 | |
| 44 | private: |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 45 | JSGraph* const jsgraph_; |
| 46 | Zone* const zone_; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 47 | |
| 48 | Node* SmiTag(Node* node); |
| 49 | Node* IsTagged(Node* node); |
| 50 | Node* Untag(Node* node); |
| 51 | Node* OffsetMinusTagConstant(int32_t offset); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 52 | Node* ComputeIndex(const ElementAccess& access, Node* const key); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 53 | Node* StringComparison(Node* node, bool requires_ordering); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 54 | Node* Int32Div(Node* const node); |
| 55 | Node* Int32Mod(Node* const node); |
| 56 | Node* Uint32Div(Node* const node); |
| 57 | Node* Uint32Mod(Node* const node); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 58 | |
| 59 | friend class RepresentationSelector; |
| 60 | |
| 61 | Zone* zone() { return jsgraph_->zone(); } |
| 62 | JSGraph* jsgraph() { return jsgraph_; } |
| 63 | Graph* graph() { return jsgraph()->graph(); } |
| 64 | CommonOperatorBuilder* common() { return jsgraph()->common(); } |
| 65 | MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
| 66 | }; |
| 67 | |
| 68 | } // namespace compiler |
| 69 | } // namespace internal |
| 70 | } // namespace v8 |
| 71 | |
| 72 | #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ |