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"
10#include "src/compiler/node.h"
14
15namespace v8 {
16namespace internal {
17namespace 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.
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
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
56 // A map from a control node to the control level of the corresponding basic
57 // block.
59 // A map from a non-control node to its early schedule position.
61};
62
63} // namespace compiler
64} // namespace internal
65} // namespace v8
66
67#endif // V8_COMPILER_LINEAR_SCHEDULER_H_
void SetEarlySchedulePosition(Node *node, Node *early_schedule_position)
void SetControlLevel(Node *control, int level)
ZoneMap< Node *, Node * > early_schedule_position_
Node * node
#define DCHECK(condition)
Definition logging.h:482
#define V8_EXPORT_PRIVATE
Definition macros.h:460