chromium/v8/src/deoptimizer/translated-state.cc

// Copyright 2021 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/deoptimizer/translated-state.h"

#include <inttypes.h>

#include <iomanip>
#include <optional>

#include "src/base/memory.h"
#include "src/common/assert-scope.h"
#include "src/deoptimizer/deoptimizer.h"
#include "src/deoptimizer/materialized-object-store.h"
#include "src/deoptimizer/translation-opcode.h"
#include "src/diagnostics/disasm.h"
#include "src/execution/frames.h"
#include "src/execution/isolate.h"
#include "src/heap/heap.h"
#include "src/numbers/conversions.h"
#include "src/objects/arguments.h"
#include "src/objects/deoptimization-data.h"
#include "src/objects/heap-number-inl.h"
#include "src/objects/heap-object.h"
#include "src/objects/oddball.h"

// Has to be the last include (doesn't have include guards)
#include "src/objects/object-macros.h"
#include "src/objects/string.h"

namespace v8 {

Memory;
ReadUnalignedValue;

namespace internal {

void DeoptimizationFrameTranslationPrintSingleOpcode(
    std::ostream& os, TranslationOpcode opcode,
    DeoptimizationFrameTranslation::Iterator& iterator,
    Tagged<DeoptimizationLiteralArray> literal_array) {}

// static
TranslatedValue TranslatedValue::NewDeferredObject(TranslatedState* container,
                                                   int length,
                                                   int object_index) {}

// static
TranslatedValue TranslatedValue::NewDuplicateObject(TranslatedState* container,
                                                    int id) {}

// static
TranslatedValue TranslatedValue::NewFloat(TranslatedState* container,
                                          Float32 value) {}

// static
TranslatedValue TranslatedValue::NewDouble(TranslatedState* container,
                                           Float64 value) {}

// static
TranslatedValue TranslatedValue::NewHoleyDouble(TranslatedState* container,
                                                Float64 value) {}

// static
TranslatedValue TranslatedValue::NewSimd128(TranslatedState* container,
                                            Simd128 value) {}

// static
TranslatedValue TranslatedValue::NewInt32(TranslatedState* container,
                                          int32_t value) {}

// static
TranslatedValue TranslatedValue::NewInt64(TranslatedState* container,
                                          int64_t value) {}

// static
TranslatedValue TranslatedValue::NewInt64ToBigInt(TranslatedState* container,
                                                  int64_t value) {}

// static
TranslatedValue TranslatedValue::NewUint64ToBigInt(TranslatedState* container,
                                                   uint64_t value) {}

// static
TranslatedValue TranslatedValue::NewUint32(TranslatedState* container,
                                           uint32_t value) {}

TranslatedValue TranslatedValue::NewUint64(TranslatedState* container,
                                           uint64_t value) {}

// static
TranslatedValue TranslatedValue::NewBool(TranslatedState* container,
                                         uint32_t value) {}

// static
TranslatedValue TranslatedValue::NewTagged(TranslatedState* container,
                                           Tagged<Object> literal) {}

// static
TranslatedValue TranslatedValue::NewInvalid(TranslatedState* container) {}

Isolate* TranslatedValue::isolate() const {}

Tagged<Object> TranslatedValue::raw_literal() const {}

int32_t TranslatedValue::int32_value() const {}

int64_t TranslatedValue::int64_value() const {}

uint64_t TranslatedValue::uint64_value() const {}

uint32_t TranslatedValue::uint32_value() const {}

Float32 TranslatedValue::float_value() const {}

Float64 TranslatedValue::double_value() const {}

Simd128 TranslatedValue::simd_value() const {}

int TranslatedValue::object_length() const {}

int TranslatedValue::object_index() const {}

Tagged<Object> TranslatedValue::GetRawValue() const {}

void TranslatedValue::set_initialized_storage(Handle<HeapObject> storage) {}

Handle<Object> TranslatedValue::GetValue() {}

bool TranslatedValue::IsMaterializedObject() const {}

bool TranslatedValue::IsMaterializableByDebugger() const {}

int TranslatedValue::GetChildrenCount() const {}

uint64_t TranslatedState::GetUInt64Slot(Address fp, int slot_offset) {}

uint32_t TranslatedState::GetUInt32Slot(Address fp, int slot_offset) {}

Float32 TranslatedState::GetFloatSlot(Address fp, int slot_offset) {}

Float64 TranslatedState::GetDoubleSlot(Address fp, int slot_offset) {}

Simd128 TranslatedState::getSimd128Slot(Address fp, int slot_offset) {}

void TranslatedValue::Handlify() {}

TranslatedFrame TranslatedFrame::UnoptimizedFrame(
    BytecodeOffset bytecode_offset, Tagged<SharedFunctionInfo> shared_info,
    int height, int return_value_offset, int return_value_count) {}

TranslatedFrame TranslatedFrame::InlinedExtraArguments(
    Tagged<SharedFunctionInfo> shared_info, int height) {}

TranslatedFrame TranslatedFrame::ConstructCreateStubFrame(
    Tagged<SharedFunctionInfo> shared_info, int height) {}

TranslatedFrame TranslatedFrame::ConstructInvokeStubFrame(
    Tagged<SharedFunctionInfo> shared_info) {}

TranslatedFrame TranslatedFrame::BuiltinContinuationFrame(
    BytecodeOffset bytecode_offset, Tagged<SharedFunctionInfo> shared_info,
    int height) {}

#if V8_ENABLE_WEBASSEMBLY
TranslatedFrame TranslatedFrame::WasmInlinedIntoJSFrame(
    BytecodeOffset bytecode_offset, Tagged<SharedFunctionInfo> shared_info,
    int height) {}

TranslatedFrame TranslatedFrame::JSToWasmBuiltinContinuationFrame(
    BytecodeOffset bytecode_offset, Tagged<SharedFunctionInfo> shared_info,
    int height, std::optional<wasm::ValueKind> return_kind) {}

TranslatedFrame TranslatedFrame::LiftoffFrame(BytecodeOffset bytecode_offset,
                                              int height, int function_index) {}
#endif  // V8_ENABLE_WEBASSEMBLY

TranslatedFrame TranslatedFrame::JavaScriptBuiltinContinuationFrame(
    BytecodeOffset bytecode_offset, Tagged<SharedFunctionInfo> shared_info,
    int height) {}

TranslatedFrame TranslatedFrame::JavaScriptBuiltinContinuationWithCatchFrame(
    BytecodeOffset bytecode_offset, Tagged<SharedFunctionInfo> shared_info,
    int height) {}

int TranslatedFrame::GetValueCount() const {}

void TranslatedFrame::Handlify(Isolate* isolate) {}

DeoptimizationLiteralProvider::DeoptimizationLiteralProvider(
    Tagged<DeoptimizationLiteralArray> literal_array)
    :{}

DeoptimizationLiteralProvider::DeoptimizationLiteralProvider(
    std::vector<DeoptimizationLiteral> literals)
    :{}

DeoptimizationLiteralProvider::~DeoptimizationLiteralProvider() = default;

TranslatedValue DeoptimizationLiteralProvider::Get(TranslatedState* container,
                                                   int literal_index) const {}

TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
    DeoptTranslationIterator* iterator,
    const DeoptimizationLiteralProvider& literal_array, Address fp,
    FILE* trace_file) {}

// static
void TranslatedFrame::AdvanceIterator(
    std::deque<TranslatedValue>::iterator* iter) {}

// Creates translated values for an arguments backing store, or the backing
// store for rest parameters depending on the given {type}. The TranslatedValue
// objects for the fields are not read from the
// DeoptimizationFrameTranslation::Iterator, but instead created on-the-fly
// based on dynamic information in the optimized frame.
void TranslatedState::CreateArgumentsElementsTranslatedValues(
    int frame_index, Address input_frame_pointer, CreateArgumentsType type,
    FILE* trace_file) {}

// We can't intermix stack decoding and allocations because the deoptimization
// infrastracture is not GC safe.
// Thus we build a temporary structure in malloced space.
// The TranslatedValue objects created correspond to the static translation
// instructions from the DeoptTranslationIterator, except for
// TranslationOpcode::ARGUMENTS_ELEMENTS, where the number and values of the
// FixedArray elements depend on dynamic information from the optimized frame.
// Returns the number of expected nested translations from the
// DeoptTranslationIterator.
int TranslatedState::CreateNextTranslatedValue(
    int frame_index, DeoptTranslationIterator* iterator,
    const DeoptimizationLiteralProvider& literal_array, Address fp,
    RegisterValues* registers, FILE* trace_file) {}

Address TranslatedState::DecompressIfNeeded(intptr_t value) {}

TranslatedState::TranslatedState(const JavaScriptFrame* frame)
    :{}

void TranslatedState::Init(Isolate* isolate, Address input_frame_pointer,
                           Address stack_frame_pointer,
                           DeoptTranslationIterator* iterator,
                           const DeoptimizationLiteralProvider& literal_array,
                           RegisterValues* registers, FILE* trace_file,
                           int formal_parameter_count,
                           int actual_argument_count) {}

void TranslatedState::Prepare(Address stack_frame_pointer) {}

TranslatedValue* TranslatedState::GetValueByObjectIndex(int object_index) {}

Handle<HeapObject> TranslatedState::InitializeObjectAt(TranslatedValue* slot) {}

void TranslatedState::InitializeCapturedObjectAt(
    int object_index, std::stack<int>* worklist,
    const DisallowGarbageCollection& no_gc) {}

void TranslatedState::EnsureObjectAllocatedAt(TranslatedValue* slot) {}

int TranslatedValue::GetSmiValue() const {}

void TranslatedState::MaterializeFixedDoubleArray(TranslatedFrame* frame,
                                                  int* value_index,
                                                  TranslatedValue* slot,
                                                  DirectHandle<Map> map) {}

void TranslatedState::MaterializeHeapNumber(TranslatedFrame* frame,
                                            int* value_index,
                                            TranslatedValue* slot) {}

namespace {

enum StorageKind : uint8_t {};

}  // namespace

void TranslatedState::SkipSlots(int slots_to_skip, TranslatedFrame* frame,
                                int* value_index) {}

void TranslatedState::EnsureCapturedObjectAllocatedAt(
    int object_index, std::stack<int>* worklist) {}

void TranslatedValue::ReplaceElementsArrayWithCopy() {}

void TranslatedState::EnsureChildrenAllocated(int count, TranslatedFrame* frame,
                                              int* value_index,
                                              std::stack<int>* worklist) {}

void TranslatedState::EnsurePropertiesAllocatedAndMarked(
    TranslatedValue* properties_slot, DirectHandle<Map> map) {}

Handle<ByteArray> TranslatedState::AllocateStorageFor(TranslatedValue* slot) {}

void TranslatedState::EnsureJSObjectAllocated(TranslatedValue* slot,
                                              DirectHandle<Map> map) {}

TranslatedValue* TranslatedState::GetResolvedSlot(TranslatedFrame* frame,
                                                  int value_index) {}

TranslatedValue* TranslatedState::GetResolvedSlotAndAdvance(
    TranslatedFrame* frame, int* value_index) {}

Handle<Object> TranslatedState::GetValueAndAdvance(TranslatedFrame* frame,
                                                   int* value_index) {}

void TranslatedState::InitializeJSObjectAt(
    TranslatedFrame* frame, int* value_index, TranslatedValue* slot,
    DirectHandle<Map> map, const DisallowGarbageCollection& no_gc) {}

void TranslatedState::InitializeObjectWithTaggedFieldsAt(
    TranslatedFrame* frame, int* value_index, TranslatedValue* slot,
    DirectHandle<Map> map, const DisallowGarbageCollection& no_gc) {}

TranslatedValue* TranslatedState::ResolveCapturedObject(TranslatedValue* slot) {}

TranslatedFrame* TranslatedState::GetFrameFromJSFrameIndex(int jsframe_index) {}

TranslatedFrame* TranslatedState::GetArgumentsInfoFromJSFrameIndex(
    int jsframe_index, int* args_count) {}

void TranslatedState::StoreMaterializedValuesAndDeopt(JavaScriptFrame* frame) {}

void TranslatedState::UpdateFromPreviouslyMaterializedObjects() {}

void TranslatedState::VerifyMaterializedObjects() {}

bool TranslatedState::DoUpdateFeedback() {}

void TranslatedState::ReadUpdateFeedback(
    DeoptTranslationIterator* iterator,
    Tagged<DeoptimizationLiteralArray> literal_array, FILE* trace_file) {}

}  // namespace internal
}  // namespace v8

// Undefine the heap manipulation macros.
#include "src/objects/object-macros-undef.h"