aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/node-properties.h
blob: 025be7857ce658bf9493923c5e85f574dd7a2b4b (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
67
// Copyright 2013 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_NODE_PROPERTIES_H_
#define V8_COMPILER_NODE_PROPERTIES_H_

#include "src/compiler/node.h"
#include "src/types.h"

namespace v8 {
namespace internal {
namespace compiler {

class Operator;

// A facade that simplifies access to the different kinds of inputs to a node.
class NodeProperties {
 public:
  static inline Node* GetValueInput(Node* node, int index);
  static inline Node* GetContextInput(Node* node);
  static inline Node* GetFrameStateInput(Node* node);
  static inline Node* GetEffectInput(Node* node, int index = 0);
  static inline Node* GetControlInput(Node* node, int index = 0);

  static inline int GetFrameStateIndex(Node* node);

  static inline bool IsValueEdge(Edge edge);
  static inline bool IsContextEdge(Edge edge);
  static inline bool IsEffectEdge(Edge edge);
  static inline bool IsControlEdge(Edge edge);

  static inline bool IsControl(Node* node);

  static inline void ReplaceControlInput(Node* node, Node* control);
  static inline void ReplaceEffectInput(Node* node, Node* effect,
                                        int index = 0);
  static inline void ReplaceFrameStateInput(Node* node, Node* frame_state);
  static inline void RemoveNonValueInputs(Node* node);
  static inline void ReplaceWithValue(Node* node, Node* value,
                                      Node* effect = NULL);

  static inline bool IsTyped(Node* node);
  static inline Bounds GetBounds(Node* node);
  static inline void SetBounds(Node* node, Bounds bounds);
  static inline void RemoveBounds(Node* node);
  static inline bool AllValueInputsAreTyped(Node* node);

  static inline int FirstValueIndex(Node* node);
  static inline int FirstContextIndex(Node* node);
  static inline int FirstFrameStateIndex(Node* node);
  static inline int FirstEffectIndex(Node* node);
  static inline int FirstControlIndex(Node* node);
  static inline int PastValueIndex(Node* node);
  static inline int PastContextIndex(Node* node);
  static inline int PastFrameStateIndex(Node* node);
  static inline int PastEffectIndex(Node* node);
  static inline int PastControlIndex(Node* node);

  static inline bool IsInputRange(Edge edge, int first, int count);
};

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

#endif  // V8_COMPILER_NODE_PROPERTIES_H_