Commit cb5c1edc authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[cleanup] Remove unnecessary helper from several Frames

This removes the unnecessary helper GetNumberOfIncomingArguments
from several frames. Clients should use ComputeParametersCount
instead.

Change-Id: I54c261fd6ff0a8a5dc6d1832a0b397429a7ba726
Bug: v8:8757
Reviewed-on: https://chromium-review.googlesource.com/c/1442642Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59192}
parent 6a6c1bfc
......@@ -1009,11 +1009,6 @@ Address StubFrame::GetCallerStackPointer() const {
return fp() + ExitFrameConstants::kCallerSPOffset;
}
int StubFrame::GetNumberOfIncomingArguments() const {
return 0;
}
int StubFrame::LookupExceptionHandlerInTable(int* stack_slots) {
Code code = LookupCode();
DCHECK(code->is_turbofanned());
......@@ -1048,19 +1043,13 @@ bool JavaScriptFrame::HasInlinedFrames() const {
Code JavaScriptFrame::unchecked_code() const { return function()->code(); }
int JavaScriptFrame::GetNumberOfIncomingArguments() const {
DCHECK(can_access_heap_objects() &&
isolate()->heap()->gc_state() == Heap::NOT_IN_GC);
return function()->shared()->internal_formal_parameter_count();
}
int OptimizedFrame::GetNumberOfIncomingArguments() const {
int OptimizedFrame::ComputeParametersCount() const {
Code code = LookupCode();
if (code->kind() == Code::BUILTIN) {
return static_cast<int>(
Memory<intptr_t>(fp() + OptimizedBuiltinFrameConstants::kArgCOffset));
} else {
return JavaScriptFrame::GetNumberOfIncomingArguments();
return JavaScriptFrame::ComputeParametersCount();
}
}
......@@ -1247,7 +1236,9 @@ Object JavaScriptFrame::GetParameter(int index) const {
}
int JavaScriptFrame::ComputeParametersCount() const {
return GetNumberOfIncomingArguments();
DCHECK(can_access_heap_objects() &&
isolate()->heap()->gc_state() == Heap::NOT_IN_GC);
return function()->shared()->internal_formal_parameter_count();
}
int JavaScriptBuiltinContinuationFrame::ComputeParametersCount() const {
......@@ -1757,7 +1748,7 @@ void InterpretedFrame::Summarize(std::vector<FrameSummary>* functions) const {
functions->push_back(summary);
}
int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const {
int ArgumentsAdaptorFrame::ComputeParametersCount() const {
return Smi::ToInt(GetExpression(0));
}
......@@ -1766,7 +1757,7 @@ Code ArgumentsAdaptorFrame::unchecked_code() const {
Builtins::kArgumentsAdaptorTrampoline);
}
int BuiltinFrame::GetNumberOfIncomingArguments() const {
int BuiltinFrame::ComputeParametersCount() const {
return Smi::ToInt(GetExpression(0));
}
......
......@@ -759,8 +759,6 @@ class JavaScriptFrame : public StandardFrame {
Address GetCallerStackPointer() const override;
virtual int GetNumberOfIncomingArguments() const;
virtual void PrintFrameKind(StringStream* accumulator) const {}
private:
......@@ -791,8 +789,6 @@ class StubFrame : public StandardFrame {
Address GetCallerStackPointer() const override;
virtual int GetNumberOfIncomingArguments() const;
friend class StackFrameIteratorBase;
};
......@@ -818,13 +814,13 @@ class OptimizedFrame : public JavaScriptFrame {
DeoptimizationData GetDeoptimizationData(int* deopt_index) const;
Object receiver() const override;
int ComputeParametersCount() const override;
static int StackSlotOffsetRelativeToFp(int slot_index);
protected:
inline explicit OptimizedFrame(StackFrameIteratorBase* iterator);
int GetNumberOfIncomingArguments() const override;
private:
friend class StackFrameIteratorBase;
......@@ -897,6 +893,8 @@ class ArgumentsAdaptorFrame: public JavaScriptFrame {
return static_cast<ArgumentsAdaptorFrame*>(frame);
}
int ComputeParametersCount() const override;
// Printing support.
void Print(StringStream* accumulator, PrintMode mode,
int index) const override;
......@@ -904,7 +902,6 @@ class ArgumentsAdaptorFrame: public JavaScriptFrame {
protected:
inline explicit ArgumentsAdaptorFrame(StackFrameIteratorBase* iterator);
int GetNumberOfIncomingArguments() const override;
private:
friend class StackFrameIteratorBase;
......@@ -920,11 +917,11 @@ class BuiltinFrame final : public JavaScriptFrame {
DCHECK(frame->is_builtin());
return static_cast<BuiltinFrame*>(frame);
}
int ComputeParametersCount() const final;
protected:
inline explicit BuiltinFrame(StackFrameIteratorBase* iterator);
int GetNumberOfIncomingArguments() const final;
void PrintFrameKind(StringStream* accumulator) const override;
private:
......
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