typed-optimization.h 3.44 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_TYPED_OPTIMIZATION_H_
#define V8_COMPILER_TYPED_OPTIMIZATION_H_

8
#include "src/base/compiler-specific.h"
9
#include "src/common/globals.h"
10 11 12 13 14 15 16 17 18 19 20 21
#include "src/compiler/graph-reducer.h"

namespace v8 {
namespace internal {

// Forward declarations.
class Factory;
class Isolate;

namespace compiler {

// Forward declarations.
22
class CompilationDependencies;
23 24
class JSGraph;
class SimplifiedOperatorBuilder;
25
class TypeCache;
26

27 28
class V8_EXPORT_PRIVATE TypedOptimization final
    : public NON_EXPORTED_BASE(AdvancedReducer) {
29 30
 public:
  TypedOptimization(Editor* editor, CompilationDependencies* dependencies,
31
                    JSGraph* jsgraph, JSHeapBroker* broker);
32
  ~TypedOptimization() override;
33 34
  TypedOptimization(const TypedOptimization&) = delete;
  TypedOptimization& operator=(const TypedOptimization&) = delete;
35

36 37
  const char* reducer_name() const override { return "TypedOptimization"; }

38 39 40
  Reduction Reduce(Node* node) final;

 private:
41
  Reduction ReduceConvertReceiver(Node* node);
42
  Reduction ReduceMaybeGrowFastElements(Node* node);
43
  Reduction ReduceCheckBounds(Node* node);
44
  Reduction ReduceCheckHeapObject(Node* node);
45
  Reduction ReduceCheckMaps(Node* node);
46
  Reduction ReduceCheckNumber(Node* node);
47
  Reduction ReduceCheckString(Node* node);
48 49
  Reduction ReduceCheckEqualsInternalizedString(Node* node);
  Reduction ReduceCheckEqualsSymbol(Node* node);
50
  Reduction ReduceLoadField(Node* node);
51
  Reduction ReduceNumberFloor(Node* node);
52
  Reduction ReduceNumberRoundop(Node* node);
53
  Reduction ReduceNumberSilenceNaN(Node* node);
54
  Reduction ReduceNumberToUint8Clamped(Node* node);
55
  Reduction ReducePhi(Node* node);
56
  Reduction ReduceReferenceEqual(Node* node);
57
  Reduction ReduceStringComparison(Node* node);
58
  Reduction ReduceStringLength(Node* node);
59
  Reduction ReduceSameValue(Node* node);
60
  Reduction ReduceSelect(Node* node);
61
  Reduction ReduceSpeculativeToNumber(Node* node);
62
  Reduction ReduceCheckNotTaggedHole(Node* node);
63
  Reduction ReduceTypeOf(Node* node);
64
  Reduction ReduceToBoolean(Node* node);
65 66
  Reduction ReduceSpeculativeNumberAdd(Node* node);
  Reduction ReduceSpeculativeNumberMultiply(Node* node);
67
  Reduction ReduceSpeculativeNumberPow(Node* node);
68 69
  Reduction ReduceSpeculativeNumberBinop(Node* node);
  Reduction ReduceSpeculativeNumberComparison(Node* node);
70

71
  Reduction TryReduceStringComparisonOfStringFromSingleCharCode(
72 73
      Node* comparison, Node* from_char_code, Type constant_type,
      bool inverted);
74
  Reduction TryReduceStringComparisonOfStringFromSingleCharCodeToConstant(
75
      Node* comparison, const StringRef& string, bool inverted);
76
  const Operator* NumberComparisonFor(const Operator* op);
77

78 79 80
  Node* ConvertPlainPrimitiveToNumber(Node* node);
  Reduction ReduceJSToNumberInput(Node* input);

81
  SimplifiedOperatorBuilder* simplified() const;
82 83
  Factory* factory() const;
  Graph* graph() const;
84 85

  CompilationDependencies* dependencies() const { return dependencies_; }
86
  JSGraph* jsgraph() const { return jsgraph_; }
87
  JSHeapBroker* broker() const { return broker_; }
88 89 90

  CompilationDependencies* const dependencies_;
  JSGraph* const jsgraph_;
91
  JSHeapBroker* broker_;
92 93
  Type const true_type_;
  Type const false_type_;
94
  TypeCache const* type_cache_;
95 96 97 98 99 100 101
};

}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_TYPED_OPTIMIZATION_H_