v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
bytecode-source-info.h
Go to the documentation of this file.
1// Copyright 2017 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_INTERPRETER_BYTECODE_SOURCE_INFO_H_
6#define V8_INTERPRETER_BYTECODE_SOURCE_INFO_H_
7
9
10namespace v8 {
11namespace internal {
12namespace interpreter {
13
14// Source code position information.
15class BytecodeSourceInfo final {
16 public:
17 static const int kUninitializedPosition = -1;
18
22
29
30 // Makes instance into a statement position.
32 // Statement positions can be replaced by other statement
33 // positions. For example , "for (x = 0; x < 3; ++x) 7;" has a
34 // statement position associated with 7 but no bytecode associated
35 // with it. Then Next is emitted after the body and has
36 // statement position and overrides the existing one.
39 }
40
41 // Makes instance into an expression position. Instance should not
42 // be a statement position otherwise it could be lost and impair the
43 // debugging experience.
49
50 // Forces an instance into an expression position.
55
56 int source_position() const {
58 return source_position_;
59 }
60
61 bool is_statement() const {
63 }
64 bool is_expression() const {
66 }
67
68 bool is_valid() const { return position_type_ != PositionType::kNone; }
73
74 bool operator==(const BytecodeSourceInfo& other) const {
75 return position_type_ == other.position_type_ &&
76 source_position_ == other.source_position_;
77 }
78
79 bool operator!=(const BytecodeSourceInfo& other) const {
80 return position_type_ != other.position_type_ ||
81 source_position_ != other.source_position_;
82 }
83
84 private:
85 enum class PositionType : uint8_t { kNone, kExpression, kStatement };
86
89};
90
91V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
92 const BytecodeSourceInfo& info);
93
94} // namespace interpreter
95} // namespace internal
96} // namespace v8
97
98#endif // V8_INTERPRETER_BYTECODE_SOURCE_INFO_H_
BytecodeSourceInfo(int source_position, bool is_statement)
bool operator!=(const BytecodeSourceInfo &other) const
bool operator==(const BytecodeSourceInfo &other) const
std::ostream & operator<<(std::ostream &os, PaddingSpace padding)
#define DCHECK_GE(v1, v2)
Definition logging.h:488
#define DCHECK(condition)
Definition logging.h:482
#define V8_EXPORT_PRIVATE
Definition macros.h:460