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