From 36d1d046470dec970fd7a19be2f77dc83526ffb3 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 13 Jul 2018 12:18:52 +0200 Subject: Add LastOffset/OffsetCount constants to CallData::Offsets For use by code that needs to iterate over the stack slots occupied by the CallData (like a JIT). Also add more checks to verify that the offsets correspond with the actual member field layout in memory. Change-Id: Iedae11a9d7602286b10910b22c9bf0eedc23b411 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4stackframe_p.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/qml/jsruntime/qv4stackframe_p.h b/src/qml/jsruntime/qv4stackframe_p.h index 4966a5637d..aa507d61a6 100644 --- a/src/qml/jsruntime/qv4stackframe_p.h +++ b/src/qml/jsruntime/qv4stackframe_p.h @@ -57,7 +57,10 @@ struct CallData Accumulator = 2, This = 3, NewTarget = 4, - Argc = 5 + Argc = 5, + + LastOffset = Argc, + OffsetCount = LastOffset + 1 }; Value function; @@ -87,8 +90,13 @@ struct CallData }; Q_STATIC_ASSERT(std::is_standard_layout::value); -Q_STATIC_ASSERT(offsetof(CallData, thisObject) == CallData::This*sizeof(Value)); -Q_STATIC_ASSERT(offsetof(CallData, args) == 6*sizeof(Value)); +Q_STATIC_ASSERT(offsetof(CallData, function ) == CallData::Function * sizeof(Value)); +Q_STATIC_ASSERT(offsetof(CallData, context ) == CallData::Context * sizeof(Value)); +Q_STATIC_ASSERT(offsetof(CallData, accumulator) == CallData::Accumulator * sizeof(Value)); +Q_STATIC_ASSERT(offsetof(CallData, thisObject ) == CallData::This * sizeof(Value)); +Q_STATIC_ASSERT(offsetof(CallData, newTarget ) == CallData::NewTarget * sizeof(Value)); +Q_STATIC_ASSERT(offsetof(CallData, _argc ) == CallData::Argc * sizeof(Value)); +Q_STATIC_ASSERT(offsetof(CallData, args ) == 6 * sizeof(Value)); struct Q_QML_EXPORT CppStackFrame { EngineBase *engine; -- cgit v1.2.3