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