chromium/v8/src/interpreter/interpreter-assembler.cc

// Copyright 2015 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/interpreter-assembler.h"

#include <limits>
#include <ostream>

#include "src/builtins/builtins-inl.h"
#include "src/codegen/code-stub-assembler-inl.h"
#include "src/codegen/interface-descriptors-inl.h"
#include "src/codegen/machine-type.h"
#include "src/interpreter/bytecodes.h"
#include "src/interpreter/interpreter.h"
#include "src/objects/objects-inl.h"

namespace v8 {
namespace internal {
namespace interpreter {

#include "src/codegen/define-code-stub-assembler-macros.inc"

CodeAssemblerState;

InterpreterAssembler::InterpreterAssembler(CodeAssemblerState* state,
                                           Bytecode bytecode,
                                           OperandScale operand_scale)
    :{}

InterpreterAssembler::~InterpreterAssembler() {}

TNode<RawPtrT> InterpreterAssembler::GetInterpretedFramePointer() {}

TNode<IntPtrT> InterpreterAssembler::BytecodeOffset() {}

TNode<IntPtrT> InterpreterAssembler::ReloadBytecodeOffset() {}

void InterpreterAssembler::SaveBytecodeOffset() {}

TNode<BytecodeArray> InterpreterAssembler::BytecodeArrayTaggedPointer() {}

TNode<ExternalReference> InterpreterAssembler::DispatchTablePointer() {}

TNode<Object> InterpreterAssembler::GetAccumulatorUnchecked() {}

TNode<Object> InterpreterAssembler::GetAccumulator() {}

void InterpreterAssembler::SetAccumulator(TNode<Object> value) {}

void InterpreterAssembler::ClobberAccumulator(TNode<Object> clobber_value) {}

TNode<Context> InterpreterAssembler::GetContext() {}

void InterpreterAssembler::SetContext(TNode<Context> value) {}

TNode<Context> InterpreterAssembler::GetContextAtDepth(TNode<Context> context,
                                                       TNode<Uint32T> depth) {}

TNode<IntPtrT> InterpreterAssembler::RegisterLocation(
    TNode<IntPtrT> reg_index) {}

TNode<IntPtrT> InterpreterAssembler::RegisterLocation(Register reg) {}

TNode<IntPtrT> InterpreterAssembler::RegisterFrameOffset(TNode<IntPtrT> index) {}

TNode<Object> InterpreterAssembler::LoadRegister(TNode<IntPtrT> reg_index) {}

TNode<Object> InterpreterAssembler::LoadRegister(Register reg) {}

TNode<IntPtrT> InterpreterAssembler::LoadAndUntagRegister(Register reg) {}

TNode<Object> InterpreterAssembler::LoadRegisterAtOperandIndex(
    int operand_index) {}

std::pair<TNode<Object>, TNode<Object>>
InterpreterAssembler::LoadRegisterPairAtOperandIndex(int operand_index) {}

InterpreterAssembler::RegListNodePair
InterpreterAssembler::GetRegisterListAtOperandIndex(int operand_index) {}

TNode<Object> InterpreterAssembler::LoadRegisterFromRegisterList(
    const RegListNodePair& reg_list, int index) {}

TNode<IntPtrT> InterpreterAssembler::RegisterLocationInRegisterList(
    const RegListNodePair& reg_list, int index) {}

void InterpreterAssembler::StoreRegister(TNode<Object> value, Register reg) {}

void InterpreterAssembler::StoreRegister(TNode<Object> value,
                                         TNode<IntPtrT> reg_index) {}

void InterpreterAssembler::StoreRegisterForShortStar(TNode<Object> value,
                                                     TNode<WordT> opcode) {}

void InterpreterAssembler::StoreRegisterAtOperandIndex(TNode<Object> value,
                                                       int operand_index) {}

void InterpreterAssembler::StoreRegisterPairAtOperandIndex(TNode<Object> value1,
                                                           TNode<Object> value2,
                                                           int operand_index) {}

void InterpreterAssembler::StoreRegisterTripleAtOperandIndex(
    TNode<Object> value1, TNode<Object> value2, TNode<Object> value3,
    int operand_index) {}

TNode<IntPtrT> InterpreterAssembler::NextRegister(TNode<IntPtrT> reg_index) {}

TNode<IntPtrT> InterpreterAssembler::OperandOffset(int operand_index) {}

TNode<Uint8T> InterpreterAssembler::BytecodeOperandUnsignedByte(
    int operand_index) {}

TNode<Int8T> InterpreterAssembler::BytecodeOperandSignedByte(
    int operand_index) {}

TNode<Word32T> InterpreterAssembler::BytecodeOperandReadUnaligned(
    int relative_offset, MachineType result_type) {}

TNode<Uint16T> InterpreterAssembler::BytecodeOperandUnsignedShort(
    int operand_index) {}

TNode<Int16T> InterpreterAssembler::BytecodeOperandSignedShort(
    int operand_index) {}

TNode<Uint32T> InterpreterAssembler::BytecodeOperandUnsignedQuad(
    int operand_index) {}

TNode<Int32T> InterpreterAssembler::BytecodeOperandSignedQuad(
    int operand_index) {}

TNode<Int32T> InterpreterAssembler::BytecodeSignedOperand(
    int operand_index, OperandSize operand_size) {}

TNode<Uint32T> InterpreterAssembler::BytecodeUnsignedOperand(
    int operand_index, OperandSize operand_size) {}

TNode<Uint32T> InterpreterAssembler::BytecodeOperandCount(int operand_index) {}

TNode<Uint32T> InterpreterAssembler::BytecodeOperandFlag8(int operand_index) {}

TNode<Uint32T> InterpreterAssembler::BytecodeOperandFlag16(int operand_index) {}

TNode<Uint32T> InterpreterAssembler::BytecodeOperandUImm(int operand_index) {}

TNode<UintPtrT> InterpreterAssembler::BytecodeOperandUImmWord(
    int operand_index) {}

TNode<Smi> InterpreterAssembler::BytecodeOperandUImmSmi(int operand_index) {}

TNode<Int32T> InterpreterAssembler::BytecodeOperandImm(int operand_index) {}

TNode<IntPtrT> InterpreterAssembler::BytecodeOperandImmIntPtr(
    int operand_index) {}

TNode<Smi> InterpreterAssembler::BytecodeOperandImmSmi(int operand_index) {}

TNode<Uint32T> InterpreterAssembler::BytecodeOperandIdxInt32(
    int operand_index) {}

TNode<UintPtrT> InterpreterAssembler::BytecodeOperandIdx(int operand_index) {}

TNode<Smi> InterpreterAssembler::BytecodeOperandIdxSmi(int operand_index) {}

TNode<TaggedIndex> InterpreterAssembler::BytecodeOperandIdxTaggedIndex(
    int operand_index) {}

TNode<UintPtrT> InterpreterAssembler::BytecodeOperandConstantPoolIdx(
    int operand_index) {}

TNode<IntPtrT> InterpreterAssembler::BytecodeOperandReg(int operand_index) {}

TNode<Uint32T> InterpreterAssembler::BytecodeOperandRuntimeId(
    int operand_index) {}

TNode<UintPtrT> InterpreterAssembler::BytecodeOperandNativeContextIndex(
    int operand_index) {}

TNode<Uint32T> InterpreterAssembler::BytecodeOperandIntrinsicId(
    int operand_index) {}

TNode<Object> InterpreterAssembler::LoadConstantPoolEntry(TNode<WordT> index) {}

TNode<IntPtrT> InterpreterAssembler::LoadAndUntagConstantPoolEntry(
    TNode<WordT> index) {}

TNode<Object> InterpreterAssembler::LoadConstantPoolEntryAtOperandIndex(
    int operand_index) {}

TNode<IntPtrT>
InterpreterAssembler::LoadAndUntagConstantPoolEntryAtOperandIndex(
    int operand_index) {}

TNode<JSFunction> InterpreterAssembler::LoadFunctionClosure() {}

TNode<HeapObject> InterpreterAssembler::LoadFeedbackVector() {}

void InterpreterAssembler::CallPrologue() {}

void InterpreterAssembler::CallEpilogue() {}

void InterpreterAssembler::CallJSAndDispatch(
    TNode<Object> function, TNode<Context> context, const RegListNodePair& args,
    ConvertReceiverMode receiver_mode) {}

template <class... TArgs>
void InterpreterAssembler::CallJSAndDispatch(TNode<Object> function,
                                             TNode<Context> context,
                                             TNode<Word32T> arg_count,
                                             ConvertReceiverMode receiver_mode,
                                             TArgs... args) {}

// Instantiate CallJSAndDispatch() for argument counts used by interpreter
// generator.
template V8_EXPORT_PRIVATE void InterpreterAssembler::CallJSAndDispatch(
    TNode<Object> function, TNode<Context> context, TNode<Word32T> arg_count,
    ConvertReceiverMode receiver_mode);
template V8_EXPORT_PRIVATE void InterpreterAssembler::CallJSAndDispatch(
    TNode<Object> function, TNode<Context> context, TNode<Word32T> arg_count,
    ConvertReceiverMode receiver_mode, TNode<Object>);
template V8_EXPORT_PRIVATE void InterpreterAssembler::CallJSAndDispatch(
    TNode<Object> function, TNode<Context> context, TNode<Word32T> arg_count,
    ConvertReceiverMode receiver_mode, TNode<Object>, TNode<Object>);
template V8_EXPORT_PRIVATE void InterpreterAssembler::CallJSAndDispatch(
    TNode<Object> function, TNode<Context> context, TNode<Word32T> arg_count,
    ConvertReceiverMode receiver_mode, TNode<Object>, TNode<Object>,
    TNode<Object>);

void InterpreterAssembler::CallJSWithSpreadAndDispatch(
    TNode<Object> function, TNode<Context> context, const RegListNodePair& args,
    TNode<UintPtrT> slot_id) {}

TNode<Object> InterpreterAssembler::Construct(
    TNode<Object> target, TNode<Context> context, TNode<Object> new_target,
    const RegListNodePair& args, TNode<UintPtrT> slot_id,
    TNode<HeapObject> maybe_feedback_vector) {}

TNode<Object> InterpreterAssembler::ConstructWithSpread(
    TNode<Object> target, TNode<Context> context, TNode<Object> new_target,
    const RegListNodePair& args, TNode<UintPtrT> slot_id) {}

// TODO(v8:13249): Add a FastConstruct variant to avoid pushing arguments twice
// (once here, and once again in construct stub).
TNode<Object> InterpreterAssembler::ConstructForwardAllArgs(
    TNode<Object> target, TNode<Context> context, TNode<Object> new_target,
    TNode<TaggedIndex> slot_id) {}

template <class T>
TNode<T> InterpreterAssembler::CallRuntimeN(TNode<Uint32T> function_id,
                                            TNode<Context> context,
                                            const RegListNodePair& args,
                                            int return_count) {}

template V8_EXPORT_PRIVATE TNode<Object> InterpreterAssembler::CallRuntimeN(
    TNode<Uint32T> function_id, TNode<Context> context,
    const RegListNodePair& args, int return_count);
template V8_EXPORT_PRIVATE TNode<PairT<Object, Object>>
InterpreterAssembler::CallRuntimeN(TNode<Uint32T> function_id,
                                   TNode<Context> context,
                                   const RegListNodePair& args,
                                   int return_count);

TNode<Int32T> InterpreterAssembler::UpdateInterruptBudget(
    TNode<Int32T> weight) {}

void InterpreterAssembler::DecreaseInterruptBudget(
    TNode<Int32T> weight, StackCheckBehavior stack_check_behavior) {}

TNode<IntPtrT> InterpreterAssembler::Advance() {}

TNode<IntPtrT> InterpreterAssembler::Advance(int delta) {}

TNode<IntPtrT> InterpreterAssembler::Advance(TNode<IntPtrT> delta) {}

void InterpreterAssembler::JumpToOffset(TNode<IntPtrT> new_bytecode_offset) {}

void InterpreterAssembler::Jump(TNode<IntPtrT> jump_offset) {}

void InterpreterAssembler::JumpBackward(TNode<IntPtrT> jump_offset) {}

void InterpreterAssembler::JumpConditional(TNode<BoolT> condition,
                                           TNode<IntPtrT> jump_offset) {}

void InterpreterAssembler::JumpConditionalByImmediateOperand(
    TNode<BoolT> condition, int operand_index) {}

void InterpreterAssembler::JumpConditionalByConstantOperand(
    TNode<BoolT> condition, int operand_index) {}

void InterpreterAssembler::JumpIfTaggedEqual(TNode<Object> lhs,
                                             TNode<Object> rhs,
                                             TNode<IntPtrT> jump_offset) {}

void InterpreterAssembler::JumpIfTaggedEqual(TNode<Object> lhs,
                                             TNode<Object> rhs,
                                             int operand_index) {}

void InterpreterAssembler::JumpIfTaggedEqualConstant(TNode<Object> lhs,
                                                     TNode<Object> rhs,
                                                     int operand_index) {}

void InterpreterAssembler::JumpIfTaggedNotEqual(TNode<Object> lhs,
                                                TNode<Object> rhs,
                                                TNode<IntPtrT> jump_offset) {}

void InterpreterAssembler::JumpIfTaggedNotEqual(TNode<Object> lhs,
                                                TNode<Object> rhs,
                                                int operand_index) {}

void InterpreterAssembler::JumpIfTaggedNotEqualConstant(TNode<Object> lhs,
                                                        TNode<Object> rhs,
                                                        int operand_index) {}

TNode<WordT> InterpreterAssembler::LoadBytecode(
    TNode<IntPtrT> bytecode_offset) {}

TNode<IntPtrT> InterpreterAssembler::LoadParameterCountWithoutReceiver() {}

void InterpreterAssembler::StarDispatchLookahead(TNode<WordT> target_bytecode) {}

void InterpreterAssembler::InlineShortStar(TNode<WordT> target_bytecode) {}

void InterpreterAssembler::Dispatch() {}

void InterpreterAssembler::DispatchToBytecodeWithOptionalStarLookahead(
    TNode<WordT> target_bytecode) {}

void InterpreterAssembler::DispatchToBytecode(
    TNode<WordT> target_bytecode, TNode<IntPtrT> new_bytecode_offset) {}

void InterpreterAssembler::DispatchToBytecodeHandlerEntry(
    TNode<RawPtrT> handler_entry, TNode<IntPtrT> bytecode_offset) {}

void InterpreterAssembler::DispatchWide(OperandScale operand_scale) {}

void InterpreterAssembler::UpdateInterruptBudgetOnReturn() {}

TNode<Int8T> InterpreterAssembler::LoadOsrState(
    TNode<FeedbackVector> feedback_vector) {}

void InterpreterAssembler::Abort(AbortReason abort_reason) {}

void InterpreterAssembler::AbortIfWordNotEqual(TNode<WordT> lhs,
                                               TNode<WordT> rhs,
                                               AbortReason abort_reason) {}

void InterpreterAssembler::OnStackReplacement(
    TNode<Context> context, TNode<FeedbackVector> feedback_vector,
    TNode<IntPtrT> relative_jump, TNode<Int32T> loop_depth,
    TNode<IntPtrT> feedback_slot, TNode<Int8T> osr_state,
    OnStackReplacementParams params) {}

void InterpreterAssembler::TraceBytecode(Runtime::FunctionId function_id) {}

void InterpreterAssembler::TraceBytecodeDispatch(TNode<WordT> target_bytecode) {}

// static
bool InterpreterAssembler::TargetSupportsUnalignedAccess() {}

void InterpreterAssembler::AbortIfRegisterCountInvalid(
    TNode<FixedArray> parameters_and_registers, TNode<IntPtrT> parameter_count,
    TNode<UintPtrT> register_count) {}

TNode<FixedArray> InterpreterAssembler::ExportParametersAndRegisterFile(
    TNode<FixedArray> array, const RegListNodePair& registers) {}

TNode<FixedArray> InterpreterAssembler::ImportRegisterFile(
    TNode<FixedArray> array, const RegListNodePair& registers) {}

int InterpreterAssembler::CurrentBytecodeSize() const {}

void InterpreterAssembler::ToNumberOrNumeric(Object::Conversion mode) {}

#undef TVARIABLE_CONSTRUCTOR

#include "src/codegen/undef-code-stub-assembler-macros.inc"

}  // namespace interpreter
}  // namespace internal
}  // namespace v8