Commit 4b419c06 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[cleanup] Rename TranslatedFrame with inlined arguments

... from ArgumentsAdaptorFrame to InlinedExtraArguments.

Change-Id: I772e0546dd50282a4cd14723625fd5bf774f424c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3609968Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80250}
parent f3f7b4e5
......@@ -1083,8 +1083,8 @@ void CodeGenerator::BuildTranslationForFrameStateDescriptor(
return_offset, return_count);
break;
}
case FrameStateType::kArgumentsAdaptor:
translations_.BeginArgumentsAdaptorFrame(shared_info_id, height);
case FrameStateType::kInlinedExtraArguments:
translations_.BeginInlinedExtraArguments(shared_info_id, height);
break;
case FrameStateType::kConstructStub:
DCHECK(bailout_id.IsValidForConstructStub());
......
......@@ -1085,7 +1085,7 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
call->InputAt(static_cast<int>(buffer->descriptor->InputCount()))};
// If it was a syntactic tail call we need to drop the current frame and
// all the frames on top of it that are either an arguments adaptor frame
// all the frames on top of it that are either inlined extra arguments
// or a tail caller frame.
if (is_tail_call) {
frame_state = FrameState{NodeProperties::GetFrameStateInput(frame_state)};
......@@ -1093,7 +1093,7 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
buffer->frame_state_descriptor->outer_state();
while (buffer->frame_state_descriptor != nullptr &&
buffer->frame_state_descriptor->type() ==
FrameStateType::kArgumentsAdaptor) {
FrameStateType::kInlinedExtraArguments) {
frame_state =
FrameState{NodeProperties::GetFrameStateInput(frame_state)};
buffer->frame_state_descriptor =
......
......@@ -1046,9 +1046,10 @@ size_t GetConservativeFrameSizeInBytes(FrameStateType type,
static_cast<int>(parameters_count), static_cast<int>(locals_count));
return info.frame_size_in_bytes();
}
case FrameStateType::kArgumentsAdaptor:
// The arguments adaptor frame state is only used in the deoptimizer and
// does not occupy any extra space in the stack. Check out the design doc:
case FrameStateType::kInlinedExtraArguments:
// The inlined extra arguments frame state is only used in the deoptimizer
// and does not occupy any extra space in the stack.
// Check out the design doc:
// https://docs.google.com/document/d/150wGaUREaZI6YWqOQFD5l2mWQXaPbbZjcAIJLOFrzMs/edit
// We just need to account for the additional parameters we might push
// here.
......@@ -1123,7 +1124,7 @@ size_t FrameStateDescriptor::GetHeight() const {
// Custom, non-JS calling convention (that does not have a notion of
// a receiver or context).
return parameters_count();
case FrameStateType::kArgumentsAdaptor:
case FrameStateType::kInlinedExtraArguments:
case FrameStateType::kConstructStub:
case FrameStateType::kJavaScriptBuiltinContinuation:
case FrameStateType::kJavaScriptBuiltinContinuationWithCatch:
......
......@@ -55,8 +55,8 @@ std::ostream& operator<<(std::ostream& os, FrameStateType type) {
case FrameStateType::kUnoptimizedFunction:
os << "UNOPTIMIZED_FRAME";
break;
case FrameStateType::kArgumentsAdaptor:
os << "ARGUMENTS_ADAPTOR";
case FrameStateType::kInlinedExtraArguments:
os << "INLINED_EXTRA_ARGUMENTS";
break;
case FrameStateType::kConstructStub:
os << "CONSTRUCT_STUB";
......
......@@ -68,7 +68,7 @@ class OutputFrameStateCombine {
// The type of stack frame that a FrameState node represents.
enum class FrameStateType {
kUnoptimizedFunction, // Represents an UnoptimizedFrame.
kArgumentsAdaptor, // Represents an ArgumentsAdaptorFrame.
kInlinedExtraArguments, // Represents inlined extra arguments.
kConstructStub, // Represents a ConstructStubFrame.
kBuiltinContinuation, // Represents a continuation to a stub.
#if V8_ENABLE_WEBASSEMBLY // ↓ WebAssembly only
......
......@@ -4149,8 +4149,8 @@ JSCallReducer::ReduceCallOrConstructWithArrayLikeOrSpreadOfCreateArguments(
// some other function (and same for the {arg_array}).
FrameState outer_state{frame_state.outer_frame_state()};
FrameStateInfo outer_info = outer_state.frame_state_info();
if (outer_info.type() == FrameStateType::kArgumentsAdaptor) {
// Need to take the parameters from the arguments adaptor.
if (outer_info.type() == FrameStateType::kInlinedExtraArguments) {
// Need to take the parameters from the inlined extra arguments frame state.
frame_state = outer_state;
}
// Add the actual parameters to the {node}, skipping the receiver.
......
......@@ -39,7 +39,7 @@ namespace {
FrameState GetArgumentsFrameState(FrameState frame_state) {
FrameState outer_state{NodeProperties::GetFrameStateInput(frame_state)};
return outer_state.frame_state_info().type() ==
FrameStateType::kArgumentsAdaptor
FrameStateType::kInlinedExtraArguments
? outer_state
: frame_state;
}
......
......@@ -713,16 +713,15 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
}
}
// Insert argument adaptor frame if required. The callees formal parameter
// count have to match the number of arguments passed
// to the call.
// Insert inlined extra arguments if required. The callees formal parameter
// count have to match the number of arguments passed to the call.
int parameter_count =
shared_info->internal_formal_parameter_count_without_receiver();
DCHECK_EQ(parameter_count, start.FormalParameterCountWithoutReceiver());
if (call.argument_count() != parameter_count) {
frame_state = CreateArtificialFrameState(
node, frame_state, call.argument_count(), BytecodeOffset::None(),
FrameStateType::kArgumentsAdaptor, *shared_info);
FrameStateType::kInlinedExtraArguments, *shared_info);
}
return InlineCall(node, new_target, context, frame_state, start, end,
......
......@@ -857,8 +857,8 @@ void Deoptimizer::DoComputeOutputFrames() {
DoComputeUnoptimizedFrame(translated_frame, frame_index,
handle_exception);
break;
case TranslatedFrame::kArgumentsAdaptor:
DoComputeArgumentsAdaptorFrame(translated_frame, frame_index);
case TranslatedFrame::kInlinedExtraArguments:
DoComputeInlinedExtraArguments(translated_frame, frame_index);
break;
case TranslatedFrame::kConstructStub:
DoComputeConstructStubFrame(translated_frame, frame_index);
......@@ -943,13 +943,13 @@ void Deoptimizer::DoComputeUnoptimizedFrame(TranslatedFrame* translated_frame,
const int parameters_count =
shared.internal_formal_parameter_count_with_receiver();
// If this is the bottom most frame or the previous frame was the arguments
// adaptor fake frame, then we already have extra arguments in the stack
// If this is the bottom most frame or the previous frame was the inlined
// extra arguments frame, then we already have extra arguments in the stack
// (including any extra padding). Therefore we should not try to add any
// padding.
bool should_pad_arguments =
!is_bottommost && (translated_state_.frames()[frame_index - 1]).kind() !=
TranslatedFrame::kArgumentsAdaptor;
TranslatedFrame::kInlinedExtraArguments;
const int locals_count = translated_frame->height();
UnoptimizedFrameInfo frame_info = UnoptimizedFrameInfo::Precise(
......@@ -1097,7 +1097,7 @@ void Deoptimizer::DoComputeUnoptimizedFrame(TranslatedFrame* translated_frame,
} else {
TranslatedFrame::Kind previous_frame_kind =
(translated_state_.frames()[frame_index - 1]).kind();
argc = previous_frame_kind == TranslatedFrame::kArgumentsAdaptor
argc = previous_frame_kind == TranslatedFrame::kInlinedExtraArguments
? output_[frame_index - 1]->parameter_count()
: parameters_count;
}
......@@ -1231,17 +1231,15 @@ void Deoptimizer::DoComputeUnoptimizedFrame(TranslatedFrame* translated_frame,
}
}
void Deoptimizer::DoComputeArgumentsAdaptorFrame(
void Deoptimizer::DoComputeInlinedExtraArguments(
TranslatedFrame* translated_frame, int frame_index) {
// Arguments adaptor can not be top most, nor the bottom most frames.
// Inlined arguments frame can not be the topmost, nor the bottom most frame.
CHECK(frame_index < output_count_ - 1);
CHECK_GT(frame_index, 0);
CHECK_NULL(output_[frame_index]);
// During execution, V8 does not understand arguments adaptor frames anymore,
// so during deoptimization we only push the extra arguments (arguments with
// index greater than the formal parameter count). Therefore we call this
// TranslatedFrame the fake adaptor frame.
// During deoptimization we need push the extra arguments of inlined functions
// (arguments with index greater than the formal parameter count).
// For more info, see the design document:
// https://docs.google.com/document/d/150wGaUREaZI6YWqOQFD5l2mWQXaPbbZjcAIJLOFrzMs
......
......@@ -149,7 +149,7 @@ class Deoptimizer : public Malloced {
void DoComputeOutputFrames();
void DoComputeUnoptimizedFrame(TranslatedFrame* translated_frame,
int frame_index, bool goto_catch_handler);
void DoComputeArgumentsAdaptorFrame(TranslatedFrame* translated_frame,
void DoComputeInlinedExtraArguments(TranslatedFrame* translated_frame,
int frame_index);
void DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
int frame_index);
......
......@@ -112,7 +112,7 @@ void TranslationArrayPrintSingleFrame(
}
#endif // V8_ENABLE_WEBASSEMBLY
case TranslationOpcode::ARGUMENTS_ADAPTOR_FRAME: {
case TranslationOpcode::INLINED_EXTRA_ARGUMENTS: {
DCHECK_EQ(TranslationOpcodeOperandCount(opcode), 2);
int shared_info_id = iterator.Next();
Object shared_info = literal_array.get(shared_info_id);
......@@ -629,9 +629,9 @@ TranslatedFrame TranslatedFrame::UnoptimizedFrame(
return frame;
}
TranslatedFrame TranslatedFrame::ArgumentsAdaptorFrame(
TranslatedFrame TranslatedFrame::InlinedExtraArguments(
SharedFunctionInfo shared_info, int height) {
return TranslatedFrame(kArgumentsAdaptor, shared_info, height);
return TranslatedFrame(kInlinedExtraArguments, shared_info, height);
}
TranslatedFrame TranslatedFrame::ConstructStubFrame(
......@@ -693,7 +693,7 @@ int TranslatedFrame::GetValueCount() {
kTheAccumulator;
}
case kArgumentsAdaptor:
case kInlinedExtraArguments:
return height() + kTheFunction;
case kConstructStub:
......@@ -752,7 +752,7 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
return_value_count);
}
case TranslationOpcode::ARGUMENTS_ADAPTOR_FRAME: {
case TranslationOpcode::INLINED_EXTRA_ARGUMENTS: {
SharedFunctionInfo shared_info =
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
int height = iterator->Next();
......@@ -761,7 +761,7 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
PrintF(trace_file, " reading arguments adaptor frame %s", name.get());
PrintF(trace_file, " => height=%d; inputs:\n", height);
}
return TranslatedFrame::ArgumentsAdaptorFrame(shared_info, height);
return TranslatedFrame::InlinedExtraArguments(shared_info, height);
}
case TranslationOpcode::CONSTRUCT_STUB_FRAME: {
......@@ -970,7 +970,7 @@ int TranslatedState::CreateNextTranslatedValue(
switch (opcode) {
case TranslationOpcode::BEGIN:
case TranslationOpcode::INTERPRETED_FRAME:
case TranslationOpcode::ARGUMENTS_ADAPTOR_FRAME:
case TranslationOpcode::INLINED_EXTRA_ARGUMENTS:
case TranslationOpcode::CONSTRUCT_STUB_FRAME:
case TranslationOpcode::JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME:
case TranslationOpcode::JAVA_SCRIPT_BUILTIN_CONTINUATION_WITH_CATCH_FRAME:
......@@ -1962,7 +1962,7 @@ TranslatedFrame* TranslatedState::GetArgumentsInfoFromJSFrameIndex(
// We have the JS function frame, now check if it has arguments
// adaptor.
if (i > 0 &&
frames_[i - 1].kind() == TranslatedFrame::kArgumentsAdaptor) {
frames_[i - 1].kind() == TranslatedFrame::kInlinedExtraArguments) {
*args_count = frames_[i - 1].height();
return &(frames_[i - 1]);
}
......
......@@ -177,7 +177,7 @@ class TranslatedFrame {
public:
enum Kind {
kUnoptimizedFunction,
kArgumentsAdaptor,
kInlinedExtraArguments,
kConstructStub,
kBuiltinContinuation,
#if V8_ENABLE_WEBASSEMBLY
......@@ -276,7 +276,7 @@ class TranslatedFrame {
int return_value_count);
static TranslatedFrame AccessorFrame(Kind kind,
SharedFunctionInfo shared_info);
static TranslatedFrame ArgumentsAdaptorFrame(SharedFunctionInfo shared_info,
static TranslatedFrame InlinedExtraArguments(SharedFunctionInfo shared_info,
int height);
static TranslatedFrame ConstructStubFrame(BytecodeOffset bailout_id,
SharedFunctionInfo shared_info,
......
......@@ -161,9 +161,9 @@ void TranslationArrayBuilder::BeginConstructStubFrame(
DCHECK_EQ(TranslationOpcodeOperandCount(opcode), 3);
}
void TranslationArrayBuilder::BeginArgumentsAdaptorFrame(int literal_id,
void TranslationArrayBuilder::BeginInlinedExtraArguments(int literal_id,
unsigned height) {
auto opcode = TranslationOpcode::ARGUMENTS_ADAPTOR_FRAME;
auto opcode = TranslationOpcode::INLINED_EXTRA_ARGUMENTS;
Add(opcode);
Add(literal_id);
Add(height);
......
......@@ -66,7 +66,7 @@ class TranslationArrayBuilder {
void BeginInterpretedFrame(BytecodeOffset bytecode_offset, int literal_id,
unsigned height, int return_value_offset,
int return_value_count);
void BeginArgumentsAdaptorFrame(int literal_id, unsigned height);
void BeginInlinedExtraArguments(int literal_id, unsigned height);
void BeginConstructStubFrame(BytecodeOffset bailout_id, int literal_id,
unsigned height);
void BeginBuiltinContinuationFrame(BytecodeOffset bailout_id, int literal_id,
......
......@@ -12,7 +12,6 @@ namespace internal {
// V(name, operand_count)
#define TRANSLATION_OPCODE_LIST(V) \
V(ARGUMENTS_ADAPTOR_FRAME, 2) \
V(ARGUMENTS_ELEMENTS, 1) \
V(ARGUMENTS_LENGTH, 0) \
V(BEGIN, 3) \
......@@ -26,6 +25,7 @@ namespace internal {
V(DUPLICATED_OBJECT, 1) \
V(FLOAT_REGISTER, 1) \
V(FLOAT_STACK_SLOT, 1) \
V(INLINED_EXTRA_ARGUMENTS, 2) \
V(INT32_REGISTER, 1) \
V(INT32_STACK_SLOT, 1) \
V(INT64_REGISTER, 1) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment