2012-11-17 20:54:26 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2013-06-24 11:50:51 +00:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-11-17 20:54:26 +00:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
|
|
|
**
|
2013-06-24 11:50:51 +00:00
|
|
|
** This file is part of the QtQml module of the Qt Toolkit.
|
2012-11-17 20:54:26 +00:00
|
|
|
**
|
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3.0 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU General Public License version 3.0 requirements will be
|
|
|
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
|
|
|
**
|
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
2013-03-18 10:03:51 +00:00
|
|
|
#ifndef QV4ENGINE_H
|
|
|
|
#define QV4ENGINE_H
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-04-15 09:50:16 +00:00
|
|
|
#include "qv4global_p.h"
|
2013-08-08 07:20:52 +00:00
|
|
|
#include "private/qv4isel_p.h"
|
2013-04-15 09:50:16 +00:00
|
|
|
#include "qv4util_p.h"
|
|
|
|
#include "qv4property_p.h"
|
2013-05-14 00:01:04 +00:00
|
|
|
#include <private/qintrusivelist_p.h>
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-04-19 09:47:50 +00:00
|
|
|
namespace WTF {
|
|
|
|
class BumpPointerAllocator;
|
2013-09-03 10:40:07 +00:00
|
|
|
class PageAllocation;
|
2013-04-19 09:47:50 +00:00
|
|
|
}
|
2013-01-14 15:53:43 +00:00
|
|
|
|
2013-01-31 09:00:06 +00:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
2013-06-04 14:00:13 +00:00
|
|
|
class QV8Engine;
|
2013-10-17 06:56:51 +00:00
|
|
|
class QQmlError;
|
2013-04-17 16:17:30 +00:00
|
|
|
|
2013-07-24 08:29:04 +00:00
|
|
|
namespace QV4 {
|
2012-11-29 13:41:26 +00:00
|
|
|
namespace Debugging {
|
|
|
|
class Debugger;
|
|
|
|
} // namespace Debugging
|
2014-01-22 16:46:20 +00:00
|
|
|
namespace Profiling {
|
|
|
|
class Profiler;
|
|
|
|
} // namespace Profiling
|
2013-08-15 12:11:19 +00:00
|
|
|
namespace CompiledData {
|
|
|
|
struct CompilationUnit;
|
|
|
|
}
|
2013-04-19 11:03:42 +00:00
|
|
|
}
|
2012-11-29 13:41:26 +00:00
|
|
|
|
2013-04-19 11:03:42 +00:00
|
|
|
namespace QV4 {
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2012-12-11 09:03:40 +00:00
|
|
|
struct Function;
|
2012-11-17 20:54:26 +00:00
|
|
|
struct Object;
|
|
|
|
struct BooleanObject;
|
|
|
|
struct NumberObject;
|
|
|
|
struct StringObject;
|
|
|
|
struct ArrayObject;
|
|
|
|
struct DateObject;
|
|
|
|
struct FunctionObject;
|
2013-01-13 22:57:35 +00:00
|
|
|
struct BoundFunction;
|
2012-11-17 20:54:26 +00:00
|
|
|
struct RegExpObject;
|
|
|
|
struct ErrorObject;
|
2013-08-08 14:59:32 +00:00
|
|
|
struct SyntaxErrorObject;
|
2012-11-17 20:54:26 +00:00
|
|
|
struct ArgumentsObject;
|
|
|
|
struct ExecutionContext;
|
|
|
|
struct ExecutionEngine;
|
2014-04-03 11:08:25 +00:00
|
|
|
struct Members;
|
2012-12-04 12:40:18 +00:00
|
|
|
class MemoryManager;
|
2013-03-25 16:31:38 +00:00
|
|
|
class ExecutableAllocator;
|
2012-11-17 20:54:26 +00:00
|
|
|
|
|
|
|
struct ObjectPrototype;
|
|
|
|
struct StringPrototype;
|
|
|
|
struct NumberPrototype;
|
|
|
|
struct BooleanPrototype;
|
|
|
|
struct ArrayPrototype;
|
|
|
|
struct FunctionPrototype;
|
|
|
|
struct DatePrototype;
|
|
|
|
struct RegExpPrototype;
|
|
|
|
struct ErrorPrototype;
|
|
|
|
struct EvalErrorPrototype;
|
|
|
|
struct RangeErrorPrototype;
|
|
|
|
struct ReferenceErrorPrototype;
|
|
|
|
struct SyntaxErrorPrototype;
|
|
|
|
struct TypeErrorPrototype;
|
|
|
|
struct URIErrorPrototype;
|
2013-05-14 00:01:04 +00:00
|
|
|
struct VariantPrototype;
|
2013-05-21 15:06:36 +00:00
|
|
|
struct SequencePrototype;
|
2013-01-23 09:07:18 +00:00
|
|
|
struct EvalFunction;
|
2013-06-27 06:57:47 +00:00
|
|
|
struct IdentifierTable;
|
2013-02-10 21:22:53 +00:00
|
|
|
struct InternalClass;
|
2014-04-16 07:36:38 +00:00
|
|
|
struct InternalClassPool;
|
2013-06-04 12:28:13 +00:00
|
|
|
class MultiplyWrappedQObjectMap;
|
2013-01-14 15:53:43 +00:00
|
|
|
class RegExp;
|
2013-03-30 16:43:03 +00:00
|
|
|
class RegExpCache;
|
2013-06-20 09:32:45 +00:00
|
|
|
struct QmlExtensions;
|
2013-09-11 11:23:21 +00:00
|
|
|
struct Exception;
|
2013-11-21 15:41:32 +00:00
|
|
|
struct ExecutionContextSaver;
|
2013-01-14 15:53:43 +00:00
|
|
|
|
2013-11-11 10:22:24 +00:00
|
|
|
#define CHECK_STACK_LIMITS(v4) \
|
|
|
|
if ((v4->jsStackTop <= v4->jsStackLimit) && (reinterpret_cast<quintptr>(&v4) >= v4->cStackLimit || v4->recheckCStackLimits())) {} \
|
|
|
|
else \
|
2013-11-21 15:41:32 +00:00
|
|
|
return v4->currentContext()->throwRangeError(QStringLiteral("Maximum call stack size exceeded."))
|
2013-11-11 10:22:24 +00:00
|
|
|
|
|
|
|
|
2013-04-16 15:03:00 +00:00
|
|
|
struct Q_QML_EXPORT ExecutionEngine
|
2012-11-17 20:54:26 +00:00
|
|
|
{
|
2013-11-21 15:41:32 +00:00
|
|
|
private:
|
|
|
|
friend struct ExecutionContextSaver;
|
|
|
|
friend struct ExecutionContext;
|
2012-11-18 22:33:06 +00:00
|
|
|
ExecutionContext *current;
|
2013-11-21 15:41:32 +00:00
|
|
|
public:
|
|
|
|
ExecutionContext *currentContext() const { return current; }
|
|
|
|
|
2014-02-05 15:12:16 +00:00
|
|
|
Value *jsStackTop;
|
|
|
|
quint32 hasException;
|
2013-04-05 11:27:38 +00:00
|
|
|
GlobalContext *rootContext;
|
2013-03-14 13:03:04 +00:00
|
|
|
|
2014-02-05 15:12:16 +00:00
|
|
|
MemoryManager *memoryManager;
|
|
|
|
ExecutableAllocator *executableAllocator;
|
|
|
|
ExecutableAllocator *regExpAllocator;
|
2014-02-14 12:58:40 +00:00
|
|
|
QScopedPointer<EvalISelFactory> iselFactory;
|
2014-02-05 15:12:16 +00:00
|
|
|
|
|
|
|
|
2014-01-24 21:55:39 +00:00
|
|
|
Value *jsStackLimit;
|
2013-11-11 10:22:24 +00:00
|
|
|
quintptr cStackLimit;
|
|
|
|
|
2013-04-19 09:47:50 +00:00
|
|
|
WTF::BumpPointerAllocator *bumperPointerAllocator; // Used by Yarr Regex engine.
|
2012-11-18 22:33:06 +00:00
|
|
|
|
2013-11-11 10:22:24 +00:00
|
|
|
enum { JSStackLimit = 4*1024*1024 };
|
2013-09-03 10:40:07 +00:00
|
|
|
WTF::PageAllocation *jsStack;
|
2014-01-24 21:55:39 +00:00
|
|
|
Value *jsStackBase;
|
2013-09-03 10:40:07 +00:00
|
|
|
|
2014-01-24 21:55:39 +00:00
|
|
|
Value *stackPush(uint nValues) {
|
|
|
|
Value *ptr = jsStackTop;
|
2013-09-03 10:40:07 +00:00
|
|
|
jsStackTop = ptr + nValues;
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
void stackPop(uint nValues) {
|
|
|
|
jsStackTop -= nValues;
|
|
|
|
}
|
|
|
|
|
2013-11-02 15:30:26 +00:00
|
|
|
void pushForGC(Managed *m) {
|
|
|
|
*jsStackTop = Value::fromManaged(m);
|
|
|
|
++jsStackTop;
|
|
|
|
}
|
|
|
|
Managed *popForGC() {
|
|
|
|
--jsStackTop;
|
|
|
|
return jsStackTop->managed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-27 06:57:47 +00:00
|
|
|
IdentifierTable *identifierTable;
|
2013-01-30 13:56:40 +00:00
|
|
|
|
2013-07-24 08:29:04 +00:00
|
|
|
QV4::Debugging::Debugger *debugger;
|
2014-01-22 16:46:20 +00:00
|
|
|
QV4::Profiling::Profiler *profiler;
|
2012-11-29 13:41:26 +00:00
|
|
|
|
2013-04-08 07:08:02 +00:00
|
|
|
Object *globalObject;
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-04-19 11:03:42 +00:00
|
|
|
Function *globalCode;
|
2013-01-28 15:46:09 +00:00
|
|
|
|
2013-06-04 14:00:13 +00:00
|
|
|
QV8Engine *v8Engine;
|
2013-04-17 16:17:30 +00:00
|
|
|
|
2014-01-24 21:55:39 +00:00
|
|
|
Value objectCtor;
|
|
|
|
Value stringCtor;
|
|
|
|
Value numberCtor;
|
|
|
|
Value booleanCtor;
|
|
|
|
Value arrayCtor;
|
|
|
|
Value functionCtor;
|
|
|
|
Value dateCtor;
|
|
|
|
Value regExpCtor;
|
|
|
|
Value errorCtor;
|
|
|
|
Value evalErrorCtor;
|
|
|
|
Value rangeErrorCtor;
|
|
|
|
Value referenceErrorCtor;
|
|
|
|
Value syntaxErrorCtor;
|
|
|
|
Value typeErrorCtor;
|
|
|
|
Value uRIErrorCtor;
|
|
|
|
Value sequencePrototype;
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2014-04-16 07:36:38 +00:00
|
|
|
InternalClassPool *classPool;
|
2013-03-04 10:48:49 +00:00
|
|
|
InternalClass *emptyClass;
|
2013-11-21 13:26:08 +00:00
|
|
|
InternalClass *executionContextClass;
|
2014-03-26 07:53:59 +00:00
|
|
|
InternalClass *constructClass;
|
2013-11-21 13:26:08 +00:00
|
|
|
InternalClass *stringClass;
|
|
|
|
|
2013-08-29 12:31:32 +00:00
|
|
|
InternalClass *objectClass;
|
2013-03-04 10:48:49 +00:00
|
|
|
InternalClass *arrayClass;
|
2014-03-18 07:28:25 +00:00
|
|
|
InternalClass *simpleArrayDataClass;
|
2013-11-21 13:26:08 +00:00
|
|
|
InternalClass *stringObjectClass;
|
2013-08-29 19:23:04 +00:00
|
|
|
InternalClass *booleanClass;
|
|
|
|
InternalClass *numberClass;
|
|
|
|
InternalClass *dateClass;
|
2013-09-01 19:22:57 +00:00
|
|
|
|
2013-08-29 19:23:04 +00:00
|
|
|
InternalClass *functionClass;
|
2013-09-01 19:22:57 +00:00
|
|
|
InternalClass *protoClass;
|
|
|
|
|
2013-08-29 19:23:04 +00:00
|
|
|
InternalClass *regExpClass;
|
2013-09-02 12:25:15 +00:00
|
|
|
InternalClass *regExpExecArrayClass;
|
2013-11-21 13:26:08 +00:00
|
|
|
InternalClass *regExpValueClass;
|
2013-09-02 12:25:15 +00:00
|
|
|
|
2013-08-29 19:23:04 +00:00
|
|
|
InternalClass *errorClass;
|
2013-08-30 07:18:03 +00:00
|
|
|
InternalClass *evalErrorClass;
|
|
|
|
InternalClass *rangeErrorClass;
|
|
|
|
InternalClass *referenceErrorClass;
|
|
|
|
InternalClass *syntaxErrorClass;
|
|
|
|
InternalClass *typeErrorClass;
|
|
|
|
InternalClass *uriErrorClass;
|
2013-08-16 06:53:47 +00:00
|
|
|
InternalClass *argumentsObjectClass;
|
|
|
|
InternalClass *strictArgumentsObjectClass;
|
2013-03-04 10:48:49 +00:00
|
|
|
|
2013-08-30 09:22:00 +00:00
|
|
|
InternalClass *variantClass;
|
2014-03-31 13:48:02 +00:00
|
|
|
InternalClass *memberDataClass;
|
2013-08-30 09:22:00 +00:00
|
|
|
|
2013-01-23 09:07:18 +00:00
|
|
|
EvalFunction *evalFunction;
|
2013-09-18 07:30:45 +00:00
|
|
|
FunctionObject *thrower;
|
2013-01-23 09:07:18 +00:00
|
|
|
|
2014-03-10 14:18:54 +00:00
|
|
|
Property *argumentsAccessors;
|
|
|
|
int nArgumentsAccessors;
|
2013-01-18 11:47:43 +00:00
|
|
|
|
2014-03-17 11:45:41 +00:00
|
|
|
StringValue id_empty;
|
2014-01-24 21:55:39 +00:00
|
|
|
StringValue id_undefined;
|
|
|
|
StringValue id_null;
|
|
|
|
StringValue id_true;
|
|
|
|
StringValue id_false;
|
|
|
|
StringValue id_boolean;
|
|
|
|
StringValue id_number;
|
|
|
|
StringValue id_string;
|
|
|
|
StringValue id_object;
|
|
|
|
StringValue id_function;
|
|
|
|
StringValue id_length;
|
|
|
|
StringValue id_prototype;
|
|
|
|
StringValue id_constructor;
|
|
|
|
StringValue id_arguments;
|
|
|
|
StringValue id_caller;
|
|
|
|
StringValue id_callee;
|
|
|
|
StringValue id_this;
|
|
|
|
StringValue id___proto__;
|
|
|
|
StringValue id_enumerable;
|
|
|
|
StringValue id_configurable;
|
|
|
|
StringValue id_writable;
|
|
|
|
StringValue id_value;
|
|
|
|
StringValue id_get;
|
|
|
|
StringValue id_set;
|
|
|
|
StringValue id_eval;
|
|
|
|
StringValue id_uintMax;
|
|
|
|
StringValue id_name;
|
|
|
|
StringValue id_index;
|
|
|
|
StringValue id_input;
|
|
|
|
StringValue id_toString;
|
2014-02-27 21:59:39 +00:00
|
|
|
StringValue id_destroy;
|
2014-01-24 21:55:39 +00:00
|
|
|
StringValue id_valueOf;
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-08-15 12:11:19 +00:00
|
|
|
QSet<CompiledData::CompilationUnit*> compilationUnits;
|
2012-11-28 12:39:14 +00:00
|
|
|
|
2013-06-04 08:05:51 +00:00
|
|
|
quint32 m_engineId;
|
|
|
|
|
2013-03-30 16:43:03 +00:00
|
|
|
RegExpCache *regExpCache;
|
|
|
|
|
2013-05-14 00:01:04 +00:00
|
|
|
// Scarce resources are "exceptionally high cost" QVariant types where allowing the
|
|
|
|
// normal JavaScript GC to clean them up is likely to lead to out-of-memory or other
|
|
|
|
// out-of-resource situations. When such a resource is passed into JavaScript we
|
|
|
|
// add it to the scarceResources list and it is destroyed when we return from the
|
|
|
|
// JavaScript execution that created it. The user can prevent this behavior by
|
|
|
|
// calling preserve() on the object which removes it from this scarceResource list.
|
|
|
|
class ScarceResourceData {
|
|
|
|
public:
|
|
|
|
ScarceResourceData(const QVariant &data) : data(data) {}
|
|
|
|
QVariant data;
|
|
|
|
QIntrusiveListNode node;
|
|
|
|
};
|
|
|
|
QIntrusiveList<ScarceResourceData, &ScarceResourceData::node> scarceResources;
|
|
|
|
|
2013-06-04 12:28:13 +00:00
|
|
|
// Normally the JS wrappers for QObjects are stored in the QQmlData/QObjectPrivate,
|
|
|
|
// but any time a QObject is wrapped a second time in another engine, we have to do
|
|
|
|
// bookkeeping.
|
|
|
|
MultiplyWrappedQObjectMap *m_multiplyWrappedQObjects;
|
|
|
|
|
2014-02-14 12:58:40 +00:00
|
|
|
ExecutionEngine(EvalISelFactory *iselFactory = 0);
|
2012-12-04 10:30:26 +00:00
|
|
|
~ExecutionEngine();
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-07-24 08:29:04 +00:00
|
|
|
void enableDebugger();
|
2014-01-22 16:46:20 +00:00
|
|
|
void enableProfiler();
|
2013-07-24 08:29:04 +00:00
|
|
|
|
2013-03-14 13:03:04 +00:00
|
|
|
ExecutionContext *pushGlobalContext();
|
2013-11-03 14:23:05 +00:00
|
|
|
void pushContext(CallContext *context);
|
2013-03-14 11:59:11 +00:00
|
|
|
ExecutionContext *popContext();
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-11-03 14:23:05 +00:00
|
|
|
Returned<FunctionObject> *newBuiltinFunction(ExecutionContext *scope, const StringRef name, ReturnedValue (*code)(CallContext *));
|
2014-04-03 11:08:25 +00:00
|
|
|
Returned<BoundFunction> *newBoundFunction(ExecutionContext *scope, FunctionObjectRef target, const ValueRef boundThis, const QV4::Members &boundArgs);
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-09-16 20:02:27 +00:00
|
|
|
Returned<Object> *newObject();
|
|
|
|
Returned<Object> *newObject(InternalClass *internalClass);
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-09-25 13:24:50 +00:00
|
|
|
Returned<String> *newString(const QString &s);
|
2013-01-30 13:56:40 +00:00
|
|
|
String *newIdentifier(const QString &text);
|
|
|
|
|
2013-09-25 13:24:50 +00:00
|
|
|
Returned<Object> *newStringObject(const ValueRef value);
|
2013-09-19 11:17:55 +00:00
|
|
|
Returned<Object> *newNumberObject(const ValueRef value);
|
|
|
|
Returned<Object> *newBooleanObject(const ValueRef value);
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-09-14 09:25:02 +00:00
|
|
|
Returned<ArrayObject> *newArrayObject(int count = 0);
|
|
|
|
Returned<ArrayObject> *newArrayObject(const QStringList &list);
|
|
|
|
Returned<ArrayObject> *newArrayObject(InternalClass *ic);
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-09-30 13:41:24 +00:00
|
|
|
Returned<DateObject> *newDateObject(const ValueRef value);
|
2013-09-13 15:07:44 +00:00
|
|
|
Returned<DateObject> *newDateObject(const QDateTime &dt);
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-09-13 15:07:44 +00:00
|
|
|
Returned<RegExpObject> *newRegExpObject(const QString &pattern, int flags);
|
2014-01-27 13:58:52 +00:00
|
|
|
Returned<RegExpObject> *newRegExpObject(RegExpRef re, bool global);
|
2013-09-13 15:07:44 +00:00
|
|
|
Returned<RegExpObject> *newRegExpObject(const QRegExp &re);
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-09-25 20:42:58 +00:00
|
|
|
Returned<Object> *newErrorObject(const ValueRef value);
|
2013-09-13 19:54:21 +00:00
|
|
|
Returned<Object> *newSyntaxErrorObject(const QString &message, const QString &fileName, int line, int column);
|
|
|
|
Returned<Object> *newSyntaxErrorObject(const QString &message);
|
2013-09-14 09:25:02 +00:00
|
|
|
Returned<Object> *newReferenceErrorObject(const QString &message);
|
|
|
|
Returned<Object> *newReferenceErrorObject(const QString &message, const QString &fileName, int lineNumber, int columnNumber);
|
|
|
|
Returned<Object> *newTypeErrorObject(const QString &message);
|
|
|
|
Returned<Object> *newRangeErrorObject(const QString &message);
|
2013-09-25 20:42:58 +00:00
|
|
|
Returned<Object> *newURIErrorObject(const ValueRef message);
|
2012-12-04 18:50:25 +00:00
|
|
|
|
2013-09-14 09:25:02 +00:00
|
|
|
Returned<Object> *newVariantObject(const QVariant &v);
|
2013-05-14 00:01:04 +00:00
|
|
|
|
2013-09-30 11:48:05 +00:00
|
|
|
Returned<Object> *newForEachIteratorObject(ExecutionContext *ctx, const ObjectRef o);
|
2013-01-18 11:47:43 +00:00
|
|
|
|
2013-09-14 09:25:02 +00:00
|
|
|
Returned<Object> *qmlContextObject() const;
|
2013-05-03 14:51:32 +00:00
|
|
|
|
2013-05-25 13:31:23 +00:00
|
|
|
StackTrace stackTrace(int frameLimit = -1) const;
|
2013-05-22 08:47:36 +00:00
|
|
|
StackFrame currentStackFrame() const;
|
2013-05-29 07:59:40 +00:00
|
|
|
QUrl resolvedUrl(const QString &file);
|
2013-05-22 08:47:36 +00:00
|
|
|
|
2013-01-18 11:47:43 +00:00
|
|
|
void requireArgumentsAccessors(int n);
|
2013-01-28 15:46:09 +00:00
|
|
|
|
|
|
|
void markObjects();
|
2013-03-05 15:11:22 +00:00
|
|
|
|
2013-03-14 13:03:04 +00:00
|
|
|
void initRootContext();
|
2013-05-06 11:29:24 +00:00
|
|
|
|
|
|
|
InternalClass *newClass(const InternalClass &other);
|
2013-05-25 13:31:23 +00:00
|
|
|
|
2013-06-20 09:32:45 +00:00
|
|
|
QmlExtensions *qmlExtensions();
|
|
|
|
|
2013-11-11 10:22:24 +00:00
|
|
|
bool recheckCStackLimits();
|
|
|
|
|
2013-10-01 14:19:28 +00:00
|
|
|
// Exception handling
|
2014-01-24 21:55:39 +00:00
|
|
|
Value exceptionValue;
|
2013-10-01 14:19:28 +00:00
|
|
|
StackTrace exceptionStackTrace;
|
|
|
|
|
2013-10-21 07:57:58 +00:00
|
|
|
ReturnedValue throwException(const ValueRef value);
|
2013-10-01 14:19:28 +00:00
|
|
|
ReturnedValue catchException(ExecutionContext *catchingContext, StackTrace *trace);
|
|
|
|
|
2013-10-17 06:56:51 +00:00
|
|
|
// Use only inside catch(...) -- will re-throw if no JS exception
|
2013-10-21 07:50:27 +00:00
|
|
|
static QQmlError catchExceptionAsQmlError(QV4::ExecutionContext *context);
|
2013-10-17 06:56:51 +00:00
|
|
|
|
2013-06-20 09:32:45 +00:00
|
|
|
private:
|
|
|
|
QmlExtensions *m_qmlExtensions;
|
2013-03-05 15:11:22 +00:00
|
|
|
};
|
|
|
|
|
2013-11-02 15:30:26 +00:00
|
|
|
inline
|
|
|
|
void Managed::mark(QV4::ExecutionEngine *engine)
|
|
|
|
{
|
2014-04-05 18:23:20 +00:00
|
|
|
Q_ASSERT(inUse());
|
|
|
|
if (markBit())
|
2013-11-02 15:30:26 +00:00
|
|
|
return;
|
2014-04-05 18:23:20 +00:00
|
|
|
managedData()->markBit = 1;
|
2013-11-02 15:30:26 +00:00
|
|
|
engine->pushForGC(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-19 11:03:42 +00:00
|
|
|
} // namespace QV4
|
2012-11-17 20:54:26 +00:00
|
|
|
|
2013-01-31 09:00:06 +00:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2013-03-18 10:03:51 +00:00
|
|
|
#endif // QV4ENGINE_H
|