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