aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-04-19 13:03:42 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-04-19 13:09:28 +0200
commit8fb620db43bb861ea7950e7176106e8aaf00876b (patch)
treeecd8dbd43edca86b5acff953b3d924227e80e458
parent9f8c2e733202ea2bcfbc6182fe1e994b140f449a (diff)
Rename QQmlJS::VM namespace to QV4
Simplifies writing code against it (less stuff to type). Change-Id: I8ac03ca2519375a204a3245e82c4be4cf1e793eb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/3rdparty/masm/stubs/ExecutableAllocator.h10
-rw-r--r--src/3rdparty/masm/stubs/JSGlobalData.h8
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp18
-rw-r--r--src/qml/qml/v4/qv4bindings.cpp2
-rw-r--r--src/qml/qml/v4vm/llvm_runtime.cpp2
-rw-r--r--src/qml/qml/v4vm/moth/qv4instr_moth_p.h60
-rw-r--r--src/qml/qml/v4vm/moth/qv4isel_moth.cpp146
-rw-r--r--src/qml/qml/v4vm/moth/qv4isel_moth_p.h10
-rw-r--r--src/qml/qml/v4vm/moth/qv4vme_moth.cpp66
-rw-r--r--src/qml/qml/v4vm/moth/qv4vme_moth_p.h10
-rw-r--r--src/qml/qml/v4vm/qv4argumentsobject.cpp7
-rw-r--r--src/qml/qml/v4vm/qv4argumentsobject_p.h4
-rw-r--r--src/qml/qml/v4vm/qv4arrayobject.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4arrayobject_p.h7
-rw-r--r--src/qml/qml/v4vm/qv4booleanobject.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4booleanobject_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4codegen.cpp16
-rw-r--r--src/qml/qml/v4vm/qv4codegen_p.h22
-rw-r--r--src/qml/qml/v4vm/qv4context.cpp16
-rw-r--r--src/qml/qml/v4vm/qv4context_p.h12
-rw-r--r--src/qml/qml/v4vm/qv4dateobject.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4dateobject_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4debugging.cpp64
-rw-r--r--src/qml/qml/v4vm/qv4debugging_p.h40
-rw-r--r--src/qml/qml/v4vm/qv4engine.cpp26
-rw-r--r--src/qml/qml/v4vm/qv4engine_p.h29
-rw-r--r--src/qml/qml/v4vm/qv4errorobject.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4errorobject_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4executableallocator.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4executableallocator_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4functionobject.cpp20
-rw-r--r--src/qml/qml/v4vm/qv4functionobject_p.h12
-rw-r--r--src/qml/qml/v4vm/qv4global_p.h4
-rw-r--r--src/qml/qml/v4vm/qv4globalobject.cpp16
-rw-r--r--src/qml/qml/v4vm/qv4globalobject_p.h8
-rw-r--r--src/qml/qml/v4vm/qv4identifier_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4internalclass.cpp10
-rw-r--r--src/qml/qml/v4vm/qv4internalclass_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4isel_llvm.cpp6
-rw-r--r--src/qml/qml/v4vm/qv4isel_masm.cpp78
-rw-r--r--src/qml/qml/v4vm/qv4isel_masm_p.h56
-rw-r--r--src/qml/qml/v4vm/qv4isel_p.cpp10
-rw-r--r--src/qml/qml/v4vm/qv4isel_p.h24
-rw-r--r--src/qml/qml/v4vm/qv4isel_util_p.h14
-rw-r--r--src/qml/qml/v4vm/qv4jsir_p.h10
-rw-r--r--src/qml/qml/v4vm/qv4jsonobject.cpp34
-rw-r--r--src/qml/qml/v4vm/qv4jsonobject_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4lookup.cpp8
-rw-r--r--src/qml/qml/v4vm/qv4lookup_p.h4
-rw-r--r--src/qml/qml/v4vm/qv4managed.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4managed_p.h5
-rw-r--r--src/qml/qml/v4vm/qv4math_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4mathobject.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4mathobject_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4mm.cpp6
-rw-r--r--src/qml/qml/v4vm/qv4mm_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4numberobject.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4numberobject_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4object.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4object_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4objectiterator.cpp7
-rw-r--r--src/qml/qml/v4vm/qv4objectiterator_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4objectproto.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4objectproto_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4property_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4regexp.cpp8
-rw-r--r--src/qml/qml/v4vm/qv4regexp_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4regexpobject.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4regexpobject_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4runtime.cpp72
-rw-r--r--src/qml/qml/v4vm/qv4runtime_p.h14
-rw-r--r--src/qml/qml/v4vm/qv4sparsearray.cpp7
-rw-r--r--src/qml/qml/v4vm/qv4sparsearray_p.h4
-rw-r--r--src/qml/qml/v4vm/qv4string.cpp6
-rw-r--r--src/qml/qml/v4vm/qv4string_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4stringobject.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4stringobject_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4unwindhelper.cpp2
-rw-r--r--src/qml/qml/v4vm/qv4unwindhelper_p-arm.h10
-rw-r--r--src/qml/qml/v4vm/qv4unwindhelper_p-dw2.h14
-rw-r--r--src/qml/qml/v4vm/qv4unwindhelper_p.h6
-rw-r--r--src/qml/qml/v4vm/qv4util_p.h4
-rw-r--r--src/qml/qml/v4vm/qv4v8.cpp508
-rw-r--r--src/qml/qml/v4vm/qv4v8_p.h23
-rw-r--r--src/qml/qml/v4vm/qv4value.cpp9
-rw-r--r--src/qml/qml/v4vm/qv4value_p.h12
-rw-r--r--src/qml/qml/v8/qjsengine.cpp10
-rw-r--r--src/qml/qml/v8/qjsvalue.cpp46
-rw-r--r--src/qml/qml/v8/qjsvalue_p.h22
-rw-r--r--src/qml/qml/v8/qjsvalueiterator.cpp10
-rw-r--r--src/qml/qml/v8/qjsvalueiterator_p.h14
-rw-r--r--src/qml/qml/v8/qv4domerrors.cpp2
-rw-r--r--src/qml/qml/v8/qv4domerrors_p.h7
-rw-r--r--src/qml/qml/v8/qv4sqlerrors.cpp4
-rw-r--r--src/qml/qml/v8/qv4sqlerrors_p.h7
-rw-r--r--src/qml/qml/v8/qv8engine.cpp72
-rw-r--r--src/qml/qml/v8/qv8engine_impl_p.h4
-rw-r--r--src/qml/qml/v8/qv8engine_p.h17
-rw-r--r--src/qml/qml/v8/qv8qobjectwrapper.cpp6
-rw-r--r--src/qml/qml/v8/qv8typewrapper.cpp12
100 files changed, 923 insertions, 1054 deletions
diff --git a/src/3rdparty/masm/stubs/ExecutableAllocator.h b/src/3rdparty/masm/stubs/ExecutableAllocator.h
index a6911b34f0..49136a9887 100644
--- a/src/3rdparty/masm/stubs/ExecutableAllocator.h
+++ b/src/3rdparty/masm/stubs/ExecutableAllocator.h
@@ -59,7 +59,7 @@ namespace JSC {
class JSGlobalData;
struct ExecutableMemoryHandle : public RefCounted<ExecutableMemoryHandle> {
- ExecutableMemoryHandle(QQmlJS::VM::ExecutableAllocator *allocator, int size)
+ ExecutableMemoryHandle(QV4::ExecutableAllocator *allocator, int size)
: m_allocator(allocator)
, m_size(size)
{
@@ -79,13 +79,13 @@ struct ExecutableMemoryHandle : public RefCounted<ExecutableMemoryHandle> {
void* start() { return m_allocation->start(); }
int sizeInBytes() { return m_size; }
- QQmlJS::VM::ExecutableAllocator *m_allocator;
- QQmlJS::VM::ExecutableAllocator::Allocation *m_allocation;
+ QV4::ExecutableAllocator *m_allocator;
+ QV4::ExecutableAllocator::Allocation *m_allocation;
int m_size;
};
struct ExecutableAllocator {
- ExecutableAllocator(QQmlJS::VM::ExecutableAllocator *alloc)
+ ExecutableAllocator(QV4::ExecutableAllocator *alloc)
: realAllocator(alloc)
{}
@@ -125,7 +125,7 @@ struct ExecutableAllocator {
#endif
}
- QQmlJS::VM::ExecutableAllocator *realAllocator;
+ QV4::ExecutableAllocator *realAllocator;
};
}
diff --git a/src/3rdparty/masm/stubs/JSGlobalData.h b/src/3rdparty/masm/stubs/JSGlobalData.h
index 281a64de83..c294f5ee50 100644
--- a/src/3rdparty/masm/stubs/JSGlobalData.h
+++ b/src/3rdparty/masm/stubs/JSGlobalData.h
@@ -44,17 +44,11 @@
#include "ExecutableAllocator.h"
#include "WeakRandom.h"
-namespace QQmlJS {
-namespace VM {
-class ExecutableAllocator;
-}
-}
-
namespace JSC {
class JSGlobalData {
public:
- JSGlobalData(QQmlJS::VM::ExecutableAllocator *realAllocator)
+ JSGlobalData(QV4::ExecutableAllocator *realAllocator)
: executableAllocator(realAllocator)
{}
ExecutableAllocator executableAllocator;
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index fc918decdd..4d0c509b2d 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -43,6 +43,9 @@
#include <qqmlcontext.h>
#include <private/qqmlengine_p.h>
+#include <private/qv8engine_p.h>
+#include <private/qv4value_p.h>
+#include <private/qv4engine_p.h>
#include <QDebug>
#include <QStringList>
@@ -63,6 +66,7 @@ Q_DECLARE_METATYPE(QQuickXmlQueryResult)
QT_BEGIN_NAMESPACE
+using namespace QV4;
typedef QPair<int, int> QQuickXmlListRange;
@@ -914,16 +918,18 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const
Q_D(const QQuickXmlListModel);
if (index < 0 || index >= count())
- return QQmlV4Handle::fromV8Handle(v8::Undefined());
+ return QQmlV4Handle::fromValue(Value::undefinedValue());
QQmlEngine *engine = qmlContext(this)->engine();
QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
- v8::Local<v8::Object> rv = v8::Object::New();
- for (int ii = 0; ii < d->roleObjects.count(); ++ii)
- rv->Set(v8engine->toString(d->roleObjects[ii]->name()),
- v8engine->fromVariant(d->data.value(ii).value(index)));
+ ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
+ Object *o = v4engine->newObject();
+ for (int ii = 0; ii < d->roleObjects.count(); ++ii) {
+ Property *p = o->insertMember(v4engine->newIdentifier(d->roleObjects[ii]->name()), PropertyAttributes());
+ p->value = v8engine->fromVariant(d->data.value(ii).value(index)).get()->v4Value();
+ }
- return QQmlV4Handle::fromV8Handle(rv);
+ return QQmlV4Handle::fromValue(Value::fromObject(o));
}
/*!
diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp
index ac5bd17288..a3b09b0ee8 100644
--- a/src/qml/qml/v4/qv4bindings.cpp
+++ b/src/qml/qml/v4/qv4bindings.cpp
@@ -1283,7 +1283,7 @@ void QV4Bindings::run(int instrIndex, quint32 &executedBlocks,
} else {
QV8Engine *v8engine = QQmlEnginePrivate::get(context->engine)->v8engine();
new (output.gethandleptr()) v8::Handle<v8::Value>(
- v8::Value::fromVmValue(QJSValuePrivate::get(tmp)->value));
+ v8::Value::fromV4Value(QJSValuePrivate::get(tmp)->value));
V8HANDLE_REGISTER(instr->unaryop.output);
}
}
diff --git a/src/qml/qml/v4vm/llvm_runtime.cpp b/src/qml/qml/v4vm/llvm_runtime.cpp
index 4fd4a68688..89d057d2a1 100644
--- a/src/qml/qml/v4vm/llvm_runtime.cpp
+++ b/src/qml/qml/v4vm/llvm_runtime.cpp
@@ -45,7 +45,7 @@
#include <stdio.h>
#include <setjmp.h>
-using namespace QQmlJS::VM;
+using namespace QV4;
extern "C" {
diff --git a/src/qml/qml/v4vm/moth/qv4instr_moth_p.h b/src/qml/qml/v4vm/moth/qv4instr_moth_p.h
index 9909f727d6..599fa00f14 100644
--- a/src/qml/qml/v4vm/moth/qv4instr_moth_p.h
+++ b/src/qml/qml/v4vm/moth/qv4instr_moth_p.h
@@ -87,7 +87,7 @@ union Instr
TempType = 3,
ScopedLocalType = 4
};
- VM::Value value;
+ QV4::Value value;
unsigned type : 3;
unsigned scope : 29;
unsigned index;
@@ -98,7 +98,7 @@ union Instr
bool isTemp() const { return type == TempType; }
bool isScopedLocal() const { return type == ScopedLocalType; }
- static Param createValue(const VM::Value &v)
+ static Param createValue(const QV4::Value &v)
{
Param p;
p.type = ValueType;
@@ -167,28 +167,28 @@ union Instr
};
struct instr_loadClosure {
MOTH_INSTR_HEADER
- VM::Function *value;
+ QV4::Function *value;
Param result;
};
struct instr_loadName {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
Param result;
};
struct instr_storeName {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
Param source;
};
struct instr_loadProperty {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
Param base;
Param result;
};
struct instr_storeProperty {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
Param base;
Param source;
};
@@ -212,7 +212,7 @@ union Instr
MOTH_INSTR_HEADER
ptrdiff_t tryOffset;
ptrdiff_t catchOffset;
- VM::String *exceptionVarName;
+ QV4::String *exceptionVarName;
Param exceptionVar;
};
struct instr_callValue {
@@ -224,7 +224,7 @@ union Instr
};
struct instr_callProperty {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
quint32 argc;
quint32 args;
Param base;
@@ -240,7 +240,7 @@ union Instr
};
struct instr_callActivationProperty {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
quint32 argc;
quint32 args;
Param result;
@@ -271,7 +271,7 @@ union Instr
};
struct instr_callBuiltinDeleteMember {
MOTH_INSTR_HEADER
- VM::String *member;
+ QV4::String *member;
Param base;
Param result;
};
@@ -283,12 +283,12 @@ union Instr
};
struct instr_callBuiltinDeleteName {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
Param result;
};
struct instr_callBuiltinTypeofMember {
MOTH_INSTR_HEADER
- VM::String *member;
+ QV4::String *member;
Param base;
Param result;
};
@@ -300,7 +300,7 @@ union Instr
};
struct instr_callBuiltinTypeofName {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
Param result;
};
struct instr_callBuiltinTypeofValue {
@@ -311,7 +311,7 @@ union Instr
struct instr_callBuiltinPostIncMember {
MOTH_INSTR_HEADER
Param base;
- VM::String *member;
+ QV4::String *member;
Param result;
};
struct instr_callBuiltinPostIncSubscript {
@@ -322,7 +322,7 @@ union Instr
};
struct instr_callBuiltinPostIncName {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
Param result;
};
struct instr_callBuiltinPostIncValue {
@@ -333,7 +333,7 @@ union Instr
struct instr_callBuiltinPostDecMember {
MOTH_INSTR_HEADER
Param base;
- VM::String *member;
+ QV4::String *member;
Param result;
};
struct instr_callBuiltinPostDecSubscript {
@@ -344,7 +344,7 @@ union Instr
};
struct instr_callBuiltinPostDecName {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
Param result;
};
struct instr_callBuiltinPostDecValue {
@@ -354,19 +354,19 @@ union Instr
};
struct instr_callBuiltinDeclareVar {
MOTH_INSTR_HEADER
- VM::String *varName;
+ QV4::String *varName;
bool isDeletable;
};
struct instr_callBuiltinDefineGetterSetter {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
Param object;
Param getter;
Param setter;
};
struct instr_callBuiltinDefineProperty {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
Param object;
Param value;
};
@@ -385,7 +385,7 @@ union Instr
};
struct instr_createProperty {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
quint32 argc;
quint32 args;
Param base;
@@ -393,7 +393,7 @@ union Instr
};
struct instr_createActivationProperty {
MOTH_INSTR_HEADER
- VM::String *name;
+ QV4::String *name;
quint32 argc;
quint32 args;
Param result;
@@ -409,13 +409,13 @@ union Instr
};
struct instr_unop {
MOTH_INSTR_HEADER
- VM::UnaryOpName alu;
+ QV4::UnaryOpName alu;
Param source;
Param result;
};
struct instr_binop {
MOTH_INSTR_HEADER
- VM::BinOp alu;
+ QV4::BinOp alu;
Param lhs;
Param rhs;
Param result;
@@ -426,22 +426,22 @@ union Instr
};
struct instr_inplaceElementOp {
MOTH_INSTR_HEADER
- VM::InplaceBinOpElement alu;
+ QV4::InplaceBinOpElement alu;
Param base;
Param index;
Param source;
};
struct instr_inplaceMemberOp {
MOTH_INSTR_HEADER
- VM::InplaceBinOpMember alu;
- VM::String *member;
+ QV4::InplaceBinOpMember alu;
+ QV4::String *member;
Param base;
Param source;
};
struct instr_inplaceNameOp {
MOTH_INSTR_HEADER
- VM::InplaceBinOpName alu;
- VM::String *name;
+ QV4::InplaceBinOpName alu;
+ QV4::String *name;
Param source;
};
diff --git a/src/qml/qml/v4vm/moth/qv4isel_moth.cpp b/src/qml/qml/v4vm/moth/qv4isel_moth.cpp
index 1e9316f49b..14010de59d 100644
--- a/src/qml/qml/v4vm/moth/qv4isel_moth.cpp
+++ b/src/qml/qml/v4vm/moth/qv4isel_moth.cpp
@@ -10,7 +10,7 @@ using namespace QQmlJS::Moth;
namespace {
-inline VM::BinOp aluOpFunction(V4IR::AluOp op)
+inline QV4::BinOp aluOpFunction(V4IR::AluOp op)
{
switch (op) {
case V4IR::OpInvalid:
@@ -26,47 +26,47 @@ inline VM::BinOp aluOpFunction(V4IR::AluOp op)
case V4IR::OpCompl:
return 0;
case V4IR::OpBitAnd:
- return VM::__qmljs_bit_and;
+ return QV4::__qmljs_bit_and;
case V4IR::OpBitOr:
- return VM::__qmljs_bit_or;
+ return QV4::__qmljs_bit_or;
case V4IR::OpBitXor:
- return VM::__qmljs_bit_xor;
+ return QV4::__qmljs_bit_xor;
case V4IR::OpAdd:
- return VM::__qmljs_add;
+ return QV4::__qmljs_add;
case V4IR::OpSub:
- return VM::__qmljs_sub;
+ return QV4::__qmljs_sub;
case V4IR::OpMul:
- return VM::__qmljs_mul;
+ return QV4::__qmljs_mul;
case V4IR::OpDiv:
- return VM::__qmljs_div;
+ return QV4::__qmljs_div;
case V4IR::OpMod:
- return VM::__qmljs_mod;
+ return QV4::__qmljs_mod;
case V4IR::OpLShift:
- return VM::__qmljs_shl;
+ return QV4::__qmljs_shl;
case V4IR::OpRShift:
- return VM::__qmljs_shr;
+ return QV4::__qmljs_shr;
case V4IR::OpURShift:
- return VM::__qmljs_ushr;
+ return QV4::__qmljs_ushr;
case V4IR::OpGt:
- return VM::__qmljs_gt;
+ return QV4::__qmljs_gt;
case V4IR::OpLt:
- return VM::__qmljs_lt;
+ return QV4::__qmljs_lt;
case V4IR::OpGe:
- return VM::__qmljs_ge;
+ return QV4::__qmljs_ge;
case V4IR::OpLe:
- return VM::__qmljs_le;
+ return QV4::__qmljs_le;
case V4IR::OpEqual:
- return VM::__qmljs_eq;
+ return QV4::__qmljs_eq;
case V4IR::OpNotEqual:
- return VM::__qmljs_ne;
+ return QV4::__qmljs_ne;
case V4IR::OpStrictEqual:
- return VM::__qmljs_se;
+ return QV4::__qmljs_se;
case V4IR::OpStrictNotEqual:
- return VM::__qmljs_sne;
+ return QV4::__qmljs_sne;
case V4IR::OpInstanceof:
- return VM::__qmljs_instanceof;
+ return QV4::__qmljs_instanceof;
case V4IR::OpIn:
- return VM::__qmljs_in;
+ return QV4::__qmljs_in;
case V4IR::OpAnd:
return 0;
case V4IR::OpOr:
@@ -79,7 +79,7 @@ inline VM::BinOp aluOpFunction(V4IR::AluOp op)
} // anonymous namespace
-InstructionSelection::InstructionSelection(VM::ExecutionEngine *engine, V4IR::Module *module)
+InstructionSelection::InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module)
: EvalInstructionSelection(engine, module)
, _function(0)
, _vmFunction(0)
@@ -94,7 +94,7 @@ InstructionSelection::~InstructionSelection()
{
}
-void InstructionSelection::run(VM::Function *vmFunction, V4IR::Function *function)
+void InstructionSelection::run(QV4::Function *vmFunction, V4IR::Function *function)
{
V4IR::BasicBlock *block;
@@ -227,14 +227,14 @@ void InstructionSelection::loadConst(V4IR::Const *sourceConst, V4IR::Temp *targe
void InstructionSelection::loadString(const QString &str, V4IR::Temp *targetTemp)
{
Instruction::LoadValue load;
- load.value = Instr::Param::createValue(VM::Value::fromString(identifier(str)));
+ load.value = Instr::Param::createValue(QV4::Value::fromString(identifier(str)));
load.result = getResultParam(targetTemp);
addInstruction(load);
}
void InstructionSelection::loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp)
{
- VM::Value v = VM::Value::fromObject(engine()->newRegExpObject(
+ QV4::Value v = QV4::Value::fromObject(engine()->newRegExpObject(
*sourceRegexp->value,
sourceRegexp->flags));
_vmFunction->generatedValues.append(v);
@@ -263,7 +263,7 @@ void InstructionSelection::setActivationProperty(V4IR::Temp *source, const QStri
void InstructionSelection::initClosure(V4IR::Closure *closure, V4IR::Temp *target)
{
- VM::Function *vmFunc = vmFunction(closure->value);
+ QV4::Function *vmFunc = vmFunction(closure->value);
assert(vmFunc);
Instruction::LoadClosure load;
load.value = vmFunc;
@@ -317,15 +317,15 @@ void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetT
void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
{
- VM::UnaryOpName op = 0;
+ QV4::UnaryOpName op = 0;
switch (oper) {
case V4IR::OpIfTrue: assert(!"unreachable"); break;
- case V4IR::OpNot: op = VM::__qmljs_not; break;
- case V4IR::OpUMinus: op = VM::__qmljs_uminus; break;
- case V4IR::OpUPlus: op = VM::__qmljs_uplus; break;
- case V4IR::OpCompl: op = VM::__qmljs_compl; break;
- case V4IR::OpIncrement: op = VM::__qmljs_increment; break;
- case V4IR::OpDecrement: op = VM::__qmljs_decrement; break;
+ case V4IR::OpNot: op = QV4::__qmljs_not; break;
+ case V4IR::OpUMinus: op = QV4::__qmljs_uminus; break;
+ case V4IR::OpUPlus: op = QV4::__qmljs_uplus; break;
+ case V4IR::OpCompl: op = QV4::__qmljs_compl; break;
+ case V4IR::OpIncrement: op = QV4::__qmljs_increment; break;
+ case V4IR::OpDecrement: op = QV4::__qmljs_decrement; break;
default: assert(!"unreachable"); break;
} // switch
@@ -352,19 +352,19 @@ void InstructionSelection::binop(V4IR::AluOp oper, V4IR::Temp *leftSource, V4IR:
void InstructionSelection::inplaceNameOp(V4IR::AluOp oper, V4IR::Temp *rightSource, const QString &targetName)
{
- VM::InplaceBinOpName op = 0;
+ QV4::InplaceBinOpName op = 0;
switch (oper) {
- case V4IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_name; break;
- case V4IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_name; break;
- case V4IR::OpBitXor: op = VM::__qmljs_inplace_bit_xor_name; break;
- case V4IR::OpAdd: op = VM::__qmljs_inplace_add_name; break;
- case V4IR::OpSub: op = VM::__qmljs_inplace_sub_name; break;
- case V4IR::OpMul: op = VM::__qmljs_inplace_mul_name; break;
- case V4IR::OpDiv: op = VM::__qmljs_inplace_div_name; break;
- case V4IR::OpMod: op = VM::__qmljs_inplace_mod_name; break;
- case V4IR::OpLShift: op = VM::__qmljs_inplace_shl_name; break;
- case V4IR::OpRShift: op = VM::__qmljs_inplace_shr_name; break;
- case V4IR::OpURShift: op = VM::__qmljs_inplace_ushr_name; break;
+ case V4IR::OpBitAnd: op = QV4::__qmljs_inplace_bit_and_name; break;
+ case V4IR::OpBitOr: op = QV4::__qmljs_inplace_bit_or_name; break;
+ case V4IR::OpBitXor: op = QV4::__qmljs_inplace_bit_xor_name; break;
+ case V4IR::OpAdd: op = QV4::__qmljs_inplace_add_name; break;
+ case V4IR::OpSub: op = QV4::__qmljs_inplace_sub_name; break;
+ case V4IR::OpMul: op = QV4::__qmljs_inplace_mul_name; break;
+ case V4IR::OpDiv: op = QV4::__qmljs_inplace_div_name; break;
+ case V4IR::OpMod: op = QV4::__qmljs_inplace_mod_name; break;
+ case V4IR::OpLShift: op = QV4::__qmljs_inplace_shl_name; break;
+ case V4IR::OpRShift: op = QV4::__qmljs_inplace_shr_name; break;
+ case V4IR::OpURShift: op = QV4::__qmljs_inplace_ushr_name; break;
default: break;
}
@@ -379,19 +379,19 @@ void InstructionSelection::inplaceNameOp(V4IR::AluOp oper, V4IR::Temp *rightSour
void InstructionSelection::inplaceElementOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBaseTemp, V4IR::Temp *targetIndexTemp)
{
- VM::InplaceBinOpElement op = 0;
+ QV4::InplaceBinOpElement op = 0;
switch (oper) {
- case V4IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_element; break;
- case V4IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_element; break;
- case V4IR::OpBitXor: op = VM::__qmljs_inplace_bit_xor_element; break;
- case V4IR::OpAdd: op = VM::__qmljs_inplace_add_element; break;
- case V4IR::OpSub: op = VM::__qmljs_inplace_sub_element; break;
- case V4IR::OpMul: op = VM::__qmljs_inplace_mul_element; break;
- case V4IR::OpDiv: op = VM::__qmljs_inplace_div_element; break;
- case V4IR::OpMod: op = VM::__qmljs_inplace_mod_element; break;
- case V4IR::OpLShift: op = VM::__qmljs_inplace_shl_element; break;
- case V4IR::OpRShift: op = VM::__qmljs_inplace_shr_element; break;
- case V4IR::OpURShift: op = VM::__qmljs_inplace_ushr_element; break;
+ case V4IR::OpBitAnd: op = QV4::__qmljs_inplace_bit_and_element; break;
+ case V4IR::OpBitOr: op = QV4::__qmljs_inplace_bit_or_element; break;
+ case V4IR::OpBitXor: op = QV4::__qmljs_inplace_bit_xor_element; break;
+ case V4IR::OpAdd: op = QV4::__qmljs_inplace_add_element; break;
+ case V4IR::OpSub: op = QV4::__qmljs_inplace_sub_element; break;
+ case V4IR::OpMul: op = QV4::__qmljs_inplace_mul_element; break;
+ case V4IR::OpDiv: op = QV4::__qmljs_inplace_div_element; break;
+ case V4IR::OpMod: op = QV4::__qmljs_inplace_mod_element; break;
+ case V4IR::OpLShift: op = QV4::__qmljs_inplace_shl_element; break;
+ case V4IR::OpRShift: op = QV4::__qmljs_inplace_shr_element; break;
+ case V4IR::OpURShift: op = QV4::__qmljs_inplace_ushr_element; break;
default: break;
}
@@ -405,19 +405,19 @@ void InstructionSelection::inplaceElementOp(V4IR::AluOp oper, V4IR::Temp *source
void InstructionSelection::inplaceMemberOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName)
{
- VM::InplaceBinOpMember op = 0;
+ QV4::InplaceBinOpMember op = 0;
switch (oper) {
- case V4IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_member; break;
- case V4IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_member; break;
- case V4IR::OpBitXor: op = VM::__qmljs_inplace_bit_xor_member; break;
- case V4IR::OpAdd: op = VM::__qmljs_inplace_add_member; break;
- case V4IR::OpSub: op = VM::__qmljs_inplace_sub_member; break;
- case V4IR::OpMul: op = VM::__qmljs_inplace_mul_member; break;
- case V4IR::OpDiv: op = VM::__qmljs_inplace_div_member; break;
- case V4IR::OpMod: op = VM::__qmljs_inplace_mod_member; break;
- case V4IR::OpLShift: op = VM::__qmljs_inplace_shl_member; break;
- case V4IR::OpRShift: op = VM::__qmljs_inplace_shr_member; break;
- case V4IR::OpURShift: op = VM::__qmljs_inplace_ushr_member; break;
+ case V4IR::OpBitAnd: op = QV4::__qmljs_inplace_bit_and_member; break;
+ case V4IR::OpBitOr: op = QV4::__qmljs_inplace_bit_or_member; break;
+ case V4IR::OpBitXor: op = QV4::__qmljs_inplace_bit_xor_member; break;
+ case V4IR::OpAdd: op = QV4::__qmljs_inplace_add_member; break;
+ case V4IR::OpSub: op = QV4::__qmljs_inplace_sub_member; break;
+ case V4IR::OpMul: op = QV4::__qmljs_inplace_mul_member; break;
+ case V4IR::OpDiv: op = QV4::__qmljs_inplace_div_member; break;
+ case V4IR::OpMod: op = QV4::__qmljs_inplace_mod_member; break;
+ case V4IR::OpLShift: op = QV4::__qmljs_inplace_shl_member; break;
+ case V4IR::OpRShift: op = QV4::__qmljs_inplace_shr_member; break;
+ case V4IR::OpURShift: op = QV4::__qmljs_inplace_ushr_member; break;
default: break;
}
@@ -600,7 +600,7 @@ void InstructionSelection::callBuiltinDeleteName(const QString &name, V4IR::Temp
void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result)
{
Instruction::LoadValue load;
- load.value = Instr::Param::createValue(VM::Value::fromBoolean(false));
+ load.value = Instr::Param::createValue(QV4::Value::fromBoolean(false));
load.result = getResultParam(result);
addInstruction(load);
}
@@ -804,9 +804,9 @@ uchar *InstructionSelection::squeezeCode() const
return squeezed;
}
-VM::String *InstructionSelection::identifier(const QString &s)
+QV4::String *InstructionSelection::identifier(const QString &s)
{
- VM::String *str = engine()->newIdentifier(s);
+ QV4::String *str = engine()->newIdentifier(s);
_vmFunction->identifiers.append(str);
return str;
}
diff --git a/src/qml/qml/v4vm/moth/qv4isel_moth_p.h b/src/qml/qml/v4vm/moth/qv4isel_moth_p.h
index 4c31ecc5fc..8bbcc2fd3f 100644
--- a/src/qml/qml/v4vm/moth/qv4isel_moth_p.h
+++ b/src/qml/qml/v4vm/moth/qv4isel_moth_p.h
@@ -15,10 +15,10 @@ class Q_QML_EXPORT InstructionSelection:
public EvalInstructionSelection
{
public:
- InstructionSelection(VM::ExecutionEngine *engine, V4IR::Module *module);
+ InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module);
~InstructionSelection();
- virtual void run(VM::Function *vmFunction, V4IR::Function *function);
+ virtual void run(QV4::Function *vmFunction, V4IR::Function *function);
protected:
virtual void visitJump(V4IR::Jump *);
@@ -133,10 +133,10 @@ private:
void patchJumpAddresses();
uchar *squeezeCode() const;
- VM::String *identifier(const QString &s);
+ QV4::String *identifier(const QString &s);
V4IR::Function *_function;
- VM::Function *_vmFunction;
+ QV4::Function *_vmFunction;
V4IR::BasicBlock *_block;
QHash<V4IR::BasicBlock *, QVector<ptrdiff_t> > _patches;
@@ -151,7 +151,7 @@ class Q_QML_EXPORT ISelFactory: public EvalISelFactory
{
public:
virtual ~ISelFactory() {}
- virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine, V4IR::Module *module)
+ virtual EvalInstructionSelection *create(QV4::ExecutionEngine *engine, V4IR::Module *module)
{ return new InstructionSelection(engine, module); }
};
diff --git a/src/qml/qml/v4vm/moth/qv4vme_moth.cpp b/src/qml/qml/v4vm/moth/qv4vme_moth.cpp
index 198f623a64..a4dde96a4b 100644
--- a/src/qml/qml/v4vm/moth/qv4vme_moth.cpp
+++ b/src/qml/qml/v4vm/moth/qv4vme_moth.cpp
@@ -21,20 +21,20 @@ using namespace QQmlJS::Moth;
class FunctionState: public Debugging::FunctionState
{
public:
- FunctionState(QQmlJS::VM::ExecutionContext *context, const uchar **code)
+ FunctionState(QV4::ExecutionContext *context, const uchar **code)
: Debugging::FunctionState(context)
, stack(0)
, stackSize(0)
, code(code)
{}
- virtual VM::Value *temp(unsigned idx) { return stack + idx; }
+ virtual QV4::Value *temp(unsigned idx) { return stack + idx; }
- void setStack(VM::Value *stack, unsigned stackSize)
+ void setStack(QV4::Value *stack, unsigned stackSize)
{ this->stack = stack; this->stackSize = stackSize; }
private:
- VM::Value *stack;
+ QV4::Value *stack;
unsigned stackSize;
const uchar **code;
};
@@ -110,8 +110,8 @@ static VMStats vmStats;
#define VMSTATS(what) {}
#endif // WITH_STATS
-static inline VM::Value *getValueRef(QQmlJS::VM::ExecutionContext *context,
- VM::Value* stack,
+static inline QV4::Value *getValueRef(QV4::ExecutionContext *context,
+ QV4::Value* stack,
const Instr::Param &param
#if !defined(QT_NO_DEBUG)
, unsigned stackSize
@@ -136,14 +136,14 @@ static inline VM::Value *getValueRef(QQmlJS::VM::ExecutionContext *context,
if (param.isValue()) {
VMSTATS(paramIsValue);
- return const_cast<VM::Value *>(&param.value);
+ return const_cast<QV4::Value *>(&param.value);
} else if (param.isArgument()) {
VMSTATS(paramIsArg);
- VM::ExecutionContext *c = context;
+ QV4::ExecutionContext *c = context;
uint scope = param.scope;
while (scope--)
c = c->outer;
- VM::CallContext *cc = static_cast<VM::CallContext *>(c);
+ QV4::CallContext *cc = static_cast<QV4::CallContext *>(c);
const unsigned arg = param.index;
Q_ASSERT(arg >= 0);
Q_ASSERT((unsigned) arg < cc->argumentCount);
@@ -152,7 +152,7 @@ static inline VM::Value *getValueRef(QQmlJS::VM::ExecutionContext *context,
} else if (param.isLocal()) {
VMSTATS(paramIsLocal);
const unsigned index = param.index;
- VM::CallContext *c = static_cast<VM::CallContext *>(context);
+ QV4::CallContext *c = static_cast<QV4::CallContext *>(context);
Q_ASSERT(index >= 0);
Q_ASSERT(index < context->variableCount());
Q_ASSERT(c->locals);
@@ -163,12 +163,12 @@ static inline VM::Value *getValueRef(QQmlJS::VM::ExecutionContext *context,
return stack + param.index;
} else if (param.isScopedLocal()) {
VMSTATS(paramIsScopedLocal);
- VM::ExecutionContext *c = context;
+ QV4::ExecutionContext *c = context;
uint scope = param.scope;
while (scope--)
c = c->outer;
const unsigned index = param.index;
- VM::CallContext *cc = static_cast<VM::CallContext *>(c);
+ QV4::CallContext *cc = static_cast<QV4::CallContext *>(c);
Q_ASSERT(index >= 0);
Q_ASSERT(index < cc->variableCount());
Q_ASSERT(cc->locals);
@@ -185,15 +185,15 @@ static inline VM::Value *getValueRef(QQmlJS::VM::ExecutionContext *context,
// The non-temp case might need some tweaking for QML: there it would probably be a value instead of a local.
# define VALUEPTR(param) \
param.isTemp() ? stack + param.index \
- : (param.isLocal() ? static_cast<VM::CallContext *>(context)->locals + param.index \
+ : (param.isLocal() ? static_cast<QV4::CallContext *>(context)->locals + param.index \
: getValueRef(context, stack, param))
#else
# define VALUE(param) *getValueRef(context, stack, param, stackSize)
# define VALUEPTR(param) getValueRef(context, stack, param, stackSize)
#endif
-VM::Value VME::run(QQmlJS::VM::ExecutionContext *context, const uchar *&code,
- VM::Value *stack, unsigned stackSize
+QV4::Value VME::run(QV4::ExecutionContext *context, const uchar *&code,
+ QV4::Value *stack, unsigned stackSize
#ifdef MOTH_THREADED_INTERPRETER
, void ***storeJumpTable
#endif
@@ -211,7 +211,7 @@ VM::Value VME::run(QQmlJS::VM::ExecutionContext *context, const uchar *&code,
};
#undef MOTH_INSTR_ADDR
*storeJumpTable = jumpTable;
- return VM::Value::undefinedValue();
+ return QV4::Value::undefinedValue();
}
#endif
@@ -268,14 +268,14 @@ VM::Value VME::run(QQmlJS::VM::ExecutionContext *context, const uchar *&code,
MOTH_BEGIN_INSTR(Push)
TRACE(inline, "stack size: %u", instr.value);
stackSize = instr.value;
- stack = static_cast<VM::Value *>(alloca(stackSize * sizeof(VM::Value)));
+ stack = static_cast<QV4::Value *>(alloca(stackSize * sizeof(QV4::Value)));
state.setStack(stack, stackSize);
MOTH_END_INSTR(Push)
MOTH_BEGIN_INSTR(CallValue)
#ifdef DO_TRACE_INSTR
if (Debugging::Debugger *debugger = context->engine->debugger) {
- if (VM::FunctionObject *o = (VALUE(instr.dest)).asFunctionObject()) {
+ if (QV4::FunctionObject *o = (VALUE(instr.dest)).asFunctionObject()) {
if (Debugging::FunctionDebugInfo *info = debugger->debugInfo(o)) {
QString n = debugger->name(o);
std::cerr << "*** Call to \"" << (n.isNull() ? "<no name>" : qPrintable(n)) << "\" defined @" << info->startLine << ":" << info->startColumn << std::endl;
@@ -284,26 +284,26 @@ VM::Value VME::run(QQmlJS::VM::ExecutionContext *context, const uchar *&code,
}
#endif // DO_TRACE_INSTR
Q_ASSERT(instr.args + instr.argc <= stackSize);
- VM::Value *args = stack + instr.args;
+ QV4::Value *args = stack + instr.args;
__qmljs_call_value(context, VALUEPTR(instr.result), /*thisObject*/0, VALUE(instr.dest), args, instr.argc);
MOTH_END_INSTR(CallValue)
MOTH_BEGIN_INSTR(CallProperty)
TRACE(property name, "%s, args=%u, argc=%u, this=%s", qPrintable(instr.name->toQString()), instr.args, instr.argc, (VALUE(instr.base)).toString(context)->toQString().toUtf8().constData());
Q_ASSERT(instr.args + instr.argc <= stackSize);
- VM::Value *args = stack + instr.args;
+ QV4::Value *args = stack + instr.args;
__qmljs_call_property(context, VALUEPTR(instr.result), VALUE(instr.base), instr.name, args, instr.argc);
MOTH_END_INSTR(CallProperty)
MOTH_BEGIN_INSTR(CallElement)
Q_ASSERT(instr.args + instr.argc <= stackSize);
- VM::Value *args = stack + instr.args;
+ QV4::Value *args = stack + instr.args;
__qmljs_call_element(context, VALUEPTR(instr.result), VALUE(instr.base), VALUE(instr.index), args, instr.argc);
MOTH_END_INSTR(CallElement)
MOTH_BEGIN_INSTR(CallActivationProperty)
Q_ASSERT(instr.args + instr.argc <= stackSize);
- VM::Value *args = stack + instr.args;
+ QV4::Value *args = stack + instr.args;
__qmljs_call_activation_property(context, VALUEPTR(instr.result), instr.name, args, instr.argc);
MOTH_END_INSTR(CallActivationProperty)
@@ -312,21 +312,21 @@ VM::Value VME::run(QQmlJS::VM::ExecutionContext *context, const uchar *&code,
MOTH_END_INSTR(CallBuiltinThrow)
MOTH_BEGIN_INSTR(EnterTry)
- VALUE(instr.exceptionVar) = VM::Value::undefinedValue();
+ VALUE(instr.exceptionVar) = QV4::Value::undefinedValue();
try {
const uchar *tryCode = ((uchar *)&instr.tryOffset) + instr.tryOffset;
run(context, tryCode, stack, stackSize);
code = tryCode;
- } catch (VM::Exception &ex) {
+ } catch (QV4::Exception &ex) {
ex.accept(context);
VALUE(instr.exceptionVar) = ex.value();
try {
- VM::ExecutionContext *catchContext = __qmljs_builtin_push_catch_scope(instr.exceptionVarName, ex.value(), context);
+ QV4::ExecutionContext *catchContext = __qmljs_builtin_push_catch_scope(instr.exceptionVarName, ex.value(), context);
const uchar *catchCode = ((uchar *)&instr.catchOffset) + instr.catchOffset;
run(catchContext, catchCode, stack, stackSize);
code = catchCode;
context = __qmljs_builtin_pop_scope(catchContext);
- } catch (VM::Exception &ex) {
+ } catch (QV4::Exception &ex) {
ex.accept(context);
VALUE(instr.exceptionVar) = ex.value();
const uchar *catchCode = ((uchar *)&instr.catchOffset) + instr.catchOffset;
@@ -337,7 +337,7 @@ VM::Value VME::run(QQmlJS::VM::ExecutionContext *context, const uchar *&code,
MOTH_END_INSTR(EnterTry)
MOTH_BEGIN_INSTR(CallBuiltinFinishTry)
- return VM::Value();
+ return QV4::Value();
MOTH_END_INSTR(CallBuiltinFinishTry)
MOTH_BEGIN_INSTR(CallBuiltinPushScope)
@@ -430,26 +430,26 @@ VM::Value VME::run(QQmlJS::VM::ExecutionContext *context, const uchar *&code,
MOTH_BEGIN_INSTR(CallBuiltinDefineArray)
Q_ASSERT(instr.args + instr.argc <= stackSize);
- VM::Value *args = stack + instr.args;
+ QV4::Value *args = stack + instr.args;
__qmljs_builtin_define_array(context, VALUEPTR(instr.result), args, instr.argc);
MOTH_END_INSTR(CallBuiltinDefineArray)
MOTH_BEGIN_INSTR(CreateValue)
Q_ASSERT(instr.args + instr.argc <= stackSize);
- VM::Value *args = stack + instr.args;
+ QV4::Value *args = stack + instr.args;
__qmljs_construct_value(context, VALUEPTR(instr.result), VALUE(instr.func), args, instr.argc);
MOTH_END_INSTR(CreateValue)
MOTH_BEGIN_INSTR(CreateProperty)
Q_ASSERT(instr.args + instr.argc <= stackSize);
- VM::Value *args = stack + instr.args;
+ QV4::Value *args = stack + instr.args;
__qmljs_construct_property(context, VALUEPTR(instr.result), VALUE(instr.base), instr.name, args, instr.argc);
MOTH_END_INSTR(CreateProperty)
MOTH_BEGIN_INSTR(CreateActivationProperty)
TRACE(inline, "property name = %s, args = %d, argc = %d", instr.name->toQString().toUtf8().constData(), instr.args, instr.argc);
Q_ASSERT(instr.args + instr.argc <= stackSize);
- VM::Value *args = stack + instr.args;
+ QV4::Value *args = stack + instr.args;
__qmljs_construct_activation_property(context, VALUEPTR(instr.result), instr.name, args, instr.argc);
MOTH_END_INSTR(CreateActivationProperty)
@@ -473,7 +473,7 @@ VM::Value VME::run(QQmlJS::VM::ExecutionContext *context, const uchar *&code,
MOTH_END_INSTR(Binop)
MOTH_BEGIN_INSTR(Ret)
- VM::Value &result = VALUE(instr.result);
+ QV4::Value &result = VALUE(instr.result);
// TRACE(Ret, "returning value %s", result.toString(context)->toQString().toUtf8().constData());
return result;
MOTH_END_INSTR(Ret)
@@ -525,7 +525,7 @@ void **VME::instructionJumpTable()
}
#endif
-VM::Value VME::exec(VM::ExecutionContext *ctxt, const uchar *code)
+QV4::Value VME::exec(QV4::ExecutionContext *ctxt, const uchar *code)
{
VME vme;
return vme.run(ctxt, code);
diff --git a/src/qml/qml/v4vm/moth/qv4vme_moth_p.h b/src/qml/qml/v4vm/moth/qv4vme_moth_p.h
index cdd5adfaa2..3279bc3dd0 100644
--- a/src/qml/qml/v4vm/moth/qv4vme_moth_p.h
+++ b/src/qml/qml/v4vm/moth/qv4vme_moth_p.h
@@ -4,25 +4,25 @@
#include <private/qv4runtime_p.h>
#include "qv4instr_moth_p.h"
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct Value;
}
+namespace QQmlJS {
namespace Moth {
class VME
{
public:
- static VM::Value exec(VM::ExecutionContext *, const uchar *);
+ static QV4::Value exec(QV4::ExecutionContext *, const uchar *);
#ifdef MOTH_THREADED_INTERPRETER
static void **instructionJumpTable();
#endif
private:
- VM::Value run(QQmlJS::VM::ExecutionContext *, const uchar *&code,
- VM::Value *stack = 0, unsigned stackSize = 0
+ QV4::Value run(QV4::ExecutionContext *, const uchar *&code,
+ QV4::Value *stack = 0, unsigned stackSize = 0
#ifdef MOTH_THREADED_INTERPRETER
, void ***storeJumpTable = 0
#endif
diff --git a/src/qml/qml/v4vm/qv4argumentsobject.cpp b/src/qml/qml/v4vm/qv4argumentsobject.cpp
index 7ae2441f1d..914f219012 100644
--- a/src/qml/qml/v4vm/qv4argumentsobject.cpp
+++ b/src/qml/qml/v4vm/qv4argumentsobject.cpp
@@ -40,9 +40,7 @@
****************************************************************************/
#include <qv4argumentsobject_p.h>
-namespace QQmlJS {
-namespace VM {
-
+using namespace QV4;
static Value throwTypeError(SimpleCallContext *ctx)
{
@@ -171,6 +169,3 @@ void ArgumentsObject::markObjects(Managed *that)
}
Object::markObjects(that);
}
-
-}
-}
diff --git a/src/qml/qml/v4vm/qv4argumentsobject_p.h b/src/qml/qml/v4vm/qv4argumentsobject_p.h
index fd5d5f7b89..b1d5a53bd4 100644
--- a/src/qml/qml/v4vm/qv4argumentsobject_p.h
+++ b/src/qml/qml/v4vm/qv4argumentsobject_p.h
@@ -46,8 +46,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct ArgumentsGetterFunction: FunctionObject
{
@@ -91,7 +90,6 @@ protected:
};
}
-}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4arrayobject.cpp b/src/qml/qml/v4vm/qv4arrayobject.cpp
index 798bd6bd56..b489c784fc 100644
--- a/src/qml/qml/v4vm/qv4arrayobject.cpp
+++ b/src/qml/qml/v4vm/qv4arrayobject.cpp
@@ -42,7 +42,7 @@
#include "qv4arrayobject_p.h"
#include "qv4sparsearray_p.h"
-using namespace QQmlJS::VM;
+using namespace QV4;
DEFINE_MANAGED_VTABLE(ArrayCtor);
diff --git a/src/qml/qml/v4vm/qv4arrayobject_p.h b/src/qml/qml/v4vm/qv4arrayobject_p.h
index 7771baee4e..a76510c3ad 100644
--- a/src/qml/qml/v4vm/qv4arrayobject_p.h
+++ b/src/qml/qml/v4vm/qv4arrayobject_p.h
@@ -47,9 +47,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
-
+namespace QV4 {
struct ArrayCtor: FunctionObject
{
@@ -95,8 +93,7 @@ struct ArrayPrototype: ArrayObject
};
-} // end of namespace VM
-} // end of namespace QQmlJS
+} // namespace QV4
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4booleanobject.cpp b/src/qml/qml/v4vm/qv4booleanobject.cpp
index 55bf45a971..7c40b81c02 100644
--- a/src/qml/qml/v4vm/qv4booleanobject.cpp
+++ b/src/qml/qml/v4vm/qv4booleanobject.cpp
@@ -41,7 +41,7 @@
#include "qv4booleanobject_p.h"
-using namespace QQmlJS::VM;
+using namespace QV4;
DEFINE_MANAGED_VTABLE(BooleanCtor);
diff --git a/src/qml/qml/v4vm/qv4booleanobject_p.h b/src/qml/qml/v4vm/qv4booleanobject_p.h
index 0a50621970..79f5d4aa0b 100644
--- a/src/qml/qml/v4vm/qv4booleanobject_p.h
+++ b/src/qml/qml/v4vm/qv4booleanobject_p.h
@@ -47,8 +47,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct BooleanCtor: FunctionObject
{
@@ -71,8 +70,7 @@ struct BooleanPrototype: BooleanObject
};
-} // end of namespace VM
-} // end of namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4codegen.cpp b/src/qml/qml/v4vm/qv4codegen.cpp
index feddcceef1..eb01e666fe 100644
--- a/src/qml/qml/v4vm/qv4codegen.cpp
+++ b/src/qml/qml/v4vm/qv4codegen.cpp
@@ -619,7 +619,7 @@ private:
class Codegen::ScanFunctions: Visitor
{
- typedef TemporaryAssignment<bool> TemporaryBoolAssignment;
+ typedef QV4::TemporaryAssignment<bool> TemporaryBoolAssignment;
public:
ScanFunctions(Codegen *cg, const QString &sourceCode)
: _cg(cg)
@@ -985,7 +985,7 @@ private: // fields:
bool _allowFuncDecls;
};
-Codegen::Codegen(VM::ExecutionContext *context, bool strict)
+Codegen::Codegen(QV4::ExecutionContext *context, bool strict)
: _module(0)
, _function(0)
, _block(0)
@@ -1177,7 +1177,7 @@ V4IR::Expr *Codegen::unop(V4IR::AluOp op, V4IR::Expr *expr)
case V4IR::OpUPlus:
return expr;
case V4IR::OpCompl:
- return _block->CONST(V4IR::NumberType, ~VM::Value::toInt32(c->value));
+ return _block->CONST(V4IR::NumberType, ~QV4::Value::toInt32(c->value));
case V4IR::OpIncrement:
return _block->CONST(V4IR::NumberType, c->value + 1);
case V4IR::OpDecrement:
@@ -1216,13 +1216,13 @@ V4IR::Expr *Codegen::binop(V4IR::AluOp op, V4IR::Expr *left, V4IR::Expr *right)
case V4IR::OpGt: return _block->CONST(V4IR::BoolType, c1->value > c2->value);
case V4IR::OpLe: return _block->CONST(V4IR::BoolType, c1->value <= c2->value);
case V4IR::OpLt: return _block->CONST(V4IR::BoolType, c1->value < c2->value);
- case V4IR::OpLShift: return _block->CONST(V4IR::NumberType, VM::Value::toInt32(c1->value) << (VM::Value::toUInt32(c2->value) & 0x1f));
+ case V4IR::OpLShift: return _block->CONST(V4IR::NumberType, QV4::Value::toInt32(c1->value) << (QV4::Value::toUInt32(c2->value) & 0x1f));
case V4IR::OpMod: return _block->CONST(V4IR::NumberType, ::fmod(c1->value, c2->value));
case V4IR::OpMul: return _block->CONST(V4IR::NumberType, c1->value * c2->value);
case V4IR::OpOr: return _block->CONST(V4IR::NumberType, c1->value ? c1->value : c2->value);
- case V4IR::OpRShift: return _block->CONST(V4IR::NumberType, VM::Value::toInt32(c1->value) >> (VM::Value::toUInt32(c2->value) & 0x1f));
+ case V4IR::OpRShift: return _block->CONST(V4IR::NumberType, QV4::Value::toInt32(c1->value) >> (QV4::Value::toUInt32(c2->value) & 0x1f));
case V4IR::OpSub: return _block->CONST(V4IR::NumberType, c1->value - c2->value);
- case V4IR::OpURShift: return _block->CONST(V4IR::NumberType,VM::Value::toUInt32(c1->value) >> (VM::Value::toUInt32(c2->value) & 0x1f));
+ case V4IR::OpURShift: return _block->CONST(V4IR::NumberType,QV4::Value::toUInt32(c1->value) >> (QV4::Value::toUInt32(c2->value) & 0x1f));
case V4IR::OpInstanceof:
case V4IR::OpIn:
@@ -3231,7 +3231,7 @@ void Codegen::throwSyntaxErrorOnEvalOrArgumentsInStrictMode(V4IR::Expr *expr, co
void Codegen::throwSyntaxError(const SourceLocation &loc, const QString &detail)
{
- VM::DiagnosticMessage *msg = new VM::DiagnosticMessage;
+ QV4::DiagnosticMessage *msg = new QV4::DiagnosticMessage;
msg->fileName = _fileName;
msg->offset = loc.begin();
msg->startLine = loc.startLine;
@@ -3248,7 +3248,7 @@ void Codegen::throwSyntaxError(const SourceLocation &loc, const QString &detail)
void Codegen::throwReferenceError(const SourceLocation &loc, const QString &detail)
{
if (_context)
- _context->throwReferenceError(VM::Value::fromString(_context, detail));
+ _context->throwReferenceError(QV4::Value::fromString(_context, detail));
else if (_errorHandler)
throwSyntaxError(loc, detail);
else
diff --git a/src/qml/qml/v4vm/qv4codegen_p.h b/src/qml/qml/v4vm/qv4codegen_p.h
index 2e7ca47f3e..9e95d89a4e 100644
--- a/src/qml/qml/v4vm/qv4codegen_p.h
+++ b/src/qml/qml/v4vm/qv4codegen_p.h
@@ -48,31 +48,31 @@
#include <QtCore/QStringList>
#include <assert.h>
-namespace QQmlJS {
-
-namespace AST {
-class UiParameterList;
-}
-
-namespace VM {
+namespace QV4 {
struct DiagnosticMessage;
struct ExecutionContext;
}
+namespace QQmlJS {
+namespace AST {
+class UiParameterList;
+}
namespace Debugging {
class Debugger;
} // namespace Debugging
+
+
class ErrorHandler
{
public:
- virtual void syntaxError(VM::DiagnosticMessage *message) = 0;
+ virtual void syntaxError(QV4::DiagnosticMessage *message) = 0;
};
class Q_QML_EXPORT Codegen: protected AST::Visitor
{
public:
- Codegen(VM::ExecutionContext *ctx, bool strict);
+ Codegen(QV4::ExecutionContext *ctx, bool strict);
Codegen(ErrorHandler *errorHandler, bool strictMode);
enum Mode {
@@ -431,7 +431,7 @@ private:
ScopeAndFinally *_scopeAndFinally;
QHash<AST::Node *, Environment *> _envMap;
QHash<AST::FunctionExpression *, int> _functionMap;
- VM::ExecutionContext *_context;
+ QV4::ExecutionContext *_context;
bool _strictMode;
Debugging::Debugger *_debugger;
ErrorHandler *_errorHandler;
@@ -439,6 +439,6 @@ private:
class ScanFunctions;
};
-} // end of namespace QQmlJS
+}
#endif // QV4CODEGEN_P_H
diff --git a/src/qml/qml/v4vm/qv4context.cpp b/src/qml/qml/v4vm/qv4context.cpp
index 7d8e87d793..1c978f8600 100644
--- a/src/qml/qml/v4vm/qv4context.cpp
+++ b/src/qml/qml/v4vm/qv4context.cpp
@@ -47,8 +47,7 @@
#include "qv4mm_p.h"
#include <qv4argumentsobject_p.h>
-namespace QQmlJS {
-namespace VM {
+using namespace QV4;
DiagnosticMessage::DiagnosticMessage()
: offset(0)
@@ -70,7 +69,7 @@ String *DiagnosticMessage::buildFullMessage(ExecutionContext *ctx) const
if (!fileName.isEmpty())
msg = fileName + QLatin1Char(':');
msg += QString::number(startLine) + QLatin1Char(':') + QString::number(startColumn) + QLatin1String(": ");
- if (type == QQmlJS::VM::DiagnosticMessage::Error)
+ if (type == QV4::DiagnosticMessage::Error)
msg += QLatin1String("error");
else
msg += QLatin1String("warning");
@@ -263,7 +262,7 @@ void ExecutionContext::mark()
thisObject.mark();
if (type >= Type_SimpleCallContext) {
- VM::CallContext *c = static_cast<CallContext *>(this);
+ QV4::CallContext *c = static_cast<CallContext *>(this);
for (unsigned arg = 0, lastArg = c->argumentCount; arg < lastArg; ++arg)
c->arguments[arg].mark();
if (type >= Type_CallContext) {
@@ -358,7 +357,7 @@ Value ExecutionContext::getProperty(String *name)
}
else if (ctx->type >= Type_CallContext) {
- VM::CallContext *c = static_cast<CallContext *>(ctx);
+ QV4::CallContext *c = static_cast<CallContext *>(ctx);
FunctionObject *f = c->function;
if (f->needsActivation || hasWith || hasCatchScope) {
for (unsigned int i = 0; i < f->varCount; ++i)
@@ -420,7 +419,7 @@ Value ExecutionContext::getPropertyNoThrow(String *name)
}
else if (ctx->type >= Type_CallContext) {
- VM::CallContext *c = static_cast<CallContext *>(ctx);
+ QV4::CallContext *c = static_cast<CallContext *>(ctx);
FunctionObject *f = c->function;
if (f->needsActivation || hasWith || hasCatchScope) {
for (unsigned int i = 0; i < f->varCount; ++i)
@@ -483,7 +482,7 @@ Value ExecutionContext::getPropertyAndBase(String *name, Object **base)
}
else if (ctx->type >= Type_CallContext) {
- VM::CallContext *c = static_cast<CallContext *>(ctx);
+ QV4::CallContext *c = static_cast<CallContext *>(ctx);
FunctionObject *f = c->function;
if (f->needsActivation || hasWith || hasCatchScope) {
for (unsigned int i = 0; i < f->varCount; ++i)
@@ -571,6 +570,3 @@ void ExecutionContext::throwURIError(Value msg)
{
throwError(Value::fromObject(engine->newURIErrorObject(this, msg)));
}
-
-} // namespace VM
-} // namespace QQmlJS
diff --git a/src/qml/qml/v4vm/qv4context_p.h b/src/qml/qml/v4vm/qv4context_p.h
index e1768f4e47..1043965b46 100644
--- a/src/qml/qml/v4vm/qv4context_p.h
+++ b/src/qml/qml/v4vm/qv4context_p.h
@@ -46,8 +46,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct Value;
struct Object;
@@ -118,7 +117,7 @@ struct ExecutionContext
Value getProperty(String *name);
Value getPropertyNoThrow(String *name);
Value getPropertyAndBase(String *name, Object **base);
- void inplaceBitOp(String *name, const QQmlJS::VM::Value &value, BinOp op);
+ void inplaceBitOp(String *name, const QV4::Value &value, BinOp op);
bool deleteProperty(String *name);
inline Value argument(unsigned int index = 0);
@@ -137,7 +136,7 @@ struct SimpleCallContext : public ExecutionContext
struct CallContext : public SimpleCallContext
{
- void initCallContext(QQmlJS::VM::ExecutionEngine *engine);
+ void initCallContext(QV4::ExecutionEngine *engine);
bool needsOwnArguments() const;
Value *locals;
@@ -153,7 +152,7 @@ struct GlobalContext : public ExecutionContext
struct CatchContext : public ExecutionContext
{
- void init(ExecutionContext *p, String *exceptionVarName, const QQmlJS::VM::Value &exceptionValue);
+ void init(ExecutionContext *p, String *exceptionVarName, const QV4::Value &exceptionValue);
String *exceptionVarName;
Value exceptionValue;
@@ -186,8 +185,7 @@ inline CallContext *ExecutionContext::asCallContext()
sizeof(CallContext) + sizeof(Value) * (f->varCount + qMax((uint)argc, f->formalParameterCount))
#define stackContextSize (sizeof(CallContext) + 32*sizeof(Value))
-} // namespace VM
-} // namespace QQmlJS
+} // namespace QV4
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4dateobject.cpp b/src/qml/qml/v4vm/qv4dateobject.cpp
index f1504b3bb8..1d6ba4ba0a 100644
--- a/src/qml/qml/v4vm/qv4dateobject.cpp
+++ b/src/qml/qml/v4vm/qv4dateobject.cpp
@@ -74,7 +74,7 @@
# endif
#endif
-using namespace QQmlJS::VM;
+using namespace QV4;
static const double HoursPerDay = 24.0;
static const double MinutesPerHour = 60.0;
diff --git a/src/qml/qml/v4vm/qv4dateobject_p.h b/src/qml/qml/v4vm/qv4dateobject_p.h
index 2e5366edd7..729e146c96 100644
--- a/src/qml/qml/v4vm/qv4dateobject_p.h
+++ b/src/qml/qml/v4vm/qv4dateobject_p.h
@@ -49,8 +49,7 @@ QT_BEGIN_NAMESPACE
class QDateTime;
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct DateObject: Object {
Value value;
@@ -129,8 +128,7 @@ struct DatePrototype: DateObject
static Value method_toJSON(SimpleCallContext *ctx);
};
-} // end of namespace VM
-} // end of namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4debugging.cpp b/src/qml/qml/v4vm/qv4debugging.cpp
index 76190eb8c4..b68f3875de 100644
--- a/src/qml/qml/v4vm/qv4debugging.cpp
+++ b/src/qml/qml/v4vm/qv4debugging.cpp
@@ -49,7 +49,7 @@
using namespace QQmlJS;
using namespace QQmlJS::Debugging;
-FunctionState::FunctionState(VM::ExecutionContext *context)
+FunctionState::FunctionState(QV4::ExecutionContext *context)
: _context(context)
{
if (debugger())
@@ -62,17 +62,17 @@ FunctionState::~FunctionState()
debugger()->leaveFunction(this);
}
-VM::Value *FunctionState::argument(unsigned idx)
+QV4::Value *FunctionState::argument(unsigned idx)
{
- VM::CallContext *c = _context->asCallContext();
+ QV4::CallContext *c = _context->asCallContext();
if (!c || idx >= c->argumentCount)
return 0;
return c->arguments + idx;
}
-VM::Value *FunctionState::local(unsigned idx)
+QV4::Value *FunctionState::local(unsigned idx)
{
- VM::CallContext *c = _context->asCallContext();
+ QV4::CallContext *c = _context->asCallContext();
if (c && idx < c->variableCount())
return c->locals + idx;
return 0;
@@ -90,7 +90,7 @@ void printStackTrace()
}
#endif // DO_TRACE_INSTR
-Debugger::Debugger(VM::ExecutionEngine *engine)
+Debugger::Debugger(QV4::ExecutionEngine *engine)
: _engine(engine)
{
#ifdef LOW_LEVEL_DEBUGGING_HELPERS
@@ -117,12 +117,12 @@ void Debugger::setSourceLocation(V4IR::Function *function, unsigned line, unsign
_functionInfo[function]->setSourceLocation(line, column);
}
-void Debugger::mapFunction(VM::Function *vmf, V4IR::Function *irf)
+void Debugger::mapFunction(QV4::Function *vmf, V4IR::Function *irf)
{
_vmToIr.insert(vmf, irf);
}
-FunctionDebugInfo *Debugger::debugInfo(VM::FunctionObject *function) const
+FunctionDebugInfo *Debugger::debugInfo(QV4::FunctionObject *function) const
{
if (!function)
return 0;
@@ -133,7 +133,7 @@ FunctionDebugInfo *Debugger::debugInfo(VM::FunctionObject *function) const
return 0;
}
-QString Debugger::name(VM::FunctionObject *function) const
+QString Debugger::name(QV4::FunctionObject *function) const
{
if (FunctionDebugInfo *i = debugInfo(function))
return i->name;
@@ -141,12 +141,12 @@ QString Debugger::name(VM::FunctionObject *function) const
return QString();
}
-void Debugger::aboutToCall(VM::FunctionObject *function, VM::ExecutionContext *context)
+void Debugger::aboutToCall(QV4::FunctionObject *function, QV4::ExecutionContext *context)
{
_callStack.append(CallInfo(context, function));
}
-void Debugger::justLeft(VM::ExecutionContext *context)
+void Debugger::justLeft(QV4::ExecutionContext *context)
{
int idx = callIndex(context);
if (idx < 0)
@@ -172,7 +172,7 @@ void Debugger::leaveFunction(FunctionState *state)
_callStack[callIndex(state->context())].state = 0;
}
-void Debugger::aboutToThrow(const VM::Value &value)
+void Debugger::aboutToThrow(const QV4::Value &value)
{
qDebug() << "*** We are about to throw...:" << value.toString(currentState()->context())->toQString();
}
@@ -211,7 +211,7 @@ void Debugger::printStackTrace() const
}
}
-int Debugger::callIndex(VM::ExecutionContext *context)
+int Debugger::callIndex(QV4::ExecutionContext *context)
{
for (int idx = _callStack.size() - 1; idx >= 0; --idx) {
if (_callStack[idx].context == context)
@@ -221,14 +221,14 @@ int Debugger::callIndex(VM::ExecutionContext *context)
return -1;
}
-V4IR::Function *Debugger::irFunction(VM::Function *vmf) const
+V4IR::Function *Debugger::irFunction(QV4::Function *vmf) const
{
return _vmToIr[vmf];
}
-static void realDumpValue(VM::Value v, VM::ExecutionContext *ctx, std::string prefix)
+static void realDumpValue(QV4::Value v, QV4::ExecutionContext *ctx, std::string prefix)
{
- using namespace VM;
+ using namespace QV4;
using namespace std;
cout << prefix << "tag: " << hex << v.tag << dec << endl << prefix << "\t-> ";
switch (v.type()) {
@@ -271,21 +271,21 @@ static void realDumpValue(VM::Value v, VM::ExecutionContext *ctx, std::string pr
cout << prefix << "\t-> @" << hex << o << endl;
cout << prefix << "object type: " << o->internalType() << endl << prefix << "\t-> ";
switch (o->internalType()) {
- case VM::Managed::Type_Invalid: cout << "Invalid"; break;
- case VM::Managed::Type_String: cout << "String"; break;
- case VM::Managed::Type_Object: cout << "Object"; break;
- case VM::Managed::Type_ArrayObject: cout << "ArrayObject"; break;
- case VM::Managed::Type_FunctionObject: cout << "FunctionObject"; break;
- case VM::Managed::Type_BooleanObject: cout << "BooleanObject"; break;
- case VM::Managed::Type_NumberObject: cout << "NumberObject"; break;
- case VM::Managed::Type_StringObject: cout << "StringObject"; break;
- case VM::Managed::Type_DateObject: cout << "DateObject"; break;
- case VM::Managed::Type_RegExpObject: cout << "RegExpObject"; break;
- case VM::Managed::Type_ErrorObject: cout << "ErrorObject"; break;
- case VM::Managed::Type_ArgumentsObject: cout << "ArgumentsObject"; break;
- case VM::Managed::Type_JSONObject: cout << "JSONObject"; break;
- case VM::Managed::Type_MathObject: cout << "MathObject"; break;
- case VM::Managed::Type_ForeachIteratorObject: cout << "ForeachIteratorObject"; break;
+ case QV4::Managed::Type_Invalid: cout << "Invalid"; break;
+ case QV4::Managed::Type_String: cout << "String"; break;
+ case QV4::Managed::Type_Object: cout << "Object"; break;
+ case QV4::Managed::Type_ArrayObject: cout << "ArrayObject"; break;
+ case QV4::Managed::Type_FunctionObject: cout << "FunctionObject"; break;
+ case QV4::Managed::Type_BooleanObject: cout << "BooleanObject"; break;
+ case QV4::Managed::Type_NumberObject: cout << "NumberObject"; break;
+ case QV4::Managed::Type_StringObject: cout << "StringObject"; break;
+ case QV4::Managed::Type_DateObject: cout << "DateObject"; break;
+ case QV4::Managed::Type_RegExpObject: cout << "RegExpObject"; break;
+ case QV4::Managed::Type_ErrorObject: cout << "ErrorObject"; break;
+ case QV4::Managed::Type_ArgumentsObject: cout << "ArgumentsObject"; break;
+ case QV4::Managed::Type_JSONObject: cout << "JSONObject"; break;
+ case QV4::Managed::Type_MathObject: cout << "MathObject"; break;
+ case QV4::Managed::Type_ForeachIteratorObject: cout << "ForeachIteratorObject"; break;
default: cout << "UNKNOWN" << endl; return;
}
cout << endl;
@@ -302,7 +302,7 @@ static void realDumpValue(VM::Value v, VM::ExecutionContext *ctx, std::string pr
}
}
-void dumpValue(VM::Value v, VM::ExecutionContext *ctx)
+void dumpValue(QV4::Value v, QV4::ExecutionContext *ctx)
{
realDumpValue(v, ctx, std::string(""));
}
diff --git a/src/qml/qml/v4vm/qv4debugging_p.h b/src/qml/qml/v4vm/qv4debugging_p.h
index a5a34b8eed..94d676796e 100644
--- a/src/qml/qml/v4vm/qv4debugging_p.h
+++ b/src/qml/qml/v4vm/qv4debugging_p.h
@@ -79,30 +79,30 @@ struct FunctionDebugInfo { // TODO: use opaque d-pointers here
class FunctionState
{
public:
- FunctionState(VM::ExecutionContext *context);
+ FunctionState(QV4::ExecutionContext *context);
virtual ~FunctionState();
- virtual VM::Value *argument(unsigned idx);
- virtual VM::Value *local(unsigned idx);
- virtual VM::Value *temp(unsigned idx) = 0;
+ virtual QV4::Value *argument(unsigned idx);
+ virtual QV4::Value *local(unsigned idx);
+ virtual QV4::Value *temp(unsigned idx) = 0;
- VM::ExecutionContext *context() const
+ QV4::ExecutionContext *context() const
{ return _context; }
Debugger *debugger() const
{ return _context->engine->debugger; }
private:
- VM::ExecutionContext *_context;
+ QV4::ExecutionContext *_context;
};
struct CallInfo
{
- VM::ExecutionContext *context;
- VM::FunctionObject *function;
+ QV4::ExecutionContext *context;
+ QV4::FunctionObject *function;
FunctionState *state;
- CallInfo(VM::ExecutionContext *context = 0, VM::FunctionObject *function = 0, FunctionState *state = 0)
+ CallInfo(QV4::ExecutionContext *context = 0, QV4::FunctionObject *function = 0, FunctionState *state = 0)
: context(context)
, function(function)
, state(state)
@@ -112,24 +112,24 @@ struct CallInfo
class Q_QML_EXPORT Debugger
{
public:
- Debugger(VM::ExecutionEngine *_engine);
+ Debugger(QV4::ExecutionEngine *_engine);
~Debugger();
public: // compile-time interface
void addFunction(V4IR::Function *function);
void setSourceLocation(V4IR::Function *function, unsigned line, unsigned column);
- void mapFunction(VM::Function *vmf, V4IR::Function *irf);
+ void mapFunction(QV4::Function *vmf, V4IR::Function *irf);
public: // run-time querying interface
- FunctionDebugInfo *debugInfo(VM::FunctionObject *function) const;
- QString name(VM::FunctionObject *function) const;
+ FunctionDebugInfo *debugInfo(QV4::FunctionObject *function) const;
+ QString name(QV4::FunctionObject *function) const;
public: // execution hooks
- void aboutToCall(VM::FunctionObject *function, VM::ExecutionContext *context);
- void justLeft(VM::ExecutionContext *context);
+ void aboutToCall(QV4::FunctionObject *function, QV4::ExecutionContext *context);
+ void justLeft(QV4::ExecutionContext *context);
void enterFunction(FunctionState *state);
void leaveFunction(FunctionState *state);
- void aboutToThrow(const VM::Value &value);
+ void aboutToThrow(const QV4::Value &value);
public: // debugging hooks
FunctionState *currentState() const;
@@ -139,13 +139,13 @@ public: // debugging hooks
void printStackTrace() const;
private:
- int callIndex(VM::ExecutionContext *context);
- V4IR::Function *irFunction(VM::Function *vmf) const;
+ int callIndex(QV4::ExecutionContext *context);
+ V4IR::Function *irFunction(QV4::Function *vmf) const;
private: // TODO: use opaque d-pointers here
- VM::ExecutionEngine *_engine;
+ QV4::ExecutionEngine *_engine;
QHash<V4IR::Function *, FunctionDebugInfo *> _functionInfo;
- QHash<VM::Function *, V4IR::Function *> _vmToIr;
+ QHash<QV4::Function *, V4IR::Function *> _vmToIr;
QVector<CallInfo> _callStack;
};
diff --git a/src/qml/qml/v4vm/qv4engine.cpp b/src/qml/qml/v4vm/qv4engine.cpp
index cd0a16bfa5..85bc50b8f4 100644
--- a/src/qml/qml/v4vm/qv4engine.cpp
+++ b/src/qml/qml/v4vm/qv4engine.cpp
@@ -62,12 +62,11 @@
#include "qv4debugging_p.h"
#include "qv4executableallocator_p.h"
-namespace QQmlJS {
-namespace VM {
+using namespace QV4;
-ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
- : memoryManager(new QQmlJS::VM::MemoryManager)
- , executableAllocator(new QQmlJS::VM::ExecutableAllocator)
+ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
+ : memoryManager(new QV4::MemoryManager)
+ , executableAllocator(new QV4::ExecutableAllocator)
, bumperPointerAllocator(new WTF::BumpPointerAllocator)
, debugger(0)
, globalObject(0)
@@ -78,7 +77,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
MemoryManager::GCBlocker gcBlocker(memoryManager);
if (!factory)
- factory = new MASM::ISelFactory;
+ factory = new QQmlJS::MASM::ISelFactory;
iselFactory.reset(factory);
memoryManager->setExecutionEngine(this);
@@ -328,7 +327,7 @@ ExecutionContext *ExecutionEngine::pushGlobalContext()
Function *ExecutionEngine::newFunction(const QString &name)
{
- VM::Function *f = new VM::Function(newIdentifier(name));
+ Function *f = new Function(newIdentifier(name));
functions.append(f);
return f;
}
@@ -339,7 +338,7 @@ FunctionObject *ExecutionEngine::newBuiltinFunction(ExecutionContext *scope, Str
return f;
}
-FunctionObject *ExecutionEngine::newScriptFunction(ExecutionContext *scope, VM::Function *function)
+FunctionObject *ExecutionEngine::newScriptFunction(ExecutionContext *scope, Function *function)
{
assert(function);
@@ -417,12 +416,12 @@ Object *ExecutionEngine::newDateObject(const Value &value)
RegExpObject *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
{
- bool global = (flags & V4IR::RegExp::RegExp_Global);
+ bool global = (flags & QQmlJS::V4IR::RegExp::RegExp_Global);
bool ignoreCase = false;
bool multiline = false;
- if (flags & V4IR::RegExp::RegExp_IgnoreCase)
+ if (flags & QQmlJS::V4IR::RegExp::RegExp_IgnoreCase)
ignoreCase = true;
- if (flags & V4IR::RegExp::RegExp_Multiline)
+ if (flags & QQmlJS::V4IR::RegExp::RegExp_Multiline)
multiline = true;
return newRegExpObject(RegExp::create(this, pattern, ignoreCase, multiline), global);
@@ -543,11 +542,8 @@ Value ExecutionEngine::run(Function *function, ExecutionContext *ctx)
if (debugger)
debugger->aboutToCall(0, ctx);
- QQmlJS::VM::Value result = function->code(ctx, function->codeData);
+ QV4::Value result = function->code(ctx, function->codeData);
if (debugger)
debugger->justLeft(ctx);
return result;
}
-
-} // namespace VM
-} // namespace QQmlJS
diff --git a/src/qml/qml/v4vm/qv4engine_p.h b/src/qml/qml/v4vm/qv4engine_p.h
index 00466659fc..02e470d213 100644
--- a/src/qml/qml/v4vm/qv4engine_p.h
+++ b/src/qml/qml/v4vm/qv4engine_p.h
@@ -58,12 +58,12 @@ QT_BEGIN_NAMESPACE
class QJSEngine;
namespace QQmlJS {
-
namespace Debugging {
class Debugger;
} // namespace Debugging
+}
-namespace VM {
+namespace QV4 {
struct Value;
struct Function;
@@ -106,13 +106,13 @@ struct InternalClass;
class RegExp;
class RegExpCache;
-typedef bool (*ExternalResourceComparison)(const VM::Value &a, const VM::Value &b);
+typedef bool (*ExternalResourceComparison)(const Value &a, const Value &b);
struct Q_QML_EXPORT ExecutionEngine
{
MemoryManager *memoryManager;
ExecutableAllocator *executableAllocator;
- QScopedPointer<EvalISelFactory> iselFactory;
+ QScopedPointer<QQmlJS::EvalISelFactory> iselFactory;
ExecutionContext *current;
GlobalContext *rootContext;
@@ -121,11 +121,11 @@ struct Q_QML_EXPORT ExecutionEngine
Identifiers *identifierCache;
- Debugging::Debugger *debugger;
+ QQmlJS::Debugging::Debugger *debugger;
Object *globalObject;
- VM::Function *globalCode;
+ Function *globalCode;
QJSEngine *publicEngine;
@@ -198,21 +198,21 @@ struct Q_QML_EXPORT ExecutionEngine
RegExpCache *regExpCache;
- ExecutionEngine(EvalISelFactory *iselFactory = 0);
+ ExecutionEngine(QQmlJS::EvalISelFactory *iselFactory = 0);
~ExecutionEngine();
WithContext *newWithContext(Object *with);
- CatchContext *newCatchContext(String* exceptionVarName, const QQmlJS::VM::Value &exceptionValue);
- CallContext *newCallContext(FunctionObject *f, const QQmlJS::VM::Value &thisObject, QQmlJS::VM::Value *args, int argc);
- CallContext *newCallContext(void *stackSpace, FunctionObject *f, const QQmlJS::VM::Value &thisObject, QQmlJS::VM::Value *args, int argc);
+ CatchContext *newCatchContext(String* exceptionVarName, const QV4::Value &exceptionValue);
+ CallContext *newCallContext(FunctionObject *f, const QV4::Value &thisObject, QV4::Value *args, int argc);
+ CallContext *newCallContext(void *stackSpace, FunctionObject *f, const QV4::Value &thisObject, QV4::Value *args, int argc);
ExecutionContext *pushGlobalContext();
void pushContext(SimpleCallContext *context);
ExecutionContext *popContext();
- VM::Function *newFunction(const QString &name);
+ Function *newFunction(const QString &name);
FunctionObject *newBuiltinFunction(ExecutionContext *scope, String *name, Value (*code)(SimpleCallContext *));
- FunctionObject *newScriptFunction(ExecutionContext *scope, VM::Function *function);
+ FunctionObject *newScriptFunction(ExecutionContext *scope, Function *function);
BoundFunction *newBoundFunction(ExecutionContext *scope, FunctionObject *target, Value boundThis, const QVector<Value> &boundArgs);
Object *newObject();
@@ -245,7 +245,7 @@ struct Q_QML_EXPORT ExecutionEngine
void markObjects();
- Value run(VM::Function *function, ExecutionContext *ctx = 0);
+ Value run(Function *function, ExecutionContext *ctx = 0);
void initRootContext();
};
@@ -269,8 +269,7 @@ inline ExecutionContext *ExecutionEngine::popContext()
}
-} // namespace VM
-} // namespace QQmlJS
+} // namespace QV4
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4errorobject.cpp b/src/qml/qml/v4vm/qv4errorobject.cpp
index f12ddbaa08..b3c05fa866 100644
--- a/src/qml/qml/v4vm/qv4errorobject.cpp
+++ b/src/qml/qml/v4vm/qv4errorobject.cpp
@@ -71,7 +71,7 @@
# include <windows.h>
#endif
-using namespace QQmlJS::VM;
+using namespace QV4;
ErrorObject::ErrorObject(ExecutionContext *context, const Value &message, ErrorType t)
: Object(context->engine)
diff --git a/src/qml/qml/v4vm/qv4errorobject_p.h b/src/qml/qml/v4vm/qv4errorobject_p.h
index 90c4079271..cb5ec3472b 100644
--- a/src/qml/qml/v4vm/qv4errorobject_p.h
+++ b/src/qml/qml/v4vm/qv4errorobject_p.h
@@ -46,8 +46,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct SyntaxErrorObject;
@@ -227,8 +226,7 @@ inline SyntaxErrorObject *ErrorObject::asSyntaxError()
return subtype == SyntaxError ? static_cast<SyntaxErrorObject *>(this) : 0;
}
-} // end of namespace VM
-} // end of namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4executableallocator.cpp b/src/qml/qml/v4vm/qv4executableallocator.cpp
index f1b12ffdd1..e710eba21b 100644
--- a/src/qml/qml/v4vm/qv4executableallocator.cpp
+++ b/src/qml/qml/v4vm/qv4executableallocator.cpp
@@ -45,7 +45,7 @@
#include <wtf/StdLibExtras.h>
#include <wtf/PageAllocation.h>
-using namespace QQmlJS::VM;
+using namespace QV4;
void *ExecutableAllocator::Allocation::start() const
{
diff --git a/src/qml/qml/v4vm/qv4executableallocator_p.h b/src/qml/qml/v4vm/qv4executableallocator_p.h
index b864652f72..ff5ea76cae 100644
--- a/src/qml/qml/v4vm/qv4executableallocator_p.h
+++ b/src/qml/qml/v4vm/qv4executableallocator_p.h
@@ -54,8 +54,7 @@ struct PageAllocation;
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
class Q_AUTOTEST_EXPORT ExecutableAllocator
{
@@ -113,8 +112,7 @@ private:
QMap<quintptr, ChunkOfPages*> chunks;
};
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4functionobject.cpp b/src/qml/qml/v4vm/qv4functionobject.cpp
index dc16725702..0b5c8f00cf 100644
--- a/src/qml/qml/v4vm/qv4functionobject.cpp
+++ b/src/qml/qml/v4vm/qv4functionobject.cpp
@@ -61,7 +61,7 @@
#include <iostream>
#include "qv4alloca_p.h"
-using namespace QQmlJS::VM;
+using namespace QV4;
DEFINE_MANAGED_VTABLE(FunctionObject);
@@ -194,27 +194,27 @@ Value FunctionCtor::construct(Managed *that, ExecutionContext *ctx, Value *args,
QString function = QLatin1String("function(") + arguments + QLatin1String("){") + body + QLatin1String("}");
QQmlJS::Engine ee, *engine = &ee;
- Lexer lexer(engine);
+ QQmlJS::Lexer lexer(engine);
lexer.setCode(function, 1, false);
- Parser parser(engine);
+ QQmlJS::Parser parser(engine);
const bool parsed = parser.parseExpression();
if (!parsed)
ctx->throwSyntaxError(0);
- using namespace AST;
- FunctionExpression *fe = AST::cast<FunctionExpression *>(parser.rootNode());
+ using namespace QQmlJS::AST;
+ FunctionExpression *fe = QQmlJS::AST::cast<FunctionExpression *>(parser.rootNode());
if (!fe)
ctx->throwSyntaxError(0);
- V4IR::Module module;
+ QQmlJS::V4IR::Module module;
- Codegen cg(ctx, f->strictMode);
- V4IR::Function *irf = cg(QString(), function, fe, &module);
+ QQmlJS::Codegen cg(ctx, f->strictMode);
+ QQmlJS::V4IR::Function *irf = cg(QString(), function, fe, &module);
- QScopedPointer<EvalInstructionSelection> isel(ctx->engine->iselFactory->create(ctx->engine, &module));
- VM::Function *vmf = isel->vmFunction(irf);
+ QScopedPointer<QQmlJS::EvalInstructionSelection> isel(ctx->engine->iselFactory->create(ctx->engine, &module));
+ QV4::Function *vmf = isel->vmFunction(irf);
return Value::fromObject(ctx->engine->newScriptFunction(ctx->engine->rootContext, vmf));
}
diff --git a/src/qml/qml/v4vm/qv4functionobject_p.h b/src/qml/qml/v4vm/qv4functionobject_p.h
index 9d24d40a70..533c560560 100644
--- a/src/qml/qml/v4vm/qv4functionobject_p.h
+++ b/src/qml/qml/v4vm/qv4functionobject_p.h
@@ -65,8 +65,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct Value;
struct Function;
@@ -106,7 +105,7 @@ struct Lookup;
struct Function {
String *name;
- VM::Value (*code)(VM::ExecutionContext *, const uchar *);
+ Value (*code)(ExecutionContext *, const uchar *);
const uchar *codeData;
JSC::MacroAssemblerCodeRef codeRef;
quint32 codeSize;
@@ -154,7 +153,7 @@ struct Q_QML_EXPORT FunctionObject: Object {
String * const *varList;
unsigned int formalParameterCount;
unsigned int varCount;
- VM::Function *function;
+ Function *function;
FunctionObject(ExecutionContext *scope);
@@ -208,7 +207,7 @@ protected:
};
struct ScriptFunction: FunctionObject {
- ScriptFunction(ExecutionContext *scope, VM::Function *function);
+ ScriptFunction(ExecutionContext *scope, Function *function);
static Value construct(Managed *, ExecutionContext *context, Value *args, int argc);
static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int);
@@ -235,8 +234,7 @@ struct BoundFunction: FunctionObject {
static bool hasInstance(Managed *that, ExecutionContext *ctx, const Value &value);
};
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4global_p.h b/src/qml/qml/v4vm/qv4global_p.h
index e96daba8e2..fa63b8c230 100644
--- a/src/qml/qml/v4vm/qv4global_p.h
+++ b/src/qml/qml/v4vm/qv4global_p.h
@@ -48,8 +48,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
enum PropertyFlag {
@@ -154,7 +153,6 @@ struct PropertyAttributes
};
}
-}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4globalobject.cpp b/src/qml/qml/v4vm/qv4globalobject.cpp
index d5a899420b..c2458517cc 100644
--- a/src/qml/qml/v4vm/qv4globalobject.cpp
+++ b/src/qml/qml/v4vm/qv4globalobject.cpp
@@ -59,7 +59,7 @@
#include <wtf/MathExtras.h>
-using namespace QQmlJS::VM;
+using namespace QV4;
static inline char toHex(char c)
{
@@ -379,7 +379,7 @@ Value EvalFunction::evalCall(ExecutionContext *parentContext, Value /*thisObject
const QString code = args[0].stringValue()->toQString();
bool inheritContext = !ctx->strictMode;
- QQmlJS::VM::Function *f = parseSource(ctx, QStringLiteral("eval code"),
+ QV4::Function *f = parseSource(ctx, QStringLiteral("eval code"),
code, QQmlJS::Codegen::EvalCode,
(directCall && parentContext->strictMode), inheritContext);
@@ -437,7 +437,7 @@ Value EvalFunction::call(Managed *that, ExecutionContext *context, const Value &
// return Value::undefinedValue();
//}
-QQmlJS::VM::Function *EvalFunction::parseSource(QQmlJS::VM::ExecutionContext *ctx,
+QV4::Function *EvalFunction::parseSource(QV4::ExecutionContext *ctx,
const QString &fileName, const QString &source,
QQmlJS::Codegen::Mode mode,
bool strictMode, bool inheritContext)
@@ -446,9 +446,9 @@ QQmlJS::VM::Function *EvalFunction::parseSource(QQmlJS::VM::ExecutionContext *ct
MemoryManager::GCBlocker gcBlocker(ctx->engine->memoryManager);
- VM::ExecutionEngine *vm = ctx->engine;
+ ExecutionEngine *vm = ctx->engine;
V4IR::Module module;
- VM::Function *globalCode = 0;
+ Function *globalCode = 0;
{
QQmlJS::Engine ee, *engine = &ee;
@@ -458,16 +458,16 @@ QQmlJS::VM::Function *EvalFunction::parseSource(QQmlJS::VM::ExecutionContext *ct
const bool parsed = parser.parseProgram();
- VM::DiagnosticMessage *error = 0, **errIt = &error;
+ DiagnosticMessage *error = 0, **errIt = &error;
foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages()) {
if (m.isError()) {
- *errIt = new VM::DiagnosticMessage;
+ *errIt = new DiagnosticMessage;
(*errIt)->fileName = fileName;
(*errIt)->offset = m.loc.offset;
(*errIt)->length = m.loc.length;
(*errIt)->startLine = m.loc.startLine;
(*errIt)->startColumn = m.loc.startColumn;
- (*errIt)->type = VM::DiagnosticMessage::Error;
+ (*errIt)->type = DiagnosticMessage::Error;
(*errIt)->message = m.message;
errIt = &(*errIt)->next;
} else {
diff --git a/src/qml/qml/v4vm/qv4globalobject_p.h b/src/qml/qml/v4vm/qv4globalobject_p.h
index da53540957..97a8b705f5 100644
--- a/src/qml/qml/v4vm/qv4globalobject_p.h
+++ b/src/qml/qml/v4vm/qv4globalobject_p.h
@@ -46,15 +46,14 @@
QT_END_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct Q_QML_EXPORT EvalFunction : FunctionObject
{
EvalFunction(ExecutionContext *scope);
EvalFunction(ExecutionContext *scope, Object *qmlActivation);
- static QQmlJS::VM::Function *parseSource(QQmlJS::VM::ExecutionContext *ctx,
+ static QV4::Function *parseSource(QV4::ExecutionContext *ctx,
const QString &fileName,
const QString &source,
QQmlJS::Codegen::Mode mode, bool strictMode,
@@ -85,8 +84,7 @@ struct GlobalFunctions
static Value method_unescape(SimpleCallContext *context);
};
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4identifier_p.h b/src/qml/qml/v4vm/qv4identifier_p.h
index 02dd9d5057..df1a3abb94 100644
--- a/src/qml/qml/v4vm/qv4identifier_p.h
+++ b/src/qml/qml/v4vm/qv4identifier_p.h
@@ -47,8 +47,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct Identifiers
{
@@ -103,8 +102,7 @@ public:
}
};
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4internalclass.cpp b/src/qml/qml/v4vm/qv4internalclass.cpp
index 4c6fbc2282..f078c51076 100644
--- a/src/qml/qml/v4vm/qv4internalclass.cpp
+++ b/src/qml/qml/v4vm/qv4internalclass.cpp
@@ -44,11 +44,9 @@
#include <qv4engine_p.h>
#include <qv4identifier_p.h>
-namespace QQmlJS {
-namespace VM {
+using namespace QV4;
-
-InternalClass::InternalClass(const QQmlJS::VM::InternalClass &other)
+InternalClass::InternalClass(const QV4::InternalClass &other)
: engine(other.engine)
, propertyTable(other.propertyTable)
, nameMap(other.nameMap)
@@ -182,7 +180,3 @@ InternalClass *InternalClass::frozen()
m_frozen->m_frozen = m_frozen;
return m_frozen;
}
-
-
-}
-}
diff --git a/src/qml/qml/v4vm/qv4internalclass_p.h b/src/qml/qml/v4vm/qv4internalclass_p.h
index bf3654e1af..beb8e2dbae 100644
--- a/src/qml/qml/v4vm/qv4internalclass_p.h
+++ b/src/qml/qml/v4vm/qv4internalclass_p.h
@@ -47,8 +47,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct String;
struct ExecutionEngine;
@@ -83,8 +82,7 @@ private:
};
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4isel_llvm.cpp b/src/qml/qml/v4vm/qv4isel_llvm.cpp
index 2b9757a696..07691582f7 100644
--- a/src/qml/qml/v4vm/qv4isel_llvm.cpp
+++ b/src/qml/qml/v4vm/qv4isel_llvm.cpp
@@ -285,9 +285,9 @@ void InstructionSelection::buildLLVMModule(IR::Module *module, llvm::Module *llv
assert(!"cannot link the QML/JS LLVM runtime");
}
- _valueTy = _llvmModule->getTypeByName("struct.QQmlJS::VM::Value");
- _contextPtrTy = _llvmModule->getTypeByName("struct.QQmlJS::VM::ExecutionContext")->getPointerTo();
- _stringPtrTy = _llvmModule->getTypeByName("struct.QQmlJS::VM::String")->getPointerTo();
+ _valueTy = _llvmModule->getTypeByName("struct.QV4::Value");
+ _contextPtrTy = _llvmModule->getTypeByName("struct.QV4::ExecutionContext")->getPointerTo();
+ _stringPtrTy = _llvmModule->getTypeByName("struct.QV4::String")->getPointerTo();
{
llvm::Type *args[] = { _contextPtrTy };
diff --git a/src/qml/qml/v4vm/qv4isel_masm.cpp b/src/qml/qml/v4vm/qv4isel_masm.cpp
index f7d3c13bb0..f6f79b8d66 100644
--- a/src/qml/qml/v4vm/qv4isel_masm.cpp
+++ b/src/qml/qml/v4vm/qv4isel_masm.cpp
@@ -59,7 +59,7 @@
using namespace QQmlJS;
using namespace QQmlJS::MASM;
-using namespace QQmlJS::VM;
+using namespace QV4;
/* Platform/Calling convention/Architecture specific section */
@@ -105,7 +105,7 @@ const int Assembler::calleeSavedRegisterCount = sizeof(calleeSavedRegisters) / s
const Assembler::VoidType Assembler::Void;
-Assembler::Assembler(V4IR::Function* function, VM::Function *vmFunction, VM::ExecutionEngine *engine)
+Assembler::Assembler(V4IR::Function* function, QV4::Function *vmFunction, QV4::ExecutionEngine *engine)
: _function(function), _vmFunction(vmFunction), _engine(engine)
{
}
@@ -143,7 +143,7 @@ Assembler::Pointer Assembler::loadTempAddress(RegisterID reg, V4IR::Temp *t)
{
int32_t offset = 0;
int scope = t->scope;
- VM::Function *f = _vmFunction;
+ QV4::Function *f = _vmFunction;
RegisterID context = ContextRegister;
if (scope) {
loadPtr(Address(ContextRegister, offsetof(ExecutionContext, outer)), ScratchRegister);
@@ -200,7 +200,7 @@ void Assembler::copyValue(Result result, V4IR::Expr* source)
loadDouble(temp, FPGpr0);
storeDouble(FPGpr0, result);
} else if (V4IR::Const *c = source->asConst()) {
- VM::Value v = convertToValue(c);
+ QV4::Value v = convertToValue(c);
storeValue(v, result);
} else {
assert(! "not implemented");
@@ -209,7 +209,7 @@ void Assembler::copyValue(Result result, V4IR::Expr* source)
}
-void Assembler::storeValue(VM::Value value, V4IR::Temp* destination)
+void Assembler::storeValue(QV4::Value value, V4IR::Temp* destination)
{
Address addr = loadTempAddress(ScratchRegister, destination);
storeValue(value, addr);
@@ -225,7 +225,7 @@ void Assembler::enterStandardStackFrame(int locals)
move(StackPointerRegister, StackFrameRegister);
// space for the locals and callee saved registers
- int32_t frameSize = locals * sizeof(QQmlJS::VM::Value) + sizeof(void*) * calleeSavedRegisterCount;
+ int32_t frameSize = locals * sizeof(QV4::Value) + sizeof(void*) * calleeSavedRegisterCount;
#if CPU(X86) || CPU(X86_64)
frameSize = (frameSize + 15) & ~15; // align on 16 byte boundaries for MMX
@@ -245,7 +245,7 @@ void Assembler::leaveStandardStackFrame(int locals)
loadPtr(Address(StackFrameRegister, -(i + 1) * sizeof(void*)), calleeSavedRegisters[i]);
// space for the locals and the callee saved registers
- int32_t frameSize = locals * sizeof(QQmlJS::VM::Value) + sizeof(void*) * calleeSavedRegisterCount;
+ int32_t frameSize = locals * sizeof(QV4::Value) + sizeof(void*) * calleeSavedRegisterCount;
#if CPU(X86) || CPU(X86_64)
frameSize = (frameSize + 15) & ~15; // align on 16 byte boundaries for MMX
#endif
@@ -345,20 +345,20 @@ void Assembler::generateBinOp(V4IR::AluOp operation, V4IR::Temp* target, V4IR::T
Jump leftTypeCheck;
if (left->asTemp()) {
Address typeAddress = loadTempAddress(ScratchRegister, left->asTemp());
- typeAddress.offset += offsetof(VM::Value, tag);
- leftTypeCheck = branch32(NotEqual, typeAddress, TrustedImm32(VM::Value::_Integer_Type));
+ typeAddress.offset += offsetof(QV4::Value, tag);
+ leftTypeCheck = branch32(NotEqual, typeAddress, TrustedImm32(QV4::Value::_Integer_Type));
}
Jump rightTypeCheck;
if (right->asTemp()) {
Address typeAddress = loadTempAddress(ScratchRegister, right->asTemp());
- typeAddress.offset += offsetof(VM::Value, tag);
- rightTypeCheck = branch32(NotEqual, typeAddress, TrustedImm32(VM::Value::_Integer_Type));
+ typeAddress.offset += offsetof(QV4::Value, tag);
+ rightTypeCheck = branch32(NotEqual, typeAddress, TrustedImm32(QV4::Value::_Integer_Type));
}
if (left->asTemp()) {
Address leftValue = loadTempAddress(ScratchRegister, left->asTemp());
- leftValue.offset += offsetof(VM::Value, int_32);
+ leftValue.offset += offsetof(QV4::Value, int_32);
load32(leftValue, IntegerOpRegister);
} else { // left->asConst()
move(TrustedImm32(leftConst.integerValue()), IntegerOpRegister);
@@ -368,7 +368,7 @@ void Assembler::generateBinOp(V4IR::AluOp operation, V4IR::Temp* target, V4IR::T
if (right->asTemp()) {
Address rightValue = loadTempAddress(ScratchRegister, right->asTemp());
- rightValue.offset += offsetof(VM::Value, int_32);
+ rightValue.offset += offsetof(QV4::Value, int_32);
overflowCheck = (this->*info.inlineMemRegOp)(rightValue, IntegerOpRegister);
} else { // right->asConst()
@@ -377,12 +377,12 @@ void Assembler::generateBinOp(V4IR::AluOp operation, V4IR::Temp* target, V4IR::T
Address resultAddr = loadTempAddress(ScratchRegister, target);
Address resultValueAddr = resultAddr;
- resultValueAddr.offset += offsetof(VM::Value, int_32);
+ resultValueAddr.offset += offsetof(QV4::Value, int_32);
store32(IntegerOpRegister, resultValueAddr);
Address resultTypeAddr = resultAddr;
- resultTypeAddr.offset += offsetof(VM::Value, tag);
- store32(TrustedImm32(VM::Value::_Integer_Type), resultTypeAddr);
+ resultTypeAddr.offset += offsetof(QV4::Value, tag);
+ store32(TrustedImm32(QV4::Value::_Integer_Type), resultTypeAddr);
binOpFinished = jump();
@@ -423,7 +423,7 @@ static void printDisassembledOutputWithCalls(const char* output, const QHash<voi
}
#endif
-void Assembler::link(VM::Function *vmFunc)
+void Assembler::link(QV4::Function *vmFunc)
{
Label endOfCode = label();
#if defined(Q_PROCESSOR_ARM) && !defined(Q_OS_IOS)
@@ -503,10 +503,10 @@ void Assembler::link(VM::Function *vmFunc)
vmFunc->codeRef = linkBuffer.finalizeCodeWithoutDisassembly();
}
- vmFunc->code = (Value (*)(VM::ExecutionContext *, const uchar *)) vmFunc->codeRef.code().executableAddress();
+ vmFunc->code = (Value (*)(QV4::ExecutionContext *, const uchar *)) vmFunc->codeRef.code().executableAddress();
}
-InstructionSelection::InstructionSelection(VM::ExecutionEngine *engine, V4IR::Module *module)
+InstructionSelection::InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module)
: EvalInstructionSelection(engine, module)
, _block(0)
, _function(0)
@@ -520,7 +520,7 @@ InstructionSelection::~InstructionSelection()
delete _as;
}
-void InstructionSelection::run(VM::Function *vmFunction, V4IR::Function *function)
+void InstructionSelection::run(QV4::Function *vmFunction, V4IR::Function *function)
{
QVector<Lookup> lookups;
QSet<V4IR::BasicBlock*> reentryBlocks;
@@ -600,7 +600,7 @@ void InstructionSelection::run(VM::Function *vmFunction, V4IR::Function *functio
void InstructionSelection::callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result)
{
int argc = prepareVariableArguments(args);
- VM::String *s = identifier(*func->id);
+ QV4::String *s = identifier(*func->id);
if (useFastLookups && func->global) {
uint index = addGlobalLookup(s);
@@ -720,7 +720,7 @@ void InstructionSelection::callBuiltinThrow(V4IR::Temp *arg)
typedef void *(*MiddleOfFunctionEntryPoint(ExecutionContext *, void *localsPtr));
static void *tryWrapper(ExecutionContext *context, void *localsPtr, MiddleOfFunctionEntryPoint tryBody, MiddleOfFunctionEntryPoint catchBody,
- VM::String *exceptionVarName, Value *exceptionVar)
+ QV4::String *exceptionVarName, Value *exceptionVar)
{
*exceptionVar = Value::undefinedValue();
void *addressToContinueAt = 0;
@@ -872,7 +872,7 @@ void InstructionSelection::setActivationProperty(V4IR::Temp *source, const QStri
void InstructionSelection::initClosure(V4IR::Closure *closure, V4IR::Temp *target)
{
- VM::Function *vmFunc = vmFunction(closure->value);
+ QV4::Function *vmFunc = vmFunction(closure->value);
assert(vmFunc);
generateFunctionCall(Assembler::Void, __qmljs_init_closure, Assembler::ContextRegister, Assembler::PointerToValue(target), Assembler::TrustedImmPtr(vmFunc));
}
@@ -880,7 +880,7 @@ void InstructionSelection::initClosure(V4IR::Closure *closure, V4IR::Temp *targe
void InstructionSelection::getProperty(V4IR::Temp *base, const QString &name, V4IR::Temp *target)
{
if (useFastLookups) {
- VM::String *s = identifier(name);
+ QV4::String *s = identifier(name);
uint index = addLookup(s);
generateFunctionCall(Assembler::Void, __qmljs_get_property_lookup, Assembler::ContextRegister, Assembler::PointerToValue(target),
Assembler::Reference(base), Assembler::TrustedImm32(index));
@@ -893,7 +893,7 @@ void InstructionSelection::getProperty(V4IR::Temp *base, const QString &name, V4
void InstructionSelection::setProperty(V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName)
{
if (useFastLookups) {
- VM::String *s = identifier(targetName);
+ QV4::String *s = identifier(targetName);
uint index = addLookup(s);
generateFunctionCall(Assembler::Void, __qmljs_set_property_lookup,
Assembler::ContextRegister, Assembler::Reference(targetBase),
@@ -929,7 +929,7 @@ void InstructionSelection::copyValue(V4IR::Temp *sourceTemp, V4IR::Temp *targetT
void InstructionSelection::unop(V4IR::AluOp oper, V4IR::Temp *sourceTemp, V4IR::Temp *targetTemp)
{
- VM::UnaryOpName op = 0;
+ QV4::UnaryOpName op = 0;
const char *opName = 0;
switch (oper) {
case V4IR::OpIfTrue: assert(!"unreachable"); break;
@@ -954,7 +954,7 @@ void InstructionSelection::binop(V4IR::AluOp oper, V4IR::Temp *leftSource, V4IR:
void InstructionSelection::inplaceNameOp(V4IR::AluOp oper, V4IR::Temp *rightSource, const QString &targetName)
{
- VM::InplaceBinOpName op = 0;
+ QV4::InplaceBinOpName op = 0;
const char *opName = 0;
switch (oper) {
case V4IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_name); break;
@@ -980,7 +980,7 @@ void InstructionSelection::inplaceNameOp(V4IR::AluOp oper, V4IR::Temp *rightSour
void InstructionSelection::inplaceElementOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBaseTemp, V4IR::Temp *targetIndexTemp)
{
- VM::InplaceBinOpElement op = 0;
+ QV4::InplaceBinOpElement op = 0;
const char *opName = 0;
switch (oper) {
case V4IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_element); break;
@@ -1008,7 +1008,7 @@ void InstructionSelection::inplaceElementOp(V4IR::AluOp oper, V4IR::Temp *source
void InstructionSelection::inplaceMemberOp(V4IR::AluOp oper, V4IR::Temp *source, V4IR::Temp *targetBase, const QString &targetName)
{
- VM::InplaceBinOpMember op = 0;
+ QV4::InplaceBinOpMember op = 0;
const char *opName = 0;
switch (oper) {
case V4IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_member); break;
@@ -1041,7 +1041,7 @@ void InstructionSelection::callProperty(V4IR::Temp *base, const QString &name,
assert(base != 0);
int argc = prepareVariableArguments(args);
- VM::String *s = identifier(name);
+ QV4::String *s = identifier(name);
if (useFastLookups) {
uint index = addLookup(s);
@@ -1084,7 +1084,7 @@ void InstructionSelection::constructActivationProperty(V4IR::Name *func, V4IR::E
if (useFastLookups && func->global) {
int argc = prepareVariableArguments(args);
- VM::String *s = identifier(*func->id);
+ QV4::String *s = identifier(*func->id);
uint index = addGlobalLookup(s);
generateFunctionCall(Assembler::Void, __qmljs_construct_global_lookup,
@@ -1124,11 +1124,11 @@ void InstructionSelection::visitCJump(V4IR::CJump *s)
if (V4IR::Temp *t = s->cond->asTemp()) {
Address temp = _as->loadTempAddress(Assembler::ScratchRegister, t);
Address tag = temp;
- tag.offset += offsetof(VM::Value, tag);
- Assembler::Jump booleanConversion = _as->branch32(Assembler::NotEqual, tag, Assembler::TrustedImm32(VM::Value::Boolean_Type));
+ tag.offset += offsetof(QV4::Value, tag);
+ Assembler::Jump booleanConversion = _as->branch32(Assembler::NotEqual, tag, Assembler::TrustedImm32(QV4::Value::Boolean_Type));
Address data = temp;
- data.offset += offsetof(VM::Value, int_32);
+ data.offset += offsetof(QV4::Value, int_32);
_as->load32(data, Assembler::ReturnValueRegister);
Assembler::Jump testBoolean = _as->jump();
@@ -1145,7 +1145,7 @@ void InstructionSelection::visitCJump(V4IR::CJump *s)
return;
} else if (V4IR::Binop *b = s->cond->asBinop()) {
if (b->left->asTemp() && b->right->asTemp()) {
- VM::CmpOp op = 0;
+ QV4::CmpOp op = 0;
const char *opName = 0;
switch (b->op) {
default: Q_UNREACHABLE(); assert(!"todo"); break;
@@ -1230,10 +1230,10 @@ void InstructionSelection::callRuntimeMethodImp(V4IR::Temp *result, const char*
}
-uint InstructionSelection::addLookup(VM::String *name)
+uint InstructionSelection::addLookup(QV4::String *name)
{
uint index = (uint)_lookups.size();
- VM::Lookup l;
+ QV4::Lookup l;
l.lookupProperty = Lookup::lookupPropertyGeneric;
for (int i = 0; i < Lookup::Size; ++i)
l.classList[i] = 0;
@@ -1244,10 +1244,10 @@ uint InstructionSelection::addLookup(VM::String *name)
return index;
}
-uint InstructionSelection::addGlobalLookup(VM::String *name)
+uint InstructionSelection::addGlobalLookup(QV4::String *name)
{
uint index = (uint)_lookups.size();
- VM::Lookup l;
+ QV4::Lookup l;
l.lookupGlobal = Lookup::lookupGlobalGeneric;
for (int i = 0; i < Lookup::Size; ++i)
l.classList[i] = 0;
diff --git a/src/qml/qml/v4vm/qv4isel_masm_p.h b/src/qml/qml/v4vm/qv4isel_masm_p.h
index adf24da7fc..7b9c21ed74 100644
--- a/src/qml/qml/v4vm/qv4isel_masm_p.h
+++ b/src/qml/qml/v4vm/qv4isel_masm_p.h
@@ -60,7 +60,7 @@ namespace MASM {
class Assembler : public JSC::MacroAssembler
{
public:
- Assembler(V4IR::Function* function, VM::Function *vmFunction, VM::ExecutionEngine *engine);
+ Assembler(V4IR::Function* function, QV4::Function *vmFunction, QV4::ExecutionEngine *engine);
#if CPU(X86)
#undef VALUE_FITS_IN_REGISTER
@@ -280,7 +280,7 @@ public:
void loadArgument(V4IR::Temp* temp, RegisterID dest)
{
if (!temp) {
- VM::Value undefined = VM::Value::undefinedValue();
+ QV4::Value undefined = QV4::Value::undefinedValue();
move(TrustedImm64(undefined.val), dest);
} else {
Pointer addr = loadTempAddress(dest, temp);
@@ -290,14 +290,14 @@ public:
void loadArgument(V4IR::Const* c, RegisterID dest)
{
- VM::Value v = convertToValue(c);
+ QV4::Value v = convertToValue(c);
move(TrustedImm64(v.val), dest);
}
void loadArgument(V4IR::Expr* expr, RegisterID dest)
{
if (!expr) {
- VM::Value undefined = VM::Value::undefinedValue();
+ QV4::Value undefined = QV4::Value::undefinedValue();
move(TrustedImm64(undefined.val), dest);
} else if (expr->asTemp()){
loadArgument(expr->asTemp(), dest);
@@ -314,7 +314,7 @@ public:
}
#endif
- void loadArgument(VM::String* string, RegisterID dest)
+ void loadArgument(QV4::String* string, RegisterID dest)
{
loadArgument(TrustedImmPtr(string), dest);
}
@@ -365,7 +365,7 @@ public:
push(ScratchRegister);
}
- void push(VM::Value value)
+ void push(QV4::Value value)
{
#ifdef VALUE_FITS_IN_REGISTER
move(TrustedImm64(value.val), ScratchRegister);
@@ -413,21 +413,21 @@ public:
addr.offset -= 4;
push(addr);
} else {
- VM::Value undefined = VM::Value::undefinedValue();
+ QV4::Value undefined = QV4::Value::undefinedValue();
push(undefined);
}
}
void push(V4IR::Const* c)
{
- VM::Value v = convertToValue(c);
+ QV4::Value v = convertToValue(c);
push(v);
}
void push(V4IR::Expr* e)
{
if (!e) {
- VM::Value undefined = VM::Value::undefinedValue();
+ QV4::Value undefined = QV4::Value::undefinedValue();
push(undefined);
} else if (V4IR::Const *c = e->asConst())
push(c);
@@ -444,7 +444,7 @@ public:
push(ScratchRegister);
}
- void push(VM::String* name)
+ void push(QV4::String* name)
{
push(TrustedImmPtr(name));
}
@@ -468,7 +468,7 @@ public:
template <typename Result>
void copyValue(Result result, V4IR::Expr* source);
- void storeValue(VM::Value value, Address destination)
+ void storeValue(QV4::Value value, Address destination)
{
#ifdef VALUE_FITS_IN_REGISTER
store64(TrustedImm64(value.val), destination);
@@ -479,7 +479,7 @@ public:
#endif
}
- void storeValue(VM::Value value, V4IR::Temp* temp);
+ void storeValue(QV4::Value value, V4IR::Temp* temp);
void enterStandardStackFrame(int locals);
void leaveStandardStackFrame(int locals);
@@ -494,8 +494,8 @@ public:
{ return 8; } // Size of value
static inline int sizeOfArgument(const Pointer&)
{ return sizeof(void*); }
- static inline int sizeOfArgument(VM::String*)
- { return sizeof(VM::String*); }
+ static inline int sizeOfArgument(QV4::String*)
+ { return sizeof(QV4::String*); }
static inline int sizeOfArgument(const PointerToValue &)
{ return sizeof(void *); }
static inline int sizeOfArgument(const Reference &)
@@ -601,7 +601,7 @@ public:
struct BinaryOperationInfo {
const char *name;
- VM::BinOp fallbackImplementation;
+ QV4::BinOp fallbackImplementation;
MemRegBinOp inlineMemRegOp;
ImmRegBinOp inlineImmRegOp;
};
@@ -751,11 +751,11 @@ public:
return Jump();
}
- void link(VM::Function *vmFunc);
+ void link(QV4::Function *vmFunc);
private:
V4IR::Function *_function;
- VM::Function *_vmFunction;
+ QV4::Function *_vmFunction;
QHash<V4IR::BasicBlock *, Label> _addrs;
QHash<V4IR::BasicBlock *, QVector<Jump> > _patches;
QList<CallToLink> _callsToLink;
@@ -768,7 +768,7 @@ private:
QHash<V4IR::BasicBlock *, QVector<DataLabelPtr> > _labelPatches;
- VM::ExecutionEngine *_engine;
+ QV4::ExecutionEngine *_engine;
};
class Q_QML_EXPORT InstructionSelection:
@@ -776,10 +776,10 @@ class Q_QML_EXPORT InstructionSelection:
public EvalInstructionSelection
{
public:
- InstructionSelection(VM::ExecutionEngine *engine, V4IR::Module *module);
+ InstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module);
~InstructionSelection();
- virtual void run(VM::Function *vmFunction, V4IR::Function *function);
+ virtual void run(QV4::Function *vmFunction, V4IR::Function *function);
protected:
virtual void callBuiltinInvalid(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
@@ -846,7 +846,7 @@ protected:
Pointer argumentAddressForCall(int argument)
{
const int index = _function->maxNumberOfArguments - argument;
- return Pointer(Assembler::LocalsRegister, sizeof(VM::Value) * (-index)
+ return Pointer(Assembler::LocalsRegister, sizeof(QV4::Value) * (-index)
- sizeof(void*) // size of ebp
- sizeof(void*) * Assembler::calleeSavedRegisterCount
);
@@ -856,7 +856,7 @@ protected:
return argumentAddressForCall(0);
}
- VM::String *identifier(const QString &s);
+ QV4::String *identifier(const QString &s);
virtual void constructActivationProperty(V4IR::Name *func, V4IR::ExprList *args, V4IR::Temp *result);
virtual void constructProperty(V4IR::Temp *base, const QString &name, V4IR::ExprList *args, V4IR::Temp *result);
virtual void constructValue(V4IR::Temp *value, V4IR::ExprList *args, V4IR::Temp *result);
@@ -875,18 +875,18 @@ private:
int prepareVariableArguments(V4IR::ExprList* args);
- typedef void (*ActivationMethod)(VM::ExecutionContext *, VM::Value *result, VM::String *name, VM::Value *args, int argc);
+ typedef void (*ActivationMethod)(QV4::ExecutionContext *, QV4::Value *result, QV4::String *name, QV4::Value *args, int argc);
void callRuntimeMethodImp(V4IR::Temp *result, const char* name, ActivationMethod method, V4IR::Expr *base, V4IR::ExprList *args);
#define callRuntimeMethod(result, function, ...) \
callRuntimeMethodImp(result, isel_stringIfy(function), function, __VA_ARGS__)
- uint addLookup(VM::String *name);
- uint addGlobalLookup(VM::String *name);
+ uint addLookup(QV4::String *name);
+ uint addGlobalLookup(QV4::String *name);
V4IR::BasicBlock *_block;
V4IR::Function* _function;
- VM::Function* _vmFunction;
- QVector<VM::Lookup> _lookups;
+ QV4::Function* _vmFunction;
+ QVector<QV4::Lookup> _lookups;
Assembler* _as;
QSet<V4IR::BasicBlock*> _reentryBlocks;
};
@@ -895,7 +895,7 @@ class Q_QML_EXPORT ISelFactory: public EvalISelFactory
{
public:
virtual ~ISelFactory() {}
- virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine, V4IR::Module *module)
+ virtual EvalInstructionSelection *create(QV4::ExecutionEngine *engine, V4IR::Module *module)
{ return new InstructionSelection(engine, module); }
};
diff --git a/src/qml/qml/v4vm/qv4isel_p.cpp b/src/qml/qml/v4vm/qv4isel_p.cpp
index 6c5d48dd3a..e1908333d6 100644
--- a/src/qml/qml/v4vm/qv4isel_p.cpp
+++ b/src/qml/qml/v4vm/qv4isel_p.cpp
@@ -16,7 +16,7 @@ QTextStream qout(stderr, QIODevice::WriteOnly);
using namespace QQmlJS;
using namespace QQmlJS::V4IR;
-EvalInstructionSelection::EvalInstructionSelection(VM::ExecutionEngine *engine, Module *module)
+EvalInstructionSelection::EvalInstructionSelection(QV4::ExecutionEngine *engine, Module *module)
: _engine(engine)
, useFastLookups(true)
{
@@ -35,9 +35,9 @@ EvalInstructionSelection::~EvalInstructionSelection()
EvalISelFactory::~EvalISelFactory()
{}
-VM::Function *EvalInstructionSelection::createFunctionMapping(VM::Function *outer, Function *irFunction)
+QV4::Function *EvalInstructionSelection::createFunctionMapping(QV4::Function *outer, Function *irFunction)
{
- VM::Function *vmFunction = _engine->newFunction(irFunction->name ? *irFunction->name : QString());
+ QV4::Function *vmFunction = _engine->newFunction(irFunction->name ? *irFunction->name : QString());
_irToVM.insert(irFunction, vmFunction);
vmFunction->hasDirectEval = irFunction->hasDirectEval;
@@ -66,8 +66,8 @@ VM::Function *EvalInstructionSelection::createFunctionMapping(VM::Function *oute
return vmFunction;
}
-VM::Function *EvalInstructionSelection::vmFunction(Function *f) {
- VM::Function *function = _irToVM[f];
+QV4::Function *EvalInstructionSelection::vmFunction(Function *f) {
+ QV4::Function *function = _irToVM[f];
if (!function->code)
run(function, f);
return function;
diff --git a/src/qml/qml/v4vm/qv4isel_p.h b/src/qml/qml/v4vm/qv4isel_p.h
index 064a83e82a..59a4b765ca 100644
--- a/src/qml/qml/v4vm/qv4isel_p.h
+++ b/src/qml/qml/v4vm/qv4isel_p.h
@@ -48,31 +48,31 @@
#include <qglobal.h>
#include <QHash>
-namespace QQmlJS {
-
-namespace VM {
+namespace QV4 {
struct ExecutionEngine;
struct Function;
-} // namespace VM
+}
+
+namespace QQmlJS {
class Q_QML_EXPORT EvalInstructionSelection
{
public:
- EvalInstructionSelection(VM::ExecutionEngine *engine, V4IR::Module *module);
+ EvalInstructionSelection(QV4::ExecutionEngine *engine, V4IR::Module *module);
virtual ~EvalInstructionSelection() = 0;
- VM::Function *vmFunction(V4IR::Function *f);
+ QV4::Function *vmFunction(V4IR::Function *f);
void setUseFastLookups(bool b) { useFastLookups = b; }
protected:
- VM::Function *createFunctionMapping(VM::Function *outer, V4IR::Function *irFunction);
- VM::ExecutionEngine *engine() const { return _engine; }
- virtual void run(VM::Function *vmFunction, V4IR::Function *function) = 0;
+ QV4::Function *createFunctionMapping(QV4::Function *outer, V4IR::Function *irFunction);
+ QV4::ExecutionEngine *engine() const { return _engine; }
+ virtual void run(QV4::Function *vmFunction, V4IR::Function *function) = 0;
private:
- VM::ExecutionEngine *_engine;
- QHash<V4IR::Function *, VM::Function *> _irToVM;
+ QV4::ExecutionEngine *_engine;
+ QHash<V4IR::Function *, QV4::Function *> _irToVM;
protected:
bool useFastLookups;
};
@@ -81,7 +81,7 @@ class Q_QML_EXPORT EvalISelFactory
{
public:
virtual ~EvalISelFactory() = 0;
- virtual EvalInstructionSelection *create(VM::ExecutionEngine *engine, V4IR::Module *module) = 0;
+ virtual EvalInstructionSelection *create(QV4::ExecutionEngine *engine, V4IR::Module *module) = 0;
};
namespace V4IR {
diff --git a/src/qml/qml/v4vm/qv4isel_util_p.h b/src/qml/qml/v4vm/qv4isel_util_p.h
index e016a19cac..54e646402f 100644
--- a/src/qml/qml/v4vm/qv4isel_util_p.h
+++ b/src/qml/qml/v4vm/qv4isel_util_p.h
@@ -47,24 +47,24 @@
namespace QQmlJS {
-inline VM::Value convertToValue(V4IR::Const *c)
+inline QV4::Value convertToValue(V4IR::Const *c)
{
switch (c->type) {
case V4IR::MissingType:
- return VM::Value::deletedValue();
+ return QV4::Value::deletedValue();
case V4IR::NullType:
- return VM::Value::nullValue();
+ return QV4::Value::nullValue();
case V4IR::UndefinedType:
- return VM::Value::undefinedValue();
+ return QV4::Value::undefinedValue();
case V4IR::BoolType:
- return VM::Value::fromBoolean(c->value != 0);
+ return QV4::Value::fromBoolean(c->value != 0);
case V4IR::NumberType: {
int ival = (int)c->value;
// +0 != -0, so we need to convert to double when negating 0
if (ival == c->value && !(c->value == 0 && isNegative(c->value))) {
- return VM::Value::fromInt32(ival);
+ return QV4::Value::fromInt32(ival);
} else {
- return VM::Value::fromDouble(c->value);
+ return QV4::Value::fromDouble(c->value);
}
}
default:
diff --git a/src/qml/qml/v4vm/qv4jsir_p.h b/src/qml/qml/v4vm/qv4jsir_p.h
index 64a467c732..1285c71e8c 100644
--- a/src/qml/qml/v4vm/qv4jsir_p.h
+++ b/src/qml/qml/v4vm/qv4jsir_p.h
@@ -68,6 +68,11 @@ QT_BEGIN_NAMESPACE
class QTextStream;
class QQmlType;
+namespace QV4 {
+struct ExecutionContext;
+struct Value;
+}
+
namespace QQmlJS {
inline bool isNegative(double d)
@@ -80,11 +85,6 @@ inline bool isNegative(double d)
}
-namespace VM {
-struct ExecutionContext;
-struct Value;
-}
-
namespace V4IR {
struct BasicBlock;
diff --git a/src/qml/qml/v4vm/qv4jsonobject.cpp b/src/qml/qml/v4vm/qv4jsonobject.cpp
index 1874edde44..2e9122980c 100644
--- a/src/qml/qml/v4vm/qv4jsonobject.cpp
+++ b/src/qml/qml/v4vm/qv4jsonobject.cpp
@@ -50,8 +50,7 @@
#include <wtf/MathExtras.h>
-namespace QQmlJS {
-namespace VM {
+using namespace QV4;
//#define PARSER_DEBUG
#ifdef PARSER_DEBUG
@@ -66,10 +65,10 @@ static int indent = 0;
#endif
-class Parser
+class JsonParser
{
public:
- Parser(ExecutionContext *context, const QChar *json, int length);
+ JsonParser(ExecutionContext *context, const QChar *json, int length);
Value parse(QJsonParseError *error);
@@ -96,7 +95,7 @@ private:
static const int nestingLimit = 1024;
-Parser::Parser(ExecutionContext *context, const QChar *json, int length)
+JsonParser::JsonParser(ExecutionContext *context, const QChar *json, int length)
: context(context), head(json), json(json), nestingLevel(0), lastError(QJsonParseError::NoError)
{
end = json + length;
@@ -144,7 +143,7 @@ enum {
Quote = 0x22
};
-bool Parser::eatSpace()
+bool JsonParser::eatSpace()
{
while (json < end) {
if (*json > Space)
@@ -159,7 +158,7 @@ bool Parser::eatSpace()
return (json < end);
}
-QChar Parser::nextToken()
+QChar JsonParser::nextToken()
{
if (!eatSpace())
return 0;
@@ -184,7 +183,7 @@ QChar Parser::nextToken()
/*
JSON-text = object / array
*/
-Value Parser::parse(QJsonParseError *error)
+Value JsonParser::parse(QJsonParseError *error)
{
#ifdef PARSER_DEBUG
indent = 0;
@@ -224,7 +223,7 @@ Value Parser::parse(QJsonParseError *error)
end-object
*/
-Value Parser::parseObject()
+Value JsonParser::parseObject()
{
if (++nestingLevel > nestingLimit) {
lastError = QJsonParseError::DeepNesting;
@@ -265,7 +264,7 @@ Value Parser::parseObject()
/*
member = string name-separator value
*/
-bool Parser::parseMember(Object *o)
+bool JsonParser::parseMember(Object *o)
{
BEGIN << "parseMember";
@@ -291,7 +290,7 @@ bool Parser::parseMember(Object *o)
/*
array = begin-array [ value *( value-separator value ) ] end-array
*/
-Value Parser::parseArray()
+Value JsonParser::parseArray()
{
BEGIN << "parseArray";
ArrayObject *array = context->engine->newArrayObject(context);
@@ -340,7 +339,7 @@ value = false / null / true / object / array / number / string
*/
-bool Parser::parseValue(Value *val)
+bool JsonParser::parseValue(Value *val)
{
BEGIN << "parse Value" << *json;
@@ -448,7 +447,7 @@ bool Parser::parseValue(Value *val)
*/
-bool Parser::parseNumber(Value *val)
+bool JsonParser::parseNumber(Value *val)
{
BEGIN << "parseNumber" << *json;
@@ -595,7 +594,7 @@ static inline bool scanEscapeSequence(const QChar *&json, const QChar *end, uint
}
-bool Parser::parseString(QString *string)
+bool JsonParser::parseString(QString *string)
{
BEGIN << "parse string stringPos=" << json;
@@ -878,7 +877,7 @@ Value JsonObject::method_parse(SimpleCallContext *ctx)
QString jtext = ctx->argument(0).toString(ctx)->toQString();
DEBUG << "parsing source = " << jtext;
- Parser parser(ctx, jtext.constData(), jtext.length());
+ JsonParser parser(ctx, jtext.constData(), jtext.length());
QJsonParseError error;
Value result = parser.parse(&error);
if (error.error != QJsonParseError::NoError) {
@@ -929,8 +928,3 @@ Value JsonObject::method_stringify(SimpleCallContext *ctx)
return Value::undefinedValue();
return Value::fromString(ctx, result);
}
-
-
-
-}
-}
diff --git a/src/qml/qml/v4vm/qv4jsonobject_p.h b/src/qml/qml/v4vm/qv4jsonobject_p.h
index f8aaee464f..2a923fb6c6 100644
--- a/src/qml/qml/v4vm/qv4jsonobject_p.h
+++ b/src/qml/qml/v4vm/qv4jsonobject_p.h
@@ -45,8 +45,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct JsonObject : Object {
JsonObject(ExecutionContext *context);
@@ -56,8 +55,7 @@ struct JsonObject : Object {
};
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4lookup.cpp b/src/qml/qml/v4vm/qv4lookup.cpp
index b5d312ad6a..f8a265ec87 100644
--- a/src/qml/qml/v4vm/qv4lookup.cpp
+++ b/src/qml/qml/v4vm/qv4lookup.cpp
@@ -43,10 +43,9 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+using namespace QV4;
-void Lookup::lookupPropertyGeneric(QQmlJS::VM::Lookup *l, ExecutionContext *ctx, QQmlJS::VM::Value *result, const QQmlJS::VM::Value &object)
+void Lookup::lookupPropertyGeneric(QV4::Lookup *l, ExecutionContext *ctx, QV4::Value *result, const QV4::Value &object)
{
if (Object *o = object.asObject()) {
PropertyAttributes attrs;
@@ -326,7 +325,4 @@ void Lookup::lookupGlobalAccessor2(Lookup *l, ExecutionContext *ctx, Value *resu
lookupGlobalGeneric(l, ctx, result);
}
-}
-}
-
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4lookup_p.h b/src/qml/qml/v4vm/qv4lookup_p.h
index 0b18ebff2e..81f9655ef0 100644
--- a/src/qml/qml/v4vm/qv4lookup_p.h
+++ b/src/qml/qml/v4vm/qv4lookup_p.h
@@ -50,8 +50,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct Lookup {
enum { Size = 3 };
@@ -137,7 +136,6 @@ struct Lookup {
};
}
-}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4managed.cpp b/src/qml/qml/v4vm/qv4managed.cpp
index 2df21ca59b..0362f188b1 100644
--- a/src/qml/qml/v4vm/qv4managed.cpp
+++ b/src/qml/qml/v4vm/qv4managed.cpp
@@ -43,7 +43,7 @@
#include "qv4mm_p.h"
#include "qv4errorobject_p.h"
-using namespace QQmlJS::VM;
+using namespace QV4;
const ManagedVTable Managed::static_vtbl =
{
diff --git a/src/qml/qml/v4vm/qv4managed_p.h b/src/qml/qml/v4vm/qv4managed_p.h
index a7a15e3b0a..ec041542ab 100644
--- a/src/qml/qml/v4vm/qv4managed_p.h
+++ b/src/qml/qml/v4vm/qv4managed_p.h
@@ -48,8 +48,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
class MemoryManager;
struct String;
@@ -240,7 +239,7 @@ private:
};
}
-}
+
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4math_p.h b/src/qml/qml/v4vm/qv4math_p.h
index 1cbb2ab490..2460c048ed 100644
--- a/src/qml/qml/v4vm/qv4math_p.h
+++ b/src/qml/qml/v4vm/qv4math_p.h
@@ -55,8 +55,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
static inline QMLJS_READONLY Value add_int32(int a, int b)
{
@@ -106,8 +105,7 @@ static inline QMLJS_READONLY Value mul_int32(int a, int b)
return Value::fromDouble((double)a * (double)b);
}
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4mathobject.cpp b/src/qml/qml/v4vm/qv4mathobject.cpp
index c8e06186be..ac7437d709 100644
--- a/src/qml/qml/v4vm/qv4mathobject.cpp
+++ b/src/qml/qml/v4vm/qv4mathobject.cpp
@@ -46,7 +46,7 @@
#include <qmath.h>
#include <qnumeric.h>
-using namespace QQmlJS::VM;
+using namespace QV4;
static const double qt_PI = 2.0 * ::asin(1.0);
diff --git a/src/qml/qml/v4vm/qv4mathobject_p.h b/src/qml/qml/v4vm/qv4mathobject_p.h
index 768e0c8fa6..1a1e43b4cc 100644
--- a/src/qml/qml/v4vm/qv4mathobject_p.h
+++ b/src/qml/qml/v4vm/qv4mathobject_p.h
@@ -45,8 +45,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct MathObject: Object
{
@@ -72,8 +71,7 @@ struct MathObject: Object
static Value method_tan(SimpleCallContext *context);
};
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4mm.cpp b/src/qml/qml/v4vm/qv4mm.cpp
index d756cf5b06..572a90f12e 100644
--- a/src/qml/qml/v4vm/qv4mm.cpp
+++ b/src/qml/qml/v4vm/qv4mm.cpp
@@ -60,7 +60,7 @@
#include <valgrind/memcheck.h>
#endif
-using namespace QQmlJS::VM;
+using namespace QV4;
using namespace WTF;
static const std::size_t CHUNK_SIZE = 1024*32;
@@ -118,14 +118,14 @@ struct MemoryManager::Data
::memset((void *)(obj + 1), c, size - sizeof(Managed));
-namespace QQmlJS { namespace VM {
+namespace QV4 {
bool operator<(const MemoryManager::Data::Chunk &a, const MemoryManager::Data::Chunk &b)
{
return a.memory.base() < b.memory.base();
}
-} } // namespace QQmlJS::VM
+} // namespace QV4
MemoryManager::MemoryManager()
: m_d(new Data(true))
diff --git a/src/qml/qml/v4vm/qv4mm_p.h b/src/qml/qml/v4vm/qv4mm_p.h
index f51331aaf9..fe858d8f7f 100644
--- a/src/qml/qml/v4vm/qv4mm_p.h
+++ b/src/qml/qml/v4vm/qv4mm_p.h
@@ -51,8 +51,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct ExecutionEngine;
struct ExecutionContext;
@@ -149,8 +148,7 @@ inline ExecutionContext *MemoryManager::allocContext(uint size)
}
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4numberobject.cpp b/src/qml/qml/v4vm/qv4numberobject.cpp
index cf35f5086a..e9e5c7e4fa 100644
--- a/src/qml/qml/v4vm/qv4numberobject.cpp
+++ b/src/qml/qml/v4vm/qv4numberobject.cpp
@@ -46,7 +46,7 @@
#include <cassert>
-using namespace QQmlJS::VM;
+using namespace QV4;
DEFINE_MANAGED_VTABLE(NumberCtor);
diff --git a/src/qml/qml/v4vm/qv4numberobject_p.h b/src/qml/qml/v4vm/qv4numberobject_p.h
index 7d89264052..f7f5ed7110 100644
--- a/src/qml/qml/v4vm/qv4numberobject_p.h
+++ b/src/qml/qml/v4vm/qv4numberobject_p.h
@@ -47,8 +47,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct NumberCtor: FunctionObject
{
@@ -75,8 +74,7 @@ struct NumberPrototype: NumberObject
};
-} // end of namespace VM
-} // end of namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4object.cpp b/src/qml/qml/v4vm/qv4object.cpp
index 46c1aa63fd..76c386515e 100644
--- a/src/qml/qml/v4vm/qv4object.cpp
+++ b/src/qml/qml/v4vm/qv4object.cpp
@@ -62,7 +62,7 @@
#include <iostream>
#include "qv4alloca_p.h"
-using namespace QQmlJS::VM;
+using namespace QV4;
DEFINE_MANAGED_VTABLE(Object);
diff --git a/src/qml/qml/v4vm/qv4object_p.h b/src/qml/qml/v4vm/qv4object_p.h
index c69733f9c0..a39ed69e53 100644
--- a/src/qml/qml/v4vm/qv4object_p.h
+++ b/src/qml/qml/v4vm/qv4object_p.h
@@ -62,8 +62,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct Value;
struct Function;
@@ -409,8 +408,7 @@ inline void Object::setArrayLengthUnchecked(uint l)
}
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4objectiterator.cpp b/src/qml/qml/v4vm/qv4objectiterator.cpp
index 185b1e486c..96d198d82a 100644
--- a/src/qml/qml/v4vm/qv4objectiterator.cpp
+++ b/src/qml/qml/v4vm/qv4objectiterator.cpp
@@ -43,8 +43,7 @@
#include "qv4stringobject_p.h"
#include "qv4identifier_p.h"
-namespace QQmlJS {
-namespace VM {
+using namespace QV4;
ObjectIterator::ObjectIterator(Object *o, uint flags)
: object(o)
@@ -178,7 +177,3 @@ Value ObjectIterator::nextPropertyNameAsString()
return __qmljs_to_string(Value::fromDouble(index), object->internalClass->engine->current);
return Value::nullValue();
}
-
-}
-}
-
diff --git a/src/qml/qml/v4vm/qv4objectiterator_p.h b/src/qml/qml/v4vm/qv4objectiterator_p.h
index caa63db057..272183fd99 100644
--- a/src/qml/qml/v4vm/qv4objectiterator_p.h
+++ b/src/qml/qml/v4vm/qv4objectiterator_p.h
@@ -45,8 +45,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct SparseArrayNode;
struct Object;
@@ -78,8 +77,7 @@ struct ObjectIterator
Value nextPropertyNameAsString();
};
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4objectproto.cpp b/src/qml/qml/v4vm/qv4objectproto.cpp
index bc564a4fee..01e14cf72b 100644
--- a/src/qml/qml/v4vm/qv4objectproto.cpp
+++ b/src/qml/qml/v4vm/qv4objectproto.cpp
@@ -68,7 +68,7 @@
# include <windows.h>
#endif
-using namespace QQmlJS::VM;
+using namespace QV4;
DEFINE_MANAGED_VTABLE(ObjectCtor);
diff --git a/src/qml/qml/v4vm/qv4objectproto_p.h b/src/qml/qml/v4vm/qv4objectproto_p.h
index 4920b4377f..87f6b0095c 100644
--- a/src/qml/qml/v4vm/qv4objectproto_p.h
+++ b/src/qml/qml/v4vm/qv4objectproto_p.h
@@ -47,8 +47,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct ObjectCtor: FunctionObject
{
@@ -96,8 +95,7 @@ struct ObjectPrototype: Object
};
-} // end of namespace VM
-} // end of namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4property_p.h b/src/qml/qml/v4vm/qv4property_p.h
index f9530d94a1..2a3c5bf976 100644
--- a/src/qml/qml/v4vm/qv4property_p.h
+++ b/src/qml/qml/v4vm/qv4property_p.h
@@ -47,8 +47,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct FunctionObject;
@@ -144,8 +143,7 @@ inline void Property::merge(PropertyAttributes &attrs, const Property &other, Pr
}
}
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4regexp.cpp b/src/qml/qml/v4vm/qv4regexp.cpp
index 4ad04b9b26..0dfbad3c3b 100644
--- a/src/qml/qml/v4vm/qv4regexp.cpp
+++ b/src/qml/qml/v4vm/qv4regexp.cpp
@@ -43,8 +43,7 @@
#include "qv4engine_p.h"
-namespace QQmlJS {
-namespace VM {
+using namespace QV4;
RegExpCache::~RegExpCache()
{
@@ -173,8 +172,3 @@ bool RegExp::deleteIndexedProperty(Managed *m, ExecutionContext *ctx, uint index
{
return false;
}
-
-} // end of namespace VM
-} // end of namespace QQmlJS
-
-
diff --git a/src/qml/qml/v4vm/qv4regexp_p.h b/src/qml/qml/v4vm/qv4regexp_p.h
index 30b707ef4e..0ae46e7278 100644
--- a/src/qml/qml/v4vm/qv4regexp_p.h
+++ b/src/qml/qml/v4vm/qv4regexp_p.h
@@ -59,8 +59,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct ExecutionEngine;
@@ -145,8 +144,7 @@ inline RegExpCacheKey::RegExpCacheKey(const RegExp *re)
{}
-} // end of namespace VM
-} // end of namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4regexpobject.cpp b/src/qml/qml/v4vm/qv4regexpobject.cpp
index 71c9f685fe..622c46e328 100644
--- a/src/qml/qml/v4vm/qv4regexpobject.cpp
+++ b/src/qml/qml/v4vm/qv4regexpobject.cpp
@@ -61,7 +61,7 @@
#include <iostream>
#include "qv4alloca_p.h"
-using namespace QQmlJS::VM;
+using namespace QV4;
DEFINE_MANAGED_VTABLE(RegExpObject);
diff --git a/src/qml/qml/v4vm/qv4regexpobject_p.h b/src/qml/qml/v4vm/qv4regexpobject_p.h
index 4c2e290233..27ef2c87eb 100644
--- a/src/qml/qml/v4vm/qv4regexpobject_p.h
+++ b/src/qml/qml/v4vm/qv4regexpobject_p.h
@@ -60,8 +60,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct RegExp;
@@ -101,8 +100,7 @@ struct RegExpPrototype: RegExpObject
static Value method_compile(SimpleCallContext *ctx);
};
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4runtime.cpp b/src/qml/qml/v4vm/qv4runtime.cpp
index fd1db0e8eb..4b6d3d22cf 100644
--- a/src/qml/qml/v4vm/qv4runtime.cpp
+++ b/src/qml/qml/v4vm/qv4runtime.cpp
@@ -65,8 +65,39 @@
#include <execinfo.h>
#endif
-namespace QQmlJS {
-namespace VM {
+using namespace QV4;
+
+
+Exception::Exception(ExecutionContext *throwingContext, const Value &exceptionValue)
+ : exception(PersistentValue(throwingContext->engine, exceptionValue))
+{
+ this->throwingContext = throwingContext->engine->current;
+ accepted = false;
+}
+
+Exception::~Exception()
+{
+ assert(accepted);
+}
+
+void Exception::accept(ExecutionContext *catchingContext)
+{
+ assert(!accepted);
+ accepted = true;
+ partiallyUnwindContext(catchingContext);
+}
+
+void Exception::partiallyUnwindContext(ExecutionContext *catchingContext)
+{
+ if (!throwingContext)
+ return;
+ ExecutionContext *context = throwingContext;
+ while (context != catchingContext)
+ context = context->engine->popContext();
+ throwingContext = context;
+}
+
+extern "C" {
QString __qmljs_numberToString(double num, int radix)
{
@@ -118,38 +149,7 @@ QString __qmljs_numberToString(double num, int radix)
return str;
}
-Exception::Exception(ExecutionContext *throwingContext, const Value &exceptionValue)
- : exception(PersistentValue(throwingContext->engine, exceptionValue))
-{
- this->throwingContext = throwingContext->engine->current;
- accepted = false;
-}
-
-Exception::~Exception()
-{
- assert(accepted);
-}
-
-void Exception::accept(ExecutionContext *catchingContext)
-{
- assert(!accepted);
- accepted = true;
- partiallyUnwindContext(catchingContext);
-}
-
-void Exception::partiallyUnwindContext(ExecutionContext *catchingContext)
-{
- if (!throwingContext)
- return;
- ExecutionContext *context = throwingContext;
- while (context != catchingContext)
- context = context->engine->popContext();
- throwingContext = context;
-}
-
-extern "C" {
-
-void __qmljs_init_closure(ExecutionContext *ctx, Value *result, VM::Function *clos)
+void __qmljs_init_closure(ExecutionContext *ctx, Value *result, Function *clos)
{
assert(clos);
*result = Value::fromObject(ctx->engine->newScriptFunction(ctx, clos));
@@ -1312,7 +1312,3 @@ void __qmljs_decrement(Value *result, const Value &value)
}
} // extern "C"
-
-
-} // namespace VM
-} // namespace QQmlJS
diff --git a/src/qml/qml/v4vm/qv4runtime_p.h b/src/qml/qml/v4vm/qv4runtime_p.h
index c718efc832..8edb618d2d 100644
--- a/src/qml/qml/v4vm/qv4runtime_p.h
+++ b/src/qml/qml/v4vm/qv4runtime_p.h
@@ -65,8 +65,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
enum TypeHint {
PREFERREDTYPE_HINT,
@@ -135,16 +134,16 @@ void __qmljs_builtin_post_decrement_element(ExecutionContext *context, Value *re
void Q_NORETURN __qmljs_builtin_throw(ExecutionContext *context, const Value &val);
void Q_NORETURN __qmljs_builtin_rethrow(ExecutionContext *context);
ExecutionContext *__qmljs_builtin_push_with_scope(const Value &o, ExecutionContext *ctx);
-ExecutionContext *__qmljs_builtin_push_catch_scope(String *exceptionVarName, const QQmlJS::VM::Value &exceptionValue, ExecutionContext *ctx);
+ExecutionContext *__qmljs_builtin_push_catch_scope(String *exceptionVarName, const QV4::Value &exceptionValue, ExecutionContext *ctx);
ExecutionContext *__qmljs_builtin_pop_scope(ExecutionContext *ctx);
void __qmljs_builtin_declare_var(ExecutionContext *ctx, bool deletable, String *name);
void __qmljs_builtin_define_property(ExecutionContext *ctx, const Value &object, String *name, Value *val);
-void __qmljs_builtin_define_array(ExecutionContext *ctx, Value *array, QQmlJS::VM::Value *values, uint length);
+void __qmljs_builtin_define_array(ExecutionContext *ctx, Value *array, QV4::Value *values, uint length);
void __qmljs_builtin_define_getter_setter(ExecutionContext *ctx, const Value &object, String *name, const Value *getter, const Value *setter);
// constructors
-void __qmljs_init_closure(ExecutionContext *ctx, Value *result, VM::Function *clos);
-VM::Function *__qmljs_register_function(ExecutionContext *ctx, String *name,
+void __qmljs_init_closure(ExecutionContext *ctx, Value *result, Function *clos);
+Function *__qmljs_register_function(ExecutionContext *ctx, String *name,
bool hasDirectEval,
bool usesArgumentsObject, bool isStrict,
bool hasNestedFunctions,
@@ -738,8 +737,7 @@ inline uint __qmljs_cmp_in(ExecutionContext *ctx, const Value &left, const Value
} // extern "C"
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4sparsearray.cpp b/src/qml/qml/v4vm/qv4sparsearray.cpp
index 20a2ff966e..262b79db0c 100644
--- a/src/qml/qml/v4vm/qv4sparsearray.cpp
+++ b/src/qml/qml/v4vm/qv4sparsearray.cpp
@@ -50,8 +50,7 @@
# include <qvector.h>
#endif
-namespace QQmlJS {
-namespace VM {
+using namespace QV4;
bool ArrayElementLessThan::operator()(const Property &p1, const Property &p2) const
{
@@ -458,7 +457,3 @@ SparseArrayNode *SparseArray::insert(uint akey)
return createNode(s, y, left);
}
-
-
-}
-}
diff --git a/src/qml/qml/v4vm/qv4sparsearray_p.h b/src/qml/qml/v4vm/qv4sparsearray_p.h
index 67bb37be13..d9b4c4defb 100644
--- a/src/qml/qml/v4vm/qv4sparsearray_p.h
+++ b/src/qml/qml/v4vm/qv4sparsearray_p.h
@@ -56,8 +56,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct SparseArray;
@@ -362,7 +361,6 @@ inline SparseArrayNode *SparseArray::upperBound(uint akey)
}
}
-}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4string.cpp b/src/qml/qml/v4vm/qv4string.cpp
index 919f0c299f..4aa220a7e3 100644
--- a/src/qml/qml/v4vm/qv4string.cpp
+++ b/src/qml/qml/v4vm/qv4string.cpp
@@ -46,8 +46,7 @@
#include "qv4stringobject_p.h"
#include <QtCore/QHash>
-namespace QQmlJS {
-namespace VM {
+using namespace QV4;
static uint toArrayIndex(const QChar *ch, const QChar *end, bool *ok)
{
@@ -237,6 +236,3 @@ uint String::createHashValue(const QChar *ch, int length)
return h;
}
-
-}
-}
diff --git a/src/qml/qml/v4vm/qv4string_p.h b/src/qml/qml/v4vm/qv4string_p.h
index 7f49588fbe..a681330a0a 100644
--- a/src/qml/qml/v4vm/qv4string_p.h
+++ b/src/qml/qml/v4vm/qv4string_p.h
@@ -46,8 +46,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct ExecutionEngine;
@@ -128,8 +127,7 @@ protected:
static const ManagedVTable static_vtbl;
};
-} // namespace VM
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4stringobject.cpp b/src/qml/qml/v4vm/qv4stringobject.cpp
index 1d4e97adcf..53a0fcf66b 100644
--- a/src/qml/qml/v4vm/qv4stringobject.cpp
+++ b/src/qml/qml/v4vm/qv4stringobject.cpp
@@ -73,7 +73,7 @@
# include <windows.h>
#endif
-using namespace QQmlJS::VM;
+using namespace QV4;
DEFINE_MANAGED_VTABLE(StringObject);
diff --git a/src/qml/qml/v4vm/qv4stringobject_p.h b/src/qml/qml/v4vm/qv4stringobject_p.h
index d22a6433ab..d53de77e8f 100644
--- a/src/qml/qml/v4vm/qv4stringobject_p.h
+++ b/src/qml/qml/v4vm/qv4stringobject_p.h
@@ -47,8 +47,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct StringObject: Object {
Value value;
@@ -100,8 +99,7 @@ struct StringPrototype: StringObject
static Value method_trim(SimpleCallContext *ctx);
};
-} // end of namespace VM
-} // end of namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4unwindhelper.cpp b/src/qml/qml/v4vm/qv4unwindhelper.cpp
index ba7690cf4e..0476eb324c 100644
--- a/src/qml/qml/v4vm/qv4unwindhelper.cpp
+++ b/src/qml/qml/v4vm/qv4unwindhelper.cpp
@@ -28,7 +28,7 @@
#endif // USE_ARM_HELPER
#ifdef USE_NULL_HELPER
-using namespace QQmlJS::VM;
+using namespace QV4;
void UnwindHelper::registerFunction(Function *function) {Q_UNUSED(function);}
void UnwindHelper::registerFunctions(QVector<Function *> functions) {Q_UNUSED(functions);}
void UnwindHelper::deregisterFunction(Function *function) {Q_UNUSED(function);}
diff --git a/src/qml/qml/v4vm/qv4unwindhelper_p-arm.h b/src/qml/qml/v4vm/qv4unwindhelper_p-arm.h
index ee30deebea..69d02a2ba8 100644
--- a/src/qml/qml/v4vm/qv4unwindhelper_p-arm.h
+++ b/src/qml/qml/v4vm/qv4unwindhelper_p-arm.h
@@ -16,8 +16,7 @@
#endif
#include <execinfo.h>
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
static void *removeThumbBit(void *addr)
{
@@ -149,7 +148,6 @@ void UnwindHelper::writeARMUnwindInfo(void *codeAddr, int codeSize)
}
}
-}
extern "C" Q_DECL_EXPORT void *__gnu_Unwind_Find_exidx(void *pc, int *entryCount)
{
@@ -160,11 +158,11 @@ extern "C" Q_DECL_EXPORT void *__gnu_Unwind_Find_exidx(void *pc, int *entryCount
oldFunction = (Old_Unwind_Find_exidx)dlsym(RTLD_NEXT, "__gnu_Unwind_Find_exidx");
{
- QMutexLocker locker(&QQmlJS::VM::functionProtector);
- QQmlJS::VM::Function *function = QQmlJS::VM::lookupFunction(pc);
+ QMutexLocker locker(&QV4::functionProtector);
+ QV4::Function *function = QV4::lookupFunction(pc);
if (function) {
*entryCount = 1;
- void * codeStart = QQmlJS::VM::removeThumbBit(function->codeRef.code().executableAddress());
+ void * codeStart = QV4::removeThumbBit(function->codeRef.code().executableAddress());
// At the end of the function we store our synthetic exception table entry.
return (char *)codeStart + function->codeSize;
}
diff --git a/src/qml/qml/v4vm/qv4unwindhelper_p-dw2.h b/src/qml/qml/v4vm/qv4unwindhelper_p-dw2.h
index c986acbd9b..b2b2495e5b 100644
--- a/src/qml/qml/v4vm/qv4unwindhelper_p-dw2.h
+++ b/src/qml/qml/v4vm/qv4unwindhelper_p-dw2.h
@@ -11,8 +11,7 @@
#define __USE_GNU
#include <dlfcn.h>
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
namespace {
#if CPU(X86_64)
@@ -148,8 +147,7 @@ void UnwindHelper::deregisterFunctions(QVector<Function *> functions)
deregisterFunctionUnlocked(f);
}
-} // VM namespace
-} // QQmlJS namespace
+}
#if defined(Q_OS_LINUX)
extern "C" {
@@ -169,14 +167,14 @@ Q_QML_EXPORT void *_Unwind_Find_FDE(void *pc, struct bases *bases)
oldFunction = (Old_Unwind_Find_FDE)dlsym(RTLD_NEXT, "_Unwind_Find_FDE");
{
- QMutexLocker locker(&QQmlJS::VM::functionProtector);
- QQmlJS::VM::Function *function = QQmlJS::VM::lookupFunction(pc);
+ QMutexLocker locker(&QV4::functionProtector);
+ QV4::Function *function = QV4::lookupFunction(pc);
if (function) {
bases->tbase = 0;
bases->dbase = 0;
bases->func = reinterpret_cast<void*>(function->code);
- QQmlJS::VM::ensureUnwindInfo(function);
- return function->unwindInfo.data() + QQmlJS::VM::fde_offset;
+ QV4::ensureUnwindInfo(function);
+ return function->unwindInfo.data() + QV4::fde_offset;
}
}
diff --git a/src/qml/qml/v4vm/qv4unwindhelper_p.h b/src/qml/qml/v4vm/qv4unwindhelper_p.h
index 9f6462d644..04c8c0ac94 100644
--- a/src/qml/qml/v4vm/qv4unwindhelper_p.h
+++ b/src/qml/qml/v4vm/qv4unwindhelper_p.h
@@ -3,8 +3,7 @@
#include <QtCore/QVector>
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct Function;
@@ -21,7 +20,6 @@ public:
#endif
};
-} // VM namespace
-} // QQmlJS namespace
+}
#endif // QV4UNWINDHELPER_H
diff --git a/src/qml/qml/v4vm/qv4util_p.h b/src/qml/qml/v4vm/qv4util_p.h
index 5857c22199..b735c27bac 100644
--- a/src/qml/qml/v4vm/qv4util_p.h
+++ b/src/qml/qml/v4vm/qv4util_p.h
@@ -45,7 +45,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
+namespace QV4 {
template <typename T>
struct TemporaryAssignment
@@ -67,7 +67,7 @@ private:
TemporaryAssignment operator=(const TemporaryAssignment<T>&);
};
-} // namespace QQmlJS
+}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v4vm/qv4v8.cpp b/src/qml/qml/v4vm/qv4v8.cpp
index 6e55e77643..da8bd826f0 100644
--- a/src/qml/qml/v4vm/qv4v8.cpp
+++ b/src/qml/qml/v4vm/qv4v8.cpp
@@ -58,21 +58,21 @@
#include <QThreadStorage>
using namespace QQmlJS;
-using namespace QQmlJS::VM;
+using namespace QV4;
namespace v8 {
#define currentEngine() Isolate::GetCurrent()->GetCurrentContext()->GetEngine()
-#define Q_D(obj) QQmlJS::VM::Value *d = reinterpret_cast<QQmlJS::VM::Value*>(obj)
+#define Q_D(obj) QV4::Value *d = reinterpret_cast<QV4::Value*>(obj)
-#define ValuePtr(obj) reinterpret_cast<QQmlJS::VM::Value*>(obj)
-#define ConstValuePtr(obj) reinterpret_cast<const QQmlJS::VM::Value*>(obj)
+#define ValuePtr(obj) reinterpret_cast<QV4::Value*>(obj)
+#define ConstValuePtr(obj) reinterpret_cast<const QV4::Value*>(obj)
void *gcProtect(void *handle)
{
Q_D(handle);
- if (VM::Managed *m = d->asManaged()) {
+ if (QV4::Managed *m = d->asManaged()) {
currentEngine()->memoryManager->protect(m);
return currentEngine()->memoryManager;
}
@@ -81,17 +81,17 @@ void *gcProtect(void *handle)
void gcProtect(void *memoryManager, void *handle)
{
Q_D(handle);
- if (VM::Managed *m = d->asManaged())
+ if (QV4::Managed *m = d->asManaged())
if (memoryManager)
- static_cast<VM::MemoryManager *>(memoryManager)->protect(m);
+ static_cast<QV4::MemoryManager *>(memoryManager)->protect(m);
}
void gcUnprotect(void *memoryManager, void *handle)
{
Q_D(handle);
- if (VM::Managed *m = d->asManaged())
+ if (QV4::Managed *m = d->asManaged())
if (memoryManager)
- static_cast<VM::MemoryManager *>(memoryManager)->unprotect(m);
+ static_cast<QV4::MemoryManager *>(memoryManager)->unprotect(m);
}
struct V8AccessorGetter: FunctionObject {
@@ -110,14 +110,14 @@ struct V8AccessorGetter: FunctionObject {
using Object::construct;
- static VM::Value call(Managed *that, ExecutionContext *context, const VM::Value &thisObject, VM::Value *args, int argc)
+ static QV4::Value call(Managed *that, ExecutionContext *context, const QV4::Value &thisObject, QV4::Value *args, int argc)
{
V8AccessorGetter *getter = static_cast<V8AccessorGetter*>(that);
AccessorInfo info(thisObject, getter->data);
- VM::Value result = VM::Value::undefinedValue();
+ QV4::Value result = QV4::Value::undefinedValue();
try {
- result = getter->getter(Local<String>::New(getter->name), info)->vmValue();
- } catch (VM::Exception &e) {
+ result = getter->getter(Local<String>::New(getter->name), info)->v4Value();
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(context);
}
@@ -146,19 +146,19 @@ struct V8AccessorSetter: FunctionObject {
using Object::construct;
- static VM::Value call(Managed *that, ExecutionContext *context, const VM::Value &thisObject, VM::Value *args, int argc)
+ static QV4::Value call(Managed *that, ExecutionContext *context, const QV4::Value &thisObject, QV4::Value *args, int argc)
{
if (!argc)
- return VM::Value::undefinedValue();
+ return QV4::Value::undefinedValue();
V8AccessorSetter *setter = static_cast<V8AccessorSetter*>(that);
AccessorInfo info(thisObject, setter->data);
try {
- setter->setter(Local<String>::New(setter->name), Local<Value>::New(Value::fromVmValue(args[0])), info);
- } catch (VM::Exception &e) {
+ setter->setter(Local<String>::New(setter->name), Local<Value>::New(Value::fromV4Value(args[0])), info);
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(context);
}
- return VM::Value::undefinedValue();
+ return QV4::Value::undefinedValue();
}
protected:
@@ -176,7 +176,7 @@ ScriptOrigin::ScriptOrigin(Handle<Value> resource_name, Handle<Integer> resource
Handle<Value> ScriptOrigin::ResourceName() const
{
- return Value::fromVmValue(VM::Value::fromString(currentEngine()->current, m_fileName));
+ return Value::fromV4Value(QV4::Value::fromString(currentEngine()->current, m_fileName));
}
Handle<Integer> ScriptOrigin::ResourceLineOffset() const
@@ -240,24 +240,24 @@ Local<Value> Script::Run()
if (context.IsEmpty())
context = Context::GetCurrent();
ASSERT(context.get());
- VM::ExecutionEngine *engine = context->GetEngine();
- VM::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionEngine *engine = context->GetEngine();
+ QV4::ExecutionContext *ctx = engine->current;
- VM::Value result = VM::Value::undefinedValue();
+ QV4::Value result = QV4::Value::undefinedValue();
try {
- QQmlJS::VM::Function *f = QQmlJS::VM::EvalFunction::parseSource(engine->rootContext, m_origin.m_fileName, m_script, QQmlJS::Codegen::EvalCode,
+ QV4::Function *f = QV4::EvalFunction::parseSource(engine->rootContext, m_origin.m_fileName, m_script, QQmlJS::Codegen::EvalCode,
/*strictMode =*/ false, /*inheritContext =*/ false);
if (!f)
- __qmljs_throw(engine->current, VM::Value::fromObject(engine->newSyntaxErrorObject(engine->current, 0)));
+ __qmljs_throw(engine->current, QV4::Value::fromObject(engine->newSyntaxErrorObject(engine->current, 0)));
result = context->GetEngine()->run(f);
- } catch (VM::Exception &e) {
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(ctx);
return Local<Value>();
}
- return Local<Value>::New(Value::fromVmValue(result));
+ return Local<Value>::New(Value::fromV4Value(result));
}
Local<Value> Script::Run(Handle<Object> qml)
@@ -266,24 +266,24 @@ Local<Value> Script::Run(Handle<Object> qml)
if (context.IsEmpty())
context = Context::GetCurrent();
ASSERT(context.get());
- VM::ExecutionEngine *engine = context->GetEngine();
- VM::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionEngine *engine = context->GetEngine();
+ QV4::ExecutionContext *ctx = engine->current;
- VM::Value result = VM::Value::undefinedValue();
+ QV4::Value result = QV4::Value::undefinedValue();
try {
- VM::EvalFunction *eval = new (engine->memoryManager) VM::EvalFunction(engine->rootContext, qml->vmValue().asObject());
+ QV4::EvalFunction *eval = new (engine->memoryManager) QV4::EvalFunction(engine->rootContext, qml->v4Value().asObject());
- VM::Value arg = VM::Value::fromString(engine->current, m_script);
+ QV4::Value arg = QV4::Value::fromString(engine->current, m_script);
- result = eval->evalCall(engine->current, VM::Value::undefinedValue(), &arg, 1, /*directCall*/ false);
- } catch (VM::Exception &e) {
+ result = eval->evalCall(engine->current, QV4::Value::undefinedValue(), &arg, 1, /*directCall*/ false);
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(ctx);
return Local<Value>();
}
- return Local<Value>::New(Value::fromVmValue(result));
+ return Local<Value>::New(Value::fromV4Value(result));
}
Local<Value> Script::Id()
@@ -300,12 +300,12 @@ void Script::SetData(Handle<String> data)
Local<String> Message::Get() const
{
- return Local<String>::New(Value::fromVmValue(VM::Value::fromString(currentEngine()->current, m_message)));
+ return Local<String>::New(Value::fromV4Value(QV4::Value::fromString(currentEngine()->current, m_message)));
}
Handle<Value> Message::GetScriptResourceName() const
{
- return Value::fromVmValue(VM::Value::fromString(currentEngine()->current, m_resourceName));
+ return Value::fromV4Value(QV4::Value::fromString(currentEngine()->current, m_resourceName));
}
int Message::GetLineNumber() const
@@ -335,12 +335,12 @@ Local<Array> StackTrace::AsArray()
Local<StackTrace> StackTrace::CurrentStackTrace(int frame_limit, StackTrace::StackTraceOptions options)
{
StackTrace *trace = new StackTrace;
- VM::ExecutionEngine *engine = currentEngine();
- VM::ExecutionContext *current = engine->current;
+ QV4::ExecutionEngine *engine = currentEngine();
+ QV4::ExecutionContext *current = engine->current;
while (current && frame_limit) {
if (CallContext *c = current->asCallContext()) {
- StackFrame *frame = new StackFrame(Value::fromVmValue(VM::Value::fromString(engine->id_null)),
- Value::fromVmValue(VM::Value::fromString(c->function->name)),
+ StackFrame *frame = new StackFrame(Value::fromV4Value(QV4::Value::fromString(engine->id_null)),
+ Value::fromV4Value(QV4::Value::fromString(c->function->name)),
0, 0);
trace->frames.append(frame);
--frame_limit;
@@ -484,42 +484,42 @@ bool Value::IsError() const
Local<Boolean> Value::ToBoolean() const
{
- return Local<Boolean>::New(Value::fromVmValue(VM::Value::fromBoolean(ConstValuePtr(this)->toBoolean())));
+ return Local<Boolean>::New(Value::fromV4Value(QV4::Value::fromBoolean(ConstValuePtr(this)->toBoolean())));
}
Local<Number> Value::ToNumber() const
{
- return Local<Number>::New(Value::fromVmValue(VM::Value::fromDouble(ConstValuePtr(this)->toNumber())));
+ return Local<Number>::New(Value::fromV4Value(QV4::Value::fromDouble(ConstValuePtr(this)->toNumber())));
}
Local<String> Value::ToString() const
{
- return Local<String>::New(Value::fromVmValue(VM::Value::fromString(ConstValuePtr(this)->toString(currentEngine()->current))));
+ return Local<String>::New(Value::fromV4Value(QV4::Value::fromString(ConstValuePtr(this)->toString(currentEngine()->current))));
}
Local<Object> Value::ToObject() const
{
- return Local<Object>::New(Value::fromVmValue(QQmlJS::VM::Value::fromObject(ConstValuePtr(this)->toObject(currentEngine()->current))));
+ return Local<Object>::New(Value::fromV4Value(QV4::Value::fromObject(ConstValuePtr(this)->toObject(currentEngine()->current))));
}
Local<Integer> Value::ToInteger() const
{
- return Local<Integer>::New(Value::fromVmValue(QQmlJS::VM::Value::fromDouble(ConstValuePtr(this)->toInteger())));
+ return Local<Integer>::New(Value::fromV4Value(QV4::Value::fromDouble(ConstValuePtr(this)->toInteger())));
}
Local<Uint32> Value::ToUint32() const
{
- return Local<Uint32>::New(Value::fromVmValue(QQmlJS::VM::Value::fromUInt32(ConstValuePtr(this)->toUInt32())));
+ return Local<Uint32>::New(Value::fromV4Value(QV4::Value::fromUInt32(ConstValuePtr(this)->toUInt32())));
}
Local<Int32> Value::ToInt32() const
{
- return Local<Int32>::New(Value::fromVmValue(QQmlJS::VM::Value::fromInt32(ConstValuePtr(this)->toInt32())));
+ return Local<Int32>::New(Value::fromV4Value(QV4::Value::fromInt32(ConstValuePtr(this)->toInt32())));
}
Local<Uint32> Value::ToArrayIndex() const
{
- return Local<Uint32>::New(Value::fromVmValue(QQmlJS::VM::Value::fromUInt32(ConstValuePtr(this)->asArrayIndex())));
+ return Local<Uint32>::New(Value::fromV4Value(QV4::Value::fromUInt32(ConstValuePtr(this)->asArrayIndex())));
}
bool Value::BooleanValue() const
@@ -557,15 +557,15 @@ bool Value::StrictEquals(Handle<Value> that) const
return __qmljs_strict_equal(*ConstValuePtr(this), *ConstValuePtr(&that));
}
-VM::Value Value::vmValue() const
+QV4::Value Value::v4Value() const
{
return *ConstValuePtr(this);
}
-Handle<Value> Value::fromVmValue(const VM::Value &vmValue)
+Handle<Value> Value::fromV4Value(const QV4::Value &v4Value)
{
Handle<Value> res;
- res.val = vmValue.val;
+ res.val = v4Value.val;
return res;
}
@@ -577,24 +577,24 @@ bool Boolean::Value() const
Handle<Boolean> Boolean::New(bool value)
{
- return Value::fromVmValue(VM::Value::fromBoolean(value));
+ return Value::fromV4Value(QV4::Value::fromBoolean(value));
}
int String::Length() const
{
- return asVMString()->toQString().length();
+ return asV4String()->toQString().length();
}
uint32_t String::Hash() const
{
- return asVMString()->hashValue();
+ return asV4String()->hashValue();
}
String::CompleteHashData String::CompleteHash() const
{
- VM::String *s = asVMString();
+ QV4::String *s = asV4String();
CompleteHashData data;
data.hash = s->hashValue();
data.length = s->toQString().length();
@@ -604,14 +604,14 @@ String::CompleteHashData String::CompleteHash() const
uint32_t String::ComputeHash(uint16_t *string, int length)
{
- return VM::String::createHashValue(reinterpret_cast<const QChar *>(string), length);
+ return QV4::String::createHashValue(reinterpret_cast<const QChar *>(string), length);
}
uint32_t String::ComputeHash(char *string, int length)
{
// ### unefficient
QString s = QString::fromLatin1((char *)string, length);
- return VM::String::createHashValue(s.constData(), s.length());
+ return QV4::String::createHashValue(s.constData(), s.length());
}
bool String::Equals(uint16_t *str, int length)
@@ -644,7 +644,7 @@ int String::Write(uint16_t *buffer, int start, int length, int options) const
v8::Local<String> String::Empty()
{
- return Local<String>::New(v8::Value::fromVmValue(VM::Value::fromString(currentEngine()->current, QString())));
+ return Local<String>::New(v8::Value::fromV4Value(QV4::Value::fromString(currentEngine()->current, QString())));
}
bool String::IsExternal() const
@@ -667,26 +667,26 @@ String *String::Cast(v8::Value *obj)
Local<String> String::New(const char *data, int length)
{
- QQmlJS::VM::Value v = QQmlJS::VM::Value::fromString(currentEngine()->current, QString::fromLatin1(data, length));
- return Local<String>::New(v8::Value::fromVmValue(v));
+ QV4::Value v = QV4::Value::fromString(currentEngine()->current, QString::fromLatin1(data, length));
+ return Local<String>::New(v8::Value::fromV4Value(v));
}
Local<String> String::New(const uint16_t *data, int length)
{
- QQmlJS::VM::Value v = QQmlJS::VM::Value::fromString(currentEngine()->current, QString((const QChar *)data, length));
- return Local<String>::New(v8::Value::fromVmValue(v));
+ QV4::Value v = QV4::Value::fromString(currentEngine()->current, QString((const QChar *)data, length));
+ return Local<String>::New(v8::Value::fromV4Value(v));
}
Local<String> String::NewSymbol(const char *data, int length)
{
QString str = QString::fromLatin1(data, length);
- VM::String *vmString = currentEngine()->newIdentifier(str);
+ QV4::String *vmString = currentEngine()->newIdentifier(str);
return New(vmString);
}
-Local<String> String::New(VM::String *s)
+Local<String> String::New(QV4::String *s)
{
- return Local<String>::New(v8::Value::fromVmValue(VM::Value::fromString(s)));
+ return Local<String>::New(v8::Value::fromV4Value(QV4::Value::fromString(s)));
}
Local<String> String::NewExternal(String::ExternalStringResource *resource)
@@ -697,12 +697,12 @@ Local<String> String::NewExternal(String::ExternalStringResource *resource)
QString String::asQString() const
{
- return asVMString()->toQString();
+ return asV4String()->toQString();
}
-VM::String *String::asVMString() const
+QV4::String *String::asV4String() const
{
- const VM::Value *v = ConstValuePtr(this);
+ const QV4::Value *v = ConstValuePtr(this);
ASSERT(v->isString());
return v->stringValue();
}
@@ -720,14 +720,14 @@ String::Value::Value(Handle<v8::Value> obj)
double Number::Value() const
{
- const VM::Value *v = ConstValuePtr(this);
+ const QV4::Value *v = ConstValuePtr(this);
assert(v->isNumber());
return v->asDouble();
}
Local<Number> Number::New(double value)
{
- return Local<Number>::New(Value::fromVmValue(VM::Value::fromDouble(value)));
+ return Local<Number>::New(Value::fromV4Value(QV4::Value::fromDouble(value)));
}
Number *Number::Cast(v8::Value *obj)
@@ -737,12 +737,12 @@ Number *Number::Cast(v8::Value *obj)
Local<Integer> Integer::New(int32_t value)
{
- return Local<Integer>::New(Value::fromVmValue(VM::Value::fromInt32(value)));
+ return Local<Integer>::New(Value::fromV4Value(QV4::Value::fromInt32(value)));
}
Local<Integer> Integer::NewFromUnsigned(uint32_t value)
{
- return Local<Integer>::New(Value::fromVmValue(VM::Value::fromUInt32(value)));
+ return Local<Integer>::New(Value::fromV4Value(QV4::Value::fromUInt32(value)));
}
Local<Integer> Integer::New(int32_t value, Isolate *)
@@ -757,7 +757,7 @@ Local<Integer> Integer::NewFromUnsigned(uint32_t value, Isolate *)
int64_t Integer::Value() const
{
- const VM::Value *v = ConstValuePtr(this);
+ const QV4::Value *v = ConstValuePtr(this);
assert(v->isNumber());
return (int64_t)v->asDouble();
}
@@ -769,20 +769,20 @@ Integer *Integer::Cast(v8::Value *obj)
int32_t Int32::Value() const
{
- const VM::Value *v = ConstValuePtr(this);
+ const QV4::Value *v = ConstValuePtr(this);
assert(v->isInteger());
return v->int_32;
}
uint32_t Uint32::Value() const
{
- const VM::Value *v = ConstValuePtr(this);
+ const QV4::Value *v = ConstValuePtr(this);
assert(v->isNumber());
return v->toUInt32();
}
-struct ExternalResourceWrapper : public QQmlJS::VM::Object::ExternalResource
+struct ExternalResourceWrapper : public QV4::Object::ExternalResource
{
ExternalResourceWrapper(v8::Object::ExternalResource *wrapped)
{
@@ -800,14 +800,14 @@ struct ExternalResourceWrapper : public QQmlJS::VM::Object::ExternalResource
bool Object::Set(Handle<Value> key, Handle<Value> value, PropertyAttribute attribs)
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
- QQmlJS::VM::ExecutionContext *ctx = currentEngine()->current;
+ QV4::ExecutionContext *ctx = currentEngine()->current;
bool result = true;
try {
o->put(ctx, ValuePtr(&key)->toString(ctx), *ValuePtr(&value));
// ### attribs
- } catch (VM::Exception &e) {
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(ctx);
result = false;
@@ -817,14 +817,14 @@ bool Object::Set(Handle<Value> key, Handle<Value> value, PropertyAttribute attri
bool Object::Set(uint32_t index, Handle<Value> value)
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
- QQmlJS::VM::ExecutionContext *ctx = currentEngine()->current;
+ QV4::ExecutionContext *ctx = currentEngine()->current;
bool result = true;
try {
o->putIndexed(ctx, index, *ValuePtr(&value));
// ### attribs
- } catch (VM::Exception &e) {
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(ctx);
result = false;
@@ -834,52 +834,52 @@ bool Object::Set(uint32_t index, Handle<Value> value)
Local<Value> Object::Get(Handle<Value> key)
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
- QQmlJS::VM::ExecutionContext *ctx = currentEngine()->current;
- QQmlJS::VM::Value prop = VM::Value::undefinedValue();
+ QV4::ExecutionContext *ctx = currentEngine()->current;
+ QV4::Value prop = QV4::Value::undefinedValue();
try {
prop = o->get(ctx, ValuePtr(&key)->toString(ctx));
- } catch (VM::Exception &e) {
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(ctx);
return Local<Value>();
}
- return Local<Value>::New(Value::fromVmValue(prop));
+ return Local<Value>::New(Value::fromV4Value(prop));
}
Local<Value> Object::Get(uint32_t key)
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
- QQmlJS::VM::ExecutionContext *ctx = currentEngine()->current;
- QQmlJS::VM::Value prop = VM::Value::undefinedValue();
+ QV4::ExecutionContext *ctx = currentEngine()->current;
+ QV4::Value prop = QV4::Value::undefinedValue();
try {
prop = o->getIndexed(ctx, key);
- } catch (VM::Exception &e) {
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(ctx);
return Local<Value>();
}
- return Local<Value>::New(Value::fromVmValue(prop));
+ return Local<Value>::New(Value::fromV4Value(prop));
}
bool Object::Has(Handle<String> key)
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
return o->__hasProperty__(ValuePtr(&key)->asString());
}
bool Object::Delete(Handle<String> key)
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
bool result = false;
ExecutionContext *ctx = currentEngine()->current;
try {
result = o->deleteProperty(ctx, ValuePtr(&key)->asString());
- } catch (VM::Exception &e) {
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(ctx);
}
@@ -888,7 +888,7 @@ bool Object::Delete(Handle<String> key)
bool Object::Has(uint32_t index)
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
if (!o)
return false;
return o->__hasProperty__(index);
@@ -896,13 +896,13 @@ bool Object::Has(uint32_t index)
bool Object::Delete(uint32_t index)
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
ExecutionContext *ctx = currentEngine()->current;
bool result = false;
try {
result = o->deleteIndexedProperty(ctx, index);
- } catch (VM::Exception &e) {
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(ctx);
}
@@ -911,23 +911,23 @@ bool Object::Delete(uint32_t index)
bool Object::SetAccessor(Handle<String> name, AccessorGetter getter, AccessorSetter setter, Handle<Value> data, AccessControl settings, PropertyAttribute attribute)
{
- VM::ExecutionEngine *engine = currentEngine();
+ QV4::ExecutionEngine *engine = currentEngine();
- VM::FunctionObject *wrappedGetter = 0;
+ QV4::FunctionObject *wrappedGetter = 0;
if (getter) {
wrappedGetter = new (engine->memoryManager) V8AccessorGetter(engine->rootContext, name, getter, data);
}
- VM::FunctionObject *wrappedSetter = 0;
+ QV4::FunctionObject *wrappedSetter = 0;
if (setter) {
wrappedSetter = new (engine->memoryManager) V8AccessorSetter(engine->rootContext, name, setter, data);
}
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
PropertyAttributes attrs = Attr_Accessor;
attrs.setConfigurable(!(attribute & DontDelete));
attrs.setEnumerable(!(attribute & DontEnum));
- VM::Property *pd = o->insertMember(name->asVMString(), attrs);
+ QV4::Property *pd = o->insertMember(name->asV4String(), attrs);
pd->setGetter(wrappedGetter);
pd->setSetter(wrappedSetter);
return true;
@@ -935,51 +935,51 @@ bool Object::SetAccessor(Handle<String> name, AccessorGetter getter, AccessorSet
Local<Array> Object::GetPropertyNames()
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
- VM::ArrayObject *array = currentEngine()->newArrayObject(currentEngine()->current)->asArrayObject();
+ QV4::ArrayObject *array = currentEngine()->newArrayObject(currentEngine()->current)->asArrayObject();
ObjectIterator it(o, ObjectIterator::WithProtoChain|ObjectIterator::EnumberableOnly);
while (1) {
- VM::Value v = it.nextPropertyNameAsString();
+ QV4::Value v = it.nextPropertyNameAsString();
if (v.isNull())
break;
array->push_back(v);
}
- return Local<Array>::New(Value::fromVmValue(VM::Value::fromObject(array)));
+ return Local<Array>::New(Value::fromV4Value(QV4::Value::fromObject(array)));
}
Local<Array> Object::GetOwnPropertyNames()
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
- VM::Value arg = VM::Value::fromObject(o);
+ QV4::Value arg = QV4::Value::fromObject(o);
ArrayObject *array = currentEngine()->newArrayObject(currentEngine()->current)->asArrayObject();
ObjectIterator it(o, ObjectIterator::EnumberableOnly);
while (1) {
- VM::Value v = it.nextPropertyNameAsString();
+ QV4::Value v = it.nextPropertyNameAsString();
if (v.isNull())
break;
array->push_back(v);
}
- return Local<Array>::New(Value::fromVmValue(VM::Value::fromObject(array)));
+ return Local<Array>::New(Value::fromV4Value(QV4::Value::fromObject(array)));
}
Local<Value> Object::GetPrototype()
{
Local<Value> result;
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
if (!o)
return Local<Value>();
- return Local<Value>::New(Value::fromVmValue(QQmlJS::VM::Value::fromObject(o->prototype)));
+ return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o->prototype)));
}
bool Object::SetPrototype(Handle<Value> prototype)
{
- QQmlJS::VM::Object *p = ConstValuePtr(&prototype)->asObject();
+ QV4::Object *p = ConstValuePtr(&prototype)->asObject();
if (!p)
return false;
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
if (!o)
return false;
@@ -1000,7 +1000,7 @@ void Object::SetInternalField(int index, Handle<Value> value)
void Object::SetExternalResource(Object::ExternalResource *resource)
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
if (!o)
return;
o->externalResource = new ExternalResourceWrapper(resource);
@@ -1008,7 +1008,7 @@ void Object::SetExternalResource(Object::ExternalResource *resource)
Object::ExternalResource *Object::GetExternalResource()
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
if (!o || !o->externalResource)
return 0;
return static_cast<ExternalResourceWrapper*>(o->externalResource)->wrapped;
@@ -1016,9 +1016,9 @@ Object::ExternalResource *Object::GetExternalResource()
bool Object::HasOwnProperty(Handle<String> key)
{
- QQmlJS::VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
assert(o);
- QQmlJS::VM::ExecutionContext *ctx = currentEngine()->current;
+ QV4::ExecutionContext *ctx = currentEngine()->current;
return o->__getOwnProperty__(ValuePtr(&key)->toString(ctx));
}
@@ -1052,16 +1052,16 @@ bool Object::IsCallable()
Local<Value> Object::CallAsFunction(Handle<Object> recv, int argc, Handle<Value> argv[])
{
- VM::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
+ QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
if (!f)
return Local<Value>();
ExecutionContext *context = currentEngine()->current;
try {
- VM::Value retval = f->call(context, recv->vmValue(),
- reinterpret_cast<QQmlJS::VM::Value*>(argv),
+ QV4::Value retval = f->call(context, recv->v4Value(),
+ reinterpret_cast<QV4::Value*>(argv),
argc);
- return Local<Value>::New(Value::fromVmValue(retval));
- } catch (VM::Exception &e) {
+ return Local<Value>::New(Value::fromV4Value(retval));
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(context);
}
@@ -1070,16 +1070,16 @@ Local<Value> Object::CallAsFunction(Handle<Object> recv, int argc, Handle<Value>
Local<Value> Object::CallAsConstructor(int argc, Handle<Value> argv[])
{
- VM::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
+ QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
if (!f)
return Local<Value>();
ExecutionContext *context = currentEngine()->current;
try {
- VM::Value retval = f->construct(context,
- reinterpret_cast<QQmlJS::VM::Value*>(argv),
+ QV4::Value retval = f->construct(context,
+ reinterpret_cast<QV4::Value*>(argv),
argc);
- return Local<Value>::New(Value::fromVmValue(retval));
- } catch (VM::Exception &e) {
+ return Local<Value>::New(Value::fromV4Value(retval));
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(context);
}
@@ -1088,8 +1088,8 @@ Local<Value> Object::CallAsConstructor(int argc, Handle<Value> argv[])
Local<Object> Object::New()
{
- VM::Object *o = currentEngine()->newObject();
- return Local<Object>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::Object *o = currentEngine()->newObject();
+ return Local<Object>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
Object *Object::Cast(Value *obj)
@@ -1100,7 +1100,7 @@ Object *Object::Cast(Value *obj)
uint32_t Array::Length() const
{
- VM::ArrayObject *a = ConstValuePtr(this)->asArrayObject();
+ QV4::ArrayObject *a = ConstValuePtr(this)->asArrayObject();
if (!a)
return 0;
return a->arrayLength();
@@ -1110,11 +1110,11 @@ Local<Array> Array::New(int length)
{
if (length < 0)
length = 0;
- VM::ArrayObject *a = currentEngine()->newArrayObject(currentEngine()->current);
+ QV4::ArrayObject *a = currentEngine()->newArrayObject(currentEngine()->current);
if (length < 0x1000)
a->arrayReserve(length);
- return Local<Array>::New(Value::fromVmValue(VM::Value::fromObject(a)));
+ return Local<Array>::New(Value::fromV4Value(QV4::Value::fromObject(a)));
}
Array *Array::Cast(Value *obj)
@@ -1125,60 +1125,60 @@ Array *Array::Cast(Value *obj)
Local<Object> Function::NewInstance() const
{
- VM::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
+ QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
assert(f);
- VM::ExecutionContext *context = currentEngine()->current;
- QQmlJS::VM::Value result = VM::Value::undefinedValue();
+ QV4::ExecutionContext *context = currentEngine()->current;
+ QV4::Value result = QV4::Value::undefinedValue();
try {
result = f->construct(context, 0, 0);
- } catch (VM::Exception &e) {
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(context);
return Local<Object>();
}
- return Local<Object>::New(Value::fromVmValue(result));
+ return Local<Object>::New(Value::fromV4Value(result));
}
Local<Object> Function::NewInstance(int argc, Handle<Value> argv[]) const
{
- VM::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
+ QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
assert(f);
- VM::ExecutionContext *context = currentEngine()->current;
- QQmlJS::VM::Value result = VM::Value::undefinedValue();
+ QV4::ExecutionContext *context = currentEngine()->current;
+ QV4::Value result = QV4::Value::undefinedValue();
try {
- result = f->construct(context, reinterpret_cast<QQmlJS::VM::Value*>(argv), argc);
- } catch (VM::Exception &e) {
+ result = f->construct(context, reinterpret_cast<QV4::Value*>(argv), argc);
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(context);
return Local<Object>();
}
- return Local<Object>::New(Value::fromVmValue(result));
+ return Local<Object>::New(Value::fromV4Value(result));
}
Local<Value> Function::Call(Handle<Object> thisObj, int argc, Handle<Value> argv[])
{
- QQmlJS::VM::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
+ QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
if (!f)
return Local<Value>();
- VM::ExecutionContext *context = currentEngine()->current;
- QQmlJS::VM::Value result = VM::Value::undefinedValue();
+ QV4::ExecutionContext *context = currentEngine()->current;
+ QV4::Value result = QV4::Value::undefinedValue();
try {
result = f->call(context, *ConstValuePtr(&thisObj),
- reinterpret_cast<QQmlJS::VM::Value*>(argv), argc);
- } catch (VM::Exception &e) {
+ reinterpret_cast<QV4::Value*>(argv), argc);
+ } catch (QV4::Exception &e) {
Isolate::GetCurrent()->setException(e.value());
e.accept(context);
return Local<Value>();
}
- return Local<Value>::New(Value::fromVmValue(result));
+ return Local<Value>::New(Value::fromV4Value(result));
}
Handle<Value> Function::GetName() const
{
- QQmlJS::VM::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
+ QV4::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
if (!f)
return Handle<Value>();
- return Value::fromVmValue(VM::Value::fromString(f->name));
+ return Value::fromV4Value(QV4::Value::fromString(f->name));
}
ScriptOrigin Function::GetScriptOrigin() const
@@ -1195,8 +1195,8 @@ Function *Function::Cast(Value *obj)
Local<Value> Date::New(double time)
{
- VM::Object *o = currentEngine()->newDateObject(VM::Value::fromDouble(time));
- return Local<Value>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::Object *o = currentEngine()->newDateObject(QV4::Value::fromDouble(time));
+ return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
double Date::NumberValue() const
@@ -1219,13 +1219,13 @@ void Date::DateTimeConfigurationChangeNotification()
Local<Value> NumberObject::New(double value)
{
- VM::Object *o = currentEngine()->newNumberObject(VM::Value::fromDouble(value));
- return Local<Value>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::Object *o = currentEngine()->newNumberObject(QV4::Value::fromDouble(value));
+ return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
double NumberObject::NumberValue() const
{
- VM::NumberObject *n = ConstValuePtr(this)->asNumberObject();
+ QV4::NumberObject *n = ConstValuePtr(this)->asNumberObject();
assert(n);
return n->value.doubleValue();
}
@@ -1237,13 +1237,13 @@ NumberObject *NumberObject::Cast(Value *obj)
Local<Value> BooleanObject::New(bool value)
{
- VM::Object *o = currentEngine()->newBooleanObject(VM::Value::fromBoolean(value));
- return Local<Value>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::Object *o = currentEngine()->newBooleanObject(QV4::Value::fromBoolean(value));
+ return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
bool BooleanObject::BooleanValue() const
{
- VM::BooleanObject *b = ConstValuePtr(this)->asBooleanObject();
+ QV4::BooleanObject *b = ConstValuePtr(this)->asBooleanObject();
assert(b);
return b->value.booleanValue();
}
@@ -1255,15 +1255,15 @@ BooleanObject *BooleanObject::Cast(Value *obj)
Local<Value> StringObject::New(Handle<String> value)
{
- VM::Object *o = currentEngine()->newStringObject(currentEngine()->current, VM::Value::fromString(value->vmValue().asString()));
- return Local<Value>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::Object *o = currentEngine()->newStringObject(currentEngine()->current, QV4::Value::fromString(value->v4Value().asString()));
+ return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
Local<String> StringObject::StringValue() const
{
- VM::StringObject *s = ConstValuePtr(this)->asStringObject();
+ QV4::StringObject *s = ConstValuePtr(this)->asStringObject();
assert(s);
- return Local<String>::New(Value::fromVmValue(s->value));
+ return Local<String>::New(Value::fromV4Value(s->value));
}
StringObject *StringObject::Cast(Value *obj)
@@ -1280,15 +1280,15 @@ Local<RegExp> RegExp::New(Handle<String> pattern, RegExp::Flags flags)
f |= V4IR::RegExp::RegExp_IgnoreCase;
if (flags & kMultiline)
f |= V4IR::RegExp::RegExp_Multiline;
- VM::Object *o = currentEngine()->newRegExpObject(pattern->asQString(), f);
- return Local<RegExp>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::Object *o = currentEngine()->newRegExpObject(pattern->asQString(), f);
+ return Local<RegExp>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
Local<String> RegExp::GetSource() const
{
RegExpObject *re = ConstValuePtr(this)->asRegExpObject();
assert(re);
- return Local<String>::New(Value::fromVmValue(VM::Value::fromString(currentEngine()->current, re->value->pattern())));
+ return Local<String>::New(Value::fromV4Value(QV4::Value::fromString(currentEngine()->current, re->value->pattern())));
}
RegExp::Flags RegExp::GetFlags() const
@@ -1312,7 +1312,7 @@ RegExp *RegExp::Cast(Value *obj)
return static_cast<RegExp *>(obj);
}
-struct VoidStarWrapper : public VM::Object::ExternalResource
+struct VoidStarWrapper : public QV4::Object::ExternalResource
{
void *data;
};
@@ -1329,11 +1329,11 @@ void *External::Unwrap(Handle<v8::Value> obj)
Local<External> External::New(void *value)
{
- VM::Object *o = currentEngine()->newObject();
+ QV4::Object *o = currentEngine()->newObject();
VoidStarWrapper *wrapper = new VoidStarWrapper;
wrapper->data = value;
o->externalResource = wrapper;
- return Local<v8::External>::New(v8::Value::fromVmValue(VM::Value::fromObject(o)));
+ return Local<v8::External>::New(v8::Value::fromV4Value(QV4::Value::fromObject(o)));
}
External *External::Cast(v8::Value *obj)
@@ -1343,7 +1343,7 @@ External *External::Cast(v8::Value *obj)
void *External::Value() const
{
- VM::Object *o = ConstValuePtr(this)->asObject();
+ QV4::Object *o = ConstValuePtr(this)->asObject();
if (!o || !o->externalResource)
return 0;
return static_cast<VoidStarWrapper*>(o->externalResource)->data;
@@ -1365,11 +1365,11 @@ void Template::Set(const char *name, Handle<Value> value)
}
-Arguments::Arguments(const VM::Value *args, int argc, const VM::Value &thisObject, bool isConstructor, const Persistent<Value> &data)
+Arguments::Arguments(const QV4::Value *args, int argc, const QV4::Value &thisObject, bool isConstructor, const Persistent<Value> &data)
{
for (int i = 0; i < argc; ++i)
- m_args << Persistent<Value>::New(Value::fromVmValue(args[i]));
- m_thisObject = Persistent<Object>::New(Value::fromVmValue(thisObject));
+ m_args << Persistent<Value>::New(Value::fromV4Value(args[i]));
+ m_thisObject = Persistent<Object>::New(Value::fromV4Value(thisObject));
m_isConstructor = isConstructor;
m_data = Persistent<Value>::New(data);
}
@@ -1411,9 +1411,9 @@ Isolate *Arguments::GetIsolate() const
}
-AccessorInfo::AccessorInfo(const VM::Value &thisObject, const Persistent<Value> &data)
+AccessorInfo::AccessorInfo(const QV4::Value &thisObject, const Persistent<Value> &data)
{
- m_this = Persistent<Object>::New(Value::fromVmValue(thisObject));
+ m_this = Persistent<Object>::New(Value::fromV4Value(thisObject));
m_data = data;
}
@@ -1442,7 +1442,7 @@ template <typename BaseClass>
class V4V8Object : public BaseClass
{
public:
- V4V8Object(VM::ExecutionEngine *engine, ObjectTemplate *tmpl)
+ V4V8Object(QV4::ExecutionEngine *engine, ObjectTemplate *tmpl)
: BaseClass(engine->rootContext)
{
this->vtbl = &static_vtbl;
@@ -1454,9 +1454,9 @@ public:
PropertyAttributes attrs = Attr_Accessor;
attrs.setConfigurable(!(acc.attribute & DontDelete));
attrs.setEnumerable(!(acc.attribute & DontEnum));
- VM::Property *pd = this->insertMember(acc.name->asVMString(), attrs);
- *pd = VM::Property::fromAccessor(acc.getter->vmValue().asFunctionObject(),
- acc.setter->vmValue().asFunctionObject());
+ QV4::Property *pd = this->insertMember(acc.name->asV4String(), attrs);
+ *pd = QV4::Property::fromAccessor(acc.getter->v4Value().asFunctionObject(),
+ acc.setter->v4Value().asFunctionObject());
}
initProperties(m_template.get());
@@ -1469,8 +1469,8 @@ public:
attrs.setConfigurable(!(p.attributes & DontDelete));
attrs.setEnumerable(!(p.attributes & DontEnum));
attrs.setWritable(!(p.attributes & ReadOnly));
- VM::Property *pd = this->insertMember(p.name->asVMString(), attrs);
- *pd = VM::Property::fromValue(p.value->vmValue());
+ QV4::Property *pd = this->insertMember(p.name->asV4String(), attrs);
+ *pd = QV4::Property::fromValue(p.value->v4Value());
}
}
@@ -1480,22 +1480,22 @@ protected:
AccessorInfo namedAccessorInfo()
{
// ### thisObject?
- return AccessorInfo(VM::Value::fromObject(this), m_template->m_namedPropertyData);
+ return AccessorInfo(QV4::Value::fromObject(this), m_template->m_namedPropertyData);
}
AccessorInfo fallbackAccessorInfo()
{
// ### thisObject?
- return AccessorInfo(VM::Value::fromObject(this), m_template->m_fallbackPropertyData);
+ return AccessorInfo(QV4::Value::fromObject(this), m_template->m_fallbackPropertyData);
}
AccessorInfo indexedAccessorInfo()
{
// ### thisObject?
- return AccessorInfo(VM::Value::fromObject(this), m_template->m_namedPropertyData);
+ return AccessorInfo(QV4::Value::fromObject(this), m_template->m_namedPropertyData);
}
static const ManagedVTable static_vtbl;
- static VM::Value get(VM::Managed *m, ExecutionContext *ctx, VM::String *name, bool *hasProperty)
+ static QV4::Value get(QV4::Managed *m, ExecutionContext *ctx, QV4::String *name, bool *hasProperty)
{
V4V8Object *that = static_cast<V4V8Object*>(m);
if (that->m_template->m_namedPropertyGetter) {
@@ -1503,19 +1503,19 @@ protected:
if (!result.IsEmpty()) {
if (hasProperty)
*hasProperty = true;
- return result->vmValue();
+ return result->v4Value();
}
}
bool hasProp = false;
- VM::Value result = BaseClass::get(m, ctx, name, &hasProp);
+ QV4::Value result = BaseClass::get(m, ctx, name, &hasProp);
if (!hasProp && that->m_template->m_fallbackPropertyGetter) {
Handle<Value> fallbackResult = that->m_template->m_fallbackPropertyGetter(String::New(name), that->fallbackAccessorInfo());
if (!fallbackResult.IsEmpty()) {
if (hasProperty)
*hasProperty = true;
- return fallbackResult->vmValue();
+ return fallbackResult->v4Value();
}
}
@@ -1524,7 +1524,7 @@ protected:
return result;
}
- static VM::Value getIndexed(VM::Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty)
+ static QV4::Value getIndexed(QV4::Managed *m, ExecutionContext *ctx, uint index, bool *hasProperty)
{
V4V8Object *that = static_cast<V4V8Object*>(m);
if (that->m_template->m_indexedPropertyGetter) {
@@ -1532,15 +1532,15 @@ protected:
if (!result.IsEmpty()) {
if (hasProperty)
*hasProperty = true;
- return result->vmValue();
+ return result->v4Value();
}
}
return BaseClass::getIndexed(m, ctx, index, hasProperty);
}
- static void put(VM::Managed *m, ExecutionContext *ctx, VM::String *name, const VM::Value &value)
+ static void put(QV4::Managed *m, ExecutionContext *ctx, QV4::String *name, const QV4::Value &value)
{
- Local<Value> v8Value = Local<Value>::New(Value::fromVmValue(value));
+ Local<Value> v8Value = Local<Value>::New(Value::fromV4Value(value));
V4V8Object *that = static_cast<V4V8Object*>(m);
if (that->m_template->m_namedPropertySetter) {
Handle<Value> result = that->m_template->m_namedPropertySetter(String::New(name), v8Value, that->namedAccessorInfo());
@@ -1557,11 +1557,11 @@ protected:
BaseClass::put(m, ctx, name, value);
}
- static void putIndexed(VM::Managed *m, ExecutionContext *ctx, uint index, const VM::Value &value)
+ static void putIndexed(QV4::Managed *m, ExecutionContext *ctx, uint index, const QV4::Value &value)
{
V4V8Object *that = static_cast<V4V8Object*>(m);
if (that->m_template->m_indexedPropertySetter) {
- Handle<Value> result = that->m_template->m_indexedPropertySetter(index, Local<Value>::New(Value::fromVmValue(value)), that->indexedAccessorInfo());
+ Handle<Value> result = that->m_template->m_indexedPropertySetter(index, Local<Value>::New(Value::fromV4Value(value)), that->indexedAccessorInfo());
if (!result.IsEmpty())
return;
}
@@ -1578,7 +1578,7 @@ protected:
return flags;
}
- static PropertyAttributes query(VM::Managed *m, ExecutionContext *ctx, VM::String *name)
+ static PropertyAttributes query(QV4::Managed *m, ExecutionContext *ctx, QV4::String *name)
{
V4V8Object *that = static_cast<V4V8Object*>(m);
if (that->m_template->m_namedPropertyQuery) {
@@ -1596,7 +1596,7 @@ protected:
return flags;
}
- static PropertyAttributes queryIndexed(VM::Managed *m, ExecutionContext *ctx, uint index)
+ static PropertyAttributes queryIndexed(QV4::Managed *m, ExecutionContext *ctx, uint index)
{
V4V8Object *that = static_cast<V4V8Object*>(m);
if (that->m_template->m_indexedPropertyQuery) {
@@ -1608,7 +1608,7 @@ protected:
return BaseClass::queryIndexed(m, ctx, index);
}
- static bool deleteProperty(VM::Managed *m, ExecutionContext *ctx, VM::String *name)
+ static bool deleteProperty(QV4::Managed *m, ExecutionContext *ctx, QV4::String *name)
{
V4V8Object *that = static_cast<V4V8Object*>(m);
if (that->m_template->m_namedPropertyDeleter) {
@@ -1628,7 +1628,7 @@ protected:
return result;
}
- static bool deleteIndexedProperty(VM::Managed *m, ExecutionContext *ctx, uint index)
+ static bool deleteIndexedProperty(QV4::Managed *m, ExecutionContext *ctx, uint index)
{
V4V8Object *that = static_cast<V4V8Object*>(m);
if (that->m_template->m_indexedPropertyDeleter) {
@@ -1641,16 +1641,16 @@ protected:
};
template<>
-DEFINE_MANAGED_VTABLE(V4V8Object<VM::Object>);
+DEFINE_MANAGED_VTABLE(V4V8Object<QV4::Object>);
template<>
-DEFINE_MANAGED_VTABLE(V4V8Object<VM::FunctionObject>);
+DEFINE_MANAGED_VTABLE(V4V8Object<QV4::FunctionObject>);
template<>
-DEFINE_MANAGED_VTABLE(V4V8Object<VM::FunctionPrototype>);
+DEFINE_MANAGED_VTABLE(V4V8Object<QV4::FunctionPrototype>);
-struct V4V8Function : public V4V8Object<VM::FunctionObject>
+struct V4V8Function : public V4V8Object<QV4::FunctionObject>
{
- V4V8Function(VM::ExecutionEngine *engine, FunctionTemplate *functionTemplate)
- : V4V8Object<VM::FunctionObject>(engine, 0)
+ V4V8Function(QV4::ExecutionEngine *engine, FunctionTemplate *functionTemplate)
+ : V4V8Object<QV4::FunctionObject>(engine, 0)
{
vtbl = &static_vtbl;
m_functionTemplate = Persistent<FunctionTemplate>(functionTemplate);
@@ -1660,32 +1660,32 @@ struct V4V8Function : public V4V8Object<VM::FunctionObject>
protected:
static const ManagedVTable static_vtbl;
- static VM::Value call(VM::Managed *m, ExecutionContext *context, const VM::Value &thisObject, VM::Value *args, int argc)
+ static QV4::Value call(QV4::Managed *m, ExecutionContext *context, const QV4::Value &thisObject, QV4::Value *args, int argc)
{
V4V8Function *that = static_cast<V4V8Function*>(m);
Arguments arguments(args, argc, thisObject, false, that->m_functionTemplate->m_data);
- VM::Value result = VM::Value::undefinedValue();
+ QV4::Value result = QV4::Value::undefinedValue();
if (that->m_functionTemplate->m_callback)
- result = that->m_functionTemplate->m_callback(arguments)->vmValue();
+ result = that->m_functionTemplate->m_callback(arguments)->v4Value();
return result;
}
- static VM::Value construct(VM::Managed *m, ExecutionContext *context, VM::Value *args, int argc)
+ static QV4::Value construct(QV4::Managed *m, ExecutionContext *context, QV4::Value *args, int argc)
{
V4V8Function *that = static_cast<V4V8Function*>(m);
- Arguments arguments(args, argc, VM::Value::undefinedValue(), true, that->m_functionTemplate->m_data);
+ Arguments arguments(args, argc, QV4::Value::undefinedValue(), true, that->m_functionTemplate->m_data);
- VM::Object *obj = that->m_functionTemplate->m_instanceTemplate->NewInstance()->vmValue().asObject();
- VM::Value proto = that->Managed::get(context, context->engine->id_prototype);
+ QV4::Object *obj = that->m_functionTemplate->m_instanceTemplate->NewInstance()->v4Value().asObject();
+ QV4::Value proto = that->Managed::get(context, context->engine->id_prototype);
if (proto.isObject())
obj->prototype = proto.objectValue();
- VM::Value result = VM::Value::undefinedValue();
+ QV4::Value result = QV4::Value::undefinedValue();
if (that->m_functionTemplate->m_callback)
- result = that->m_functionTemplate->m_callback(arguments)->vmValue();
+ result = that->m_functionTemplate->m_callback(arguments)->v4Value();
if (result.isObject())
return result;
- return VM::Value::fromObject(obj);
+ return QV4::Value::fromObject(obj);
}
@@ -1710,11 +1710,11 @@ Local<FunctionTemplate> FunctionTemplate::New(InvocationCallback callback, Handl
Local<Function> FunctionTemplate::GetFunction()
{
- VM::ExecutionEngine *engine = currentEngine();
- VM::Object *o = new (engine->memoryManager) V4V8Function(engine, this);
- VM::Object *proto = new (engine->memoryManager) V4V8Object<VM::FunctionPrototype>(engine, m_prototypeTemplate.get());
- o->put(engine->current, engine->id_prototype, VM::Value::fromObject(proto));
- return Local<Function>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::ExecutionEngine *engine = currentEngine();
+ QV4::Object *o = new (engine->memoryManager) V4V8Function(engine, this);
+ QV4::Object *proto = new (engine->memoryManager) V4V8Object<QV4::FunctionPrototype>(engine, m_prototypeTemplate.get());
+ o->put(engine->current, engine->id_prototype, QV4::Value::fromObject(proto));
+ return Local<Function>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
Local<ObjectTemplate> FunctionTemplate::InstanceTemplate()
@@ -1740,26 +1740,26 @@ Local<ObjectTemplate> ObjectTemplate::New()
Local<Object> ObjectTemplate::NewInstance()
{
- VM::ExecutionEngine *engine = currentEngine();
- VM::Object *o = new (engine->memoryManager) V4V8Object<VM::Object>(engine, this);
+ QV4::ExecutionEngine *engine = currentEngine();
+ QV4::Object *o = new (engine->memoryManager) V4V8Object<QV4::Object>(engine, this);
o->prototype = engine->objectPrototype;
o->externalComparison = m_useUserComparison;
- return Local<Object>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ return Local<Object>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
void ObjectTemplate::SetAccessor(Handle<String> name, AccessorGetter getter, AccessorSetter setter, Handle<Value> data, AccessControl settings, PropertyAttribute attribute)
{
- VM::ExecutionEngine *engine = currentEngine();
+ QV4::ExecutionEngine *engine = currentEngine();
Accessor a;
if (getter) {
- VM::FunctionObject *wrappedGetter = new (engine->memoryManager) V8AccessorGetter(engine->rootContext, name, getter, data);
- a.getter = Persistent<Value>::New(Value::fromVmValue(VM::Value::fromObject(wrappedGetter)));
+ QV4::FunctionObject *wrappedGetter = new (engine->memoryManager) V8AccessorGetter(engine->rootContext, name, getter, data);
+ a.getter = Persistent<Value>::New(Value::fromV4Value(QV4::Value::fromObject(wrappedGetter)));
}
if (setter) {
- VM::FunctionObject *wrappedSetter = new (engine->memoryManager) V8AccessorSetter(engine->rootContext, name, setter, data);
- a.setter = Persistent<Value>::New(Value::fromVmValue(VM::Value::fromObject(wrappedSetter)));
+ QV4::FunctionObject *wrappedSetter = new (engine->memoryManager) V8AccessorSetter(engine->rootContext, name, setter, data);
+ a.setter = Persistent<Value>::New(Value::fromV4Value(QV4::Value::fromObject(wrappedSetter)));
}
a.attribute = attribute;
a.name = Persistent<String>::New(name);
@@ -1850,35 +1850,35 @@ ObjectTemplate::ObjectTemplate()
Handle<Primitive> Undefined()
{
Handle<Primitive> val;
- val.val = VM::Value::undefinedValue().val;
+ val.val = QV4::Value::undefinedValue().val;
return val;
}
Handle<Primitive> Null()
{
Handle<Primitive> val;
- val.val = VM::Value::nullValue().val;
+ val.val = QV4::Value::nullValue().val;
return val;
}
Handle<Boolean> True()
{
Handle<Primitive> val;
- val.val = VM::Value::fromBoolean(true).val;
+ val.val = QV4::Value::fromBoolean(true).val;
return val;
}
Handle<Boolean> False()
{
Handle<Primitive> val;
- val.val = VM::Value::fromBoolean(false).val;
+ val.val = QV4::Value::fromBoolean(false).val;
return val;
}
Handle<Value> ThrowException(Handle<Value> exception)
{
- __qmljs_throw(currentEngine()->current, exception->vmValue());
+ __qmljs_throw(currentEngine()->current, exception->v4Value());
return Handle<Value>();
}
@@ -1886,29 +1886,29 @@ Handle<Value> ThrowException(Handle<Value> exception)
Local<Value> Exception::ReferenceError(Handle<String> message)
{
Q_UNUSED(message);
- VM::Object *o = currentEngine()->newReferenceErrorObject(currentEngine()->current, message->ToString()->asQString());
- return Local<Value>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::Object *o = currentEngine()->newReferenceErrorObject(currentEngine()->current, message->ToString()->asQString());
+ return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
Local<Value> Exception::SyntaxError(Handle<String> message)
{
Q_UNUSED(message);
- VM::Object *o = currentEngine()->newSyntaxErrorObject(currentEngine()->current, 0);
- return Local<Value>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::Object *o = currentEngine()->newSyntaxErrorObject(currentEngine()->current, 0);
+ return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
Local<Value> Exception::TypeError(Handle<String> message)
{
Q_UNUSED(message);
- VM::Object *o = currentEngine()->newTypeErrorObject(currentEngine()->current, message->ToString()->asQString());
- return Local<Value>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::Object *o = currentEngine()->newTypeErrorObject(currentEngine()->current, message->ToString()->asQString());
+ return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
Local<Value> Exception::Error(Handle<String> message)
{
Q_UNUSED(message);
- VM::Object *o = currentEngine()->newErrorObject(VM::Value::fromString(currentEngine()->current, message->ToString()->asQString()));
- return Local<Value>::New(Value::fromVmValue(VM::Value::fromObject(o)));
+ QV4::Object *o = currentEngine()->newErrorObject(QV4::Value::fromString(currentEngine()->current, message->ToString()->asQString()));
+ return Local<Value>::New(Value::fromV4Value(QV4::Value::fromObject(o)));
}
@@ -1958,11 +1958,11 @@ void *Isolate::GetData()
Q_UNREACHABLE();
}
-void Isolate::setException(const VM::Value &ex)
+void Isolate::setException(const QV4::Value &ex)
{
if (tryCatch) {
tryCatch->hasCaughtException = true;
- tryCatch->exception = Local<Value>::New(Value::fromVmValue(ex));
+ tryCatch->exception = Local<Value>::New(Value::fromV4Value(ex));
}
}
@@ -1986,12 +1986,12 @@ void V8::SetFlagsFromString(const char *, int)
static UserObjectComparisonCallback userObjectComparisonCallback = 0;
-static bool v8ExternalResourceComparison(const VM::Value &a, const VM::Value &b)
+static bool v8ExternalResourceComparison(const QV4::Value &a, const QV4::Value &b)
{
if (!userObjectComparisonCallback)
return false;
- Local<Object> la = Local<Object>::New(Value::fromVmValue(a));
- Local<Object> lb = Local<Object>::New(Value::fromVmValue(b));
+ Local<Object> la = Local<Object>::New(Value::fromV4Value(a));
+ Local<Object> lb = Local<Object>::New(Value::fromV4Value(b));
return userObjectComparisonCallback(la, lb);
}
@@ -2090,10 +2090,10 @@ struct Context::Private
{
Private()
{
- engine.reset(new QQmlJS::VM::ExecutionEngine);
+ engine.reset(new QV4::ExecutionEngine);
}
- QScopedPointer<QQmlJS::VM::ExecutionEngine> engine;
+ QScopedPointer<QV4::ExecutionEngine> engine;
};
Context::Context()
@@ -2115,7 +2115,7 @@ Persistent<Context> Context::New(ExtensionConfiguration *extensions, Handle<Obje
Local<Object> Context::Global()
{
- return Local<Object>::New(Value::fromVmValue(VM::Value::fromObject(d->engine->globalObject)));
+ return Local<Object>::New(Value::fromV4Value(QV4::Value::fromObject(d->engine->globalObject)));
}
Local<Context> Context::GetCurrent()
@@ -2131,8 +2131,8 @@ Local<Context> Context::GetCalling()
Local<Object> Context::GetCallingQmlGlobal()
{
- VM::ExecutionEngine *engine = GetCurrent()->GetEngine();
- VM::ExecutionContext *ctx = engine->current;
+ QV4::ExecutionEngine *engine = GetCurrent()->GetEngine();
+ QV4::ExecutionContext *ctx = engine->current;
while (ctx && ctx->outer != engine->rootContext)
ctx = ctx->outer;
@@ -2140,7 +2140,7 @@ Local<Object> Context::GetCallingQmlGlobal()
if (!ctx->type == ExecutionContext::Type_QmlContext)
return Local<Object>();
- return Local<Object>::New(Value::fromVmValue(VM::Value::fromObject(static_cast<CallContext *>(ctx)->activation)));
+ return Local<Object>::New(Value::fromV4Value(QV4::Value::fromObject(static_cast<CallContext *>(ctx)->activation)));
}
Local<Value> Context::GetCallingScriptData()
@@ -2161,7 +2161,7 @@ void Context::Exit()
}
-QQmlJS::VM::ExecutionEngine *Context::GetEngine()
+QV4::ExecutionEngine *Context::GetEngine()
{
return d->engine.data();
}
diff --git a/src/qml/qml/v4vm/qv4v8_p.h b/src/qml/qml/v4vm/qv4v8_p.h
index c351833ca2..bf6563a941 100644
--- a/src/qml/qml/v4vm/qv4v8_p.h
+++ b/src/qml/qml/v4vm/qv4v8_p.h
@@ -83,15 +83,14 @@
#include <QStack>
#include <QSharedData>
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct Value;
struct String;
struct ExecutionEngine;
struct Object;
class MemoryManager;
}
-}
+
#include <stdint.h>
@@ -1026,8 +1025,8 @@ class V8EXPORT Value {
return res;
}
- QQmlJS::VM::Value vmValue() const;
- static Handle<Value> fromVmValue(const QQmlJS::VM::Value &vmValue);
+ QV4::Value v4Value() const;
+ static Handle<Value> fromV4Value(const QV4::Value &v4Value);
};
@@ -1227,7 +1226,7 @@ class V8EXPORT String : public Primitive {
/** Creates a symbol. Returns one if it exists already.*/
static Local<String> NewSymbol(const char* data, int length = -1);
- static Local<String> New(QQmlJS::VM::String *s);
+ static Local<String> New(QV4::String *s);
/**
* Creates a new external string using the data defined in the given
@@ -1283,7 +1282,7 @@ class V8EXPORT String : public Primitive {
};
QString asQString() const;
- QQmlJS::VM::String *asVMString() const;
+ QV4::String *asV4String() const;
};
@@ -1730,7 +1729,7 @@ DEFINE_REFCOUNTED_HANDLE_OPERATIONS(Template)
*/
class V8EXPORT Arguments {
public:
- Arguments(const QQmlJS::VM::Value *args, int argc, const QQmlJS::VM::Value &thisObject, bool isConstructor,
+ Arguments(const QV4::Value *args, int argc, const QV4::Value &thisObject, bool isConstructor,
const Persistent<Value> &data);
int Length() const;
Local<Value> operator[](int i) const;
@@ -1754,7 +1753,7 @@ private:
*/
class V8EXPORT AccessorInfo {
public:
- AccessorInfo(const QQmlJS::VM::Value &thisObject, const Persistent<Value> &data);
+ AccessorInfo(const QV4::Value &thisObject, const Persistent<Value> &data);
Isolate* GetIsolate() const;
Local<Value> Data() const;
Local<Object> This() const;
@@ -2287,9 +2286,9 @@ class V8EXPORT Isolate {
void* GetData();
Context *GetCurrentContext() { return m_contextStack.top(); }
- void setException(const QQmlJS::VM::Value &ex);
+ void setException(const QV4::Value &ex);
- static QQmlJS::VM::ExecutionEngine *GetEngine();
+ static QV4::ExecutionEngine *GetEngine();
private:
friend class Context;
@@ -2556,7 +2555,7 @@ class V8EXPORT Context : public QSharedData {
Handle<Context> context_;
};
- QQmlJS::VM::ExecutionEngine *GetEngine();
+ QV4::ExecutionEngine *GetEngine();
private:
Context* m_lastContext;
diff --git a/src/qml/qml/v4vm/qv4value.cpp b/src/qml/qml/v4vm/qv4value.cpp
index 38da68b2d2..996b9997d0 100644
--- a/src/qml/qml/v4vm/qv4value.cpp
+++ b/src/qml/qml/v4vm/qv4value.cpp
@@ -45,9 +45,7 @@
#include <wtf/MathExtras.h>
-namespace QQmlJS {
-namespace VM {
-
+using namespace QV4;
int Value::toUInt16() const
{
@@ -221,8 +219,3 @@ void PersistentValuePrivate::deref()
if (!--refcount && !engine)
delete this;
}
-
-
-
-} // namespace VM
-} // namespace QQmlJS
diff --git a/src/qml/qml/v4vm/qv4value_p.h b/src/qml/qml/v4vm/qv4value_p.h
index d707844e11..9a9c8abd8a 100644
--- a/src/qml/qml/v4vm/qv4value_p.h
+++ b/src/qml/qml/v4vm/qv4value_p.h
@@ -52,8 +52,7 @@
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct String;
struct ExecutionContext;
@@ -301,10 +300,10 @@ inline Value Value::nullValue()
return v;
}
-inline VM::Value Value::deletedValue()
+inline Value Value::deletedValue()
{
- VM::Value v;
- v.tag = VM::Value::_Deleted_Type;
+ Value v;
+ v.tag = Value::_Deleted_Type;
v.uint_32 = 0;
return v;
}
@@ -580,8 +579,7 @@ private:
PersistentValuePrivate *d;
};
-} // namespace VM
-} // namespace QQmlJS
+} // namespace QV4
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qjsengine.cpp b/src/qml/qml/v8/qjsengine.cpp
index 6a9fe326ac..5baf7513e2 100644
--- a/src/qml/qml/v8/qjsengine.cpp
+++ b/src/qml/qml/v8/qjsengine.cpp
@@ -258,14 +258,14 @@ void QJSEngine::collectGarbage()
QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, int lineNumber)
{
try {
- QQmlJS::VM::Function *f = QQmlJS::VM::EvalFunction::parseSource(d->m_v4Engine->current, fileName, program, QQmlJS::Codegen::EvalCode,
+ QV4::Function *f = QV4::EvalFunction::parseSource(d->m_v4Engine->current, fileName, program, QQmlJS::Codegen::EvalCode,
d->m_v4Engine->current->strictMode, true);
if (!f)
return new QJSValuePrivate(d->m_v4Engine, d->m_v4Engine->newSyntaxErrorObject(d->m_v4Engine->current, 0));
- QQmlJS::VM::Value result = d->m_v4Engine->run(f);
+ QV4::Value result = d->m_v4Engine->run(f);
return new QJSValuePrivate(d->m_v4Engine, result);
- } catch (QQmlJS::VM::Exception& ex) {
+ } catch (QV4::Exception& ex) {
ex.accept(d->m_v4Engine->current);
return new QJSValuePrivate(d->m_v4Engine, ex.value());
}
@@ -291,7 +291,7 @@ QJSValue QJSEngine::newObject()
*/
QJSValue QJSEngine::newArray(uint length)
{
- QQmlJS::VM::ArrayObject *array = d->m_v4Engine->newArrayObject(d->m_v4Engine->current);
+ QV4::ArrayObject *array = d->m_v4Engine->newArrayObject(d->m_v4Engine->current);
array->setArrayLength(length);
return new QJSValuePrivate(d->m_v4Engine, array);
}
@@ -359,7 +359,7 @@ QJSValue QJSEngine::create(int type, const void *ptr)
bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr)
{
QJSValuePrivate *vp = QJSValuePrivate::get(value);
- QQmlJS::VM::ExecutionEngine *e = vp->engine;
+ QV4::ExecutionEngine *e = vp->engine;
QV8Engine *engine = e ? QV8Engine::get(e->publicEngine) : 0;
if (engine) {
return engine->metaTypeFromJS(vp->getValue(engine->m_v4Engine), type, ptr);
diff --git a/src/qml/qml/v8/qjsvalue.cpp b/src/qml/qml/v8/qjsvalue.cpp
index 4fb1a2af92..03e8020fb1 100644
--- a/src/qml/qml/v8/qjsvalue.cpp
+++ b/src/qml/qml/v8/qjsvalue.cpp
@@ -118,7 +118,7 @@
QT_BEGIN_NAMESPACE
-using namespace QQmlJS::VM;
+using namespace QV4;
/*!
Constructs a new QJSValue with a boolean \a value.
@@ -335,7 +335,7 @@ bool QJSValue::isVariant() const
*/
QString QJSValue::toString() const
{
- // have to check these here as converting those to a VM::String requires a context
+ // have to check these here as converting those to a QV4::String requires a context
// (which we don't always have for those types)
if (d->value.isUndefined())
return QStringLiteral("undefined");
@@ -350,7 +350,7 @@ QString QJSValue::toString() const
else if (d->value.isNumber())
return __qmljs_numberToString(d->value.asDouble());
- QQmlJS::VM::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
+ QV4::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
try {
return d->value.toString(ctx)->toQString();
} catch (Exception &e) {
@@ -373,7 +373,7 @@ QString QJSValue::toString() const
*/
double QJSValue::toNumber() const
{
- QQmlJS::VM::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
+ QV4::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
try {
return d->value.toNumber();
} catch (Exception &e) {
@@ -396,7 +396,7 @@ double QJSValue::toNumber() const
*/
bool QJSValue::toBool() const
{
- QQmlJS::VM::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
+ QV4::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
try {
return d->value.toBoolean();
} catch (Exception &e) {
@@ -419,7 +419,7 @@ bool QJSValue::toBool() const
*/
qint32 QJSValue::toInt() const
{
- QQmlJS::VM::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
+ QV4::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
try {
return d->value.toInt32();
} catch (Exception &e) {
@@ -442,7 +442,7 @@ qint32 QJSValue::toInt() const
*/
quint32 QJSValue::toUInt() const
{
- QQmlJS::VM::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
+ QV4::ExecutionContext *ctx = d->engine ? d->engine->current : 0;
try {
return d->value.toUInt32();
} catch (Exception &e) {
@@ -508,7 +508,7 @@ QJSValue QJSValue::call(const QJSValueList &args)
arguments[i] = args.at(i).d->getValue(engine);
Value result;
- QQmlJS::VM::ExecutionContext *ctx = d->engine->current;
+ QV4::ExecutionContext *ctx = d->engine->current;
try {
result = f->call(ctx, Value::fromObject(d->engine->globalObject), arguments.data(), arguments.size());
} catch (Exception &e) {
@@ -553,7 +553,7 @@ QJSValue QJSValue::callWithInstance(const QJSValue &instance, const QJSValueList
arguments[i] = args.at(i).d->getValue(engine);
Value result;
- QQmlJS::VM::ExecutionContext *ctx = d->engine->current;
+ QV4::ExecutionContext *ctx = d->engine->current;
try {
result = f->call(ctx, instance.d->getValue(engine), arguments.data(), arguments.size());
} catch (Exception &e) {
@@ -596,7 +596,7 @@ QJSValue QJSValue::callAsConstructor(const QJSValueList &args)
arguments[i] = args.at(i).d->getValue(engine);
Value result;
- QQmlJS::VM::ExecutionContext *ctx = d->engine->current;
+ QV4::ExecutionContext *ctx = d->engine->current;
try {
result = f->construct(ctx, arguments.data(), arguments.size());
} catch (Exception &e) {
@@ -758,11 +758,11 @@ QJSValue QJSValue::property(const QString& name) const
return property(idx);
s->makeIdentifier(d->engine->current);
- QQmlJS::VM::ExecutionContext *ctx = d->engine->current;
+ QV4::ExecutionContext *ctx = d->engine->current;
try {
- QQmlJS::VM::Value v = o->get(ctx, s);
+ QV4::Value v = o->get(ctx, s);
return new QJSValuePrivate(d->engine, v);
- } catch (QQmlJS::VM::Exception &e) {
+ } catch (QV4::Exception &e) {
e.accept(ctx);
return QJSValue();
}
@@ -786,11 +786,11 @@ QJSValue QJSValue::property(quint32 arrayIndex) const
if (!o)
return QJSValue();
- QQmlJS::VM::ExecutionContext *ctx = d->engine->current;
+ QV4::ExecutionContext *ctx = d->engine->current;
try {
- QQmlJS::VM::Value v = o->getIndexed(ctx, arrayIndex);
+ QV4::Value v = o->getIndexed(ctx, arrayIndex);
return new QJSValuePrivate(d->engine, v);
- } catch (QQmlJS::VM::Exception &e) {
+ } catch (QV4::Exception &e) {
e.accept(ctx);
return QJSValue();
}
@@ -820,11 +820,11 @@ void QJSValue::setProperty(const QString& name, const QJSValue& value)
return;
}
- QQmlJS::VM::ExecutionContext *ctx = d->engine->current;
+ QV4::ExecutionContext *ctx = d->engine->current;
s->makeIdentifier(ctx);
try {
o->put(ctx, s, value.d->value);
- } catch (QQmlJS::VM::Exception &e) {
+ } catch (QV4::Exception &e) {
e.accept(ctx);
}
}
@@ -847,10 +847,10 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value)
if (!o)
return;
- QQmlJS::VM::ExecutionContext *ctx = d->engine->current;
+ QV4::ExecutionContext *ctx = d->engine->current;
try {
o->putIndexed(ctx, arrayIndex, value.d->value);
- } catch (QQmlJS::VM::Exception &e) {
+ } catch (QV4::Exception &e) {
e.accept(ctx);
}
}
@@ -941,10 +941,10 @@ QObject *QJSValue::toQObject() const
*/
QDateTime QJSValue::toDateTime() const
{
- QQmlJS::VM::DateObject *date = d->value.asDateObject();
+ QV4::DateObject *date = d->value.asDateObject();
if (!date)
return QDateTime();
- return QQmlJS::VM::DatePrototype::toQDateTime(date->value.toNumber());
+ return QV4::DatePrototype::toQDateTime(date->value.toNumber());
}
/*!
@@ -1004,7 +1004,7 @@ bool QJSValue::isQObject() const
Q_QML_EXPORT v8::Local<v8::Value> qt_QJSValueV8Value(const QJSValue &value)
{
QJSValuePrivate *d = QJSValuePrivate::get(value);
- return v8::Local<v8::Value>::New(v8::Value::fromVmValue(d->value));
+ return v8::Local<v8::Value>::New(v8::Value::fromV4Value(d->value));
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qjsvalue_p.h b/src/qml/qml/v8/qjsvalue_p.h
index d28d22cc6b..26dc7e6178 100644
--- a/src/qml/qml/v8/qjsvalue_p.h
+++ b/src/qml/qml/v8/qjsvalue_p.h
@@ -64,22 +64,22 @@ QT_BEGIN_NAMESPACE
\internal
\class QJSValuePrivate
*/
-class QJSValuePrivate : public QQmlJS::VM::PersistentValuePrivate
+class QJSValuePrivate : public QV4::PersistentValuePrivate
{
public:
- QJSValuePrivate(QQmlJS::VM::ExecutionEngine *e, const QQmlJS::VM::Value &v)
+ QJSValuePrivate(QV4::ExecutionEngine *e, const QV4::Value &v)
: PersistentValuePrivate(e, v)
, string(QString())
{}
- QJSValuePrivate(QQmlJS::VM::ExecutionEngine *e, QQmlJS::VM::Object *o)
- : PersistentValuePrivate(e, QQmlJS::VM::Value::fromObject(o))
+ QJSValuePrivate(QV4::ExecutionEngine *e, QV4::Object *o)
+ : PersistentValuePrivate(e, QV4::Value::fromObject(o))
, string(QString())
{}
- QJSValuePrivate(QQmlJS::VM::ExecutionEngine *e, QQmlJS::VM::String *s)
- : PersistentValuePrivate(e, QQmlJS::VM::Value::fromString(s))
+ QJSValuePrivate(QV4::ExecutionEngine *e, QV4::String *s)
+ : PersistentValuePrivate(e, QV4::Value::fromString(s))
, string(QString())
{}
- QJSValuePrivate(const QQmlJS::VM::Value &v)
+ QJSValuePrivate(const QV4::Value &v)
: PersistentValuePrivate(v)
, string(QString())
{}
@@ -87,20 +87,20 @@ public:
: PersistentValuePrivate()
, string(s)
{
- value = QQmlJS::VM::Value::fromString(&string);
+ value = QV4::Value::fromString(&string);
}
- QQmlJS::VM::Value getValue(QQmlJS::VM::ExecutionEngine *e) {
+ QV4::Value getValue(QV4::ExecutionEngine *e) {
if (value.asString() == &string) {
engine = e;
- value = QQmlJS::VM::Value::fromString(e->newString(string.toQString()));
+ value = QV4::Value::fromString(e->newString(string.toQString()));
}
return value;
}
static QJSValuePrivate *get(const QJSValue &v) { return v.d; }
- QQmlJS::VM::String string;
+ QV4::String string;
};
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qjsvalueiterator.cpp b/src/qml/qml/v8/qjsvalueiterator.cpp
index 4004269be9..a995fb6e95 100644
--- a/src/qml/qml/v8/qjsvalueiterator.cpp
+++ b/src/qml/qml/v8/qjsvalueiterator.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
QJSValueIteratorPrivate::QJSValueIteratorPrivate(const QJSValue &v)
: value(v)
- , iterator(QJSValuePrivate::get(v)->value.asObject(), QQmlJS::VM::ObjectIterator::NoFlags)
+ , iterator(QJSValuePrivate::get(v)->value.asObject(), QV4::ObjectIterator::NoFlags)
, currentValue(0)
, currentName(0)
, currentIndex(UINT_MAX)
@@ -175,11 +175,11 @@ QJSValue QJSValueIterator::value() const
if (!d_ptr->currentValue)
return QJSValue();
- QQmlJS::VM::Object *o = d_ptr->iterator.object;
+ QV4::Object *o = d_ptr->iterator.object;
try {
- QQmlJS::VM::Value v = o->getValue(o->internalClass->engine->current, d_ptr->currentValue, d_ptr->currentAttributes);
+ QV4::Value v = o->getValue(o->internalClass->engine->current, d_ptr->currentValue, d_ptr->currentAttributes);
return new QJSValuePrivate(o->internalClass->engine, v);
- } catch (QQmlJS::VM::Exception &e) {
+ } catch (QV4::Exception &e) {
return QJSValue();
}
}
@@ -192,7 +192,7 @@ QJSValue QJSValueIterator::value() const
*/
QJSValueIterator& QJSValueIterator::operator=(QJSValue& object)
{
- d_ptr->iterator = QQmlJS::VM::ObjectIterator(QJSValuePrivate::get(object)->value.asObject(), QQmlJS::VM::ObjectIterator::NoFlags);
+ d_ptr->iterator = QV4::ObjectIterator(QJSValuePrivate::get(object)->value.asObject(), QV4::ObjectIterator::NoFlags);
d_ptr->nextValue = d_ptr->iterator.next(&d_ptr->nextName, &d_ptr->nextIndex, &d_ptr->nextAttributes);
}
diff --git a/src/qml/qml/v8/qjsvalueiterator_p.h b/src/qml/qml/v8/qjsvalueiterator_p.h
index 2f3b81e34d..999003b41c 100644
--- a/src/qml/qml/v8/qjsvalueiterator_p.h
+++ b/src/qml/qml/v8/qjsvalueiterator_p.h
@@ -55,14 +55,14 @@ public:
QJSValueIteratorPrivate(const QJSValue &v);
QJSValue value;
- QQmlJS::VM::ObjectIterator iterator;
- QQmlJS::VM::Property *currentValue;
- QQmlJS::VM::PropertyAttributes currentAttributes;
- QQmlJS::VM::String *currentName;
+ QV4::ObjectIterator iterator;
+ QV4::Property *currentValue;
+ QV4::PropertyAttributes currentAttributes;
+ QV4::String *currentName;
uint currentIndex;
- QQmlJS::VM::Property *nextValue;
- QQmlJS::VM::PropertyAttributes nextAttributes;
- QQmlJS::VM::String *nextName;
+ QV4::Property *nextValue;
+ QV4::PropertyAttributes nextAttributes;
+ QV4::String *nextName;
uint nextIndex;
};
diff --git a/src/qml/qml/v8/qv4domerrors.cpp b/src/qml/qml/v8/qv4domerrors.cpp
index f40d82ccc6..63c79f85c2 100644
--- a/src/qml/qml/v8/qv4domerrors.cpp
+++ b/src/qml/qml/v8/qv4domerrors.cpp
@@ -44,7 +44,7 @@
QT_BEGIN_NAMESPACE
-using namespace QQmlJS::VM;
+using namespace QV4;
void qt_add_domexceptions(ExecutionEngine *e)
{
diff --git a/src/qml/qml/v8/qv4domerrors_p.h b/src/qml/qml/v8/qv4domerrors_p.h
index 3118a6849d..26cc5fc34d 100644
--- a/src/qml/qml/v8/qv4domerrors_p.h
+++ b/src/qml/qml/v8/qv4domerrors_p.h
@@ -83,13 +83,12 @@ QT_BEGIN_NAMESPACE
return v8::Handle<v8::Value>(); \
}
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
class ExecutionEngine;
}
-}
-void qt_add_domexceptions(QQmlJS::VM::ExecutionEngine *e);
+
+void qt_add_domexceptions(QV4::ExecutionEngine *e);
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qv4sqlerrors.cpp b/src/qml/qml/v8/qv4sqlerrors.cpp
index 524b2a9e9f..246a6f6026 100644
--- a/src/qml/qml/v8/qv4sqlerrors.cpp
+++ b/src/qml/qml/v8/qv4sqlerrors.cpp
@@ -44,9 +44,9 @@
QT_BEGIN_NAMESPACE
-using namespace QQmlJS::VM;
+using namespace QV4;
-void qt_add_sqlexceptions(QQmlJS::VM::ExecutionEngine *engine)
+void qt_add_sqlexceptions(QV4::ExecutionEngine *engine)
{
Object *sqlexception = engine->newObject();
sqlexception->defineReadonlyProperty(engine, QStringLiteral("UNKNOWN_ERR"), Value::fromInt32(SQLEXCEPTION_UNKNOWN_ERR));
diff --git a/src/qml/qml/v8/qv4sqlerrors_p.h b/src/qml/qml/v8/qv4sqlerrors_p.h
index 922e9c1e8c..df6a795cb7 100644
--- a/src/qml/qml/v8/qv4sqlerrors_p.h
+++ b/src/qml/qml/v8/qv4sqlerrors_p.h
@@ -65,12 +65,11 @@ QT_BEGIN_NAMESPACE
#define SQLEXCEPTION_CONSTRAINT_ERR 7
#define SQLEXCEPTION_TIMEOUT_ERR 8
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
class ExecutionEngine;
}
-}
-void qt_add_sqlexceptions(QQmlJS::VM::ExecutionEngine *engine);
+
+void qt_add_sqlexceptions(QV4::ExecutionEngine *engine);
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index c1b4c051cd..5e5b89d7eb 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -353,7 +353,7 @@ v8::Handle<v8::Value> QV8Engine::fromVariant(const QVariant &variant)
case QMetaType::Double:
return v8::Number::New(*reinterpret_cast<const double*>(ptr));
case QMetaType::QString:
- return v8::Value::fromVmValue(QQmlJS::VM::Value::fromString(m_v4Engine->current, *reinterpret_cast<const QString*>(ptr)));
+ return v8::Value::fromV4Value(QV4::Value::fromString(m_v4Engine->current, *reinterpret_cast<const QString*>(ptr)));
case QMetaType::Float:
return v8::Number::New(*reinterpret_cast<const float*>(ptr));
case QMetaType::Short:
@@ -414,7 +414,7 @@ v8::Handle<v8::Value> QV8Engine::fromVariant(const QVariant &variant)
const QJSValue *value = reinterpret_cast<const QJSValue *>(ptr);
QJSValuePrivate *valuep = QJSValuePrivate::get(*value);
valuep->engine = m_v4Engine;
- return v8::Local<v8::Value>::New(v8::Value::fromVmValue(valuep->getValue(valuep->engine)));
+ return v8::Local<v8::Value>::New(v8::Value::fromV4Value(valuep->getValue(valuep->engine)));
// if (valuep->assignEngine(this))
// return v8::Local<v8::Value>::New(*valuep);
} else if (type == qMetaTypeId<QList<QObject *> >()) {
@@ -532,7 +532,7 @@ QVariant QV8Engine::toBasicVariant(v8::Handle<v8::Value> value)
if (value->IsNumber())
return value->ToNumber()->Value();
if (value->IsString())
- return value.get()->vmValue().toString(m_v4Engine->current)->toQString();
+ return value.get()->v4Value().toString(m_v4Engine->current)->toQString();
if (value->IsDate())
return qtDateTimeFromJsDate(v8::Handle<v8::Date>::Cast(value)->NumberValue());
// NOTE: since we convert QTime to JS Date, round trip will change the variant type (to QDateTime)!
@@ -1077,7 +1077,7 @@ v8::Handle<v8::Value> QV8Engine::metaTypeToJS(int type, const void *data)
break;
default:
if (type == qMetaTypeId<QJSValue>()) {
- return v8::Value::fromVmValue(QJSValuePrivate::get(*reinterpret_cast<const QJSValue*>(data))->value);
+ return v8::Value::fromV4Value(QJSValuePrivate::get(*reinterpret_cast<const QJSValue*>(data))->value);
} else {
QByteArray typeName = QMetaType::typeName(type);
if (typeName.endsWith('*') && !*reinterpret_cast<void* const *>(data)) {
@@ -1094,7 +1094,7 @@ v8::Handle<v8::Value> QV8Engine::metaTypeToJS(int type, const void *data)
// Converts a JS value to a meta-type.
// data must point to a place that can store a value of the given type.
// Returns true if conversion succeeded, false otherwise.
-bool QV8Engine::metaTypeFromJS(const QQmlJS::VM::Value &value, int type, void *data) {
+bool QV8Engine::metaTypeFromJS(const QV4::Value &value, int type, void *data) {
// check if it's one of the types we know
switch (QMetaType::Type(type)) {
case QMetaType::Bool:
@@ -1145,53 +1145,53 @@ bool QV8Engine::metaTypeFromJS(const QQmlJS::VM::Value &value, int type, void *d
}
return true;
case QMetaType::QDateTime:
- if (QQmlJS::VM::DateObject *d = value.asDateObject()) {
- *reinterpret_cast<QDateTime *>(data) = QQmlJS::VM::DatePrototype::toQDateTime(d->value.doubleValue());
+ if (QV4::DateObject *d = value.asDateObject()) {
+ *reinterpret_cast<QDateTime *>(data) = QV4::DatePrototype::toQDateTime(d->value.doubleValue());
return true;
} break;
case QMetaType::QDate:
- if (QQmlJS::VM::DateObject *d = value.asDateObject()) {
- *reinterpret_cast<QDate *>(data) = QQmlJS::VM::DatePrototype::toQDateTime(d->value.doubleValue()).date();
+ if (QV4::DateObject *d = value.asDateObject()) {
+ *reinterpret_cast<QDate *>(data) = QV4::DatePrototype::toQDateTime(d->value.doubleValue()).date();
return true;
} break;
case QMetaType::QRegExp:
- if (QQmlJS::VM::RegExpObject *r = value.asRegExpObject()) {
- *reinterpret_cast<QRegExp *>(data) = QJSConverter::toRegExp(v8::Handle<v8::RegExp>::Cast(v8::Value::fromVmValue(value)));
+ if (QV4::RegExpObject *r = value.asRegExpObject()) {
+ *reinterpret_cast<QRegExp *>(data) = QJSConverter::toRegExp(v8::Handle<v8::RegExp>::Cast(v8::Value::fromV4Value(value)));
return true;
} break;
case QMetaType::QObjectStar: {
- v8::Handle<v8::Value> v = v8::Value::fromVmValue(value);
+ v8::Handle<v8::Value> v = v8::Value::fromV4Value(value);
if (isQObject(v) || value.isNull()) {
*reinterpret_cast<QObject* *>(data) = qtObjectFromJS(v);
return true;
} break;
}
case QMetaType::QStringList:
- if (QQmlJS::VM::ArrayObject *a = value.asArrayObject()) {
- *reinterpret_cast<QStringList *>(data) = QJSConverter::toStringList(v8::Handle<v8::Array>::Cast(v8::Value::fromVmValue(value)));
+ if (QV4::ArrayObject *a = value.asArrayObject()) {
+ *reinterpret_cast<QStringList *>(data) = QJSConverter::toStringList(v8::Handle<v8::Array>::Cast(v8::Value::fromV4Value(value)));
return true;
} break;
case QMetaType::QVariantList:
- if (QQmlJS::VM::ArrayObject *a = value.asArrayObject()) {
- *reinterpret_cast<QVariantList *>(data) = variantListFromJS(v8::Handle<v8::Array>::Cast(v8::Value::fromVmValue(value)));
+ if (QV4::ArrayObject *a = value.asArrayObject()) {
+ *reinterpret_cast<QVariantList *>(data) = variantListFromJS(v8::Handle<v8::Array>::Cast(v8::Value::fromV4Value(value)));
return true;
} break;
case QMetaType::QVariantMap:
- if (QQmlJS::VM::Object *o = value.asObject()) {
- *reinterpret_cast<QVariantMap *>(data) = variantMapFromJS(v8::Handle<v8::Object>::Cast(v8::Value::fromVmValue(value)));
+ if (QV4::Object *o = value.asObject()) {
+ *reinterpret_cast<QVariantMap *>(data) = variantMapFromJS(v8::Handle<v8::Object>::Cast(v8::Value::fromV4Value(value)));
return true;
} break;
case QMetaType::QVariant:
- *reinterpret_cast<QVariant*>(data) = variantFromJS(v8::Value::fromVmValue(value));
+ *reinterpret_cast<QVariant*>(data) = variantFromJS(v8::Value::fromV4Value(value));
return true;
case QMetaType::QJsonValue:
- *reinterpret_cast<QJsonValue *>(data) = jsonValueFromJS(v8::Value::fromVmValue(value));
+ *reinterpret_cast<QJsonValue *>(data) = jsonValueFromJS(v8::Value::fromV4Value(value));
return true;
case QMetaType::QJsonObject:
- *reinterpret_cast<QJsonObject *>(data) = jsonObjectFromJS(v8::Value::fromVmValue(value));
+ *reinterpret_cast<QJsonObject *>(data) = jsonObjectFromJS(v8::Value::fromV4Value(value));
return true;
case QMetaType::QJsonArray:
- *reinterpret_cast<QJsonArray *>(data) = jsonArrayFromJS(v8::Value::fromVmValue(value));
+ *reinterpret_cast<QJsonArray *>(data) = jsonArrayFromJS(v8::Value::fromV4Value(value));
return true;
default:
;
@@ -1219,18 +1219,18 @@ bool QV8Engine::metaTypeFromJS(const QQmlJS::VM::Value &value, int type, void *d
// Try to use magic; for compatibility with qscriptvalue_cast.
QByteArray name = QMetaType::typeName(type);
- if (convertToNativeQObject(v8::Value::fromVmValue(value), name, reinterpret_cast<void* *>(data)))
+ if (convertToNativeQObject(v8::Value::fromV4Value(value), name, reinterpret_cast<void* *>(data)))
return true;
- if (isVariant(v8::Value::fromVmValue(value)) && name.endsWith('*')) {
+ if (isVariant(v8::Value::fromV4Value(value)) && name.endsWith('*')) {
int valueType = QMetaType::type(name.left(name.size()-1));
- QVariant &var = variantValue(v8::Value::fromVmValue(value));
+ QVariant &var = variantValue(v8::Value::fromV4Value(value));
if (valueType == var.userType()) {
// We have T t, T* is requested, so return &t.
*reinterpret_cast<void* *>(data) = var.data();
return true;
} else {
// Look in the prototype chain.
- v8::Handle<v8::Value> proto = v8::Value::fromVmValue(value)->ToObject()->GetPrototype();
+ v8::Handle<v8::Value> proto = v8::Value::fromV4Value(value)->ToObject()->GetPrototype();
while (proto->IsObject()) {
bool canCast = false;
if (isVariant(proto)) {
@@ -1401,7 +1401,7 @@ QJSValue QV8Engine::evaluate(v8::Handle<v8::Script> script, v8::TryCatch& tryCat
// This is possible on syntax errors like { a:12, b:21 } <- missing "(", ")" around expression.
return QJSValue();
}
- return new QJSValuePrivate(m_v4Engine, exception.get()->vmValue());
+ return new QJSValuePrivate(m_v4Engine, exception.get()->v4Value());
}
v8::Handle<v8::Value> result;
result = script->Run();
@@ -1411,21 +1411,21 @@ QJSValue QV8Engine::evaluate(v8::Handle<v8::Script> script, v8::TryCatch& tryCat
//Q_ASSERT(!exception.IsEmpty());
if (exception.IsEmpty())
exception = v8::Exception::Error(v8::String::New("missing exception value"));
- return new QJSValuePrivate(m_v4Engine, exception.get()->vmValue());
+ return new QJSValuePrivate(m_v4Engine, exception.get()->v4Value());
}
- return new QJSValuePrivate(m_v4Engine, result.get()->vmValue());
+ return new QJSValuePrivate(m_v4Engine, result.get()->v4Value());
}
QJSValue QV8Engine::scriptValueFromInternal(v8::Handle<v8::Value> value) const
{
if (value.IsEmpty())
return QJSValue();
- return new QJSValuePrivate(m_v4Engine, value.get()->vmValue());
+ return new QJSValuePrivate(m_v4Engine, value.get()->v4Value());
}
QJSValue QV8Engine::newArray(uint length)
{
- return new QJSValuePrivate(m_v4Engine, v8::Array::New(length).get()->vmValue());
+ return new QJSValuePrivate(m_v4Engine, v8::Array::New(length).get()->v4Value());
}
void QV8Engine::startTimer(const QString &timerName)
@@ -1560,12 +1560,12 @@ QV8Engine::ThreadData::~ThreadData()
QString QV8Engine::toString(v8::Handle<v8::Value> string)
{
- return string.get()->vmValue().toString(m_v4Engine->current)->toQString();
+ return string.get()->v4Value().toString(m_v4Engine->current)->toQString();
}
QString QV8Engine::toString(v8::Handle<v8::String> string)
{
- return string.get()->vmValue().toString(m_v4Engine->current)->toQString();
+ return string.get()->v4Value().toString(m_v4Engine->current)->toQString();
}
v8::Local<v8::String> QV8Engine::toString(const QString &string)
@@ -1574,14 +1574,14 @@ v8::Local<v8::String> QV8Engine::toString(const QString &string)
}
-QQmlJS::VM::Value QQmlV4Handle::toValue() const
+QV4::Value QQmlV4Handle::toValue() const
{
- QQmlJS::VM::Value val;
+ QV4::Value val;
val.val = d;
return val;
}
-QQmlV4Handle QQmlV4Handle::fromValue(const QQmlJS::VM::Value &v)
+QQmlV4Handle QQmlV4Handle::fromValue(const QV4::Value &v)
{
QQmlV4Handle handle;
handle.d = v.val;
diff --git a/src/qml/qml/v8/qv8engine_impl_p.h b/src/qml/qml/v8/qv8engine_impl_p.h
index 0eeaced761..b2dd9f7c83 100644
--- a/src/qml/qml/v8/qv8engine_impl_p.h
+++ b/src/qml/qml/v8/qv8engine_impl_p.h
@@ -151,8 +151,8 @@ QJSValue QV8Engine::evaluate(const QString& program, const QString& fileName, qu
if (script.IsEmpty()) {
// TODO: Why don't we get the exception, as with Script::Compile()?
// Q_ASSERT(tryCatch.HasCaught());
- QQmlJS::VM::Object *error = m_v4Engine->newSyntaxErrorObject(m_v4Engine->current, 0);
- return new QJSValuePrivate(m_v4Engine, QQmlJS::VM::Value::fromObject(error));
+ QV4::Object *error = m_v4Engine->newSyntaxErrorObject(m_v4Engine->current, 0);
+ return new QJSValuePrivate(m_v4Engine, QV4::Value::fromObject(error));
}
return evaluate(script, tryCatch);
}
diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h
index dbe90a7a10..509ebf4881 100644
--- a/src/qml/qml/v8/qv8engine_p.h
+++ b/src/qml/qml/v8/qv8engine_p.h
@@ -92,12 +92,11 @@ inline uint qHash(const v8::Handle<v8::Object> &object, uint seed = 0)
QT_BEGIN_NAMESPACE
-namespace QQmlJS {
-namespace VM {
+namespace QV4 {
struct ExecutionEngine;
struct Value;
}
-}
+
// Uncomment the following line to enable global handle debugging. When enabled, all the persistent
// handles allocated using qPersistentNew() (or registered with qPersistentRegsiter()) and disposed
@@ -217,8 +216,8 @@ public:
return v8::Value::NewFromInternalValue(d);
}
- QQmlJS::VM::Value toValue() const;
- static QQmlV4Handle fromValue(const QQmlJS::VM::Value &v);
+ QV4::Value toValue() const;
+ static QQmlV4Handle fromValue(const QV4::Value &v);
private:
QQmlV4Handle(v8::Handle<v8::Value> h) : d(h.val) {}
quint64 d;
@@ -258,8 +257,8 @@ class Q_QML_PRIVATE_EXPORT QV8Engine
public:
static QV8Engine* get(QJSEngine* q) { Q_ASSERT(q); return q->handle(); }
static QJSEngine* get(QV8Engine* d) { Q_ASSERT(d); return d->q; }
- static QQmlJS::VM::ExecutionEngine *getV4(QJSEngine *q) { return q->handle()->m_v4Engine; }
- static QQmlJS::VM::ExecutionEngine *getV4(QV8Engine *d) { return d->m_v4Engine; }
+ static QV4::ExecutionEngine *getV4(QJSEngine *q) { return q->handle()->m_v4Engine; }
+ static QV4::ExecutionEngine *getV4(QV8Engine *d) { return d->m_v4Engine; }
enum ContextOwnership {
AdoptCurrentContext,
@@ -411,7 +410,7 @@ public:
QJsonArray jsonArrayFromJS(v8::Handle<v8::Value> value);
v8::Handle<v8::Value> metaTypeToJS(int type, const void *data);
- bool metaTypeFromJS(const QQmlJS::VM::Value &value, int type, void *data);
+ bool metaTypeFromJS(const QV4::Value &value, int type, void *data);
bool convertToNativeQObject(v8::Handle<v8::Value> value,
const QByteArray &targetType,
@@ -459,7 +458,7 @@ protected:
QJSEngine* q;
QQmlEngine *m_engine;
- QQmlJS::VM::ExecutionEngine *m_v4Engine;
+ QV4::ExecutionEngine *m_v4Engine;
bool m_ownsV8Context;
v8::Persistent<v8::Context> m_context;
diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp
index 15265517cc..13574e1543 100644
--- a/src/qml/qml/v8/qv8qobjectwrapper.cpp
+++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp
@@ -433,7 +433,7 @@ static v8::Handle<v8::Value> LoadProperty(QV8Engine *engine, QObject *object,
} else if (property.propType == qMetaTypeId<QJSValue>()) {
QJSValue v;
ReadFunction(object, property, &v, notifier);
- return v8::Value::fromVmValue(QJSValuePrivate::get(v)->getValue(QV8Engine::getV4(engine)));
+ return v8::Value::fromV4Value(QJSValuePrivate::get(v)->getValue(QV8Engine::getV4(engine)));
} else if (property.isQVariant()) {
QVariant v;
ReadFunction(object, property, &v, notifier);
@@ -2143,7 +2143,7 @@ void CallArgument::fromValue(int callType, QV8Engine *engine, v8::Handle<v8::Val
if (type != 0) { cleanup(); type = 0; }
if (callType == qMetaTypeId<QJSValue>()) {
- qjsValuePtr = new (&allocData) QJSValue(new QJSValuePrivate(QV8Engine::getV4(engine), value.get()->vmValue()));
+ qjsValuePtr = new (&allocData) QJSValue(new QJSValuePrivate(QV8Engine::getV4(engine), value.get()->v4Value()));
type = qMetaTypeId<QJSValue>();
} else if (callType == QMetaType::Int) {
intValue = quint32(value->Int32Value());
@@ -2232,7 +2232,7 @@ void CallArgument::fromValue(int callType, QV8Engine *engine, v8::Handle<v8::Val
v8::Handle<v8::Value> CallArgument::toValue(QV8Engine *engine)
{
if (type == qMetaTypeId<QJSValue>()) {
- return v8::Value::fromVmValue(QJSValuePrivate::get(*qjsValuePtr)->getValue(QV8Engine::getV4(engine)));
+ return v8::Value::fromV4Value(QJSValuePrivate::get(*qjsValuePtr)->getValue(QV8Engine::getV4(engine)));
} else if (type == QMetaType::Int) {
return v8::Integer::New(int(intValue));
} else if (type == QMetaType::UInt) {
diff --git a/src/qml/qml/v8/qv8typewrapper.cpp b/src/qml/qml/v8/qv8typewrapper.cpp
index e7e1f43ebe..7c77772282 100644
--- a/src/qml/qml/v8/qv8typewrapper.cpp
+++ b/src/qml/qml/v8/qv8typewrapper.cpp
@@ -195,12 +195,12 @@ v8::Handle<v8::Value> QV8TypeWrapper::Getter(v8::Local<v8::String> property,
v8::Handle<v8::Value> rv = v8engine->qobjectWrapper()->getProperty(qobjectSingleton, propertystring, context, QV8QObjectWrapper::IgnoreRevision);
return rv;
} else if (!siinfo->scriptApi(e).isUndefined()) {
- QQmlJS::VM::ExecutionEngine *engine = v8::Isolate::GetEngine();
+ QV4::ExecutionEngine *engine = v8::Isolate::GetEngine();
// NOTE: if used in a binding, changes will not trigger re-evaluation since non-NOTIFYable.
- QQmlJS::VM::Object *o = QJSValuePrivate::get(siinfo->scriptApi(e))->getValue(engine).asObject();
+ QV4::Object *o = QJSValuePrivate::get(siinfo->scriptApi(e))->getValue(engine).asObject();
if (!o)
return v8::Handle<v8::Value>();
- return v8::Value::fromVmValue(o->get(engine->current, property.get()->vmValue().toString(engine->current)));
+ return v8::Value::fromV4Value(o->get(engine->current, property.get()->v4Value().toString(engine->current)));
}
// Fall through to return empty handle
@@ -290,14 +290,14 @@ v8::Handle<v8::Value> QV8TypeWrapper::Setter(v8::Local<v8::String> property,
v8engine->qobjectWrapper()->setProperty(qobjectSingleton, propertystring, context, value,
QV8QObjectWrapper::IgnoreRevision);
} else if (!siinfo->scriptApi(e).isUndefined()) {
- QQmlJS::VM::Value setVal = value.get()->vmValue();
- QQmlJS::VM::Object *apiprivate = QJSValuePrivate::get(siinfo->scriptApi(e))->value.asObject();
+ QV4::Value setVal = value.get()->v4Value();
+ QV4::Object *apiprivate = QJSValuePrivate::get(siinfo->scriptApi(e))->value.asObject();
if (!apiprivate) {
QString error = QLatin1String("Cannot assign to read-only property \"") +
v8engine->toString(property) + QLatin1Char('\"');
v8::ThrowException(v8::Exception::Error(v8engine->toString(error)));
} else {
- apiprivate->put(v8::Isolate::GetEngine()->current, property.get()->vmValue().stringValue(), setVal);
+ apiprivate->put(v8::Isolate::GetEngine()->current, property.get()->v4Value().stringValue(), setVal);
}
}
}