Commit d4843937 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

Revert "[cleanup] Create virtual FrameWithJSLinkages"

This reverts commit 5afa3add.

Reason for revert: Seems to break CFI, see https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20-%20cfi/26994

Original change's description:
> [cleanup] Create virtual FrameWithJSLinkages
>
> - CommonFrameWithJSLinkage
> - TypedFrameWithJSLinkage
>
> Change-Id: Ib70967c6b8bc9129d7562ec5587076e66312ca25
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2480562
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#70609}

TBR=ishell@chromium.org,victorgomes@chromium.org

Change-Id: I5d3a16a3010e41896448cb9462d7cc2a0813ca63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2484705Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70612}
parent 3082bf8b
......@@ -97,14 +97,6 @@ inline Address* StackFrame::ResolveReturnAddressLocation(Address* pc_address) {
inline TypedFrame::TypedFrame(StackFrameIteratorBase* iterator)
: CommonFrame(iterator) {}
inline CommonFrameWithJSLinkage::CommonFrameWithJSLinkage(
StackFrameIteratorBase* iterator)
: CommonFrame(iterator) {}
inline TypedFrameWithJSLinkage::TypedFrameWithJSLinkage(
StackFrameIteratorBase* iterator)
: CommonFrameWithJSLinkage(iterator) {}
inline NativeFrame::NativeFrame(StackFrameIteratorBase* iterator)
: TypedFrame(iterator) {}
......@@ -183,16 +175,16 @@ inline bool CommonFrame::IsArgumentsAdaptorFrame(Address fp) {
return frame_type == StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR);
}
inline bool CommonFrameWithJSLinkage::IsConstructFrame(Address fp) {
inline bool CommonFrame::IsConstructFrame(Address fp) {
intptr_t frame_type =
base::Memory<intptr_t>(fp + TypedFrameConstants::kFrameTypeOffset);
return frame_type == StackFrame::TypeToMarker(StackFrame::CONSTRUCT);
}
inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator)
: CommonFrameWithJSLinkage(iterator) {}
: CommonFrame(iterator) {}
Address CommonFrameWithJSLinkage::GetParameterSlot(int index) const {
Address JavaScriptFrame::GetParameterSlot(int index) const {
DCHECK_LE(-1, index);
#ifdef V8_NO_ARGUMENTS_ADAPTOR
DCHECK_LT(index,
......@@ -205,12 +197,6 @@ Address CommonFrameWithJSLinkage::GetParameterSlot(int index) const {
return caller_sp() + parameter_offset;
}
#ifdef V8_NO_ARGUMENTS_ADAPTOR
inline int CommonFrameWithJSLinkage::GetActualArgumentCount() const {
return 0;
}
#endif
inline void JavaScriptFrame::set_receiver(Object value) {
base::Memory<Address>(GetParameterSlot(-1)) = value.ptr();
}
......@@ -240,7 +226,7 @@ inline ArgumentsAdaptorFrame::ArgumentsAdaptorFrame(
}
inline BuiltinFrame::BuiltinFrame(StackFrameIteratorBase* iterator)
: TypedFrameWithJSLinkage(iterator) {}
: TypedFrame(iterator) {}
inline WasmFrame::WasmFrame(StackFrameIteratorBase* iterator)
: TypedFrame(iterator) {}
......@@ -278,7 +264,7 @@ inline BuiltinContinuationFrame::BuiltinContinuationFrame(
inline JavaScriptBuiltinContinuationFrame::JavaScriptBuiltinContinuationFrame(
StackFrameIteratorBase* iterator)
: TypedFrameWithJSLinkage(iterator) {}
: JavaScriptFrame(iterator) {}
inline JavaScriptBuiltinContinuationWithCatchFrame::
JavaScriptBuiltinContinuationWithCatchFrame(
......
......@@ -156,13 +156,6 @@ StackFrame* StackFrameIteratorBase::SingletonFor(StackFrame::Type type) {
// -------------------------------------------------------------------------
void TypedFrameWithJSLinkage::Iterate(RootVisitor* v) const {
IterateExpressions(v);
IteratePc(v, pc_address(), constant_pool_address(), LookupCode());
}
// -------------------------------------------------------------------------
void JavaScriptFrameIterator::Advance() {
do {
iterator_.Advance();
......@@ -1097,9 +1090,7 @@ bool JavaScriptFrame::HasInlinedFrames() const {
return functions.size() > 1;
}
Code CommonFrameWithJSLinkage::unchecked_code() const {
return function().code();
}
Code JavaScriptFrame::unchecked_code() const { return function().code(); }
int OptimizedFrame::ComputeParametersCount() const {
Code code = LookupCode();
......@@ -1132,12 +1123,7 @@ void JavaScriptFrame::GetFunctions(
}
}
bool CommonFrameWithJSLinkage::IsConstructor() const {
return IsConstructFrame(caller_fp());
}
void CommonFrameWithJSLinkage::Summarize(
std::vector<FrameSummary>* functions) const {
void JavaScriptFrame::Summarize(std::vector<FrameSummary>* functions) const {
DCHECK(functions->empty());
Code code = LookupCode();
int offset = static_cast<int>(pc() - code.InstructionStart());
......@@ -1162,7 +1148,7 @@ Object JavaScriptFrame::unchecked_function() const {
return function_slot_object();
}
Object CommonFrameWithJSLinkage::receiver() const { return GetParameter(-1); }
Object JavaScriptFrame::receiver() const { return GetParameter(-1); }
Object JavaScriptFrame::context() const {
const int offset = StandardFrameConstants::kContextOffset;
......@@ -1175,7 +1161,7 @@ Script JavaScriptFrame::script() const {
return Script::cast(function().shared().script());
}
int CommonFrameWithJSLinkage::LookupExceptionHandlerInTable(
int JavaScriptFrame::LookupExceptionHandlerInTable(
int* stack_depth, HandlerTable::CatchPrediction* prediction) {
DCHECK(!LookupCode().has_handler_table());
DCHECK(!LookupCode().is_optimized_code());
......@@ -1270,11 +1256,11 @@ void JavaScriptFrame::CollectFunctionAndOffsetForICStats(JSFunction function,
}
}
Object CommonFrameWithJSLinkage::GetParameter(int index) const {
Object JavaScriptFrame::GetParameter(int index) const {
return Object(Memory<Address>(GetParameterSlot(index)));
}
int CommonFrameWithJSLinkage::ComputeParametersCount() const {
int JavaScriptFrame::ComputeParametersCount() const {
DCHECK(can_access_heap_objects() &&
isolate()->heap()->gc_state() == Heap::NOT_IN_GC);
return function().shared().internal_formal_parameter_count();
......@@ -1287,7 +1273,7 @@ int JavaScriptFrame::GetActualArgumentCount() const {
}
#endif
Handle<FixedArray> CommonFrameWithJSLinkage::GetParameters() const {
Handle<FixedArray> JavaScriptFrame::GetParameters() const {
if (V8_LIKELY(!FLAG_detailed_error_stack_trace)) {
return isolate()->factory()->empty_fixed_array();
}
......@@ -1301,11 +1287,6 @@ Handle<FixedArray> CommonFrameWithJSLinkage::GetParameters() const {
return parameters;
}
JSFunction JavaScriptBuiltinContinuationFrame::function() const {
const int offset = BuiltinContinuationFrameConstants::kFunctionOffset;
return JSFunction::cast(Object(base::Memory<Address>(fp() + offset)));
}
int JavaScriptBuiltinContinuationFrame::ComputeParametersCount() const {
// Assert that the first allocatable register is also the argument count
// register.
......@@ -1789,11 +1770,6 @@ Code ArgumentsAdaptorFrame::unchecked_code() const {
return isolate()->builtins()->builtin(Builtins::kArgumentsAdaptorTrampoline);
}
JSFunction BuiltinFrame::function() const {
const int offset = BuiltinFrameConstants::kFunctionOffset;
return JSFunction::cast(Object(base::Memory<Address>(fp() + offset)));
}
int BuiltinFrame::ComputeParametersCount() const {
const int offset = BuiltinFrameConstants::kLengthOffset;
return Smi::ToInt(Object(base::Memory<Address>(fp() + offset)));
......
......@@ -14,15 +14,12 @@
//
// Frame inheritance hierarchy (please keep in sync with frame-constants.h):
// - CommonFrame
// - CommonFrameWithJSLinkage
// - JavaScriptFrame (aka StandardFrame)
// - InterpretedFrame
// - OptimizedFrame
// - ArgumentsAdaptorFrame (technically a TypedFrame)
// - TypedFrameWithJSLinkage
// - BuiltinFrame
// - JavaScriptBuiltinContinuationFrame
// - JavaScriptBuiltinContinuationWithCatchFrame
// - JavaScriptFrame (aka StandardFrame)
// - InterpretedFrame
// - OptimizedFrame
// - ArgumentsAdaptorFrame (technically a TypedFrame)
// - JavaScriptBuiltinContinuationFrame (*)
// - JavaScriptBuiltinContinuationWithCatchFrame
// - TypedFrame
// - NativeFrame
// - EntryFrame
......@@ -32,6 +29,7 @@
// - StubFrame
// - JsToWasmFrame
// - CWasmEntryFrame
// - BuiltinFrame
// - Internal
// - ConstructFrame
// - BuiltinContinuationFrame
......@@ -40,6 +38,11 @@
// - WasmDebugBreakFrame
// - WasmCompileLazyFrame
//
// (*) This is actually a BuiltinContinuationFrame with JS arguments.
//
// TODO(victorgomes): Create a class to access JS arguments and change
// BuiltinContinuationFrame to be of type TypedFrame.
namespace v8 {
namespace internal {
......@@ -466,8 +469,7 @@ class V8_EXPORT_PRIVATE FrameSummary {
class CommonFrame : public StackFrame {
public:
// Accessors.
virtual Object context()
const; // TODO(victorgomes): CommonFrames don't have context.
virtual Object context() const;
virtual int position() const;
// Access the expressions in the stack frame including locals.
......@@ -515,6 +517,10 @@ class CommonFrame : public StackFrame {
// an arguments adaptor frame.
static inline bool IsArgumentsAdaptorFrame(Address fp);
// Determines if the standard frame for the given frame pointer is a
// construct frame.
static inline bool IsConstructFrame(Address fp);
// Used by OptimizedFrames and StubFrames.
void IterateCompiledFrame(RootVisitor* v) const;
......@@ -532,74 +538,35 @@ class TypedFrame : public CommonFrame {
inline explicit TypedFrame(StackFrameIteratorBase* iterator);
};
class CommonFrameWithJSLinkage : public CommonFrame {
class JavaScriptFrame : public CommonFrame {
public:
// Accessors.
virtual JSFunction function() const = 0;
// Access the parameters.
virtual Object receiver() const;
virtual Object GetParameter(int index) const;
virtual int ComputeParametersCount() const;
Handle<FixedArray> GetParameters() const;
#ifdef V8_NO_ARGUMENTS_ADAPTOR
virtual int GetActualArgumentCount() const;
#endif
// Determine the code for the frame.
Code unchecked_code() const override;
// Lookup exception handler for current {pc}, returns -1 if none found. Also
// returns data associated with the handler site specific to the frame type:
// - OptimizedFrame : Data is not used and will not return a value.
// - InterpretedFrame: Data is the register index holding the context.
virtual int LookupExceptionHandlerInTable(
int* data, HandlerTable::CatchPrediction* prediction);
// Check if this frame is a constructor frame invoked through 'new'.
virtual bool IsConstructor() const;
Type type() const override = 0;
// Summarize Frame
void Summarize(std::vector<FrameSummary>* frames) const override;
protected:
inline explicit CommonFrameWithJSLinkage(StackFrameIteratorBase* iterator);
// Determines if the standard frame for the given frame pointer is a
// construct frame.
static inline bool IsConstructFrame(Address fp);
inline Address GetParameterSlot(int index) const;
};
class TypedFrameWithJSLinkage : public CommonFrameWithJSLinkage {
public:
void Iterate(RootVisitor* v) const override;
protected:
inline explicit TypedFrameWithJSLinkage(StackFrameIteratorBase* iterator);
};
class JavaScriptFrame : public CommonFrameWithJSLinkage {
public:
Type type() const override = 0;
// Accessors.
JSFunction function() const override;
virtual JSFunction function() const;
Object unchecked_function() const;
Script script() const;
Object receiver() const;
Object context() const override;
Script script() const;
inline void set_receiver(Object value);
// Access the parameters.
inline Address GetParameterSlot(int index) const;
Object GetParameter(int index) const;
virtual int ComputeParametersCount() const;
#ifdef V8_NO_ARGUMENTS_ADAPTOR
int GetActualArgumentCount() const override;
int GetActualArgumentCount() const;
#endif
inline void set_receiver(Object value);
Handle<FixedArray> GetParameters() const;
// Debugger access.
void SetParameterValue(int index, Object value) const;
// Check if this frame is a constructor frame invoked through 'new'.
bool IsConstructor() const override;
bool IsConstructor() const;
// Determines whether this frame includes inlined activations. To get details
// about the inlined frames use {GetFunctions} and {Summarize}.
......@@ -617,11 +584,21 @@ class JavaScriptFrame : public CommonFrameWithJSLinkage {
void Print(StringStream* accumulator, PrintMode mode,
int index) const override;
// Determine the code for the frame.
Code unchecked_code() const override;
// Return a list with {SharedFunctionInfo} objects of this frame.
virtual void GetFunctions(std::vector<SharedFunctionInfo>* functions) const;
void GetFunctions(std::vector<Handle<SharedFunctionInfo>>* functions) const;
// Lookup exception handler for current {pc}, returns -1 if none found. Also
// returns data associated with the handler site specific to the frame type:
// - OptimizedFrame : Data is not used and will not return a value.
// - InterpretedFrame: Data is the register index holding the context.
virtual int LookupExceptionHandlerInTable(
int* data, HandlerTable::CatchPrediction* prediction);
// Architecture-specific register description.
static Register fp_register();
static Register context_register();
......@@ -918,7 +895,7 @@ class ArgumentsAdaptorFrame : public JavaScriptFrame {
// Builtin frames are built for builtins with JavaScript linkage, such as
// various standard library functions (i.e. Math.asin, Math.floor, etc.).
class BuiltinFrame final : public TypedFrameWithJSLinkage {
class BuiltinFrame final : public TypedFrame {
public:
Type type() const final { return BUILTIN; }
......@@ -926,9 +903,7 @@ class BuiltinFrame final : public TypedFrameWithJSLinkage {
DCHECK(frame->is_builtin());
return static_cast<BuiltinFrame*>(frame);
}
JSFunction function() const override;
int ComputeParametersCount() const override;
int ComputeParametersCount() const;
protected:
inline explicit BuiltinFrame(StackFrameIteratorBase* iterator);
......@@ -1128,7 +1103,7 @@ class BuiltinContinuationFrame : public InternalFrame {
friend class StackFrameIteratorBase;
};
class JavaScriptBuiltinContinuationFrame : public TypedFrameWithJSLinkage {
class JavaScriptBuiltinContinuationFrame : public JavaScriptFrame {
public:
Type type() const override { return JAVA_SCRIPT_BUILTIN_CONTINUATION; }
......@@ -1137,7 +1112,6 @@ class JavaScriptBuiltinContinuationFrame : public TypedFrameWithJSLinkage {
return static_cast<JavaScriptBuiltinContinuationFrame*>(frame);
}
JSFunction function() const override;
int ComputeParametersCount() const override;
intptr_t GetSPToFPDelta() const;
......
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