v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
linear-scheduler.h
Go to the documentation of this file.
1
// Copyright 2013 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_COMPILER_LINEAR_SCHEDULER_H_
6
#define V8_COMPILER_LINEAR_SCHEDULER_H_
7
8
#include "
src/base/flags.h
"
9
#include "
src/common/globals.h
"
10
#include "
src/compiler/node.h
"
11
#include "
src/compiler/opcodes.h
"
12
#include "
src/compiler/zone-stats.h
"
13
#include "
src/zone/zone-containers.h
"
14
15
namespace
v8
{
16
namespace
internal
{
17
namespace
compiler {
18
19
// A simple, linear-time scheduler to check whether two nodes are in a same
20
// basic block without actually building basic block.
21
class
V8_EXPORT_PRIVATE
LinearScheduler
{
22
public
:
23
explicit
LinearScheduler
(
Zone
* zone,
TFGraph
* graph);
24
bool
SameBasicBlock(
Node
* node0,
Node
* node1);
25
// Get a node's early schedule position. It is the earliest block (represented
26
// by a control node) where a node could be scheduled.
27
Node
* GetEarlySchedulePosition(
Node
* node);
28
29
private
:
30
// Compute the level of each control node. The level is defined by the
31
// shortest control path from the start node.
32
void
ComputeControlLevel();
33
34
struct
NodeState
{
35
Node
*
node
;
36
Node
*
early_schedule_position
;
37
int
input_index
;
38
};
39
40
int
GetControlLevel
(
Node
* control)
const
{
41
auto
it = control_level_.find(control);
42
DCHECK
(it != control_level_.end());
43
return
it->second;
44
}
45
46
void
SetControlLevel
(
Node
* control,
int
level) {
47
DCHECK
(control_level_.find(control) == control_level_.end());
48
control_level_[control] = level;
49
}
50
51
void
SetEarlySchedulePosition
(
Node
* node,
Node
* early_schedule_position) {
52
early_schedule_position_[
node
] = early_schedule_position;
53
}
54
55
TFGraph
*
graph_
;
56
// A map from a control node to the control level of the corresponding basic
57
// block.
58
ZoneMap<Node*, int>
control_level_
;
59
// A map from a non-control node to its early schedule position.
60
ZoneMap<Node*, Node*>
early_schedule_position_
;
61
};
62
63
}
// namespace compiler
64
}
// namespace internal
65
}
// namespace v8
66
67
#endif
// V8_COMPILER_LINEAR_SCHEDULER_H_
flags.h
v8::internal::ZoneMap
Definition
zone-containers.h:698
v8::internal::Zone
Definition
zone.h:43
v8::internal::compiler::LinearScheduler
Definition
linear-scheduler.h:21
v8::internal::compiler::LinearScheduler::graph_
TFGraph * graph_
Definition
linear-scheduler.h:55
v8::internal::compiler::LinearScheduler::SetEarlySchedulePosition
void SetEarlySchedulePosition(Node *node, Node *early_schedule_position)
Definition
linear-scheduler.h:51
v8::internal::compiler::LinearScheduler::control_level_
ZoneMap< Node *, int > control_level_
Definition
linear-scheduler.h:58
v8::internal::compiler::LinearScheduler::SetControlLevel
void SetControlLevel(Node *control, int level)
Definition
linear-scheduler.h:46
v8::internal::compiler::LinearScheduler::GetControlLevel
int GetControlLevel(Node *control) const
Definition
linear-scheduler.h:40
v8::internal::compiler::LinearScheduler::early_schedule_position_
ZoneMap< Node *, Node * > early_schedule_position_
Definition
linear-scheduler.h:60
v8::internal::compiler::Node
Definition
node.h:41
v8::internal::compiler::TFGraph
Definition
turbofan-graph.h:32
globals.h
node
Node * node
Definition
js-inlining-heuristic.cc:316
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
v8
Definition
api-arguments-inl.h:19
node.h
opcodes.h
DCHECK
#define DCHECK(condition)
Definition
logging.h:482
V8_EXPORT_PRIVATE
#define V8_EXPORT_PRIVATE
Definition
macros.h:460
v8::internal::compiler::LinearScheduler::NodeState
Definition
linear-scheduler.h:34
v8::internal::compiler::LinearScheduler::NodeState::early_schedule_position
Node * early_schedule_position
Definition
linear-scheduler.h:36
v8::internal::compiler::LinearScheduler::NodeState::node
Node * node
Definition
linear-scheduler.h:35
v8::internal::compiler::LinearScheduler::NodeState::input_index
int input_index
Definition
linear-scheduler.h:37
zone-containers.h
zone-stats.h
src
compiler
linear-scheduler.h
Generated on Sun Apr 6 2025 21:08:52 for v8 by
1.12.0