v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
bytecode-node.cc
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
6
7#include <iomanip>
8
9namespace v8 {
10namespace internal {
11namespace interpreter {
12
13void BytecodeNode::Print(std::ostream& os) const {
14#ifdef DEBUG
15 std::ios saved_state(nullptr);
16 saved_state.copyfmt(os);
18
19 for (int i = 0; i < operand_count(); ++i) {
20 os << ' ' << std::setw(8) << std::setfill('0') << std::hex << operands_[i];
21 }
22 os.copyfmt(saved_state);
23
24 if (source_info_.is_valid()) {
25 os << ' ' << source_info_;
26 }
27 os << '\n';
28#else
29 os << static_cast<const void*>(this);
30#endif // DEBUG
31}
32
33bool BytecodeNode::operator==(const BytecodeNode& other) const {
34 if (this == &other) {
35 return true;
36 } else if (this->bytecode() != other.bytecode() ||
37 this->source_info() != other.source_info()) {
38 return false;
39 } else {
40 for (int i = 0; i < this->operand_count(); ++i) {
41 if (this->operand(i) != other.operand(i)) {
42 return false;
43 }
44 }
45 }
46 return true;
47}
48
49std::ostream& operator<<(std::ostream& os, const BytecodeNode& node) {
50 node.Print(os);
51 return os;
52}
53
54} // namespace interpreter
55} // namespace internal
56} // namespace v8
bool operator==(const BytecodeNode &other) const
uint32_t operands_[Bytecodes::kMaxOperands]
void Print(std::ostream &os) const
static const char * ToString(Bytecode bytecode)
Definition bytecodes.cc:123
std::ostream & operator<<(std::ostream &os, PaddingSpace padding)