v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
maglev-ir-inl.h
Go to the documentation of this file.
1// Copyright 2021 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_MAGLEV_MAGLEV_IR_INL_H_
6#define V8_MAGLEV_MAGLEV_IR_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
14
15namespace v8 {
16namespace internal {
17namespace maglev {
18
19#ifdef DEBUG
20inline RegList GetGeneralRegistersUsedAsInputs(
21 const EagerDeoptInfo* deopt_info) {
22 RegList regs;
23 InputLocation* input = deopt_info->input_locations();
24 deopt_info->ForEachInput([&regs, &input](ValueNode* value) {
25 if (input->IsGeneralRegister()) {
26 regs.set(input->AssignedGeneralRegister());
27 }
28 input++;
29 });
30 return regs;
31}
32#endif // DEBUG
33
34// Helper macro for checking that a reglist is empty which prints the contents
35// when non-empty.
36#define DCHECK_REGLIST_EMPTY(...) DCHECK_EQ((__VA_ARGS__), RegList{})
37
38// ---
39// Value location constraint setting helpers.
40// ---
41
42static constexpr int kNoVreg = -1;
43
44inline void DefineAsRegister(Node* node) {
45 node->result().SetUnallocated(
47}
48inline void DefineAsConstant(Node* node) {
49 node->result().SetUnallocated(compiler::UnallocatedOperand::NONE, kNoVreg);
50}
51
52inline void DefineAsFixed(Node* node, Register reg) {
53 node->result().SetUnallocated(compiler::UnallocatedOperand::FIXED_REGISTER,
54 reg.code(), kNoVreg);
55}
56
57// TODO(v8:7700): Create generic DefineSameAs(..., int input).
58inline void DefineSameAsFirst(Node* node) {
59 node->result().SetUnallocated(kNoVreg, 0);
60}
61
75inline void UseFixed(Input& input, Register reg) {
76 input.SetUnallocated(compiler::UnallocatedOperand::FIXED_REGISTER, reg.code(),
77 kNoVreg);
78 input.node()->SetHint(input.operand());
79}
80inline void UseFixed(Input& input, DoubleRegister reg) {
82 reg.code(), kNoVreg);
83 input.node()->SetHint(input.operand());
84}
85
87 uint64_t bitfield,
88#ifdef V8_ENABLE_LEAPTIERING
89 JSDispatchHandle dispatch_handle,
90#endif
91 compiler::SharedFunctionInfoRef shared_function_info, ValueNode* closure,
93 : Base(bitfield),
94#ifdef V8_ENABLE_LEAPTIERING
95 dispatch_handle_(dispatch_handle),
96#endif
97 shared_function_info_(shared_function_info),
98 expected_parameter_count_(
99#ifdef V8_ENABLE_LEAPTIERING
100 IsolateGroup::current()->js_dispatch_table()->GetParameterCount(
101 dispatch_handle)
102#else
103 shared_function_info.internal_formal_parameter_count_with_receiver()
104#endif
105 ) {
106 set_input(kClosureIndex, closure);
107 set_input(kContextIndex, context);
108 set_input(kReceiverIndex, receiver);
109 set_input(kNewTargetIndex, new_target);
110}
111
112} // namespace maglev
113} // namespace internal
114} // namespace v8
115
116#endif // V8_MAGLEV_MAGLEV_IR_INL_H_
CallKnownJSFunction(uint64_t bitfield, compiler::SharedFunctionInfoRef shared_function_info, ValueNode *closure, ValueNode *context, ValueNode *receiver, ValueNode *new_target)
DirectHandle< Object > new_target
Definition execution.cc:75
TNode< Object > receiver
LiftoffRegister reg
void DefineAsRegister(Node *node)
void DefineSameAsFirst(Node *node)
void DefineAsFixed(Node *node, Register reg)
void UseAndClobberRegister(Input &input)
void DefineAsConstant(Node *node)
void UseAny(Input &input)
static constexpr int kNoVreg
void UseRegister(Input &input)
void UseFixed(Input &input, Register reg)
RegListBase< Register > RegList
Definition reglist-arm.h:14