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