summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/js-type-feedback-lowering.h
blob: db0fbdd626a050bd738e7d41516f7916588d00f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2015 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_JS_TYPE_FEEDBACK_LOWERING_H_
#define V8_COMPILER_JS_TYPE_FEEDBACK_LOWERING_H_

#include "src/base/flags.h"
#include "src/compiler/graph-reducer.h"
#include "src/compiler/simplified-operator.h"

namespace v8 {
namespace internal {

// Forward declarations.
class Factory;

namespace compiler {

// Forward declarations.
class CommonOperatorBuilder;
class JSGraph;
class MachineOperatorBuilder;


// Lowers JS-level operators to simplified operators based on type feedback.
class JSTypeFeedbackLowering final : public AdvancedReducer {
 public:
  // Various configuration flags to control the operation of this lowering.
  enum Flag {
    kNoFlags = 0,
    kDeoptimizationEnabled = 1 << 0,
  };
  typedef base::Flags<Flag> Flags;

  JSTypeFeedbackLowering(Editor* editor, Flags flags, JSGraph* jsgraph);
  ~JSTypeFeedbackLowering() final {}

  Reduction Reduce(Node* node) final;

 private:
  Reduction ReduceJSLoadNamed(Node* node);

  Factory* factory() const;
  Flags flags() const { return flags_; }
  Graph* graph() const;
  Isolate* isolate() const;
  JSGraph* jsgraph() const { return jsgraph_; }
  CommonOperatorBuilder* common() const;
  MachineOperatorBuilder* machine() const;
  SimplifiedOperatorBuilder* simplified() { return &simplified_; }

  Flags const flags_;
  JSGraph* const jsgraph_;
  SimplifiedOperatorBuilder simplified_;

  DISALLOW_COPY_AND_ASSIGN(JSTypeFeedbackLowering);
};

DEFINE_OPERATORS_FOR_FLAGS(JSTypeFeedbackLowering::Flags)

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

#endif  // V8_COMPILER_JS_TYPE_FEEDBACK_LOWERING_H_