diff options
Diffstat (limited to 'deps/v8/src/interpreter/bytecode-operands.cc')
-rw-r--r-- | deps/v8/src/interpreter/bytecode-operands.cc | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/deps/v8/src/interpreter/bytecode-operands.cc b/deps/v8/src/interpreter/bytecode-operands.cc new file mode 100644 index 0000000000..6be81fe62e --- /dev/null +++ b/deps/v8/src/interpreter/bytecode-operands.cc @@ -0,0 +1,89 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/interpreter/bytecode-operands.h" + +#include <iomanip> + +namespace v8 { +namespace internal { +namespace interpreter { + +namespace { + +const char* AccumulatorUseToString(AccumulatorUse accumulator_use) { + switch (accumulator_use) { + case AccumulatorUse::kNone: + return "None"; + case AccumulatorUse::kRead: + return "Read"; + case AccumulatorUse::kWrite: + return "Write"; + case AccumulatorUse::kReadWrite: + return "ReadWrite"; + } + UNREACHABLE(); + return ""; +} + +const char* OperandTypeToString(OperandType operand_type) { + switch (operand_type) { +#define CASE(Name, _) \ + case OperandType::k##Name: \ + return #Name; + OPERAND_TYPE_LIST(CASE) +#undef CASE + } + UNREACHABLE(); + return ""; +} + +const char* OperandScaleToString(OperandScale operand_scale) { + switch (operand_scale) { +#define CASE(Name, _) \ + case OperandScale::k##Name: \ + return #Name; + OPERAND_SCALE_LIST(CASE) +#undef CASE + } + UNREACHABLE(); + return ""; +} + +const char* OperandSizeToString(OperandSize operand_size) { + switch (operand_size) { + case OperandSize::kNone: + return "None"; + case OperandSize::kByte: + return "Byte"; + case OperandSize::kShort: + return "Short"; + case OperandSize::kQuad: + return "Quad"; + } + UNREACHABLE(); + return ""; +} + +} // namespace + +std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use) { + return os << AccumulatorUseToString(use); +} + +std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size) { + return os << OperandSizeToString(operand_size); +} + +std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale) { + return os << OperandScaleToString(operand_scale); +} + +std::ostream& operator<<(std::ostream& os, const OperandType& operand_type) { + return os << OperandTypeToString(operand_type); +} + +} // namespace interpreter +} // namespace internal +} // namespace v8 |