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 1858342 : class V8_EXPORT_PRIVATE SimplifiedOperatorReducer final
27 : : public NON_EXPORTED_BASE(AdvancedReducer) {
28 : public:
29 : SimplifiedOperatorReducer(Editor* editor, JSGraph* jsgraph,
30 : JSHeapBroker* broker);
31 : ~SimplifiedOperatorReducer() final;
32 :
33 58 : const char* reducer_name() const override {
34 58 : return "SimplifiedOperatorReducer";
35 : }
36 :
37 : Reduction Reduce(Node* node) final;
38 :
39 : private:
40 : Reduction ReduceReferenceEqual(Node* node);
41 :
42 : Reduction Change(Node* node, const Operator* op, Node* a);
43 : Reduction ReplaceBoolean(bool value);
44 : Reduction ReplaceFloat64(double value);
45 : Reduction ReplaceInt32(int32_t value);
46 : Reduction ReplaceUint32(uint32_t value) {
47 : return ReplaceInt32(bit_cast<int32_t>(value));
48 : }
49 : Reduction ReplaceNumber(double value);
50 : Reduction ReplaceNumber(int32_t value);
51 :
52 : Factory* factory() const;
53 : Graph* graph() const;
54 : MachineOperatorBuilder* machine() const;
55 : SimplifiedOperatorBuilder* simplified() const;
56 :
57 : JSGraph* jsgraph() const { return jsgraph_; }
58 : JSHeapBroker* broker() const { return broker_; }
59 :
60 : JSGraph* const jsgraph_;
61 : JSHeapBroker* const broker_;
62 :
63 : DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer);
64 : };
65 :
66 : } // namespace compiler
67 : } // namespace internal
68 : } // namespace v8
69 :
70 : #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_
|