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