11cb0ef41Sopenharmony_ci// Copyright 2015 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_INTERPRETER_BYTECODE_DECODER_H_ 61cb0ef41Sopenharmony_ci#define V8_INTERPRETER_BYTECODE_DECODER_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include <iosfwd> 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci#include "src/common/globals.h" 111cb0ef41Sopenharmony_ci#include "src/interpreter/bytecode-register.h" 121cb0ef41Sopenharmony_ci#include "src/interpreter/bytecodes.h" 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_cinamespace v8 { 151cb0ef41Sopenharmony_cinamespace internal { 161cb0ef41Sopenharmony_cinamespace interpreter { 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciclass V8_EXPORT_PRIVATE BytecodeDecoder final { 191cb0ef41Sopenharmony_ci public: 201cb0ef41Sopenharmony_ci // Decodes a register operand in a byte array. 211cb0ef41Sopenharmony_ci static Register DecodeRegisterOperand(Address operand_start, 221cb0ef41Sopenharmony_ci OperandType operand_type, 231cb0ef41Sopenharmony_ci OperandScale operand_scale); 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci // Decodes a register list operand in a byte array. 261cb0ef41Sopenharmony_ci static RegisterList DecodeRegisterListOperand(Address operand_start, 271cb0ef41Sopenharmony_ci uint32_t count, 281cb0ef41Sopenharmony_ci OperandType operand_type, 291cb0ef41Sopenharmony_ci OperandScale operand_scale); 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ci // Decodes a signed operand in a byte array. 321cb0ef41Sopenharmony_ci static int32_t DecodeSignedOperand(Address operand_start, 331cb0ef41Sopenharmony_ci OperandType operand_type, 341cb0ef41Sopenharmony_ci OperandScale operand_scale); 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci // Decodes an unsigned operand in a byte array. 371cb0ef41Sopenharmony_ci static uint32_t DecodeUnsignedOperand(Address operand_start, 381cb0ef41Sopenharmony_ci OperandType operand_type, 391cb0ef41Sopenharmony_ci OperandScale operand_scale); 401cb0ef41Sopenharmony_ci 411cb0ef41Sopenharmony_ci // Decode a single bytecode and operands to |os|. 421cb0ef41Sopenharmony_ci static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start); 431cb0ef41Sopenharmony_ci}; 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ci} // namespace interpreter 461cb0ef41Sopenharmony_ci} // namespace internal 471cb0ef41Sopenharmony_ci} // namespace v8 481cb0ef41Sopenharmony_ci 491cb0ef41Sopenharmony_ci#endif // V8_INTERPRETER_BYTECODE_DECODER_H_ 50