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 |
20 | 20 |
21 class SimplifiedLowering FINAL { | 21 class SimplifiedLowering FINAL { |
22 public: | 22 public: |
23 explicit SimplifiedLowering(JSGraph* jsgraph) : jsgraph_(jsgraph) {} | 23 SimplifiedLowering(JSGraph* jsgraph, Zone* zone) |
| 24 : jsgraph_(jsgraph), zone_(zone) {} |
24 ~SimplifiedLowering() {} | 25 ~SimplifiedLowering() {} |
25 | 26 |
26 void LowerAllNodes(); | 27 void LowerAllNodes(); |
27 | 28 |
28 // TODO(titzer): These are exposed for direct testing. Use a friend class. | 29 // TODO(titzer): These are exposed for direct testing. Use a friend class. |
29 void DoLoadField(Node* node); | 30 void DoLoadField(Node* node); |
30 void DoStoreField(Node* node); | 31 void DoStoreField(Node* node); |
31 // TODO(turbofan): The output_type can be removed once the result of the | 32 // TODO(turbofan): The output_type can be removed once the result of the |
32 // representation analysis is stored in the node bounds. | 33 // representation analysis is stored in the node bounds. |
33 void DoLoadBuffer(Node* node, MachineType output_type, | 34 void DoLoadBuffer(Node* node, MachineType output_type, |
34 RepresentationChanger* changer); | 35 RepresentationChanger* changer); |
35 void DoStoreBuffer(Node* node); | 36 void DoStoreBuffer(Node* node); |
36 void DoLoadElement(Node* node); | 37 void DoLoadElement(Node* node); |
37 void DoStoreElement(Node* node); | 38 void DoStoreElement(Node* node); |
38 void DoStringAdd(Node* node); | 39 void DoStringAdd(Node* node); |
39 void DoStringEqual(Node* node); | 40 void DoStringEqual(Node* node); |
40 void DoStringLessThan(Node* node); | 41 void DoStringLessThan(Node* node); |
41 void DoStringLessThanOrEqual(Node* node); | 42 void DoStringLessThanOrEqual(Node* node); |
42 | 43 |
43 private: | 44 private: |
44 JSGraph* jsgraph_; | 45 JSGraph* const jsgraph_; |
| 46 Zone* const zone_; |
45 | 47 |
46 Node* SmiTag(Node* node); | 48 Node* SmiTag(Node* node); |
47 Node* IsTagged(Node* node); | 49 Node* IsTagged(Node* node); |
48 Node* Untag(Node* node); | 50 Node* Untag(Node* node); |
49 Node* OffsetMinusTagConstant(int32_t offset); | 51 Node* OffsetMinusTagConstant(int32_t offset); |
50 Node* ComputeIndex(const ElementAccess& access, Node* const key); | 52 Node* ComputeIndex(const ElementAccess& access, Node* const key); |
51 Node* StringComparison(Node* node, bool requires_ordering); | 53 Node* StringComparison(Node* node, bool requires_ordering); |
52 Node* Int32Div(Node* const node); | 54 Node* Int32Div(Node* const node); |
53 Node* Int32Mod(Node* const node); | 55 Node* Int32Mod(Node* const node); |
54 Node* Uint32Div(Node* const node); | 56 Node* Uint32Div(Node* const node); |
55 Node* Uint32Mod(Node* const node); | 57 Node* Uint32Mod(Node* const node); |
56 | 58 |
57 friend class RepresentationSelector; | 59 friend class RepresentationSelector; |
58 | 60 |
59 Zone* zone() { return jsgraph_->zone(); } | 61 Zone* zone() { return jsgraph_->zone(); } |
60 JSGraph* jsgraph() { return jsgraph_; } | 62 JSGraph* jsgraph() { return jsgraph_; } |
61 Graph* graph() { return jsgraph()->graph(); } | 63 Graph* graph() { return jsgraph()->graph(); } |
62 CommonOperatorBuilder* common() { return jsgraph()->common(); } | 64 CommonOperatorBuilder* common() { return jsgraph()->common(); } |
63 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } | 65 MachineOperatorBuilder* machine() { return jsgraph()->machine(); } |
64 }; | 66 }; |
65 | 67 |
66 } // namespace compiler | 68 } // namespace compiler |
67 } // namespace internal | 69 } // namespace internal |
68 } // namespace v8 | 70 } // namespace v8 |
69 | 71 |
70 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ | 72 #endif // V8_COMPILER_SIMPLIFIED_LOWERING_H_ |
OLD | NEW |