v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
operation.h
Go to the documentation of this file.
1// Copyright 2022 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_COMMON_OPERATION_H_
6#define V8_COMMON_OPERATION_H_
7
8#include <ostream>
9
10#define ARITHMETIC_OPERATION_LIST(V) \
11 V(Add) \
12 V(Subtract) \
13 V(Multiply) \
14 V(Divide) \
15 V(Modulus) \
16 V(Exponentiate) \
17 V(BitwiseAnd) \
18 V(BitwiseOr) \
19 V(BitwiseXor) \
20 V(ShiftLeft) \
21 V(ShiftRight) \
22 V(ShiftRightLogical)
23
24#define UNARY_OPERATION_LIST(V) \
25 V(BitwiseNot) \
26 V(Negate) \
27 V(Increment) \
28 V(Decrement)
29
30#define COMPARISON_OPERATION_LIST(V) \
31 V(Equal) \
32 V(StrictEqual) \
33 V(LessThan) \
34 V(LessThanOrEqual) \
35 V(GreaterThan) \
36 V(GreaterThanOrEqual)
37
38#define OPERATION_LIST(V) \
39 ARITHMETIC_OPERATION_LIST(V) \
40 UNARY_OPERATION_LIST(V) \
41 COMPARISON_OPERATION_LIST(V)
42
43enum class Operation : uint8_t {
44#define DEFINE_OP(name) k##name,
46#undef DEFINE_OP
47};
48
49inline std::ostream& operator<<(std::ostream& os, const Operation& operation) {
50 switch (operation) {
51#define CASE(name) \
52 case Operation::k##name: \
53 return os << #name;
55#undef CASE
56 }
57}
58
59#endif // V8_COMMON_OPERATION_H_
Operation
Definition operation.h:43
std::ostream & operator<<(std::ostream &os, const Operation &operation)
Definition operation.h:49
#define OPERATION_LIST(V)
Definition operation.h:38
#define DEFINE_OP(name)
Definition operation.h:44
#define CASE(name)