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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
// Copyright 2014 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_COMMON_OPERATOR_H_
#define V8_COMPILER_COMMON_OPERATOR_H_
#include "src/compiler/frame-states.h"
#include "src/compiler/machine-type.h"
#include "src/unique.h"
namespace v8 {
namespace internal {
// Forward declarations.
class ExternalReference;
namespace compiler {
// Forward declarations.
class CallDescriptor;
struct CommonOperatorGlobalCache;
class Operator;
// Prediction hint for branches.
enum class BranchHint : uint8_t { kNone, kTrue, kFalse };
inline size_t hash_value(BranchHint hint) { return static_cast<size_t>(hint); }
std::ostream& operator<<(std::ostream&, BranchHint);
BranchHint BranchHintOf(const Operator* const);
class SelectParameters final {
public:
explicit SelectParameters(MachineType type,
BranchHint hint = BranchHint::kNone)
: type_(type), hint_(hint) {}
MachineType type() const { return type_; }
BranchHint hint() const { return hint_; }
private:
const MachineType type_;
const BranchHint hint_;
};
bool operator==(SelectParameters const&, SelectParameters const&);
bool operator!=(SelectParameters const&, SelectParameters const&);
size_t hash_value(SelectParameters const& p);
std::ostream& operator<<(std::ostream&, SelectParameters const& p);
SelectParameters const& SelectParametersOf(const Operator* const);
size_t ProjectionIndexOf(const Operator* const);
// The {IrOpcode::kParameter} opcode represents an incoming parameter to the
// function. This class bundles the index and a debug name for such operators.
class ParameterInfo final {
public:
ParameterInfo(int index, const char* debug_name)
: index_(index), debug_name_(debug_name) {}
int index() const { return index_; }
const char* debug_name() const { return debug_name_; }
private:
int index_;
const char* debug_name_;
};
std::ostream& operator<<(std::ostream&, ParameterInfo const&);
int ParameterIndexOf(const Operator* const);
const ParameterInfo& ParameterInfoOf(const Operator* const);
// Interface for building common operators that can be used at any level of IR,
// including JavaScript, mid-level, and low-level.
class CommonOperatorBuilder final : public ZoneObject {
public:
explicit CommonOperatorBuilder(Zone* zone);
const Operator* Dead();
const Operator* End();
const Operator* Branch(BranchHint = BranchHint::kNone);
const Operator* IfTrue();
const Operator* IfFalse();
const Operator* IfSuccess();
const Operator* IfException();
const Operator* Switch(size_t control_output_count);
const Operator* IfValue(int32_t value);
const Operator* IfDefault();
const Operator* Throw();
const Operator* Deoptimize();
const Operator* Return();
const Operator* Terminate();
const Operator* Start(int num_formal_parameters);
const Operator* Loop(int control_input_count);
const Operator* Merge(int control_input_count);
const Operator* Parameter(int index, const char* debug_name = nullptr);
const Operator* OsrNormalEntry();
const Operator* OsrLoopEntry();
const Operator* OsrValue(int index);
const Operator* Int32Constant(int32_t);
const Operator* Int64Constant(int64_t);
const Operator* Float32Constant(volatile float);
const Operator* Float64Constant(volatile double);
const Operator* ExternalConstant(const ExternalReference&);
const Operator* NumberConstant(volatile double);
const Operator* HeapConstant(const Unique<HeapObject>&);
const Operator* Select(MachineType, BranchHint = BranchHint::kNone);
const Operator* Phi(MachineType type, int value_input_count);
const Operator* EffectPhi(int effect_input_count);
const Operator* EffectSet(int arguments);
const Operator* ValueEffect(int arguments);
const Operator* Finish(int arguments);
const Operator* StateValues(int arguments);
const Operator* TypedStateValues(const ZoneVector<MachineType>* types);
const Operator* FrameState(
FrameStateType type, BailoutId bailout_id,
OutputFrameStateCombine state_combine,
MaybeHandle<JSFunction> jsfunction = MaybeHandle<JSFunction>());
const Operator* Call(const CallDescriptor* descriptor);
const Operator* TailCall(const CallDescriptor* descriptor);
const Operator* Projection(size_t index);
// Constructs a new merge or phi operator with the same opcode as {op}, but
// with {size} inputs.
const Operator* ResizeMergeOrPhi(const Operator* op, int size);
private:
Zone* zone() const { return zone_; }
const CommonOperatorGlobalCache& cache_;
Zone* const zone_;
DISALLOW_COPY_AND_ASSIGN(CommonOperatorBuilder);
};
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_COMMON_OPERATOR_H_
|