Home | History | Annotate | Download | only in compiler
      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/compiler/graph-reducer.h"
      9 
     10 namespace v8 {
     11 namespace internal {
     12 
     13 // Forward declarations.
     14 class TypeCache;
     15 
     16 namespace compiler {
     17 
     18 // Forward declarations.
     19 class JSGraph;
     20 class MachineOperatorBuilder;
     21 class SimplifiedOperatorBuilder;
     22 
     23 class SimplifiedOperatorReducer final : public AdvancedReducer {
     24  public:
     25   SimplifiedOperatorReducer(Editor* editor, JSGraph* jsgraph);
     26   ~SimplifiedOperatorReducer() final;
     27 
     28   Reduction Reduce(Node* node) final;
     29 
     30  private:
     31   Reduction ReduceReferenceEqual(Node* node);
     32   Reduction ReduceTypeGuard(Node* node);
     33 
     34   Reduction Change(Node* node, const Operator* op, Node* a);
     35   Reduction ReplaceBoolean(bool value);
     36   Reduction ReplaceFloat64(double value);
     37   Reduction ReplaceInt32(int32_t value);
     38   Reduction ReplaceUint32(uint32_t value) {
     39     return ReplaceInt32(bit_cast<int32_t>(value));
     40   }
     41   Reduction ReplaceNumber(double value);
     42   Reduction ReplaceNumber(int32_t value);
     43 
     44   Graph* graph() const;
     45   JSGraph* jsgraph() const { return jsgraph_; }
     46   MachineOperatorBuilder* machine() const;
     47   SimplifiedOperatorBuilder* simplified() const;
     48 
     49   JSGraph* const jsgraph_;
     50   TypeCache const& type_cache_;
     51 
     52   DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer);
     53 };
     54 
     55 }  // namespace compiler
     56 }  // namespace internal
     57 }  // namespace v8
     58 
     59 #endif  // V8_COMPILER_SIMPLIFIED_OPERATOR_REDUCER_H_
     60