8#include <private/qv4mm_p.h>
13#include <private/qqmljsengine_p.h>
14#include <private/qqmljslexer_p.h>
15#include <private/qqmljsparser_p.h>
16#include <private/qqmljsast_p.h>
17#include <private/qqmljavascriptexpression_p.h>
18#include <private/qqmlengine_p.h>
19#include <qv4runtimecodegen_p.h>
20#include "private/qlocale_tools_p.h"
21#include "private/qqmlbuiltinfunctions_p.h"
22#include <private/qv4jscall_p.h>
23#include <private/qv4vme_moth_p.h>
24#include <private/qv4alloca_p.h>
26#include <QtCore/QDebug>
34void Heap::FunctionObject::init(QV4::ExecutionEngine *engine, QV4::String *name)
38 ScopedFunctionObject f(s,
this);
43void Heap::FunctionObject::init(QV4::ExecutionEngine *engine,
const QString &name)
45 Scope valueScope(engine);
46 ScopedString s(valueScope, engine->newString(name));
50void Heap::FunctionObject::init()
52 init(internalClass->engine,
static_cast<QV4::String *>(
nullptr));
55void Heap::JavaScriptFunctionObject::init(
56 QV4::ExecutionContext *scope, Function *function, QV4::String *n)
58 Q_ASSERT(n || function);
59 Scope s(scope->engine());
60 ScopedString name(s, n ? n->d() : function->name());
61 FunctionObject::init(s.engine, name);
62 this->scope.set(s.engine, scope->d());
63 setFunction(function);
66void Heap::JavaScriptFunctionObject::setFunction(Function *f)
70 function->executableCompilationUnit()->addref();
73void Heap::JavaScriptFunctionObject::destroy()
76 function->executableCompilationUnit()->release();
77 FunctionObject::destroy();
80void Heap::DynamicFunctionObject::init(
81 QV4::ExecutionEngine *engine, QV4::String *name, VTable::Call call)
83 FunctionObject::init(engine, name);
87void FunctionObject::createDefaultPrototypeProperty(uint protoConstructorSlot)
91 Q_ASSERT(s.engine->internalClasses(EngineBase::Class_ObjectProto)->verifyIndex(s.engine->id_constructor()->propertyKey(), protoConstructorSlot));
93 ScopedObject proto(s, s.engine->newObject(s.engine->internalClasses(EngineBase::Class_ObjectProto)));
94 proto->setProperty(protoConstructorSlot, d());
95 defineDefaultProperty(s.engine->id_prototype(), proto, Attr_NotEnumerable|Attr_NotConfigurable);
98ReturnedValue FunctionObject::name()
const
100 return get(engine()->id_name());
103ReturnedValue FunctionObject::failCall()
const
105 return engine()->throwTypeError(QStringLiteral(
"Function can only be called with |new|."));
108ReturnedValue FunctionObject::failCallAsConstructor()
const
110 return engine()->throwTypeError(QStringLiteral(
"Function is not a constructor."));
113void FunctionObject::virtualConvertAndCall(
114 const FunctionObject *f, QObject *thisObject,
115 void **argv,
const QMetaType *types,
int argc)
117 QV4::convertAndCall(f->engine(), thisObject, argv, types, argc,
118 [f](
const Value *thisObject,
const Value *argv,
int argc) {
119 return f->call(thisObject, argv, argc);
123Heap::FunctionObject *FunctionObject::createScriptFunction(ExecutionContext *scope, Function *function)
125 if (function->isArrowFunction())
126 return scope->engine()->memoryManager->allocate<ArrowFunction>(scope, function);
127 return scope->engine()->memoryManager->allocate<ScriptFunction>(scope, function);
130Heap::FunctionObject *FunctionObject::createConstructorFunction(
131 ExecutionContext *scope, Function *function, Object *homeObject,
bool isDerivedConstructor)
133 QV4::ExecutionEngine *engine = scope->engine();
135 Heap::DefaultClassConstructorFunction *c
136 = engine->memoryManager->allocate<DefaultClassConstructorFunction>(scope);
137 c->isDerivedConstructor = isDerivedConstructor;
141 Heap::ConstructorFunction *c
142 = engine->memoryManager->allocate<ConstructorFunction>(scope, function);
143 c->homeObject.set(engine, homeObject->d());
144 c->isDerivedConstructor = isDerivedConstructor;
148Heap::FunctionObject *FunctionObject::createMemberFunction(ExecutionContext *scope, Function *function, Object *homeObject, QV4::String *name)
150 Heap::MemberFunction *m = scope->engine()->memoryManager->allocate<MemberFunction>(scope, function, name);
151 m->homeObject.set(scope->engine(), homeObject->d());
155Heap::FunctionObject *FunctionObject::createBuiltinFunction(ExecutionEngine *engine, StringOrSymbol *nameOrSymbol, VTable::Call code,
int argumentCount)
158 ScopedString name(scope, nameOrSymbol);
160 name = engine->newString(QChar::fromLatin1(
'[') + QStringView{nameOrSymbol->toQString()}.mid(1) + QChar::fromLatin1(
']'));
162 ScopedFunctionObject function(
163 scope, engine->memoryManager->allocate<DynamicFunctionObject>(engine, name, code));
164 function->defineReadonlyConfigurableProperty(engine->id_length(), Value::fromInt32(argumentCount));
165 return function->d();
168ReturnedValue FunctionObject::getHomeObject()
const
170 const MemberFunction *m = as<MemberFunction>();
172 return m->d()->homeObject->asReturnedValue();
173 const ConstructorFunction *c = as<ConstructorFunction>();
175 return c->d()->homeObject->asReturnedValue();
176 return Encode::undefined();
181QQmlSourceLocation JavaScriptFunctionObject::sourceLocation()
const
183 return d()->function->sourceLocation();
188ReturnedValue DynamicFunctionObject::virtualCall(
189 const FunctionObject *f,
const Value *thisObject,
const Value *argv,
int argc) {
190 Heap::DynamicFunctionObject *d =
static_cast<
const DynamicFunctionObject *>(f)->d();
192 return d->jsCall(f, thisObject, argv, argc);
193 return d->internalClass->engine->throwTypeError(
194 QStringLiteral(
"Function can only be called with |new|."));
199void Heap::FunctionCtor::init(QV4::ExecutionEngine *engine)
201 Heap::FunctionObject::init(engine, QStringLiteral(
"Function"));
205QQmlRefPointer<ExecutableCompilationUnit>
FunctionCtor::parse(ExecutionEngine *engine,
const Value *argv,
int argc,
Type t)
210 for (
int i = 0, ei = argc - 1; i < ei; ++i) {
212 arguments += QLatin1String(
", ");
213 arguments += argv[i].toQString();
215 body = argv[argc - 1].toQString();
217 if (engine->hasException)
220 QString function = (t == Type_Function ? QLatin1String(
"function anonymous(") : QLatin1String(
"function* anonymous(")) + arguments + QLatin1String(
"\n){") + body + QLatin1String(
"\n}");
223 const QQmlJS::Parser::Result parsed =
224 QQmlJS::Parser::parseCode(&ee, function, QQmlJS::Parser::Goal::Expression);
226 if (!parsed.success) {
227 engine->throwSyntaxError(QLatin1String(
"Parse error"));
231 QQmlJS::AST::FunctionExpression *fe =
232 QQmlJS::AST::cast<QQmlJS::AST::FunctionExpression *>(parsed.rootNode);
234 engine->throwSyntaxError(QLatin1String(
"Parse error"));
238 Compiler::
Module module(QString(), QString(), engine->debugInstructionPass());
240 Compiler::JSUnitGenerator jsGenerator(&module);
242 cg.generateFromFunctionExpression(function, fe, &module);
244 if (engine->hasException)
247 return engine->insertCompilationUnit(cg.generateCompilationUnit());
250ReturnedValue
FunctionCtor::virtualCallAsConstructor(
const FunctionObject *f,
const Value *argv,
int argc,
const Value *newTarget)
252 ExecutionEngine *engine = f->engine();
254 QQmlRefPointer<ExecutableCompilationUnit> compilationUnit
255 = parse(engine, argv, argc, Type_Function);
256 if (engine->hasException)
257 return Encode::undefined();
259 Function *vmf = compilationUnit->rootFunction();
260 ExecutionContext *global = engine->scriptContext();
261 ReturnedValue o = Encode(FunctionObject::createScriptFunction(global, vmf));
267 obj->setProtoFromNewTarget(newTarget);
268 return obj->asReturnedValue();
272ReturnedValue
FunctionCtor::virtualCall(
const FunctionObject *f,
const Value *,
const Value *argv,
int argc)
274 return virtualCallAsConstructor(f, argv, argc, f);
279void Heap::FunctionPrototype::init()
281 Heap::FunctionObject::init();
289 ctor->defineReadonlyConfigurableProperty(engine->id_length(), Value::fromInt32(1));
290 ctor->defineReadonlyProperty(engine->id_prototype(), (o =
this));
292 defineReadonlyConfigurableProperty(engine->id_name(), *engine->id_empty());
293 defineReadonlyConfigurableProperty(engine->id_length(), Value::fromInt32(0));
294 defineDefaultProperty(QStringLiteral(
"constructor"), (o = ctor));
295 defineDefaultProperty(engine->id_toString(), method_toString, 0);
296 defineDefaultProperty(QStringLiteral(
"apply"), method_apply, 2);
297 defineDefaultProperty(QStringLiteral(
"call"), method_call, 1);
298 defineDefaultProperty(QStringLiteral(
"bind"), method_bind, 1);
299 defineDefaultProperty(engine->symbol_hasInstance(), method_hasInstance, 1,
Attr_ReadOnly);
303 const FunctionObject *,
const Value *,
const Value *,
int)
305 return Encode::undefined();
308ReturnedValue
FunctionPrototype::method_toString(
const FunctionObject *b,
const Value *thisObject,
const Value *,
int)
310 ExecutionEngine *v4 = b->engine();
311 const FunctionObject *fun = thisObject->as<FunctionObject>();
313 return v4->throwTypeError();
315 const Scope scope(fun->engine());
316 const ScopedString scopedFunctionName(scope, fun->name());
317 const QString functionName(scopedFunctionName ? scopedFunctionName->toQString() : QString());
318 QString functionAsString = QStringLiteral(
"function");
322 if (!functionName.isEmpty())
323 functionAsString.append(QLatin1Char(
' ') + functionName);
325 functionAsString.append(QStringLiteral(
"() { [native code] }"));
327 return Encode(v4->newString(functionAsString));
330ReturnedValue
FunctionPrototype::method_apply(
const QV4::FunctionObject *b,
const Value *thisObject,
const Value *argv,
int argc)
332 ExecutionEngine *v4 = b->engine();
333 const FunctionObject *f = thisObject->as<FunctionObject>();
335 return v4->throwTypeError();
336 thisObject = argc ? argv :
nullptr;
337 if (argc < 2 || argv[1].isNullOrUndefined())
338 return checkedResult(v4, f->call(thisObject, argv, 0));
340 Object *arr = argv[1].objectValue();
342 return v4->throwTypeError();
345 const int len = v4->safeForAllocLength(arr->getLength());
348 Value *arguments = scope.alloc(len);
352 int l = qMin(len, a->d()->context->argc());
353 memcpy(arguments, a->d()->context->args(), l*
sizeof(Value));
354 for (
int i = l; i < len; ++i)
355 arguments[i] = Value::undefinedValue();
356 }
else if (arr->arrayType() == Heap::ArrayData::Simple && !arr->protoHasArray()) {
358 int alen = sad ? sad->values.size : 0;
361 for (
int i = 0; i < alen; ++i)
362 arguments[i] = sad->data(i);
363 for (
int i = alen; i < len; ++i)
364 arguments[i] = Value::undefinedValue();
367 memset(arguments, 0, len*
sizeof(Value));
368 for (
int i = 0; i < len; ++i)
369 arguments[i] = arr->get(i);
373 return checkedResult(v4, f->call(thisObject, arguments, len));
376ReturnedValue
FunctionPrototype::method_call(
const QV4::FunctionObject *b,
const Value *thisObject,
const Value *argv,
int argc)
378 QV4::ExecutionEngine *v4 = b->engine();
379 if (!thisObject->isFunctionObject())
380 return v4->throwTypeError();
382 const FunctionObject *f =
static_cast<
const FunctionObject *>(thisObject);
384 thisObject = argc ? argv :
nullptr;
389 return checkedResult(v4, f->call(thisObject, argv, argc));
392ReturnedValue
FunctionPrototype::method_bind(
const FunctionObject *b,
const Value *thisObject,
const Value *argv,
int argc)
396 if (!target || target->isBinding())
397 return scope.engine->throwTypeError();
399 ScopedValue boundThis(scope, argc ? argv[0] : Value::undefinedValue());
402 int nArgs = (argc - 1 >= 0) ? argc - 1 : 0;
403 if (target->isBoundFunction()) {
406 boundThis = bound->boundThis();
407 int oldSize = !oldArgs ? 0 : oldArgs->size();
408 if (oldSize + nArgs) {
410 boundArgs->d()->values.size = oldSize + nArgs;
411 for (uint i = 0; i <
static_cast<uint>(oldSize); ++i)
412 boundArgs->set(scope.engine, i, oldArgs->data()[i]);
413 for (uint i = 0; i <
static_cast<uint>(nArgs); ++i)
414 boundArgs->set(scope.engine, oldSize + i, argv[i + 1]);
419 boundArgs->d()->values.size = nArgs;
420 for (uint i = 0, ei =
static_cast<uint>(nArgs); i < ei; ++i)
421 boundArgs->set(scope.engine, i, argv[i + 1]);
424 if (target->isConstructor()) {
425 return scope.engine->memoryManager->allocate<
BoundConstructor>(target, boundThis, boundArgs)
429 return scope.engine->memoryManager->allocate<
BoundFunction>(target, boundThis, boundArgs)
433ReturnedValue
FunctionPrototype::method_hasInstance(
const FunctionObject *,
const Value *thisObject,
const Value *argv,
int argc)
436 return Encode(
false);
437 const Object *o = thisObject->as<Object>();
439 return Encode(
false);
441 return Object::virtualInstanceOf(o, argv[0]);
446ReturnedValue
ScriptFunction::virtualCallAsConstructor(
const FunctionObject *fo,
const Value *argv,
int argc,
const Value *newTarget)
448 ExecutionEngine *v4 = fo->engine();
449 const ScriptFunction *f =
static_cast<
const ScriptFunction *>(fo);
450 Q_ASSERT(newTarget->isFunctionObject());
451 const FunctionObject *nt =
static_cast<
const FunctionObject *>(newTarget);
455 if (nt->d() == f->d()) {
459 ic = scope.engine->internalClasses(EngineBase::Class_Object);
461 ic = ic->changePrototype(o->d());
463 ScopedValue thisObject(scope, v4->memoryManager->allocObject<Object>(ic));
465 JSTypesStackFrame frame;
466 frame.init(f->function(), argv, argc);
467 frame.setupJSFrame(v4->jsStackTop, *f, f->scope(),
469 newTarget ? *newTarget : Value::undefinedValue());
472 v4->jsStackTop += frame.requiredJSStackFrameSize();
474 ReturnedValue result = Moth::VME::exec(&frame, v4);
478 if (Q_UNLIKELY(v4->hasException))
479 return Encode::undefined();
480 else if (!Value::fromReturnedValue(result).isObject())
481 return thisObject
->asReturnedValue();
487void ArrowFunction::virtualCallWithMetaTypes(
const FunctionObject *fo, QObject *thisObject,
488 void **a,
const QMetaType *types,
int argc)
490 const ArrowFunction *self =
static_cast<
const ArrowFunction *>(fo);
491 Function *function = self->function();
492 if (function->kind != Function::AotCompiled) {
493 QV4::convertAndCall(fo->engine(), thisObject, a, types, argc,
494 [fo](
const Value *thisObject,
const Value *argv,
int argc) {
495 return ArrowFunction::virtualCall(fo, thisObject, argv, argc);
501 QV4::
Scoped<ExecutionContext> context(scope, self->scope());
502 MetaTypesStackFrame frame;
503 frame.init(function, thisObject, context, a, types, argc);
504 frame.push(scope.engine);
505 Moth::VME::exec(&frame, scope.engine);
506 frame.pop(scope.engine);
510 const QV4::JavaScriptFunctionObject *fo,
const QV4::Value *thisObject,
511 const QV4::Value *argv,
int argc)
513 ExecutionEngine *engine = fo->engine();
514 JSTypesStackFrame frame;
515 frame.init(fo->function(), argv, argc,
true);
516 frame.setupJSFrame(engine->jsStackTop, *fo, fo->scope(),
517 thisObject ? *thisObject : Value::undefinedValue());
520 engine->jsStackTop += frame.requiredJSStackFrameSize();
522 ReturnedValue result;
525 frame.setPendingTailCall(
false);
526 result = Moth::VME::exec(&frame, engine);
527 frame.setTailCalling(
true);
528 }
while (frame.pendingTailCall());
535ReturnedValue
ArrowFunction::virtualCall(
const QV4::FunctionObject *fo,
const Value *thisObject,
536 const QV4::Value *argv,
int argc)
538 const ArrowFunction *self =
static_cast<
const ArrowFunction *>(fo);
539 Function *function = self->function();
540 switch (function->kind) {
541 case Function::AotCompiled: {
542 const auto &types = function->aotCompiledFunction.types;
543 return QV4::convertAndCall(
544 fo->engine(), types.data(), types.length(), argv, argc,
545 [fo, thisObject](
void **a,
const QMetaType *types,
int argc) {
546 ArrowFunction::virtualCallWithMetaTypes(
547 fo, QV4::cppThisObject(thisObject), a, types, argc);
550 case Function::JsTyped:
551 return QV4::coerceAndCall(
552 fo->engine(), &function->jsTypedFunction, function->compiledFunction, argv, argc,
553 [self, thisObject](
const Value *argv,
int argc) {
554 return qfoDoCall(self, thisObject, argv, argc);
560 return qfoDoCall(self, thisObject, argv, argc);
563void Heap::ArrowFunction::init(QV4::ExecutionContext *scope, Function *function, QV4::String *n)
566 JavaScriptFunctionObject::init(scope, function, n);
569 Q_ASSERT(internalClass && internalClass->verifyIndex(s.engine->id_length()->propertyKey(), Index_Length));
570 setProperty(s.engine, Index_Length, Value::fromInt32(
int(function->compiledFunction->length)));
573void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function)
575 ArrowFunction::init(scope, function);
576 Q_ASSERT(!function->isArrowFunction());
579 ScopedFunctionObject f(s,
this);
580 f->createDefaultPrototypeProperty(Heap::FunctionObject::Index_ProtoConstructor);
583void Heap::DefaultClassConstructorFunction::init(QV4::ExecutionContext *scope)
585 Scope s(scope->engine());
586 FunctionObject::init(s.engine,
nullptr);
587 this->scope.set(s.engine, scope->d());
592 Scope scope(engine());
594 if (d()->cachedClassForConstructor && d()->cachedClassForConstructor->prototype == o
->heapObject())
595 return d()->cachedClassForConstructor;
600 ic = ic->changePrototype(p->d());
601 d()->cachedClassForConstructor.set(scope.engine, ic->d());
608ReturnedValue
ConstructorFunction::virtualCallAsConstructor(
const FunctionObject *f,
const Value *argv,
int argc,
const Value *newTarget)
611 if (!c->d()->isDerivedConstructor)
612 return ScriptFunction::virtualCallAsConstructor(f, argv, argc, newTarget);
614 ExecutionEngine *v4 = f->engine();
616 JSTypesStackFrame frame;
617 frame.init(c->function(), argv, argc);
618 frame.setupJSFrame(v4->jsStackTop, *f, c->scope(),
620 newTarget ? *newTarget : Value::undefinedValue());
623 v4->jsStackTop += frame.requiredJSStackFrameSize();
625 ReturnedValue result = Moth::VME::exec(&frame, v4);
626 ReturnedValue thisObject = frame.jsFrame->thisObject.asReturnedValue();
630 if (Q_UNLIKELY(v4->hasException))
631 return Encode::undefined();
632 else if (Value::fromReturnedValue(result).isObject())
634 else if (!Value::fromReturnedValue(result).isUndefined())
635 return v4->throwTypeError();
636 else if (Value::fromReturnedValue(thisObject).isEmpty()) {
638 ScopedString s(scope, v4->newString(QStringLiteral(
"this")));
639 return v4->throwReferenceError(s);
646 return f->engine()->throwTypeError(QStringLiteral(
"Cannot call a class constructor without |new|"));
656 ExecutionEngine *v4 = f->engine();
660 if (!c->d()->isDerivedConstructor) {
661 ScopedObject proto(scope,
static_cast<
const Object *>(newTarget)->get(scope.engine->id_prototype()));
663 c->setPrototypeUnchecked(proto);
664 return c->asReturnedValue();
668 Q_ASSERT(super->isFunctionObject());
670 JSTypesStackFrame frame;
671 frame.init(
nullptr, argv, argc);
672 frame.setupJSFrame(v4->jsStackTop, *f, c
->scope(),
673 Value::undefinedValue(),
674 newTarget ? *newTarget : Value::undefinedValue(), argc, argc);
677 v4->jsStackTop += frame.requiredJSStackFrameSize(argc);
680 ReturnedValue result = super->callAsConstructor(argv, argc, newTarget);
681 ReturnedValue thisObject = frame.jsFrame->thisObject.asReturnedValue();
685 if (Q_UNLIKELY(v4->hasException))
686 return Encode::undefined();
687 else if (Value::fromReturnedValue(result).isObject())
689 else if (!Value::fromReturnedValue(result).isUndefined())
690 return v4->throwTypeError();
691 else if (Value::fromReturnedValue(thisObject).isEmpty()) {
693 ScopedString s(scope, v4->newString(QStringLiteral(
"this")));
694 return v4->throwReferenceError(s);
702 return f->engine()->throwTypeError(QStringLiteral(
"Cannot call a class constructor without |new|"));
709void Heap::BoundFunction::init(
710 QV4::FunctionObject *target,
const Value &boundThis, QV4::MemberData *boundArgs)
712 ExecutionEngine *engine = target->engine();
714 ScopedString name(s, engine->newString(QStringLiteral(
"__bound function__")));
715 if (
auto *js = target->as<QV4::JavaScriptFunctionObject>()) {
716 ScopedContext ctx(s, js->scope());
717 JavaScriptFunctionObject::init(ctx, js->function(), name);
720 JavaScriptFunctionObject::init(engine->rootContext(),
nullptr, name);
723 this->target.set(s.engine, target->d());
724 this->boundArgs.set(s.engine, boundArgs ? boundArgs->d() :
nullptr);
725 this->boundThis.set(s.engine, boundThis);
727 ScopedObject f(s,
this);
729 ScopedValue l(s, target->get(engine->id_length()));
730 int len = l->toUInt32();
732 len -= boundArgs->size();
735 f->defineReadonlyConfigurableProperty(engine->id_length(), Value::fromInt32(len));
737 ScopedProperty pd(s);
738 pd->value = engine->thrower();
739 pd->set = engine->thrower();
740 f->insertMember(engine->id_arguments(), pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
741 f->insertMember(engine->id_caller(), pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
744ReturnedValue
BoundFunction::virtualCall(
const FunctionObject *fo,
const Value *,
const Value *argv,
int argc)
746 QV4::ExecutionEngine *v4 = fo->engine();
747 if (v4->hasException)
748 return Encode::undefined();
750 const BoundFunction *f =
static_cast<
const BoundFunction *>(fo);
754 JSCallArguments jsCallData(scope, (boundArgs ? boundArgs->size() : 0) + argc);
755 *jsCallData.thisObject = f->boundThis();
756 Value *argp = jsCallData.args;
758 memcpy(argp, boundArgs->data(), boundArgs->size()*
sizeof(Value));
759 argp += boundArgs->size();
761 memcpy(argp, argv, argc*
sizeof(Value));
762 return checkedResult(v4, target->call(jsCallData));
768 const FunctionObject *fo,
const Value *argv,
int argc,
const Value *)
770 const BoundFunction *f =
static_cast<
const BoundFunction *>(fo);
771 Scope scope(f->engine());
773 if (scope.hasException())
774 return Encode::undefined();
778 JSCallArguments jsCallData(scope, (boundArgs ? boundArgs->size() : 0) + argc);
779 Value *argp = jsCallData.args;
781 memcpy(argp, boundArgs->data(), boundArgs->size()*
sizeof(Value));
782 argp += boundArgs->size();
784 memcpy(argp, argv, argc*
sizeof(Value));
785 return target->callAsConstructor(jsCallData);
Scoped< FunctionObject > ScopedFunctionObject
Scoped< Object > ScopedObject
Scoped< String > ScopedString
DEFINE_OBJECT_VTABLE(ConstructorFunction)
DEFINE_OBJECT_VTABLE(BoundConstructor)
DEFINE_OBJECT_VTABLE(FunctionPrototype)
DEFINE_OBJECT_VTABLE(FunctionObject)
static ReturnedValue qfoDoCall(const QV4::JavaScriptFunctionObject *fo, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
DEFINE_OBJECT_VTABLE(IndexedBuiltinFunction)
DEFINE_OBJECT_VTABLE(JavaScriptFunctionObject)
DEFINE_OBJECT_VTABLE(ArrowFunction)
DEFINE_OBJECT_VTABLE(ScriptFunction)
DEFINE_OBJECT_VTABLE(BoundFunction)
DEFINE_OBJECT_VTABLE(FunctionCtor)
DEFINE_OBJECT_VTABLE(DefaultClassConstructorFunction)
DEFINE_OBJECT_VTABLE(MemberFunction)
DEFINE_OBJECT_VTABLE(DynamicFunctionObject)
#define CHECK_EXCEPTION()
static bool isNonStrictArgumentsObject(Managed *m)
Heap::FunctionObject * target() const
Heap::ExecutionContext * scope() const
void init(ExecutionEngine *engine, Object *ctor)
static Heap::MemberData * allocate(QV4::ExecutionEngine *e, uint n, Heap::MemberData *old=nullptr)
Scope(ExecutionEngine *e)
Heap::InternalClass * classForConstructor() const