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_CHANGE_LOWERING_H_ | 5 #ifndef V8_COMPILER_CHANGE_LOWERING_H_ |
6 #define V8_COMPILER_CHANGE_LOWERING_H_ | 6 #define V8_COMPILER_CHANGE_LOWERING_H_ |
7 | 7 |
8 #include "include/v8.h" | |
9 #include "src/compiler/common-operator.h" | |
10 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
11 #include "src/compiler/machine-operator.h" | |
12 | 9 |
13 namespace v8 { | 10 namespace v8 { |
14 namespace internal { | 11 namespace internal { |
15 namespace compiler { | 12 namespace compiler { |
16 | 13 |
17 // Forward declarations. | 14 // Forward declarations. |
18 class CommonNodeCache; | 15 class CommonOperatorBuilder; |
| 16 class JSGraph; |
19 class Linkage; | 17 class Linkage; |
| 18 class MachineOperatorBuilder; |
20 | 19 |
21 class ChangeLoweringBase : public Reducer { | 20 class ChangeLowering V8_FINAL : public Reducer { |
22 public: | 21 public: |
23 ChangeLoweringBase(Graph* graph, Linkage* linkage, CommonNodeCache* cache); | 22 ChangeLowering(JSGraph* jsgraph, Linkage* linkage, |
24 virtual ~ChangeLoweringBase(); | 23 MachineOperatorBuilder* machine) |
25 | 24 : jsgraph_(jsgraph), linkage_(linkage), machine_(machine) {} |
26 protected: | 25 virtual ~ChangeLowering(); |
27 Node* ExternalConstant(ExternalReference reference); | |
28 Node* HeapConstant(PrintableUnique<HeapObject> value); | |
29 Node* ImmovableHeapConstant(Handle<HeapObject> value); | |
30 Node* Int32Constant(int32_t value); | |
31 Node* NumberConstant(double value); | |
32 Node* CEntryStubConstant(); | |
33 Node* TrueConstant(); | |
34 Node* FalseConstant(); | |
35 | |
36 Reduction ChangeBitToBool(Node* val, Node* control); | |
37 | |
38 Graph* graph() const { return graph_; } | |
39 Isolate* isolate() const { return isolate_; } | |
40 Linkage* linkage() const { return linkage_; } | |
41 CommonNodeCache* cache() const { return cache_; } | |
42 CommonOperatorBuilder* common() { return &common_; } | |
43 MachineOperatorBuilder* machine() { return &machine_; } | |
44 | |
45 private: | |
46 Graph* graph_; | |
47 Isolate* isolate_; | |
48 Linkage* linkage_; | |
49 CommonNodeCache* cache_; | |
50 CommonOperatorBuilder common_; | |
51 MachineOperatorBuilder machine_; | |
52 | |
53 SetOncePointer<Node> c_entry_stub_constant_; | |
54 SetOncePointer<Node> true_constant_; | |
55 SetOncePointer<Node> false_constant_; | |
56 }; | |
57 | |
58 | |
59 template <size_t kPointerSize = kApiPointerSize> | |
60 class ChangeLowering V8_FINAL : public ChangeLoweringBase { | |
61 public: | |
62 ChangeLowering(Graph* graph, Linkage* linkage); | |
63 ChangeLowering(Graph* graph, Linkage* linkage, CommonNodeCache* cache) | |
64 : ChangeLoweringBase(graph, linkage, cache) {} | |
65 virtual ~ChangeLowering() {} | |
66 | 26 |
67 virtual Reduction Reduce(Node* node) V8_OVERRIDE; | 27 virtual Reduction Reduce(Node* node) V8_OVERRIDE; |
68 | 28 |
69 private: | 29 protected: |
| 30 Node* HeapNumberValueIndexConstant(); |
| 31 Node* SmiShiftBitsConstant(); |
| 32 |
| 33 Reduction ChangeBitToBool(Node* val, Node* control); |
70 Reduction ChangeBoolToBit(Node* val); | 34 Reduction ChangeBoolToBit(Node* val); |
71 Reduction ChangeInt32ToTagged(Node* val, Node* effect, Node* control); | 35 Reduction ChangeInt32ToTagged(Node* val, Node* effect, Node* control); |
72 Reduction ChangeTaggedToFloat64(Node* val, Node* effect, Node* control); | 36 Reduction ChangeTaggedToFloat64(Node* val, Node* effect, Node* control); |
| 37 |
| 38 Graph* graph() const; |
| 39 Isolate* isolate() const; |
| 40 JSGraph* jsgraph() const { return jsgraph_; } |
| 41 Linkage* linkage() const { return linkage_; } |
| 42 CommonOperatorBuilder* common() const; |
| 43 MachineOperatorBuilder* machine() const { return machine_; } |
| 44 |
| 45 private: |
| 46 JSGraph* jsgraph_; |
| 47 Linkage* linkage_; |
| 48 MachineOperatorBuilder* machine_; |
73 }; | 49 }; |
74 | 50 |
75 } // namespace compiler | 51 } // namespace compiler |
76 } // namespace internal | 52 } // namespace internal |
77 } // namespace v8 | 53 } // namespace v8 |
78 | 54 |
79 #endif // V8_COMPILER_CHANGE_LOWERING_H_ | 55 #endif // V8_COMPILER_CHANGE_LOWERING_H_ |
OLD | NEW |