From 4b419c0672f2aef7c689ea73bec1989da8140c70 Mon Sep 17 00:00:00 2001 From: Victor Gomes Date: Thu, 28 Apr 2022 11:54:49 +0200 Subject: [PATCH] [cleanup] Rename TranslatedFrame with inlined arguments ... from ArgumentsAdaptorFrame to InlinedExtraArguments. Change-Id: I772e0546dd50282a4cd14723625fd5bf774f424c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3609968 Reviewed-by: Nico Hartmann Reviewed-by: Toon Verwaest Commit-Queue: Victor Gomes Cr-Commit-Position: refs/heads/main@{#80250} --- src/compiler/backend/code-generator.cc | 4 ++-- src/compiler/backend/instruction-selector.cc | 4 ++-- src/compiler/backend/instruction.cc | 9 ++++---- src/compiler/frame-states.cc | 4 ++-- src/compiler/frame-states.h | 2 +- src/compiler/js-call-reducer.cc | 4 ++-- src/compiler/js-create-lowering.cc | 2 +- src/compiler/js-inlining.cc | 7 +++---- src/deoptimizer/deoptimizer.cc | 22 +++++++++----------- src/deoptimizer/deoptimizer.h | 2 +- src/deoptimizer/translated-state.cc | 16 +++++++------- src/deoptimizer/translated-state.h | 4 ++-- src/deoptimizer/translation-array.cc | 4 ++-- src/deoptimizer/translation-array.h | 2 +- src/deoptimizer/translation-opcode.h | 2 +- 15 files changed, 43 insertions(+), 45 deletions(-) diff --git a/src/compiler/backend/code-generator.cc b/src/compiler/backend/code-generator.cc index f8d2b7643c..eea824ae23 100644 --- a/src/compiler/backend/code-generator.cc +++ b/src/compiler/backend/code-generator.cc @@ -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()); diff --git a/src/compiler/backend/instruction-selector.cc b/src/compiler/backend/instruction-selector.cc index 3b302c8ee7..cacd3d105e 100644 --- a/src/compiler/backend/instruction-selector.cc +++ b/src/compiler/backend/instruction-selector.cc @@ -1085,7 +1085,7 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer, call->InputAt(static_cast(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 = diff --git a/src/compiler/backend/instruction.cc b/src/compiler/backend/instruction.cc index 45d4de79c0..f904a9c20c 100644 --- a/src/compiler/backend/instruction.cc +++ b/src/compiler/backend/instruction.cc @@ -1046,9 +1046,10 @@ size_t GetConservativeFrameSizeInBytes(FrameStateType type, static_cast(parameters_count), static_cast(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: diff --git a/src/compiler/frame-states.cc b/src/compiler/frame-states.cc index 113ec96102..fd9767b7a1 100644 --- a/src/compiler/frame-states.cc +++ b/src/compiler/frame-states.cc @@ -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"; diff --git a/src/compiler/frame-states.h b/src/compiler/frame-states.h index d3319d6034..5b411fa8dd 100644 --- a/src/compiler/frame-states.h +++ b/src/compiler/frame-states.h @@ -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 diff --git a/src/compiler/js-call-reducer.cc b/src/compiler/js-call-reducer.cc index 9a10331a14..e7925e3262 100644 --- a/src/compiler/js-call-reducer.cc +++ b/src/compiler/js-call-reducer.cc @@ -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. diff --git a/src/compiler/js-create-lowering.cc b/src/compiler/js-create-lowering.cc index fab65507ea..68d96aed8a 100644 --- a/src/compiler/js-create-lowering.cc +++ b/src/compiler/js-create-lowering.cc @@ -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; } diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc index 5ee61373cd..a1359e04ec 100644 --- a/src/compiler/js-inlining.cc +++ b/src/compiler/js-inlining.cc @@ -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, diff --git a/src/deoptimizer/deoptimizer.cc b/src/deoptimizer/deoptimizer.cc index 68382da025..1040407384 100644 --- a/src/deoptimizer/deoptimizer.cc +++ b/src/deoptimizer/deoptimizer.cc @@ -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 diff --git a/src/deoptimizer/deoptimizer.h b/src/deoptimizer/deoptimizer.h index ff7ad1ef02..8ad5b19485 100644 --- a/src/deoptimizer/deoptimizer.h +++ b/src/deoptimizer/deoptimizer.h @@ -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); diff --git a/src/deoptimizer/translated-state.cc b/src/deoptimizer/translated-state.cc index c066e94c0b..b045cc14f5 100644 --- a/src/deoptimizer/translated-state.cc +++ b/src/deoptimizer/translated-state.cc @@ -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]); } diff --git a/src/deoptimizer/translated-state.h b/src/deoptimizer/translated-state.h index 6fd2936520..958e99fafd 100644 --- a/src/deoptimizer/translated-state.h +++ b/src/deoptimizer/translated-state.h @@ -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, diff --git a/src/deoptimizer/translation-array.cc b/src/deoptimizer/translation-array.cc index e3d5244c4f..fd34cb1fcd 100644 --- a/src/deoptimizer/translation-array.cc +++ b/src/deoptimizer/translation-array.cc @@ -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); diff --git a/src/deoptimizer/translation-array.h b/src/deoptimizer/translation-array.h index 1634a8a6db..9d7d8f1b6d 100644 --- a/src/deoptimizer/translation-array.h +++ b/src/deoptimizer/translation-array.h @@ -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, diff --git a/src/deoptimizer/translation-opcode.h b/src/deoptimizer/translation-opcode.h index d3032bc726..a51b98c593 100644 --- a/src/deoptimizer/translation-opcode.h +++ b/src/deoptimizer/translation-opcode.h @@ -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) \