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_OPERATOR_REDUCER_H_ | 5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_ |
6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_ | 6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_ |
7 | 7 |
8 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 // Forward declarations. | 14 // Forward declarations. |
15 class Factory; | 15 class Factory; |
| 16 class Heap; |
16 | 17 |
17 namespace compiler { | 18 namespace compiler { |
18 | 19 |
19 // Forward declarations. | 20 // Forward declarations. |
20 class CommonOperatorBuilder; | 21 class CommonOperatorBuilder; |
21 class JSGraph; | 22 class JSGraph; |
22 class MachineOperatorBuilder; | 23 class MachineOperatorBuilder; |
23 | 24 |
24 class SimplifiedOperatorReducer FINAL : public Reducer { | 25 class SimplifiedOperatorReducer FINAL : public Reducer { |
25 public: | 26 public: |
26 explicit SimplifiedOperatorReducer(JSGraph* jsgraph); | 27 explicit SimplifiedOperatorReducer(JSGraph* jsgraph); |
27 ~SimplifiedOperatorReducer() FINAL; | 28 ~SimplifiedOperatorReducer() FINAL; |
28 | 29 |
29 Reduction Reduce(Node* node) FINAL; | 30 Reduction Reduce(Node* node) FINAL; |
30 | 31 |
31 private: | 32 private: |
32 Reduction ReduceAnyToBoolean(Node* node); | 33 Reduction ReduceAnyToBoolean(Node* node); |
33 Reduction ReduceChangeWord32ToBit(Node* node); | |
34 | 34 |
35 Reduction Change(Node* node, const Operator* op, Node* a); | 35 Reduction Change(Node* node, const Operator* op, Node* a); |
36 Reduction ReplaceFloat64(double value); | 36 Reduction ReplaceFloat64(double value); |
37 Reduction ReplaceInt32(int32_t value); | 37 Reduction ReplaceInt32(int32_t value); |
38 Reduction ReplaceUint32(uint32_t value) { | 38 Reduction ReplaceUint32(uint32_t value) { |
39 return ReplaceInt32(bit_cast<int32_t>(value)); | 39 return ReplaceInt32(bit_cast<int32_t>(value)); |
40 } | 40 } |
41 Reduction ReplaceNumber(double value); | 41 Reduction ReplaceNumber(double value); |
42 Reduction ReplaceNumber(int32_t value); | 42 Reduction ReplaceNumber(int32_t value); |
43 | 43 |
44 Graph* graph() const; | 44 Graph* graph() const; |
45 Factory* factory() const; | 45 Factory* factory() const; |
46 JSGraph* jsgraph() const { return jsgraph_; } | 46 JSGraph* jsgraph() const { return jsgraph_; } |
47 CommonOperatorBuilder* common() const; | 47 CommonOperatorBuilder* common() const; |
48 MachineOperatorBuilder* machine() const; | 48 MachineOperatorBuilder* machine() const; |
49 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 49 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
50 | 50 |
51 JSGraph* jsgraph_; | 51 JSGraph* jsgraph_; |
52 SimplifiedOperatorBuilder simplified_; | 52 SimplifiedOperatorBuilder simplified_; |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer); | 54 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer); |
55 }; | 55 }; |
56 | 56 |
57 } // namespace compiler | 57 } // namespace compiler |
58 } // namespace internal | 58 } // namespace internal |
59 } // namespace v8 | 59 } // namespace v8 |
60 | 60 |
61 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_ | 61 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_ |
OLD | NEW |