Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qv4argumentsobject_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4#ifndef QV4ARGUMENTSOBJECTS_H
5#define QV4ARGUMENTSOBJECTS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qv4object_p.h"
19
21
22namespace QV4 {
23
24namespace Heap {
25
26#define ArgumentsObjectMembers(class, Member)
27 Member(class, Pointer, CallContext *, context)
28 Member(class, NoMark, bool, fullyCreated)
29 Member(class, NoMark, uint, argCount)
30 Member(class, NoMark, quint64, mapped)
31
32DECLARE_HEAP_OBJECT(ArgumentsObject, Object) {
33 DECLARE_MARKOBJECTS(ArgumentsObject)
34 enum {
35 LengthPropertyIndex = 0,
36 SymbolIteratorPropertyIndex = 1,
37 CalleePropertyIndex = 2
38 };
39 void init(CppStackFrame *frame);
40};
41
42#define StrictArgumentsObjectMembers(class, Member)
43
45 enum {
46 LengthPropertyIndex = 0,
47 SymbolIteratorPropertyIndex = 1,
48 CalleePropertyIndex = 2,
49 CalleeSetterPropertyIndex = 3
50 };
51 void init(JSTypesStackFrame *frame);
52};
53
54}
55
57 V4_OBJECT2(ArgumentsObject, Object)
59
60 Heap::CallContext *context() const { return d()->context; }
61 bool fullyCreated() const { return d()->fullyCreated; }
62
63 static bool isNonStrictArgumentsObject(Managed *m) {
64 return m->vtable() == staticVTable();
65 }
66
67 static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *desc, PropertyAttributes attrs);
68 static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
69 static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
70 static bool virtualDeleteProperty(Managed *m, PropertyKey id);
71 static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p);
72 static qint64 virtualGetLength(const Managed *m);
73 static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m, Value *target);
74
75 void fullyCreate();
76
77 // There's a slight hack here, as this limits the amount of mapped arguments to 64, but that should be
78 // more than enough for all practical uses of arguments
79 bool isMapped(uint arg) const {
80 return arg < 64 && (d()->mapped & (1ull << arg));
81 }
82
83 void removeMapping(uint arg) {
84 if (arg < 64)
85 (d()->mapped &= ~(1ull << arg));
86 }
87
88};
89
94
95}
96
97QT_END_NAMESPACE
98
99#endif
DECLARE_HEAP_OBJECT(StrictArgumentsObject, Object)
DECLARE_HEAP_OBJECT(ArgumentsObject, Object)
Definition qjsvalue.h:23
DEFINE_OBJECT_VTABLE(StrictArgumentsObject)
DEFINE_OBJECT_VTABLE(ArgumentsObject)
#define Q_MANAGED_TYPE(type)
static qint64 virtualGetLength(const Managed *m)
static bool virtualDefineOwnProperty(Managed *m, PropertyKey id, const Property *desc, PropertyAttributes attrs)
Heap::CallContext * context() const
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty)
static OwnPropertyKeyIterator * virtualOwnPropertyKeys(const Object *m, Value *target)
static bool isNonStrictArgumentsObject(Managed *m)
static bool virtualDeleteProperty(Managed *m, PropertyKey id)
static PropertyAttributes virtualGetOwnProperty(const Managed *m, PropertyKey id, Property *p)
bool isMapped(uint arg) const
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver)