8#include <private/qv4mm_p.h>
25 size_t requiredMemory =
sizeof(CallContext::Data) -
sizeof(
Value) +
sizeof(
Value) * nLocals;
30 c->
type = Heap::ExecutionContext::Type_BlockContext;
32 Heap::ExecutionContext *outer =
static_cast<Heap::ExecutionContext *
>(
frame->context()->m());
33 c->outer.set(v4, outer);
34 if (
frame->isJSTypesFrame()) {
35 c->function.set(v4,
static_cast<Heap::FunctionObject *
>(
39 c->function.set(v4,
nullptr);
42 c->locals.size = nLocals;
43 c->locals.alloc = nLocals;
45 c->setupLocalTemporalDeadZone(
function->executableCompilationUnit()->unitData()->blockAt(blockIndex));
51 Heap::CallContext *callContext)
53 uint nLocals = callContext->locals.alloc;
54 size_t requiredMemory =
sizeof(CallContext::Data) -
sizeof(
Value) +
sizeof(
Value) * nLocals;
57 requiredMemory, callContext->internalClass);
58 memcpy(
c, callContext, requiredMemory);
66 Heap::ExecutionContext *outer =
static_cast<Heap::ExecutionContext *
>(
frame->context()->m());
69 uint localsAndFormals =
function->compiledFunction->nLocals + nFormals;
70 size_t requiredMemory =
sizeof(CallContext::Data) -
sizeof(
Value) +
sizeof(
Value) * (localsAndFormals);
76 c->outer.set(v4, outer);
77 c->function.set(v4,
static_cast<Heap::FunctionObject *
>(
82 c->locals.size = nLocals;
83 c->locals.alloc = localsAndFormals;
87 c->setupLocalTemporalDeadZone(compiledFunction);
102 c->activation.set(
engine(), with);
125 switch (
ctx->d()->type) {
126 case Heap::ExecutionContext::Type_CallContext:
128 Heap::CallContext *
c =
static_cast<Heap::CallContext *
>(
ctx->d());
131 activation =
c->activation;
134 case Heap::ExecutionContext::Type_QmlContext: {
137 activation =
ctx->d()->activation;
140 case Heap::ExecutionContext::Type_GlobalContext: {
143 activation =
ctx->d()->activation;
146 case Heap::ExecutionContext::Type_BlockContext:
159 attrs.setConfigurable(deletable);
160 if (!activation->defineOwnProperty(
id,
desc,
attrs))
182 Heap::ExecutionContext *
ctx =
d();
187 case Heap::ExecutionContext::Type_BlockContext:
188 case Heap::ExecutionContext::Type_CallContext: {
189 Heap::CallContext *
c =
static_cast<Heap::CallContext *
>(
ctx);
190 uint index =
c->internalClass->indexOfValueOrGetter(
id);
191 if (
index < UINT_MAX)
196 case Heap::ExecutionContext::Type_WithContext: {
197 if (
ctx->activation) {
200 if (
object &&
object->hasProperty(
id)) {
206 return object->deleteProperty(
id);
211 case Heap::ExecutionContext::Type_GlobalContext: {
212 if (
ctx->activation) {
215 if (
object &&
object->hasProperty(
id))
216 return object->deleteProperty(
id);
220 case Heap::ExecutionContext::Type_QmlContext:
233 Heap::ExecutionContext *
ctx =
d();
238 case Heap::ExecutionContext::Type_WithContext: {
241 if (
w->hasProperty(
id)) {
253 case Heap::ExecutionContext::Type_BlockContext:
254 case Heap::ExecutionContext::Type_CallContext: {
255 Heap::CallContext *
c =
static_cast<Heap::CallContext *
>(
ctx);
256 uint index =
c->internalClass->indexOfValueOrGetter(
id);
257 if (
index < UINT_MAX) {
263 case Heap::ExecutionContext::Type_GlobalContext:
264 if (
ctx->activation) {
265 auto member =
ctx->activation->internalClass->findValueOrSetter(
id);
266 if (member.index < UINT_MAX) {
269 if (!
a->putValue(member.index, member.attrs,
value))
275 case Heap::ExecutionContext::Type_QmlContext: {
293 Heap::ExecutionContext *
ctx =
d();
298 case Heap::ExecutionContext::Type_BlockContext:
299 case Heap::ExecutionContext::Type_CallContext: {
300 Heap::CallContext *
c =
static_cast<Heap::CallContext *
>(
ctx);
302 uint index =
c->internalClass->indexOfValueOrGetter(
id);
303 if (
index < UINT_MAX)
304 return c->locals[
index].asReturnedValue();
307 case Heap::ExecutionContext::Type_WithContext:
308 if (
ctx->activation) {
311 if (activation->hasProperty(
id)) {
317 return activation->get(
id);
321 case Heap::ExecutionContext::Type_GlobalContext:
322 case Heap::ExecutionContext::Type_QmlContext: {
323 if (
ctx->activation) {
326 bool hasProperty =
false;
343 Heap::ExecutionContext *
ctx =
d();
348 case Heap::ExecutionContext::Type_BlockContext:
349 case Heap::ExecutionContext::Type_CallContext: {
350 Heap::CallContext *
c =
static_cast<Heap::CallContext *
>(
ctx);
352 uint index =
c->internalClass->indexOfValueOrGetter(
id);
353 if (
index < UINT_MAX)
354 return c->locals[
index].asReturnedValue();
357 case Heap::ExecutionContext::Type_GlobalContext: {
358 if (
ctx->activation) {
361 bool hasProperty =
false;
368 case Heap::ExecutionContext::Type_WithContext:
369 if (
ctx->activation) {
372 if (activation->hasProperty(
id)) {
378 base->setM(activation->d());
379 return activation->get(
id);
383 case Heap::ExecutionContext::Type_QmlContext: {
386 bool hasProperty =
false;
401 locals.set(internalClass->engine, locals.size +
index,
v);
ManagedType::Data * allocManaged(std::size_t size, Heap::InternalClass *ic)
ManagedType::Data * alloc(Args &&... args)
\qmltype Particle \inqmlmodule QtQuick.Particles
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
static struct AttrInfo attrs[]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
static bool unscopable(ExecutionEngine *engine, Heap::Object *withObject, PropertyKey id)
#define DEFINE_MANAGED_VTABLE(classname)
static constexpr ReturnedValue undefined()
MemoryManager * memoryManager
CppStackFrame * currentStackFrame
static Heap::ExecutionContext * newCatchContext(CppStackFrame *frame, int blockIndex, Heap::String *exceptionVarName)
static Heap::CallContext * cloneBlockContext(ExecutionEngine *engine, Heap::CallContext *callContext)
bool deleteProperty(String *name)
ReturnedValue getProperty(String *name)
Heap::ExecutionContext * newWithContext(Heap::Object *with) const
static Heap::CallContext * newBlockContext(QV4::CppStackFrame *frame, int blockIndex)
Error setProperty(String *name, const Value &value)
void createMutableBinding(String *name, bool deletable)
ReturnedValue getPropertyAndBase(String *name, Value *base)
static Heap::CallContext * newCallContext(JSTypesStackFrame *frame)
ReturnedValue throwReferenceError(const Value &value)
Heap::Object * newObject()
ReturnedValue catchException(StackTrace *trace=nullptr)
Symbol * symbol_unscopables() const
ReturnedValue throwTypeError()
ExecutionEngine * engine() const
constexpr ReturnedValue asReturnedValue() const
static constexpr Value fromStaticValue(StaticValue staticValue)
static constexpr Value undefinedValue()