Line data Source code
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
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_
6 : #define V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_
7 :
8 : #include "src/base/compiler-specific.h"
9 : #include "src/compiler/graph-reducer.h"
10 : #include "src/globals.h"
11 :
12 : namespace v8 {
13 : namespace internal {
14 :
15 : // Forward declarations.
16 : class Factory;
17 : class Isolate;
18 :
19 : namespace compiler {
20 :
21 : // Forward declarations.
22 : class JSGraph;
23 : class MachineOperatorBuilder;
24 : class SimplifiedOperatorBuilder;
25 :
26 : class V8_EXPORT_PRIVATE SimplifiedOperatorReducer final
27 : : public NON_EXPORTED_BASE(AdvancedReducer) {
28 : public:
29 : SimplifiedOperatorReducer(Editor* editor, JSGraph* jsgraph);
30 : ~SimplifiedOperatorReducer() final;
31 :
32 0 : const char* reducer_name() const override {
33 0 : return "SimplifiedOperatorReducer";
34 : }
35 :
36 : Reduction Reduce(Node* node) final;
37 :
38 : private:
39 : Reduction ReduceReferenceEqual(Node* node);
40 :
41 : Reduction Change(Node* node, const Operator* op, Node* a);
42 : Reduction ReplaceBoolean(bool value);
43 : Reduction ReplaceFloat64(double value);
44 : Reduction ReplaceInt32(int32_t value);
45 : Reduction ReplaceUint32(uint32_t value) {
46 : return ReplaceInt32(bit_cast<int32_t>(value));
47 : }
48 : Reduction ReplaceNumber(double value);
49 : Reduction ReplaceNumber(int32_t value);
50 :
51 : Factory* factory() const;
52 : Graph* graph() const;
53 : Isolate* isolate() const;
54 : JSGraph* jsgraph() const { return jsgraph_; }
55 : MachineOperatorBuilder* machine() const;
56 : SimplifiedOperatorBuilder* simplified() const;
57 :
58 : JSGraph* const jsgraph_;
59 :
60 : DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer);
61 : };
62 :
63 : } // namespace compiler
64 : } // namespace internal
65 : } // namespace v8
66 :
67 : #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_
|