17#include "third_party/zlib/google/compression_utils_portable.h" 
   30      return isolate->factory()->NewNumber(
number_);
 
   40      return isolate->factory()->undefined_value();
 
 
   54                                                   int deopt_entry_count) {
 
   56      isolate->factory()->NewProtectedFixedArray(
LengthFor(deopt_entry_count)));
 
 
   60                                                   int deopt_entry_count) {
 
   62      isolate->factory()->NewProtectedFixedArray(
LengthFor(deopt_entry_count)));
 
 
   67      isolate->factory()->empty_protected_fixed_array());
 
 
   72      isolate->factory()->empty_protected_fixed_array());
 
 
   93    int idx = TranslationIndex(
i).value();
 
   94    DeoptimizationFrameTranslation::Iterator iterator(FrameTranslation(), idx);
 
   95    auto [frame_count, jsframe_count] = iterator.EnterBeginOpcode();
 
   98    bool first_frame = 
true;
 
   99    while (frame_count > 0) {
 
  105          bailout = BytecodeOffset(iterator.NextOperand());
 
  118#ifdef ENABLE_SLOW_DCHECKS 
  119      interpreter::BytecodeArrayIterator bytecode_iterator(bytecode);
 
  120      while (bytecode_iterator.current_offset() < bailout.ToInt()) {
 
  121        bytecode_iterator.Advance();
 
  122        DCHECK_LE(bytecode_iterator.current_offset(), bailout.ToInt());
 
  126      DCHECK_LT(bailout.ToInt(), bytecode->length());
 
  133#ifdef ENABLE_DISASSEMBLER 
  136void print_pc(std::ostream& os, 
int pc) {
 
  140    os << std::hex << 
pc << std::dec;
 
  145void DeoptimizationData::PrintDeoptimizationData(std::ostream& os)
 const {
 
  147    os << 
"Deoptimization Input Data invalidated by lazy deoptimization\n";
 
  151  int const inlined_function_count = InlinedFunctionCount().value();
 
  152  os << 
"Inlined functions (count = " << inlined_function_count << 
")\n";
 
  153  for (
int id = 0; 
id < inlined_function_count; ++id) {
 
  159  os << 
"Deoptimization Input Data (deopt points = " << deopt_count << 
")\n";
 
  160  if (0 != deopt_count) {
 
  162    os << 
" index  bytecode-offset  node-id    pc";
 
  164    os << 
" index  bytecode-offset    pc";
 
  166    if (
v8_flags.print_code_verbose) os << 
"  commands";
 
  169  for (
int i = 0; 
i < deopt_count; 
i++) {
 
  170    os << std::setw(6) << 
i << 
"  " << std::setw(15)
 
  173       << std::setw(7) << 
NodeId(
i).value() << 
"  " 
  176    print_pc(os, Pc(
i).
value());
 
  177    os << std::setw(2) << 
"\n";
 
  180      FrameTranslation()->PrintFrameTranslation(os, TranslationIndex(
i).
value(),
 
  181                                                ProtectedLiteralArray(),
 
  195        base::ReadUnalignedValue<uint32_t>(reinterpret_cast<Address>(
 
  196            &buffer_[DeoptimizationFrameTranslation::kUncompressedSizeOffset]));
 
  197    uncompressed_contents_.insert(uncompressed_contents_.begin(), size, 0);
 
  199    uLongf uncompressed_size = size *
 
  200                               DeoptimizationFrameTranslation::
 
  201                                   kDeoptimizationFrameTranslationElementSize;
 
  203    CHECK_EQ(zlib_internal::UncompressHelper(
 
  205                 reinterpret_cast<Bytef*>(uncompressed_contents_.data()),
 
  208                     DeoptimizationFrameTranslation::kCompressedDataOffset,
 
  211    DCHECK(index >= 0 && index < size);
 
 
  226          base::Vector<uint8_t>(buffer->begin(), buffer->length()), index) {}
 
 
  230    return uncompressed_contents_[
index_++];
 
  231  } 
else if (remaining_ops_to_use_from_previous_translation_) {
 
 
  246  DCHECK_NE(opcode, TranslationOpcode::MATCH_PREVIOUS_TRANSLATION);
 
 
  259    return uncompressed_contents_[
index_++];
 
  260  } 
else if (remaining_ops_to_use_from_previous_translation_) {
 
  261    return NextUnsignedOperandAtPreviousIndex();
 
 
  273  if (remaining_ops_to_use_from_previous_translation_) {
 
  274    --remaining_ops_to_use_from_previous_translation_;
 
  276  if (remaining_ops_to_use_from_previous_translation_) {
 
  277    return NextOpcodeAtPreviousIndex();
 
  287    remaining_ops_to_use_from_previous_translation_ =
 
  290        static_cast<uint8_t
>(TranslationOpcode::MATCH_PREVIOUS_TRANSLATION);
 
  291  } 
else if (opcode_byte ==
 
  292             static_cast<uint8_t
>(
 
  293                 TranslationOpcode::MATCH_PREVIOUS_TRANSLATION)) {
 
  294    remaining_ops_to_use_from_previous_translation_ = NextOperandUnsigned();
 
  305    uint32_t lookback_distance =
 
  307    if (lookback_distance) {
 
  308      previous_index_ = 
index_ - 1 - lookback_distance;
 
  315    ops_since_previous_index_was_updated_ = 1;
 
  316  } 
else if (opcode == TranslationOpcode::MATCH_PREVIOUS_TRANSLATION) {
 
  317    for (
int i = 0; 
i < ops_since_previous_index_was_updated_; ++
i) {
 
  318      SkipOpcodeAndItsOperandsAtPreviousIndex();
 
  320    ops_since_previous_index_was_updated_ = 0;
 
  321    opcode = NextOpcodeAtPreviousIndex();
 
  323    ++ops_since_previous_index_was_updated_;
 
 
  334  int frame_count = NextOperand();
 
  335  int jsframe_count = NextOperand();
 
  336  return {frame_count, jsframe_count};
 
 
  340  while (HasNextOpcode()) {
 
 
  354  while (HasNextOpcode()) {
 
 
  372           remaining_ops_to_use_from_previous_translation_ > 1;
 
 
  379    NextUnsignedOperandAtPreviousIndex();
 
 
  383#ifdef ENABLE_DISASSEMBLER 
  385void DeoptimizationFrameTranslation::PrintFrameTranslation(
 
  386    std::ostream& os, 
int index,
 
  394  os << first_opcode << 
" ";
 
  396      os, first_opcode, iterator, protected_literal_array, literal_array);
 
  397  while (iterator.HasNextOpcode()) {
 
  404        os, opcode, iterator, protected_literal_array, literal_array);
 
static V8_EXPORT_PRIVATE Handle< BigInt > FromUint64(Isolate *isolate, uint64_t n)
static V8_EXPORT_PRIVATE Handle< BigInt > FromInt64(Isolate *isolate, int64_t n)
static constexpr BytecodeOffset None()
constexpr int ToInt() const
DeoptimizationFrameTranslation::FrameCount EnterBeginOpcode()
TranslationOpcode NextOpcodeAtPreviousIndex()
const base::Vector< const uint8_t > buffer_
uint32_t NextOperandUnsigned()
bool HasNextOpcode() const
TranslationOpcode SeekNextJSFrame()
void SkipOpcodeAndItsOperandsAtPreviousIndex()
TranslationOpcode NextOpcode()
TranslationOpcode SeekNextFrame()
uint32_t NextUnsignedOperandAtPreviousIndex()
DeoptTranslationIterator(base::Vector< const uint8_t > buffer, int index)
static int LengthFor(int entry_count)
Tagged< ProtectedDeoptimizationLiteralArray > Tagged< TrustedPodArray< InliningPosition > > Tagged< SharedFunctionInfo > GetSharedFunctionInfo() const
BytecodeOffset GetBytecodeOffsetOrBuiltinContinuationId(int i) const
static Handle< DeoptimizationData > New(Isolate *isolate, int deopt_entry_count)
Tagged< SharedFunctionInfo > GetInlinedFunction(int index)
static V8_EXPORT_PRIVATE Handle< DeoptimizationData > Empty(Isolate *isolate)
Iterator(Tagged< DeoptimizationFrameTranslation > buffer, int index)
DeoptimizationLiteralKind kind_
DirectHandle< Object > Reify(Isolate *isolate) const
IndirectHandle< Object > object_
Tagged< ElementT > get(int index) const
base::OwnedVector< uint8_t > buffer_
uint32_t VLQDecodeUnsigned(GetNextFunction &&get_next)
int32_t VLQDecode(const uint8_t *data_start, int *index)
bool IsTranslationFrameOpcode(TranslationOpcode o)
bool TranslationOpcodeIsBegin(TranslationOpcode o)
int TranslationOpcodeOperandCount(TranslationOpcode o)
static constexpr int kNumTranslationOpcodes
bool IsTranslationJsFrameOpcode(TranslationOpcode o)
void DeoptimizationFrameTranslationPrintSingleOpcode(std::ostream &os, TranslationOpcode opcode, DeoptimizationFrameTranslation::Iterator &iterator, Tagged< ProtectedDeoptimizationLiteralArray > protected_literal_array, Tagged< DeoptimizationLiteralArray > literal_array)
V8_EXPORT_PRIVATE FlagValues v8_flags
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define DCHECK_LE(v1, v2)
#define CHECK_LT(lhs, rhs)
#define DCHECK_NE(v1, v2)
#define DCHECK_GE(v1, v2)
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define V8_UNLIKELY(condition)