v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
verifier.h
Go to the documentation of this file.
1// Copyright 2014 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_VERIFIER_H_
6#define V8_COMPILER_VERIFIER_H_
7
8#include "src/base/macros.h"
9
10namespace v8 {
11namespace internal {
12namespace compiler {
13
14class TFGraph;
15class Edge;
16class Node;
17class Schedule;
18
19// Verifies properties of a graph, such as the well-formedness of inputs to
20// each node, etc.
21class Verifier {
22 public:
23 enum Typing { TYPED, UNTYPED };
26
27 Verifier(const Verifier&) = delete;
28 Verifier& operator=(const Verifier&) = delete;
29
30 static void Run(TFGraph* graph, Typing typing = TYPED,
31 CheckInputs check_inputs = kAll,
32 CodeType code_type = kDefault);
33
34#ifdef DEBUG
35 // Verifies consistency of node inputs and uses:
36 // - node inputs should agree with the input count computed from
37 // the node's operator.
38 // - effect inputs should have effect outputs.
39 // - control inputs should have control outputs.
40 // - frame state inputs should be frame states.
41 // - if the node has control uses, it should produce control.
42 // - if the node has effect uses, it should produce effect.
43 // - if the node has frame state uses, it must be a frame state.
44 static void VerifyNode(Node* node);
45
46 // Verify that {replacement} has the required outputs
47 // (effect, control or frame state) to be used as an input for {edge}.
48 static void VerifyEdgeInputReplacement(const Edge& edge,
49 const Node* replacement);
50#else
51 static void VerifyNode(Node* node) {}
52 static void VerifyEdgeInputReplacement(const Edge& edge,
53 const Node* replacement) {}
54#endif // DEBUG
55
56 private:
57 class Visitor;
58};
59
60// Verifies properties of a schedule, such as dominance, phi placement, etc.
62 public:
63 static void Run(Schedule* schedule);
64};
65} // namespace compiler
66} // namespace internal
67} // namespace v8
68
69#endif // V8_COMPILER_VERIFIER_H_
Schedule * schedule
Verifier(const Verifier &)=delete
static void VerifyEdgeInputReplacement(const Edge &edge, const Node *replacement)
Definition verifier.h:52
static void VerifyNode(Node *node)
Definition verifier.h:51
static void Run(TFGraph *graph, Typing typing=TYPED, CheckInputs check_inputs=kAll, CodeType code_type=kDefault)
Definition verifier.cc:2050
Verifier & operator=(const Verifier &)=delete
#define V8_EXPORT_PRIVATE
Definition macros.h:460