summaryrefslogtreecommitdiff
path: root/deps/v8/src/interpreter/bytecode-operands.h
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2017-03-21 10:16:54 +0100
committerMichaël Zasso <targos@protonmail.com>2017-03-25 09:44:10 +0100
commitc459d8ea5d402c702948c860d9497b2230ff7e8a (patch)
tree56c282fc4d40e5cb613b47cf7be3ea0526ed5b6f /deps/v8/src/interpreter/bytecode-operands.h
parente0bc5a7361b1d29c3ed034155fd779ce6f44fb13 (diff)
downloadnode-new-c459d8ea5d402c702948c860d9497b2230ff7e8a.tar.gz
deps: update V8 to 5.7.492.69
PR-URL: https://github.com/nodejs/node/pull/11752 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'deps/v8/src/interpreter/bytecode-operands.h')
-rw-r--r--deps/v8/src/interpreter/bytecode-operands.h55
1 files changed, 44 insertions, 11 deletions
diff --git a/deps/v8/src/interpreter/bytecode-operands.h b/deps/v8/src/interpreter/bytecode-operands.h
index 55485027d3..f649d93a08 100644
--- a/deps/v8/src/interpreter/bytecode-operands.h
+++ b/deps/v8/src/interpreter/bytecode-operands.h
@@ -23,27 +23,33 @@ namespace interpreter {
V(RegOutPair, OperandTypeInfo::kScalableSignedByte) \
V(RegOutTriple, OperandTypeInfo::kScalableSignedByte)
-#define UNSIGNED_SCALAR_OPERAND_TYPE_LIST(V) \
- V(Flag8, OperandTypeInfo::kFixedUnsignedByte) \
- V(IntrinsicId, OperandTypeInfo::kFixedUnsignedByte) \
+#define SIGNED_SCALABLE_SCALAR_OPERAND_TYPE_LIST(V) \
+ V(Imm, OperandTypeInfo::kScalableSignedByte)
+
+#define UNSIGNED_SCALABLE_SCALAR_OPERAND_TYPE_LIST(V) \
V(Idx, OperandTypeInfo::kScalableUnsignedByte) \
V(UImm, OperandTypeInfo::kScalableUnsignedByte) \
- V(RegCount, OperandTypeInfo::kScalableUnsignedByte) \
+ V(RegCount, OperandTypeInfo::kScalableUnsignedByte)
+
+#define UNSIGNED_FIXED_SCALAR_OPERAND_TYPE_LIST(V) \
+ V(Flag8, OperandTypeInfo::kFixedUnsignedByte) \
+ V(IntrinsicId, OperandTypeInfo::kFixedUnsignedByte) \
V(RuntimeId, OperandTypeInfo::kFixedUnsignedShort)
-#define SIGNED_SCALAR_OPERAND_TYPE_LIST(V) \
- V(Imm, OperandTypeInfo::kScalableSignedByte)
+// Carefully ordered for operand type range checks below.
+#define NON_REGISTER_OPERAND_TYPE_LIST(V) \
+ INVALID_OPERAND_TYPE_LIST(V) \
+ UNSIGNED_FIXED_SCALAR_OPERAND_TYPE_LIST(V) \
+ UNSIGNED_SCALABLE_SCALAR_OPERAND_TYPE_LIST(V) \
+ SIGNED_SCALABLE_SCALAR_OPERAND_TYPE_LIST(V)
+// Carefully ordered for operand type range checks below.
#define REGISTER_OPERAND_TYPE_LIST(V) \
REGISTER_INPUT_OPERAND_TYPE_LIST(V) \
REGISTER_OUTPUT_OPERAND_TYPE_LIST(V)
-#define NON_REGISTER_OPERAND_TYPE_LIST(V) \
- INVALID_OPERAND_TYPE_LIST(V) \
- UNSIGNED_SCALAR_OPERAND_TYPE_LIST(V) \
- SIGNED_SCALAR_OPERAND_TYPE_LIST(V)
-
// The list of operand types used by bytecodes.
+// Carefully ordered for operand type range checks below.
#define OPERAND_TYPE_LIST(V) \
NON_REGISTER_OPERAND_TYPE_LIST(V) \
REGISTER_OPERAND_TYPE_LIST(V)
@@ -125,6 +131,33 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
const OperandSize& operand_size);
std::ostream& operator<<(std::ostream& os, const OperandType& operand_type);
+class BytecodeOperands {
+ public:
+ // Returns true if |accumulator_use| reads the accumulator.
+ static constexpr bool ReadsAccumulator(AccumulatorUse accumulator_use) {
+ return accumulator_use == AccumulatorUse::kRead ||
+ accumulator_use == AccumulatorUse::kReadWrite;
+ }
+
+ // Returns true if |accumulator_use| writes the accumulator.
+ static constexpr bool WritesAccumulator(AccumulatorUse accumulator_use) {
+ return accumulator_use == AccumulatorUse::kWrite ||
+ accumulator_use == AccumulatorUse::kReadWrite;
+ }
+
+ // Returns true if |operand_type| is a scalable signed byte.
+ static constexpr bool IsScalableSignedByte(OperandType operand_type) {
+ return operand_type >= OperandType::kImm &&
+ operand_type <= OperandType::kRegOutTriple;
+ }
+
+ // Returns true if |operand_type| is a scalable unsigned byte.
+ static constexpr bool IsScalableUnsignedByte(OperandType operand_type) {
+ return operand_type >= OperandType::kIdx &&
+ operand_type <= OperandType::kRegCount;
+ }
+};
+
} // namespace interpreter
} // namespace internal
} // namespace v8