aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-03-10 19:58:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-11 08:37:01 +0100
commit8ed6c62dc76ebc2e510ecc028c34c160018af86c (patch)
tree335e73bcdb52b1a8300a67c1f91299e7bc97972a /src/qml
parentdfed088a50298fe4a9d0eb8a9d0a2711dfc206c1 (diff)
Cleanup our runtime methods
Move all our runtime methods into the QV4::Runtime struct and give them nicer names without underscores. Sort them logically and remove a few unused methods. Change-Id: Ib69b71764ff194d0ba211aac581f9a99734d8180 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h4
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp44
-rw-r--r--src/qml/compiler/qv4ssa.cpp16
-rw-r--r--src/qml/jit/qv4binop.cpp44
-rw-r--r--src/qml/jit/qv4binop_p.h4
-rw-r--r--src/qml/jit/qv4isel_masm.cpp145
-rw-r--r--src/qml/jit/qv4unop.cpp14
-rw-r--r--src/qml/jsapi/qjsengine.cpp2
-rw-r--r--src/qml/jsapi/qjsvalue.cpp16
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp2
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp8
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp4
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp6
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp6
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp251
-rw-r--r--src/qml/jsruntime/qv4runtime_p.h416
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4string.cpp2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4value.cpp22
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp114
25 files changed, 564 insertions, 578 deletions
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h
index 12ef3bc0af..d70c82233f 100644
--- a/src/qml/compiler/qv4instr_moth_p.h
+++ b/src/qml/compiler/qv4instr_moth_p.h
@@ -598,7 +598,7 @@ union Instr
};
struct instr_binop {
MOTH_INSTR_HEADER
- QV4::BinOp alu;
+ QV4::Runtime::BinaryOperation alu;
Param lhs;
Param rhs;
Param result;
@@ -683,7 +683,7 @@ union Instr
};
struct instr_binopContext {
MOTH_INSTR_HEADER
- QV4::BinOpContext alu;
+ QV4::Runtime::BinaryOperationContext alu;
Param lhs;
Param rhs;
Param result;
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index d97fa5827f..1e0e88730b 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -56,7 +56,7 @@ using namespace QV4::Moth;
namespace {
-inline QV4::BinOp aluOpFunction(IR::AluOp op)
+inline QV4::Runtime::BinaryOperation aluOpFunction(IR::AluOp op)
{
switch (op) {
case IR::OpInvalid:
@@ -72,43 +72,43 @@ inline QV4::BinOp aluOpFunction(IR::AluOp op)
case IR::OpCompl:
return 0;
case IR::OpBitAnd:
- return QV4::__qmljs_bit_and;
+ return QV4::Runtime::bitAnd;
case IR::OpBitOr:
- return QV4::__qmljs_bit_or;
+ return QV4::Runtime::bitOr;
case IR::OpBitXor:
- return QV4::__qmljs_bit_xor;
+ return QV4::Runtime::bitXor;
case IR::OpAdd:
return 0;
case IR::OpSub:
- return QV4::__qmljs_sub;
+ return QV4::Runtime::sub;
case IR::OpMul:
- return QV4::__qmljs_mul;
+ return QV4::Runtime::mul;
case IR::OpDiv:
- return QV4::__qmljs_div;
+ return QV4::Runtime::div;
case IR::OpMod:
- return QV4::__qmljs_mod;
+ return QV4::Runtime::mod;
case IR::OpLShift:
- return QV4::__qmljs_shl;
+ return QV4::Runtime::shl;
case IR::OpRShift:
- return QV4::__qmljs_shr;
+ return QV4::Runtime::shr;
case IR::OpURShift:
- return QV4::__qmljs_ushr;
+ return QV4::Runtime::ushr;
case IR::OpGt:
- return QV4::__qmljs_gt;
+ return QV4::Runtime::greaterThan;
case IR::OpLt:
- return QV4::__qmljs_lt;
+ return QV4::Runtime::lessThan;
case IR::OpGe:
- return QV4::__qmljs_ge;
+ return QV4::Runtime::greaterEqual;
case IR::OpLe:
- return QV4::__qmljs_le;
+ return QV4::Runtime::lessEqual;
case IR::OpEqual:
- return QV4::__qmljs_eq;
+ return QV4::Runtime::equal;
case IR::OpNotEqual:
- return QV4::__qmljs_ne;
+ return QV4::Runtime::notEqual;
case IR::OpStrictEqual:
- return QV4::__qmljs_se;
+ return QV4::Runtime::strictEqual;
case IR::OpStrictNotEqual:
- return QV4::__qmljs_sne;
+ return QV4::Runtime::strictNotEqual;
case IR::OpInstanceof:
return 0;
case IR::OpIn:
@@ -978,11 +978,11 @@ Param InstructionSelection::binopHelper(IR::AluOp oper, IR::Expr *leftSource, IR
if (oper == IR::OpInstanceof || oper == IR::OpIn || oper == IR::OpAdd) {
Instruction::BinopContext binop;
if (oper == IR::OpInstanceof)
- binop.alu = QV4::__qmljs_instanceof;
+ binop.alu = QV4::Runtime::instanceof;
else if (oper == IR::OpIn)
- binop.alu = QV4::__qmljs_in;
+ binop.alu = QV4::Runtime::in;
else
- binop.alu = QV4::__qmljs_add;
+ binop.alu = QV4::Runtime::add;
binop.lhs = getParam(leftSource);
binop.rhs = getParam(rightSource);
binop.result = getResultParam(target);
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 85f1677563..ca0bbb1bb3 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -3096,22 +3096,22 @@ bool tryOptimizingComparison(Expr *&expr)
switch (b->op) {
case OpGt:
- leftConst->value = __qmljs_cmp_gt(&l, &r);
+ leftConst->value = Runtime::compareGreaterThan(&l, &r);
leftConst->type = BoolType;
expr = leftConst;
return true;
case OpLt:
- leftConst->value = __qmljs_cmp_lt(&l, &r);
+ leftConst->value = Runtime::compareLessThan(&l, &r);
leftConst->type = BoolType;
expr = leftConst;
return true;
case OpGe:
- leftConst->value = __qmljs_cmp_ge(&l, &r);
+ leftConst->value = Runtime::compareGreaterEqual(&l, &r);
leftConst->type = BoolType;
expr = leftConst;
return true;
case OpLe:
- leftConst->value = __qmljs_cmp_le(&l, &r);
+ leftConst->value = Runtime::compareLessEqual(&l, &r);
leftConst->type = BoolType;
expr = leftConst;
return true;
@@ -3120,7 +3120,7 @@ bool tryOptimizingComparison(Expr *&expr)
return false;
// intentional fall-through
case OpEqual:
- leftConst->value = __qmljs_cmp_eq(&l, &r);
+ leftConst->value = Runtime::compareEqual(&l, &r);
leftConst->type = BoolType;
expr = leftConst;
return true;
@@ -3129,7 +3129,7 @@ bool tryOptimizingComparison(Expr *&expr)
return false;
// intentional fall-through
case OpNotEqual:
- leftConst->value = __qmljs_cmp_ne(&l, &r);
+ leftConst->value = Runtime::compareNotEqual(&l, &r);
leftConst->type = BoolType;
expr = leftConst;
return true;
@@ -3366,8 +3366,8 @@ void optimizeSSA(IR::Function *function, DefUsesCalculator &defUses, DominatorTr
QV4::Primitive lc = convertToValue(leftConst);
QV4::Primitive rc = convertToValue(rightConst);
- double l = __qmljs_to_number(&lc);
- double r = __qmljs_to_number(&rc);
+ double l = RuntimeHelpers::toNumber(&lc);
+ double r = RuntimeHelpers::toNumber(&rc);
switch (binop->op) {
case OpMul:
diff --git a/src/qml/jit/qv4binop.cpp b/src/qml/jit/qv4binop.cpp
index 2a4cbeea9b..e584f1142f 100644
--- a/src/qml/jit/qv4binop.cpp
+++ b/src/qml/jit/qv4binop.cpp
@@ -79,32 +79,32 @@ const Binop::OpInfo Binop::operations[IR::LastAluOp + 1] = {
NULL_OP, // OpIncrement
NULL_OP, // OpDecrement
- INLINE_OP(__qmljs_bit_and, &Binop::inline_and32, &Binop::inline_and32), // OpBitAnd
- INLINE_OP(__qmljs_bit_or, &Binop::inline_or32, &Binop::inline_or32), // OpBitOr
- INLINE_OP(__qmljs_bit_xor, &Binop::inline_xor32, &Binop::inline_xor32), // OpBitXor
+ INLINE_OP(Runtime::bitAnd, &Binop::inline_and32, &Binop::inline_and32), // OpBitAnd
+ INLINE_OP(Runtime::bitOr, &Binop::inline_or32, &Binop::inline_or32), // OpBitOr
+ INLINE_OP(Runtime::bitXor, &Binop::inline_xor32, &Binop::inline_xor32), // OpBitXor
- INLINE_OPCONTEXT(__qmljs_add, &Binop::inline_add32, &Binop::inline_add32), // OpAdd
- INLINE_OP(__qmljs_sub, &Binop::inline_sub32, &Binop::inline_sub32), // OpSub
- INLINE_OP(__qmljs_mul, &Binop::inline_mul32, &Binop::inline_mul32), // OpMul
+ INLINE_OPCONTEXT(Runtime::add, &Binop::inline_add32, &Binop::inline_add32), // OpAdd
+ INLINE_OP(Runtime::sub, &Binop::inline_sub32, &Binop::inline_sub32), // OpSub
+ INLINE_OP(Runtime::mul, &Binop::inline_mul32, &Binop::inline_mul32), // OpMul
- OP(__qmljs_div), // OpDiv
- OP(__qmljs_mod), // OpMod
+ OP(Runtime::div), // OpDiv
+ OP(Runtime::mod), // OpMod
- INLINE_OP(__qmljs_shl, &Binop::inline_shl32, &Binop::inline_shl32), // OpLShift
- INLINE_OP(__qmljs_shr, &Binop::inline_shr32, &Binop::inline_shr32), // OpRShift
- INLINE_OP(__qmljs_ushr, &Binop::inline_ushr32, &Binop::inline_ushr32), // OpURShift
+ INLINE_OP(Runtime::shl, &Binop::inline_shl32, &Binop::inline_shl32), // OpLShift
+ INLINE_OP(Runtime::shr, &Binop::inline_shr32, &Binop::inline_shr32), // OpRShift
+ INLINE_OP(Runtime::ushr, &Binop::inline_ushr32, &Binop::inline_ushr32), // OpURShift
- OP(__qmljs_gt), // OpGt
- OP(__qmljs_lt), // OpLt
- OP(__qmljs_ge), // OpGe
- OP(__qmljs_le), // OpLe
- OP(__qmljs_eq), // OpEqual
- OP(__qmljs_ne), // OpNotEqual
- OP(__qmljs_se), // OpStrictEqual
- OP(__qmljs_sne), // OpStrictNotEqual
+ OP(Runtime::greaterThan), // OpGt
+ OP(Runtime::lessThan), // OpLt
+ OP(Runtime::greaterEqual), // OpGe
+ OP(Runtime::lessEqual), // OpLe
+ OP(Runtime::equal), // OpEqual
+ OP(Runtime::notEqual), // OpNotEqual
+ OP(Runtime::strictEqual), // OpStrictEqual
+ OP(Runtime::strictNotEqual), // OpStrictNotEqual
- OPCONTEXT(__qmljs_instanceof), // OpInstanceof
- OPCONTEXT(__qmljs_in), // OpIn
+ OPCONTEXT(Runtime::instanceof), // OpInstanceof
+ OPCONTEXT(Runtime::in), // OpIn
NULL_OP, // OpAnd
NULL_OP // OpOr
@@ -134,7 +134,7 @@ void Binop::generate(IR::Expr *lhs, IR::Expr *rhs, IR::Temp *target)
if (op == IR::OpAdd &&
(lhs->type == IR::StringType || rhs->type == IR::StringType)) {
- const Binop::OpInfo stringAdd = OPCONTEXT(__qmljs_add_string);
+ const Binop::OpInfo stringAdd = OPCONTEXT(Runtime::addString);
info = stringAdd;
}
diff --git a/src/qml/jit/qv4binop_p.h b/src/qml/jit/qv4binop_p.h
index 096f28e881..a6292e6fb5 100644
--- a/src/qml/jit/qv4binop_p.h
+++ b/src/qml/jit/qv4binop_p.h
@@ -68,8 +68,8 @@ struct Binop {
struct OpInfo {
const char *name;
- QV4::BinOp fallbackImplementation;
- QV4::BinOpContext contextImplementation;
+ QV4::Runtime::BinaryOperation fallbackImplementation;
+ QV4::Runtime::BinaryOperationContext contextImplementation;
MemRegOp inlineMemRegOp;
ImmRegOp inlineImmRegOp;
};
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index dc3f45500f..5e51b84cd5 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -388,12 +388,12 @@ void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args
if (useFastLookups && func->global) {
uint index = registerGlobalGetterLookup(*func->id);
- generateFunctionCall(result, __qmljs_call_global_lookup,
+ generateFunctionCall(result, Runtime::callGlobalLookup,
Assembler::ContextRegister,
Assembler::TrustedImm32(index),
baseAddressForCallData());
} else {
- generateFunctionCall(result, __qmljs_call_activation_property,
+ generateFunctionCall(result, Runtime::callActivationProperty,
Assembler::ContextRegister,
Assembler::PointerToString(*func->id),
baseAddressForCallData());
@@ -403,46 +403,46 @@ void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args
void InstructionSelection::callBuiltinTypeofMember(IR::Expr *base, const QString &name,
IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_builtin_typeof_member, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::typeofMember, Assembler::ContextRegister,
Assembler::PointerToValue(base), Assembler::PointerToString(name));
}
void InstructionSelection::callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index,
IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_builtin_typeof_element,
+ generateFunctionCall(result, Runtime::typeofElement,
Assembler::ContextRegister,
Assembler::PointerToValue(base), Assembler::PointerToValue(index));
}
void InstructionSelection::callBuiltinTypeofName(const QString &name, IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_builtin_typeof_name, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::typeofName, Assembler::ContextRegister,
Assembler::PointerToString(name));
}
void InstructionSelection::callBuiltinTypeofValue(IR::Expr *value, IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_builtin_typeof, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::typeofValue, Assembler::ContextRegister,
Assembler::PointerToValue(value));
}
void InstructionSelection::callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_delete_member, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::deleteMember, Assembler::ContextRegister,
Assembler::Reference(base), Assembler::PointerToString(name));
}
void InstructionSelection::callBuiltinDeleteSubscript(IR::Temp *base, IR::Expr *index,
IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_delete_subscript, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::deleteElement, Assembler::ContextRegister,
Assembler::Reference(base), Assembler::PointerToValue(index));
}
void InstructionSelection::callBuiltinDeleteName(const QString &name, IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_delete_name, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::deleteName, Assembler::ContextRegister,
Assembler::PointerToString(name));
}
@@ -453,7 +453,7 @@ void InstructionSelection::callBuiltinDeleteValue(IR::Temp *result)
void InstructionSelection::callBuiltinThrow(IR::Expr *arg)
{
- generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_throw, Assembler::ContextRegister,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::throwException, Assembler::ContextRegister,
Assembler::PointerToValue(arg));
}
@@ -464,14 +464,14 @@ void InstructionSelection::callBuiltinReThrow()
void InstructionSelection::callBuiltinUnwindException(IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_builtin_unwind_exception, Assembler::ContextRegister);
+ generateFunctionCall(result, Runtime::unwindException, Assembler::ContextRegister);
}
void InstructionSelection::callBuiltinPushCatchScope(const QString &exceptionName)
{
Assembler::Pointer s = _as->loadStringAddress(Assembler::ScratchRegister, exceptionName);
- generateFunctionCall(Assembler::ContextRegister, __qmljs_builtin_push_catch_scope, Assembler::ContextRegister, s);
+ generateFunctionCall(Assembler::ContextRegister, Runtime::pushCatchScope, Assembler::ContextRegister, s);
}
void InstructionSelection::callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result)
@@ -479,7 +479,7 @@ void InstructionSelection::callBuiltinForeachIteratorObject(IR::Temp *arg, IR::T
Q_ASSERT(arg);
Q_ASSERT(result);
- generateFunctionCall(result, __qmljs_foreach_iterator_object, Assembler::ContextRegister, Assembler::Reference(arg));
+ generateFunctionCall(result, Runtime::foreachIterator, Assembler::ContextRegister, Assembler::Reference(arg));
}
void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Temp *arg, IR::Temp *result)
@@ -487,24 +487,24 @@ void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Temp *arg, IR:
Q_ASSERT(arg);
Q_ASSERT(result);
- generateFunctionCall(result, __qmljs_foreach_next_property_name, Assembler::Reference(arg));
+ generateFunctionCall(result, Runtime::foreachNextPropertyName, Assembler::Reference(arg));
}
void InstructionSelection::callBuiltinPushWithScope(IR::Temp *arg)
{
Q_ASSERT(arg);
- generateFunctionCall(Assembler::ContextRegister, __qmljs_builtin_push_with_scope, Assembler::Reference(arg), Assembler::ContextRegister);
+ generateFunctionCall(Assembler::ContextRegister, Runtime::pushWithScope, Assembler::Reference(arg), Assembler::ContextRegister);
}
void InstructionSelection::callBuiltinPopScope()
{
- generateFunctionCall(Assembler::ContextRegister, __qmljs_builtin_pop_scope, Assembler::ContextRegister);
+ generateFunctionCall(Assembler::ContextRegister, Runtime::popScope, Assembler::ContextRegister);
}
void InstructionSelection::callBuiltinDeclareVar(bool deletable, const QString &name)
{
- generateFunctionCall(Assembler::Void, __qmljs_builtin_declare_var, Assembler::ContextRegister,
+ generateFunctionCall(Assembler::Void, Runtime::declareVar, Assembler::ContextRegister,
Assembler::TrustedImm32(deletable), Assembler::PointerToString(name));
}
@@ -513,7 +513,7 @@ void InstructionSelection::callBuiltinDefineArray(IR::Temp *result, IR::ExprList
Q_ASSERT(result);
int length = prepareVariableArguments(args);
- generateFunctionCall(result, __qmljs_builtin_define_array, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::arrayLiteral, Assembler::ContextRegister,
baseAddressForCallArguments(), Assembler::TrustedImm32(length));
}
@@ -593,19 +593,19 @@ void InstructionSelection::callBuiltinDefineObjectLiteral(IR::Temp *result, int
it = it->next;
}
- generateFunctionCall(result, __qmljs_builtin_define_object_literal, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::objectLiteral, Assembler::ContextRegister,
baseAddressForCallArguments(), Assembler::TrustedImm32(classId),
Assembler::TrustedImm32(arrayValueCount), Assembler::TrustedImm32(arrayGetterSetterCount | (needSparseArray << 30)));
}
void InstructionSelection::callBuiltinSetupArgumentObject(IR::Temp *result)
{
- generateFunctionCall(result, __qmljs_builtin_setup_arguments_object, Assembler::ContextRegister);
+ generateFunctionCall(result, Runtime::setupArgumentsObject, Assembler::ContextRegister);
}
void InstructionSelection::callBuiltinConvertThisToObject()
{
- generateFunctionCall(Assembler::Void, __qmljs_builtin_convert_this_to_object, Assembler::ContextRegister);
+ generateFunctionCall(Assembler::Void, Runtime::convertThisToObject, Assembler::ContextRegister);
}
void InstructionSelection::callValue(IR::Temp *value, IR::ExprList *args, IR::Temp *result)
@@ -613,7 +613,7 @@ void InstructionSelection::callValue(IR::Temp *value, IR::ExprList *args, IR::Te
Q_ASSERT(value);
prepareCallData(args, 0);
- generateFunctionCall(result, __qmljs_call_value, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::callValue, Assembler::ContextRegister,
Assembler::Reference(value),
baseAddressForCallData());
}
@@ -632,27 +632,27 @@ void InstructionSelection::loadThisObject(IR::Temp *temp)
void InstructionSelection::loadQmlIdArray(IR::Temp *temp)
{
- generateFunctionCall(temp, __qmljs_get_id_array, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlIdArray, Assembler::ContextRegister);
}
void InstructionSelection::loadQmlImportedScripts(IR::Temp *temp)
{
- generateFunctionCall(temp, __qmljs_get_imported_scripts, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlImportedScripts, Assembler::ContextRegister);
}
void InstructionSelection::loadQmlContextObject(IR::Temp *temp)
{
- generateFunctionCall(temp, __qmljs_get_context_object, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlContextObject, Assembler::ContextRegister);
}
void InstructionSelection::loadQmlScopeObject(IR::Temp *temp)
{
- generateFunctionCall(temp, __qmljs_get_scope_object, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlScopeObject, Assembler::ContextRegister);
}
void InstructionSelection::loadQmlSingleton(const QString &name, IR::Temp *temp)
{
- generateFunctionCall(temp, __qmljs_get_qml_singleton, Assembler::ContextRegister, Assembler::PointerToString(name));
+ generateFunctionCall(temp, Runtime::getQmlSingleton, Assembler::ContextRegister, Assembler::PointerToString(name));
}
void InstructionSelection::loadConst(IR::Const *sourceConst, IR::Temp *targetTemp)
@@ -696,7 +696,7 @@ void InstructionSelection::loadString(const QString &str, IR::Temp *targetTemp)
void InstructionSelection::loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp)
{
int id = registerRegExp(sourceRegexp);
- generateFunctionCall(targetTemp, __qmljs_lookup_runtime_regexp, Assembler::ContextRegister, Assembler::TrustedImm32(id));
+ generateFunctionCall(targetTemp, Runtime::regexpLiteral, Assembler::ContextRegister, Assembler::TrustedImm32(id));
}
void InstructionSelection::getActivationProperty(const IR::Name *name, IR::Temp *temp)
@@ -706,20 +706,20 @@ void InstructionSelection::getActivationProperty(const IR::Name *name, IR::Temp
generateLookupCall(temp, index, qOffsetOf(QV4::Lookup, globalGetter), Assembler::ContextRegister, Assembler::Void);
return;
}
- generateFunctionCall(temp, __qmljs_get_activation_property, Assembler::ContextRegister, Assembler::PointerToString(*name->id));
+ generateFunctionCall(temp, Runtime::getActivationProperty, Assembler::ContextRegister, Assembler::PointerToString(*name->id));
}
void InstructionSelection::setActivationProperty(IR::Expr *source, const QString &targetName)
{
// ### should use a lookup call here
- generateFunctionCall(Assembler::Void, __qmljs_set_activation_property,
+ generateFunctionCall(Assembler::Void, Runtime::setActivationProperty,
Assembler::ContextRegister, Assembler::PointerToString(targetName), Assembler::PointerToValue(source));
}
void InstructionSelection::initClosure(IR::Closure *closure, IR::Temp *target)
{
int id = closure->value;
- generateFunctionCall(target, __qmljs_init_closure, Assembler::ContextRegister, Assembler::TrustedImm32(id));
+ generateFunctionCall(target, Runtime::closure, Assembler::ContextRegister, Assembler::TrustedImm32(id));
}
void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR::Temp *target)
@@ -728,7 +728,7 @@ void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR::
uint index = registerGetterLookup(name);
generateLookupCall(target, index, qOffsetOf(QV4::Lookup, getter), Assembler::PointerToValue(base), Assembler::Void);
} else {
- generateFunctionCall(target, __qmljs_get_property, Assembler::ContextRegister,
+ generateFunctionCall(target, Runtime::getProperty, Assembler::ContextRegister,
Assembler::PointerToValue(base), Assembler::PointerToString(name));
}
}
@@ -736,9 +736,9 @@ void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR::
void InstructionSelection::getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, int attachedPropertiesId, IR::Temp *target)
{
if (attachedPropertiesId != 0)
- generateFunctionCall(target, __qmljs_get_attached_property, Assembler::ContextRegister, Assembler::TrustedImm32(attachedPropertiesId), Assembler::TrustedImm32(propertyIndex));
+ generateFunctionCall(target, Runtime::getQmlAttachedProperty, Assembler::ContextRegister, Assembler::TrustedImm32(attachedPropertiesId), Assembler::TrustedImm32(propertyIndex));
else
- generateFunctionCall(target, __qmljs_get_qobject_property, Assembler::ContextRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(propertyIndex),
+ generateFunctionCall(target, Runtime::getQmlQObjectProperty, Assembler::ContextRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(propertyIndex),
Assembler::TrustedImm32(captureRequired));
}
@@ -751,7 +751,7 @@ void InstructionSelection::setProperty(IR::Expr *source, IR::Expr *targetBase,
Assembler::PointerToValue(targetBase),
Assembler::PointerToValue(source));
} else {
- generateFunctionCall(Assembler::Void, __qmljs_set_property, Assembler::ContextRegister,
+ generateFunctionCall(Assembler::Void, Runtime::setProperty, Assembler::ContextRegister,
Assembler::PointerToValue(targetBase), Assembler::PointerToString(targetName),
Assembler::PointerToValue(source));
}
@@ -759,7 +759,7 @@ void InstructionSelection::setProperty(IR::Expr *source, IR::Expr *targetBase,
void InstructionSelection::setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex)
{
- generateFunctionCall(Assembler::Void, __qmljs_set_qobject_property, Assembler::ContextRegister, Assembler::PointerToValue(targetBase),
+ generateFunctionCall(Assembler::Void, Runtime::setQmlQObjectProperty, Assembler::ContextRegister, Assembler::PointerToValue(targetBase),
Assembler::TrustedImm32(propertyIndex), Assembler::PointerToValue(source));
}
@@ -773,7 +773,7 @@ void InstructionSelection::getElement(IR::Expr *base, IR::Expr *index, IR::Temp
return;
}
- generateFunctionCall(target, __qmljs_get_element, Assembler::ContextRegister,
+ generateFunctionCall(target, Runtime::getElement, Assembler::ContextRegister,
Assembler::PointerToValue(base), Assembler::PointerToValue(index));
}
@@ -786,7 +786,7 @@ void InstructionSelection::setElement(IR::Expr *source, IR::Expr *targetBase, IR
Assembler::PointerToValue(source));
return;
}
- generateFunctionCall(Assembler::Void, __qmljs_set_element, Assembler::ContextRegister,
+ generateFunctionCall(Assembler::Void, Runtime::setElement, Assembler::ContextRegister,
Assembler::PointerToValue(targetBase), Assembler::PointerToValue(targetIndex),
Assembler::PointerToValue(source));
}
@@ -947,13 +947,12 @@ void InstructionSelection::callProperty(IR::Expr *base, const QString &name, IR:
if (useFastLookups) {
uint index = registerGetterLookup(name);
- generateFunctionCall(result, __qmljs_call_property_lookup,
+ generateFunctionCall(result, Runtime::callPropertyLookup,
Assembler::ContextRegister,
Assembler::TrustedImm32(index),
baseAddressForCallData());
- } else
- {
- generateFunctionCall(result, __qmljs_call_property, Assembler::ContextRegister,
+ } else {
+ generateFunctionCall(result, Runtime::callProperty, Assembler::ContextRegister,
Assembler::PointerToString(name),
baseAddressForCallData());
}
@@ -965,7 +964,7 @@ void InstructionSelection::callSubscript(IR::Expr *base, IR::Expr *index, IR::Ex
assert(base != 0);
prepareCallData(args, base);
- generateFunctionCall(result, __qmljs_call_element, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::callElement, Assembler::ContextRegister,
Assembler::PointerToValue(index),
baseAddressForCallData());
}
@@ -1041,7 +1040,7 @@ void InstructionSelection::convertTypeToDouble(IR::Temp *source, IR::Temp *targe
Assembler::TrustedImm32(Value::NotDouble_Mask));
#endif
- generateFunctionCall(target, __qmljs_value_to_double, Assembler::PointerToValue(source));
+ generateFunctionCall(target, Runtime::toDouble, Assembler::PointerToValue(source));
Assembler::Jump noDoubleDone = _as->jump();
// it is a double:
@@ -1104,7 +1103,7 @@ void InstructionSelection::convertTypeToBool(IR::Temp *source, IR::Temp *target)
case IR::StringType:
case IR::VarType:
default:
- generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_to_boolean,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::toBoolean,
Assembler::PointerToValue(source));
_as->storeBool(Assembler::ReturnValueRegister, target);
break;
@@ -1136,7 +1135,7 @@ void InstructionSelection::convertTypeToSInt32(IR::Temp *source, IR::Temp *targe
// not an int:
fallback.link(_as);
- generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_value_to_int32,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::toInt,
_as->loadTempAddress(Assembler::ScratchRegister, source));
isInt.link(_as);
@@ -1172,7 +1171,7 @@ void InstructionSelection::convertTypeToSInt32(IR::Temp *source, IR::Temp *targe
// not an int:
fallback.link(_as);
- generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_value_to_int32,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::toInt,
_as->loadTempAddress(Assembler::ScratchRegister, source));
_as->storeInt32(Assembler::ReturnValueRegister, target);
@@ -1185,7 +1184,7 @@ void InstructionSelection::convertTypeToSInt32(IR::Temp *source, IR::Temp *targe
_as->branchTruncateDoubleToInt32(_as->toDoubleRegister(source),
Assembler::ReturnValueRegister,
Assembler::BranchIfTruncateSuccessful);
- generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_double_to_int32,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::doubleToInt,
Assembler::PointerToValue(source));
success.link(_as);
_as->storeInt32(Assembler::ReturnValueRegister, target);
@@ -1203,7 +1202,7 @@ void InstructionSelection::convertTypeToSInt32(IR::Temp *source, IR::Temp *targe
break;
case IR::StringType:
default:
- generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_value_to_int32,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::toInt,
_as->loadTempAddress(Assembler::ScratchRegister, source));
_as->storeInt32(Assembler::ReturnValueRegister, target);
break;
@@ -1228,7 +1227,7 @@ void InstructionSelection::convertTypeToUInt32(IR::Temp *source, IR::Temp *targe
// not an int:
isNoInt.link(_as);
- generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_value_to_uint32,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::toUInt,
_as->loadTempAddress(Assembler::ScratchRegister, source));
_as->storeInt32(Assembler::ReturnValueRegister, target);
@@ -1239,7 +1238,7 @@ void InstructionSelection::convertTypeToUInt32(IR::Temp *source, IR::Temp *targe
Assembler::Jump success =
_as->branchTruncateDoubleToUint32(reg, Assembler::ReturnValueRegister,
Assembler::BranchIfTruncateSuccessful);
- generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_double_to_uint32,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::doubleToUInt,
Assembler::PointerToValue(source));
success.link(_as);
_as->storeUInt32(Assembler::ReturnValueRegister, target);
@@ -1250,7 +1249,7 @@ void InstructionSelection::convertTypeToUInt32(IR::Temp *source, IR::Temp *targe
_as->storeUInt32(Assembler::ReturnValueRegister, target);
break;
case IR::StringType:
- generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_value_to_uint32,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::toUInt,
Assembler::PointerToValue(source));
_as->storeUInt32(Assembler::ReturnValueRegister, target);
break;
@@ -1270,13 +1269,13 @@ void InstructionSelection::constructActivationProperty(IR::Name *func, IR::ExprL
if (useFastLookups && func->global) {
uint index = registerGlobalGetterLookup(*func->id);
- generateFunctionCall(result, __qmljs_construct_global_lookup,
+ generateFunctionCall(result, Runtime::constructGlobalLookup,
Assembler::ContextRegister,
Assembler::TrustedImm32(index), baseAddressForCallData());
return;
}
- generateFunctionCall(result, __qmljs_construct_activation_property,
+ generateFunctionCall(result, Runtime::constructActivationProperty,
Assembler::ContextRegister,
Assembler::PointerToString(*func->id),
baseAddressForCallData());
@@ -1288,14 +1287,14 @@ void InstructionSelection::constructProperty(IR::Temp *base, const QString &name
prepareCallData(args, base);
if (useFastLookups) {
uint index = registerGetterLookup(name);
- generateFunctionCall(result, __qmljs_construct_property_lookup,
+ generateFunctionCall(result, Runtime::constructPropertyLookup,
Assembler::ContextRegister,
Assembler::TrustedImm32(index),
baseAddressForCallData());
return;
}
- generateFunctionCall(result, __qmljs_construct_property, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::constructProperty, Assembler::ContextRegister,
Assembler::PointerToString(name),
baseAddressForCallData());
}
@@ -1305,7 +1304,7 @@ void InstructionSelection::constructValue(IR::Temp *value, IR::ExprList *args, I
assert(value != 0);
prepareCallData(args, 0);
- generateFunctionCall(result, __qmljs_construct_value,
+ generateFunctionCall(result, Runtime::constructValue,
Assembler::ContextRegister,
Assembler::Reference(value),
baseAddressForCallData());
@@ -1340,7 +1339,7 @@ void InstructionSelection::visitCJump(IR::CJump *s)
booleanConversion.link(_as);
reg = Assembler::ReturnValueRegister;
- generateFunctionCall(reg, __qmljs_to_boolean, Assembler::Reference(t));
+ generateFunctionCall(reg, Runtime::toBoolean, Assembler::Reference(t));
testBoolean.link(_as);
}
@@ -1350,7 +1349,7 @@ void InstructionSelection::visitCJump(IR::CJump *s)
} else if (IR::Const *c = s->cond->asConst()) {
// TODO: SSA optimization for constant condition evaluation should remove this.
// See also visitCJump() in RegAllocInfo.
- generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_to_boolean,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::toBoolean,
Assembler::PointerToValue(c));
_as->generateCJumpOnNonZero(Assembler::ReturnValueRegister, _block, s->iftrue, s->iffalse);
return;
@@ -1368,21 +1367,21 @@ void InstructionSelection::visitCJump(IR::CJump *s)
return;
}
- CmpOp op = 0;
- CmpOpContext opContext = 0;
+ Runtime::CompareOperation op = 0;
+ Runtime::CompareOperationContext opContext = 0;
const char *opName = 0;
switch (b->op) {
default: Q_UNREACHABLE(); assert(!"todo"); break;
- case IR::OpGt: setOp(op, opName, __qmljs_cmp_gt); break;
- case IR::OpLt: setOp(op, opName, __qmljs_cmp_lt); break;
- case IR::OpGe: setOp(op, opName, __qmljs_cmp_ge); break;
- case IR::OpLe: setOp(op, opName, __qmljs_cmp_le); break;
- case IR::OpEqual: setOp(op, opName, __qmljs_cmp_eq); break;
- case IR::OpNotEqual: setOp(op, opName, __qmljs_cmp_ne); break;
- case IR::OpStrictEqual: setOp(op, opName, __qmljs_cmp_se); break;
- case IR::OpStrictNotEqual: setOp(op, opName, __qmljs_cmp_sne); break;
- case IR::OpInstanceof: setOpContext(op, opName, __qmljs_cmp_instanceof); break;
- case IR::OpIn: setOpContext(op, opName, __qmljs_cmp_in); break;
+ case IR::OpGt: setOp(op, opName, Runtime::compareGreaterThan); break;
+ case IR::OpLt: setOp(op, opName, Runtime::compareLessThan); break;
+ case IR::OpGe: setOp(op, opName, Runtime::compareGreaterEqual); break;
+ case IR::OpLe: setOp(op, opName, Runtime::compareLessEqual); break;
+ case IR::OpEqual: setOp(op, opName, Runtime::compareEqual); break;
+ case IR::OpNotEqual: setOp(op, opName, Runtime::compareNotEqual); break;
+ case IR::OpStrictEqual: setOp(op, opName, Runtime::compareStrictEqual); break;
+ case IR::OpStrictNotEqual: setOp(op, opName, Runtime::compareStrictNotEqual); break;
+ case IR::OpInstanceof: setOpContext(op, opName, Runtime::compareInstanceof); break;
+ case IR::OpIn: setOpContext(op, opName, Runtime::compareIn); break;
} // switch
// TODO: in SSA optimization, do constant expression evaluation.
@@ -1652,7 +1651,7 @@ void InstructionSelection::visitCJumpStrict(IR::Binop *binop, IR::BasicBlock *tr
IR::Expr *left = binop->left;
IR::Expr *right = binop->right;
- _as->generateFunctionCallImp(Assembler::ReturnValueRegister, "__qmljs_cmp_se", __qmljs_cmp_se,
+ _as->generateFunctionCallImp(Assembler::ReturnValueRegister, "Runtime::compareStrictEqual", Runtime::compareStrictEqual,
Assembler::PointerToValue(left), Assembler::PointerToValue(right));
_as->generateCJumpOnCompare(binop->op == IR::OpStrictEqual ? Assembler::NotEqual : Assembler::Equal,
Assembler::ReturnValueRegister, Assembler::TrustedImm32(0),
@@ -1816,7 +1815,7 @@ void InstructionSelection::visitCJumpEqual(IR::Binop *binop, IR::BasicBlock *tru
IR::Expr *left = binop->left;
IR::Expr *right = binop->right;
- _as->generateFunctionCallImp(Assembler::ReturnValueRegister, "__qmljs_cmp_eq", __qmljs_cmp_eq,
+ _as->generateFunctionCallImp(Assembler::ReturnValueRegister, "Runtime::compareEqual", Runtime::compareEqual,
Assembler::PointerToValue(left), Assembler::PointerToValue(right));
_as->generateCJumpOnCompare(binop->op == IR::OpEqual ? Assembler::NotEqual : Assembler::Equal,
Assembler::ReturnValueRegister, Assembler::TrustedImm32(0),
diff --git a/src/qml/jit/qv4unop.cpp b/src/qml/jit/qv4unop.cpp
index 514002adf5..40f86f91b5 100644
--- a/src/qml/jit/qv4unop.cpp
+++ b/src/qml/jit/qv4unop.cpp
@@ -53,7 +53,7 @@ using namespace JIT;
void Unop::generate(IR::Temp *source, IR::Temp *target)
{
- UnaryOpName call = 0;
+ Runtime::UnaryOperation call = 0;
const char *name = 0;
switch (op) {
case IR::OpNot:
@@ -62,12 +62,12 @@ void Unop::generate(IR::Temp *source, IR::Temp *target)
case IR::OpUMinus:
generateUMinus(source, target);
return;
- case IR::OpUPlus: setOp(__qmljs_uplus); break;
+ case IR::OpUPlus: setOp(Runtime::uPlus); break;
case IR::OpCompl:
generateCompl(source, target);
return;
- case IR::OpIncrement: setOp(__qmljs_increment); break;
- case IR::OpDecrement: setOp(__qmljs_decrement); break;
+ case IR::OpIncrement: setOp(Runtime::increment); break;
+ case IR::OpDecrement: setOp(Runtime::decrement); break;
default:
Q_UNREACHABLE();
} // switch
@@ -91,7 +91,7 @@ void Unop::generateUMinus(IR::Temp *source, IR::Temp *target)
return;
}
- as->generateFunctionCallImp(target, "__qmljs_uminus", __qmljs_uminus, Assembler::PointerToValue(source));
+ as->generateFunctionCallImp(target, "Runtime::uMinus", Runtime::uMinus, Assembler::PointerToValue(source));
}
void Unop::generateNot(IR::Temp *source, IR::Temp *target)
@@ -119,7 +119,7 @@ void Unop::generateNot(IR::Temp *source, IR::Temp *target)
}
// ## generic implementation testing for int/bool
- as->generateFunctionCallImp(target, "__qmljs_not", __qmljs_not, Assembler::PointerToValue(source));
+ as->generateFunctionCallImp(target, "Runtime::uNot", Runtime::uNot, Assembler::PointerToValue(source));
}
void Unop::generateCompl(IR::Temp *source, IR::Temp *target)
@@ -133,7 +133,7 @@ void Unop::generateCompl(IR::Temp *source, IR::Temp *target)
as->storeInt32(tReg, target);
return;
}
- as->generateFunctionCallImp(target, "__qmljs_compl", __qmljs_compl, Assembler::PointerToValue(source));
+ as->generateFunctionCallImp(target, "Runtime::complement", Runtime::complement, Assembler::PointerToValue(source));
}
#endif
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp
index 1cf67a1c47..1ff6f509e0 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -391,7 +391,7 @@ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr)
*reinterpret_cast<QString*>(ptr) = vp->string;
return true;
}
- double d = QV4::__qmljs_string_to_number(vp->string);
+ double d = QV4::RuntimeHelpers::stringToNumber(vp->string);
switch (type) {
case QMetaType::Int:
*reinterpret_cast<int*>(ptr) = QV4::Primitive::toInt32(d);
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 38a8e40cb2..5fba40edac 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -381,7 +381,7 @@ QString QJSValue::toString() const
double QJSValue::toNumber() const
{
if (d->value.isEmpty())
- return __qmljs_string_to_number(d->string);
+ return RuntimeHelpers::stringToNumber(d->string);
QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
double dbl = d->value.toNumber();
@@ -433,7 +433,7 @@ bool QJSValue::toBool() const
qint32 QJSValue::toInt() const
{
if (d->value.isEmpty())
- return QV4::Primitive::toInt32(__qmljs_string_to_number(d->string));
+ return QV4::Primitive::toInt32(RuntimeHelpers::stringToNumber(d->string));
QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
qint32 i = d->value.toInt32();
@@ -459,7 +459,7 @@ qint32 QJSValue::toInt() const
quint32 QJSValue::toUInt() const
{
if (d->value.isEmpty())
- return QV4::Primitive::toUInt32(__qmljs_string_to_number(d->string));
+ return QV4::Primitive::toUInt32(RuntimeHelpers::stringToNumber(d->string));
QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
quint32 u = d->value.toUInt32();
@@ -744,12 +744,12 @@ static bool js_equal(const QString &string, QV4::ValueRef value)
if (value->isString())
return string == value->stringValue()->toQString();
if (value->isNumber())
- return __qmljs_string_to_number(string) == value->asDouble();
+ return RuntimeHelpers::stringToNumber(string) == value->asDouble();
if (value->isBoolean())
- return __qmljs_string_to_number(string) == double(value->booleanValue());
+ return RuntimeHelpers::stringToNumber(string) == double(value->booleanValue());
if (value->isObject()) {
Scope scope(value->objectValue()->engine());
- ScopedValue p(scope, __qmljs_to_primitive(value, PREFERREDTYPE_HINT));
+ ScopedValue p(scope, RuntimeHelpers::toPrimitive(value, PREFERREDTYPE_HINT));
return js_equal(string, p);
}
return false;
@@ -789,7 +789,7 @@ bool QJSValue::equals(const QJSValue& other) const
if (other.d->value.isEmpty())
return other.equals(*this);
- return __qmljs_cmp_eq(QV4::ValueRef(d), QV4::ValueRef(other.d));
+ return Runtime::compareEqual(QV4::ValueRef(d), QV4::ValueRef(other.d));
}
/*!
@@ -826,7 +826,7 @@ bool QJSValue::strictlyEquals(const QJSValue& other) const
if (other.d->value.isEmpty())
return other.strictlyEquals(*this);
- return __qmljs_strict_equal(QV4::ValueRef(d), QV4::ValueRef(other.d));
+ return RuntimeHelpers::strictEqual(QV4::ValueRef(d), QV4::ValueRef(other.d));
}
/*!
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index f03f5cd378..9156a94e09 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -662,7 +662,7 @@ bool ArrayElementLessThan::operator()(const Value &v1, const Value &v2) const
callData->thisObject = Primitive::undefinedValue();
callData->args[0] = v1;
callData->args[1] = v2;
- result = __qmljs_call_value(m_context, m_comparefn, callData);
+ result = Runtime::callValue(m_context, m_comparefn, callData);
return result->toNumber() < 0;
}
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 3d710d2338..d5b3b8a651 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -605,7 +605,7 @@ ReturnedValue ArrayPrototype::method_indexOf(CallContext *ctx)
for (uint k = fromIndex; k < len; ++k) {
bool exists;
v = instance->getIndexed(k, &exists);
- if (exists && __qmljs_strict_equal(v, searchValue))
+ if (exists && RuntimeHelpers::strictEqual(v, searchValue))
return Encode(k);
}
return Encode(-1);
@@ -620,7 +620,7 @@ ReturnedValue ArrayPrototype::method_indexOf(CallContext *ctx)
value = instance->getIndexed(i, &exists);
if (scope.hasException())
return Encode::undefined();
- if (exists && __qmljs_strict_equal(value, searchValue))
+ if (exists && RuntimeHelpers::strictEqual(value, searchValue))
return Encode(i);
}
} else if (!instance->arrayData) {
@@ -637,7 +637,7 @@ ReturnedValue ArrayPrototype::method_indexOf(CallContext *ctx)
value = *val;
if (scope.hasException())
return Encode::undefined();
- if (__qmljs_strict_equal(value, searchValue))
+ if (RuntimeHelpers::strictEqual(value, searchValue))
return Encode((uint)(val - instance->arrayData->data));
}
++val;
@@ -686,7 +686,7 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
v = instance->getIndexed(k, &exists);
if (scope.hasException())
return Encode::undefined();
- if (exists && __qmljs_strict_equal(v, searchValue))
+ if (exists && RuntimeHelpers::strictEqual(v, searchValue))
return Encode(k);
}
return Encode(-1);
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index a9ef29618c..bbf064b6f8 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -676,7 +676,7 @@ ReturnedValue DateCtor::construct(Managed *m, CallData *callData)
if (DateObject *d = arg->asDateObject())
arg = d->value;
else
- arg = __qmljs_to_primitive(arg, PREFERREDTYPE_HINT);
+ arg = RuntimeHelpers::toPrimitive(arg, PREFERREDTYPE_HINT);
if (arg->isString())
t = ParseString(arg->stringValue()->toQString());
@@ -1307,8 +1307,8 @@ ReturnedValue DatePrototype::method_toISOString(CallContext *ctx)
ReturnedValue DatePrototype::method_toJSON(CallContext *ctx)
{
Scope scope(ctx);
- ScopedValue O(scope, __qmljs_to_object(ctx, ValueRef(&ctx->callData->thisObject)));
- ScopedValue tv(scope, __qmljs_to_primitive(O, NUMBER_HINT));
+ ScopedValue O(scope, RuntimeHelpers::toObject(ctx, ValueRef(&ctx->callData->thisObject)));
+ ScopedValue tv(scope, RuntimeHelpers::toPrimitive(O, NUMBER_HINT));
if (tv->isNumber() && !std::isfinite(tv->toNumber()))
return Encode::null();
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 20927ab8e7..36706f2766 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -929,7 +929,7 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx)
for (uint i = 0; i < arrayLen; ++i) {
v = o->getIndexed(i);
if (v->asNumberObject() || v->asStringObject() || v->isNumber())
- v = __qmljs_to_string(ctx, v);
+ v = RuntimeHelpers::toString(ctx, v);
if (v->isString()) {
String *s = v->stringValue();
if (!stringify.propertyList.contains(s))
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index 3508316c80..081b5b3514 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -141,7 +141,7 @@ ReturnedValue Lookup::indexedGetterFallback(Lookup *l, const ValueRef object, co
return ctx->throwTypeError(message);
}
- o = __qmljs_convert_to_object(ctx, object);
+ o = RuntimeHelpers::convertToObject(ctx, object);
if (!o) // type error
return Encode::undefined();
}
@@ -615,7 +615,7 @@ void Lookup::setterGeneric(Lookup *l, const ValueRef object, const ValueRef valu
Scope scope(l->name->engine());
ScopedObject o(scope, object);
if (!o) {
- o = __qmljs_convert_to_object(scope.engine->currentContext(), object);
+ o = RuntimeHelpers::convertToObject(scope.engine->currentContext(), object);
if (!o) // type error
return;
ScopedString s(scope, l->name);
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp
index decbcab7a0..1076094a1e 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -213,7 +213,7 @@ ReturnedValue NumberPrototype::method_toFixed(CallContext *ctx)
else if (v < 1.e21)
str = QString::number(v, 'f', int (fdigits));
else
- return __qmljs_string_from_number(ctx, v)->asReturnedValue();
+ return RuntimeHelpers::stringFromNumber(ctx, v)->asReturnedValue();
return ctx->engine->newString(str)->asReturnedValue();
}
@@ -250,7 +250,7 @@ ReturnedValue NumberPrototype::method_toPrecision(CallContext *ctx)
return Encode::undefined();
if (!ctx->callData->argc || ctx->callData->args[0].isUndefined())
- return __qmljs_to_string(ctx, v);
+ return RuntimeHelpers::toString(ctx, v);
double precision = ctx->callData->args[0].toInt32();
if (precision < 1 || precision > 21) {
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index 8f55f3ea58..5c824bdfbd 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -92,14 +92,14 @@ ReturnedValue ObjectCtor::construct(Managed *that, CallData *callData)
obj->setPrototype(proto.getPointer());
return obj.asReturnedValue();
}
- return __qmljs_to_object(v4->currentContext(), ValueRef(&callData->args[0]));
+ return RuntimeHelpers::toObject(v4->currentContext(), ValueRef(&callData->args[0]));
}
ReturnedValue ObjectCtor::call(Managed *m, CallData *callData)
{
if (!callData->argc || callData->args[0].isUndefined() || callData->args[0].isNull())
return m->engine()->newObject()->asReturnedValue();
- return __qmljs_to_object(m->engine()->currentContext(), ValueRef(&callData->args[0]));
+ return RuntimeHelpers::toObject(m->engine()->currentContext(), ValueRef(&callData->args[0]));
}
void ObjectPrototype::init(ExecutionEngine *v4, ObjectRef ctor)
@@ -417,7 +417,7 @@ ReturnedValue ObjectPrototype::method_toString(CallContext *ctx)
} else if (ctx->callData->thisObject.isNull()) {
return ctx->engine->newString(QStringLiteral("[object Null]"))->asReturnedValue();
} else {
- ScopedObject obj(scope, __qmljs_to_object(ctx, ValueRef(&ctx->callData->thisObject)));
+ ScopedObject obj(scope, RuntimeHelpers::toObject(ctx, ValueRef(&ctx->callData->thisObject)));
QString className = obj->className();
return ctx->engine->newString(QString::fromLatin1("[object %1]").arg(className))->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 4ebfcd01cd..531987f52d 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -810,7 +810,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
if (slotIndexToDisconnect != -1) {
// This is a QObject function wrapper
if (connection->thisObject.isUndefined() == thisObject->isUndefined() &&
- (connection->thisObject.isUndefined() || __qmljs_strict_equal(connection->thisObject, thisObject))) {
+ (connection->thisObject.isUndefined() || RuntimeHelpers::strictEqual(connection->thisObject, thisObject))) {
QV4::ScopedFunctionObject f(scope, connection->function.value());
QPair<QObject *, int> connectedFunctionData = extractQtMethod(f);
@@ -822,9 +822,9 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
}
} else {
// This is a normal JS function
- if (__qmljs_strict_equal(connection->function, function) &&
+ if (RuntimeHelpers::strictEqual(connection->function, function) &&
connection->thisObject.isUndefined() == thisObject->isUndefined() &&
- (connection->thisObject.isUndefined() || __qmljs_strict_equal(connection->thisObject, thisObject))) {
+ (connection->thisObject.isUndefined() || RuntimeHelpers::strictEqual(connection->thisObject, thisObject))) {
*ret = true;
return;
}
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 790eaf79f7..daf85c0f7d 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -274,7 +274,7 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
bool ignoreCase = false;
bool multiLine = false;
if (!f->isUndefined()) {
- f = __qmljs_to_string(ctx, f);
+ f = RuntimeHelpers::toString(ctx, f);
if (scope.hasException())
return Encode::undefined();
QString str = f->stringValue()->toQString();
@@ -360,7 +360,7 @@ ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
return ctx->throwTypeError();
ScopedValue arg(scope, ctx->argument(0));
- arg = __qmljs_to_string(ctx, arg);
+ arg = RuntimeHelpers::toString(ctx, arg);
if (scope.hasException())
return Encode::undefined();
QString s = arg->stringValue()->toQString();
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 04a0d6fdec..8b345f53ee 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -207,7 +207,7 @@ void RuntimeCounters::count(const char *func, uint tag1, uint tag2)
#endif // QV4_COUNT_RUNTIME_FUNCTIONS
-void __qmljs_numberToString(QString *result, double num, int radix)
+void RuntimeHelpers::numberToString(QString *result, double num, int radix)
{
Q_ASSERT(result);
@@ -260,7 +260,7 @@ void __qmljs_numberToString(QString *result, double num, int radix)
result->prepend(QLatin1Char('-'));
}
-ReturnedValue __qmljs_init_closure(ExecutionContext *ctx, int functionId)
+ReturnedValue Runtime::closure(ExecutionContext *ctx, int functionId)
{
QV4::Function *clos = ctx->compilationUnit->runtimeFunctions[functionId];
Q_ASSERT(clos);
@@ -268,7 +268,7 @@ ReturnedValue __qmljs_init_closure(ExecutionContext *ctx, int functionId)
return f->asReturnedValue();
}
-ReturnedValue __qmljs_delete_subscript(ExecutionContext *ctx, const ValueRef base, const ValueRef index)
+ReturnedValue Runtime::deleteElement(ExecutionContext *ctx, const ValueRef base, const ValueRef index)
{
Scope scope(ctx);
ScopedObject o(scope, base);
@@ -280,10 +280,10 @@ ReturnedValue __qmljs_delete_subscript(ExecutionContext *ctx, const ValueRef bas
}
ScopedString name(scope, index->toString(ctx));
- return __qmljs_delete_member(ctx, base, name);
+ return Runtime::deleteMember(ctx, base, name);
}
-ReturnedValue __qmljs_delete_member(ExecutionContext *ctx, const ValueRef base, const StringRef name)
+ReturnedValue Runtime::deleteMember(ExecutionContext *ctx, const ValueRef base, const StringRef name)
{
Scope scope(ctx);
ScopedObject obj(scope, base->toObject(ctx));
@@ -292,13 +292,13 @@ ReturnedValue __qmljs_delete_member(ExecutionContext *ctx, const ValueRef base,
return Encode(obj->deleteProperty(name));
}
-ReturnedValue __qmljs_delete_name(ExecutionContext *ctx, const StringRef name)
+ReturnedValue Runtime::deleteName(ExecutionContext *ctx, const StringRef name)
{
Scope scope(ctx);
return Encode(ctx->deleteProperty(name));
}
-QV4::ReturnedValue __qmljs_instanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+QV4::ReturnedValue Runtime::instanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
{
FunctionObject *f = right->asFunctionObject();
if (!f)
@@ -330,7 +330,7 @@ QV4::ReturnedValue __qmljs_instanceof(ExecutionContext *ctx, const ValueRef left
return Encode(false);
}
-QV4::ReturnedValue __qmljs_in(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+QV4::ReturnedValue Runtime::in(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
{
if (!right->isObject())
return ctx->throwTypeError();
@@ -342,7 +342,7 @@ QV4::ReturnedValue __qmljs_in(ExecutionContext *ctx, const ValueRef left, const
return Encode(r);
}
-double __qmljs_string_to_number(const QString &string)
+double RuntimeHelpers::stringToNumber(const QString &string)
{
QString s = string.trimmed();
if (s.startsWith(QLatin1String("0x")) || s.startsWith(QLatin1String("0X")))
@@ -363,14 +363,14 @@ double __qmljs_string_to_number(const QString &string)
return d;
}
-Returned<String> *__qmljs_string_from_number(ExecutionContext *ctx, double number)
+Returned<String> *RuntimeHelpers::stringFromNumber(ExecutionContext *ctx, double number)
{
QString qstr;
- __qmljs_numberToString(&qstr, number, 10);
+ RuntimeHelpers::numberToString(&qstr, number, 10);
return ctx->engine->newString(qstr);
}
-ReturnedValue __qmljs_object_default_value(Object *object, int typeHint)
+ReturnedValue RuntimeHelpers::objectDefaultValue(Object *object, int typeHint)
{
if (typeHint == PREFERREDTYPE_HINT) {
if (object->asDateObject())
@@ -414,13 +414,12 @@ ReturnedValue __qmljs_object_default_value(Object *object, int typeHint)
return ctx->throwTypeError();
}
-Bool __qmljs_to_boolean(const ValueRef value)
+Bool Runtime::toBoolean(const ValueRef value)
{
return value->toBoolean();
}
-
-Returned<Object> *__qmljs_convert_to_object(ExecutionContext *ctx, const ValueRef value)
+Returned<Object> *RuntimeHelpers::convertToObject(ExecutionContext *ctx, const ValueRef value)
{
assert(!value->isObject());
switch (value->type()) {
@@ -439,7 +438,7 @@ Returned<Object> *__qmljs_convert_to_object(ExecutionContext *ctx, const ValueRe
}
}
-Returned<String> *__qmljs_convert_to_string(ExecutionContext *ctx, const ValueRef value)
+Returned<String> *RuntimeHelpers::convertToString(ExecutionContext *ctx, const ValueRef value)
{
switch (value->type()) {
case Value::Empty_Type:
@@ -458,13 +457,13 @@ Returned<String> *__qmljs_convert_to_string(ExecutionContext *ctx, const ValueRe
return value->stringValue()->asReturned<String>();
{
Scope scope(ctx);
- ScopedValue prim(scope, __qmljs_to_primitive(value, STRING_HINT));
- return __qmljs_convert_to_string(ctx, prim);
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(value, STRING_HINT));
+ return RuntimeHelpers::convertToString(ctx, prim);
}
case Value::Integer_Type:
- return __qmljs_string_from_number(ctx, value->int_32);
+ return RuntimeHelpers::stringFromNumber(ctx, value->int_32);
default: // double
- return __qmljs_string_from_number(ctx, value->doubleValue());
+ return RuntimeHelpers::stringFromNumber(ctx, value->doubleValue());
} // switch
}
@@ -489,22 +488,22 @@ static Returned<String> *convert_to_string_add(ExecutionContext *ctx, const Valu
return value->stringValue()->asReturned<String>();
{
Scope scope(ctx);
- ScopedValue prim(scope, __qmljs_to_primitive(value, PREFERREDTYPE_HINT));
- return __qmljs_convert_to_string(ctx, prim);
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(value, PREFERREDTYPE_HINT));
+ return RuntimeHelpers::convertToString(ctx, prim);
}
case Value::Integer_Type:
- return __qmljs_string_from_number(ctx, value->int_32);
+ return RuntimeHelpers::stringFromNumber(ctx, value->int_32);
default: // double
- return __qmljs_string_from_number(ctx, value->doubleValue());
+ return RuntimeHelpers::stringFromNumber(ctx, value->doubleValue());
} // switch
}
-QV4::ReturnedValue __qmljs_add_helper(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+QV4::ReturnedValue RuntimeHelpers::addHelper(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
{
Scope scope(ctx);
- ScopedValue pleft(scope, __qmljs_to_primitive(left, PREFERREDTYPE_HINT));
- ScopedValue pright(scope, __qmljs_to_primitive(right, PREFERREDTYPE_HINT));
+ ScopedValue pleft(scope, RuntimeHelpers::toPrimitive(left, PREFERREDTYPE_HINT));
+ ScopedValue pright(scope, RuntimeHelpers::toPrimitive(right, PREFERREDTYPE_HINT));
if (pleft->isString() || pright->isString()) {
if (!pleft->isString())
pleft = convert_to_string_add(ctx, pleft);
@@ -518,12 +517,12 @@ QV4::ReturnedValue __qmljs_add_helper(ExecutionContext *ctx, const ValueRef left
return pleft->asReturnedValue();
return (new (ctx->engine->memoryManager) String(ctx->engine, pleft->stringValue(), pright->stringValue()))->asReturnedValue();
}
- double x = __qmljs_to_number(pleft);
- double y = __qmljs_to_number(pright);
+ double x = RuntimeHelpers::toNumber(pleft);
+ double y = RuntimeHelpers::toNumber(pright);
return Encode(x + y);
}
-QV4::ReturnedValue __qmljs_add_string(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right)
+QV4::ReturnedValue Runtime::addString(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right)
{
Q_ASSERT(left->isString() || right->isString());
@@ -552,7 +551,7 @@ QV4::ReturnedValue __qmljs_add_string(QV4::ExecutionContext *ctx, const QV4::Val
return (new (ctx->engine->memoryManager) String(ctx->engine, pleft->stringValue(), pright->stringValue()))->asReturnedValue();
}
-void __qmljs_set_property(ExecutionContext *ctx, const ValueRef object, const StringRef name, const ValueRef value)
+void Runtime::setProperty(ExecutionContext *ctx, const ValueRef object, const StringRef name, const ValueRef value)
{
Scope scope(ctx);
ScopedObject o(scope, object->toObject(ctx));
@@ -561,7 +560,7 @@ void __qmljs_set_property(ExecutionContext *ctx, const ValueRef object, const St
o->put(name, value);
}
-ReturnedValue __qmljs_get_element(ExecutionContext *ctx, const ValueRef object, const ValueRef index)
+ReturnedValue Runtime::getElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index)
{
Scope scope(ctx);
uint idx = index->asArrayIndex();
@@ -583,7 +582,7 @@ ReturnedValue __qmljs_get_element(ExecutionContext *ctx, const ValueRef object,
return ctx->throwTypeError(message);
}
- o = __qmljs_convert_to_object(ctx, object);
+ o = RuntimeHelpers::convertToObject(ctx, object);
if (!o) // type error
return Encode::undefined();
}
@@ -604,7 +603,7 @@ ReturnedValue __qmljs_get_element(ExecutionContext *ctx, const ValueRef object,
return o->get(name);
}
-void __qmljs_set_element(ExecutionContext *ctx, const ValueRef object, const ValueRef index, const ValueRef value)
+void Runtime::setElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index, const ValueRef value)
{
Scope scope(ctx);
ScopedObject o(scope, object->toObject(ctx));
@@ -628,7 +627,7 @@ void __qmljs_set_element(ExecutionContext *ctx, const ValueRef object, const Val
o->put(name, value);
}
-ReturnedValue __qmljs_foreach_iterator_object(ExecutionContext *ctx, const ValueRef in)
+ReturnedValue Runtime::foreachIterator(ExecutionContext *ctx, const ValueRef in)
{
Scope scope(ctx);
Scoped<Object> o(scope, (Object *)0);
@@ -638,7 +637,7 @@ ReturnedValue __qmljs_foreach_iterator_object(ExecutionContext *ctx, const Value
return it.asReturnedValue();
}
-ReturnedValue __qmljs_foreach_next_property_name(const ValueRef foreach_iterator)
+ReturnedValue Runtime::foreachNextPropertyName(const ValueRef foreach_iterator)
{
Q_ASSERT(foreach_iterator->isObject());
@@ -649,12 +648,12 @@ ReturnedValue __qmljs_foreach_next_property_name(const ValueRef foreach_iterator
}
-void __qmljs_set_activation_property(ExecutionContext *ctx, const StringRef name, const ValueRef value)
+void Runtime::setActivationProperty(ExecutionContext *ctx, const StringRef name, const ValueRef value)
{
ctx->setProperty(name, value);
}
-ReturnedValue __qmljs_get_property(ExecutionContext *ctx, const ValueRef object, const StringRef name)
+ReturnedValue Runtime::getProperty(ExecutionContext *ctx, const ValueRef object, const StringRef name)
{
Scope scope(ctx);
@@ -667,18 +666,18 @@ ReturnedValue __qmljs_get_property(ExecutionContext *ctx, const ValueRef object,
return ctx->throwTypeError(message);
}
- o = __qmljs_convert_to_object(ctx, object);
+ o = RuntimeHelpers::convertToObject(ctx, object);
if (!o) // type error
return Encode::undefined();
return o->get(name);
}
-ReturnedValue __qmljs_get_activation_property(ExecutionContext *ctx, const StringRef name)
+ReturnedValue Runtime::getActivationProperty(ExecutionContext *ctx, const StringRef name)
{
return ctx->getProperty(name);
}
-uint __qmljs_equal_helper(const ValueRef x, const ValueRef y)
+uint RuntimeHelpers::equalHelper(const ValueRef x, const ValueRef y)
{
Q_ASSERT(x->type() != y->type() || (x->isManaged() && (x->isString() != y->isString())));
@@ -689,29 +688,29 @@ uint __qmljs_equal_helper(const ValueRef x, const ValueRef y)
} else if (x->isUndefined() && y->isNull()) {
return true;
} else if (x->isNumber() && y->isString()) {
- double dy = __qmljs_to_number(y);
+ double dy = RuntimeHelpers::toNumber(y);
return x->asDouble() == dy;
} else if (x->isString() && y->isNumber()) {
- double dx = __qmljs_to_number(x);
+ double dx = RuntimeHelpers::toNumber(x);
return dx == y->asDouble();
} else if (x->isBoolean()) {
- return __qmljs_cmp_eq(Primitive::fromDouble((double) x->booleanValue()), y);
+ return Runtime::compareEqual(Primitive::fromDouble((double) x->booleanValue()), y);
} else if (y->isBoolean()) {
- return __qmljs_cmp_eq(x, Primitive::fromDouble((double) y->booleanValue()));
+ return Runtime::compareEqual(x, Primitive::fromDouble((double) y->booleanValue()));
} else if ((x->isNumber() || x->isString()) && y->isObject()) {
Scope scope(y->objectValue()->engine());
- ScopedValue py(scope, __qmljs_to_primitive(y, PREFERREDTYPE_HINT));
- return __qmljs_cmp_eq(x, py);
+ ScopedValue py(scope, RuntimeHelpers::toPrimitive(y, PREFERREDTYPE_HINT));
+ return Runtime::compareEqual(x, py);
} else if (x->isObject() && (y->isNumber() || y->isString())) {
Scope scope(x->objectValue()->engine());
- ScopedValue px(scope, __qmljs_to_primitive(x, PREFERREDTYPE_HINT));
- return __qmljs_cmp_eq(px, y);
+ ScopedValue px(scope, RuntimeHelpers::toPrimitive(x, PREFERREDTYPE_HINT));
+ return Runtime::compareEqual(px, y);
}
return false;
}
-Bool __qmljs_strict_equal(const ValueRef x, const ValueRef y)
+Bool RuntimeHelpers::strictEqual(const ValueRef x, const ValueRef y)
{
TRACE2(x, y);
@@ -726,7 +725,7 @@ Bool __qmljs_strict_equal(const ValueRef x, const ValueRef y)
return false;
}
-QV4::Bool __qmljs_cmp_gt(const QV4::ValueRef l, const QV4::ValueRef r)
+QV4::Bool Runtime::compareGreaterThan(const QV4::ValueRef l, const QV4::ValueRef r)
{
TRACE2(l, r);
if (l->isInteger() && r->isInteger())
@@ -739,17 +738,17 @@ QV4::Bool __qmljs_cmp_gt(const QV4::ValueRef l, const QV4::ValueRef r)
if (l->isObject() || r->isObject()) {
QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
QV4::Scope scope(e);
- QV4::ScopedValue pl(scope, __qmljs_to_primitive(l, QV4::NUMBER_HINT));
- QV4::ScopedValue pr(scope, __qmljs_to_primitive(r, QV4::NUMBER_HINT));
- return __qmljs_cmp_gt(pl, pr);
+ QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
+ QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
+ return Runtime::compareGreaterThan(pl, pr);
}
- double dl = __qmljs_to_number(l);
- double dr = __qmljs_to_number(r);
+ double dl = RuntimeHelpers::toNumber(l);
+ double dr = RuntimeHelpers::toNumber(r);
return dl > dr;
}
-QV4::Bool __qmljs_cmp_lt(const QV4::ValueRef l, const QV4::ValueRef r)
+QV4::Bool Runtime::compareLessThan(const QV4::ValueRef l, const QV4::ValueRef r)
{
TRACE2(l, r);
if (l->isInteger() && r->isInteger())
@@ -762,17 +761,17 @@ QV4::Bool __qmljs_cmp_lt(const QV4::ValueRef l, const QV4::ValueRef r)
if (l->isObject() || r->isObject()) {
QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
QV4::Scope scope(e);
- QV4::ScopedValue pl(scope, __qmljs_to_primitive(l, QV4::NUMBER_HINT));
- QV4::ScopedValue pr(scope, __qmljs_to_primitive(r, QV4::NUMBER_HINT));
- return __qmljs_cmp_lt(pl, pr);
+ QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
+ QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
+ return Runtime::compareLessThan(pl, pr);
}
- double dl = __qmljs_to_number(l);
- double dr = __qmljs_to_number(r);
+ double dl = RuntimeHelpers::toNumber(l);
+ double dr = RuntimeHelpers::toNumber(r);
return dl < dr;
}
-QV4::Bool __qmljs_cmp_ge(const QV4::ValueRef l, const QV4::ValueRef r)
+QV4::Bool Runtime::compareGreaterEqual(const QV4::ValueRef l, const QV4::ValueRef r)
{
TRACE2(l, r);
if (l->isInteger() && r->isInteger())
@@ -785,17 +784,17 @@ QV4::Bool __qmljs_cmp_ge(const QV4::ValueRef l, const QV4::ValueRef r)
if (l->isObject() || r->isObject()) {
QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
QV4::Scope scope(e);
- QV4::ScopedValue pl(scope, __qmljs_to_primitive(l, QV4::NUMBER_HINT));
- QV4::ScopedValue pr(scope, __qmljs_to_primitive(r, QV4::NUMBER_HINT));
- return __qmljs_cmp_ge(pl, pr);
+ QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
+ QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
+ return Runtime::compareGreaterEqual(pl, pr);
}
- double dl = __qmljs_to_number(l);
- double dr = __qmljs_to_number(r);
+ double dl = RuntimeHelpers::toNumber(l);
+ double dr = RuntimeHelpers::toNumber(r);
return dl >= dr;
}
-QV4::Bool __qmljs_cmp_le(const QV4::ValueRef l, const QV4::ValueRef r)
+QV4::Bool Runtime::compareLessEqual(const QV4::ValueRef l, const QV4::ValueRef r)
{
TRACE2(l, r);
if (l->isInteger() && r->isInteger())
@@ -808,18 +807,18 @@ QV4::Bool __qmljs_cmp_le(const QV4::ValueRef l, const QV4::ValueRef r)
if (l->isObject() || r->isObject()) {
QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
QV4::Scope scope(e);
- QV4::ScopedValue pl(scope, __qmljs_to_primitive(l, QV4::NUMBER_HINT));
- QV4::ScopedValue pr(scope, __qmljs_to_primitive(r, QV4::NUMBER_HINT));
- return __qmljs_cmp_le(pl, pr);
+ QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
+ QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
+ return Runtime::compareLessEqual(pl, pr);
}
- double dl = __qmljs_to_number(l);
- double dr = __qmljs_to_number(r);
+ double dl = RuntimeHelpers::toNumber(l);
+ double dr = RuntimeHelpers::toNumber(r);
return dl <= dr;
}
-ReturnedValue __qmljs_call_global_lookup(ExecutionContext *context, uint index, CallDataRef callData)
+ReturnedValue Runtime::callGlobalLookup(ExecutionContext *context, uint index, CallDataRef callData)
{
Scope scope(context);
Q_ASSERT(callData->thisObject.isUndefined());
@@ -836,7 +835,7 @@ ReturnedValue __qmljs_call_global_lookup(ExecutionContext *context, uint index,
}
-ReturnedValue __qmljs_call_activation_property(ExecutionContext *context, const StringRef name, CallDataRef callData)
+ReturnedValue Runtime::callActivationProperty(ExecutionContext *context, const StringRef name, CallDataRef callData)
{
Q_ASSERT(callData->thisObject.isUndefined());
Scope scope(context);
@@ -865,7 +864,7 @@ ReturnedValue __qmljs_call_activation_property(ExecutionContext *context, const
return o->call(callData);
}
-ReturnedValue __qmljs_call_property(ExecutionContext *context, const StringRef name, CallDataRef callData)
+ReturnedValue Runtime::callProperty(ExecutionContext *context, const StringRef name, CallDataRef callData)
{
Scope scope(context);
Scoped<Object> baseObject(scope, callData->thisObject);
@@ -876,7 +875,7 @@ ReturnedValue __qmljs_call_property(ExecutionContext *context, const StringRef n
return context->throwTypeError(message);
}
- baseObject = __qmljs_convert_to_object(context, ValueRef(&callData->thisObject));
+ baseObject = RuntimeHelpers::convertToObject(context, ValueRef(&callData->thisObject));
if (!baseObject) // type error
return Encode::undefined();
callData->thisObject = baseObject.asReturnedValue();
@@ -891,7 +890,7 @@ ReturnedValue __qmljs_call_property(ExecutionContext *context, const StringRef n
return o->call(callData);
}
-ReturnedValue __qmljs_call_property_lookup(ExecutionContext *context, uint index, CallDataRef callData)
+ReturnedValue Runtime::callPropertyLookup(ExecutionContext *context, uint index, CallDataRef callData)
{
Lookup *l = context->lookups + index;
Value v;
@@ -902,7 +901,7 @@ ReturnedValue __qmljs_call_property_lookup(ExecutionContext *context, uint index
return v.objectValue()->call(callData);
}
-ReturnedValue __qmljs_call_element(ExecutionContext *context, const ValueRef index, CallDataRef callData)
+ReturnedValue Runtime::callElement(ExecutionContext *context, const ValueRef index, CallDataRef callData)
{
Scope scope(context);
ScopedObject baseObject(scope, callData->thisObject.toObject(context));
@@ -919,7 +918,7 @@ ReturnedValue __qmljs_call_element(ExecutionContext *context, const ValueRef ind
return o->call(callData);
}
-ReturnedValue __qmljs_call_value(ExecutionContext *context, const ValueRef func, CallDataRef callData)
+ReturnedValue Runtime::callValue(ExecutionContext *context, const ValueRef func, CallDataRef callData)
{
if (!func->isObject())
return context->throwTypeError();
@@ -928,7 +927,7 @@ ReturnedValue __qmljs_call_value(ExecutionContext *context, const ValueRef func,
}
-ReturnedValue __qmljs_construct_global_lookup(ExecutionContext *context, uint index, CallDataRef callData)
+ReturnedValue Runtime::constructGlobalLookup(ExecutionContext *context, uint index, CallDataRef callData)
{
Scope scope(context);
Q_ASSERT(callData->thisObject.isUndefined());
@@ -942,7 +941,7 @@ ReturnedValue __qmljs_construct_global_lookup(ExecutionContext *context, uint in
}
-ReturnedValue __qmljs_construct_activation_property(ExecutionContext *context, const StringRef name, CallDataRef callData)
+ReturnedValue Runtime::constructActivationProperty(ExecutionContext *context, const StringRef name, CallDataRef callData)
{
Scope scope(context);
ScopedValue func(scope, context->getProperty(name));
@@ -956,7 +955,7 @@ ReturnedValue __qmljs_construct_activation_property(ExecutionContext *context, c
return f->construct(callData);
}
-ReturnedValue __qmljs_construct_value(ExecutionContext *context, const ValueRef func, CallDataRef callData)
+ReturnedValue Runtime::constructValue(ExecutionContext *context, const ValueRef func, CallDataRef callData)
{
Object *f = func->asObject();
if (!f)
@@ -965,7 +964,7 @@ ReturnedValue __qmljs_construct_value(ExecutionContext *context, const ValueRef
return f->construct(callData);
}
-ReturnedValue __qmljs_construct_property(ExecutionContext *context, const StringRef name, CallDataRef callData)
+ReturnedValue Runtime::constructProperty(ExecutionContext *context, const StringRef name, CallDataRef callData)
{
Scope scope(context);
ScopedObject thisObject(scope, callData->thisObject.toObject(context));
@@ -979,7 +978,7 @@ ReturnedValue __qmljs_construct_property(ExecutionContext *context, const String
return f->construct(callData);
}
-ReturnedValue __qmljs_construct_property_lookup(ExecutionContext *context, uint index, CallDataRef callData)
+ReturnedValue Runtime::constructPropertyLookup(ExecutionContext *context, uint index, CallDataRef callData)
{
Lookup *l = context->lookups + index;
Value v;
@@ -991,13 +990,13 @@ ReturnedValue __qmljs_construct_property_lookup(ExecutionContext *context, uint
}
-void __qmljs_throw(ExecutionContext *context, const ValueRef value)
+void Runtime::throwException(ExecutionContext *context, const ValueRef value)
{
if (!value->isEmpty())
context->throwError(value);
}
-ReturnedValue __qmljs_builtin_typeof(ExecutionContext *ctx, const ValueRef value)
+ReturnedValue Runtime::typeofValue(ExecutionContext *ctx, const ValueRef value)
{
Scope scope(ctx);
ScopedString res(scope);
@@ -1026,26 +1025,26 @@ ReturnedValue __qmljs_builtin_typeof(ExecutionContext *ctx, const ValueRef value
return res.asReturnedValue();
}
-QV4::ReturnedValue __qmljs_builtin_typeof_name(ExecutionContext *context, const StringRef name)
+QV4::ReturnedValue Runtime::typeofName(ExecutionContext *context, const StringRef name)
{
Scope scope(context);
ScopedValue prop(scope, context->getProperty(name));
// typeof doesn't throw. clear any possible exception
context->engine->hasException = false;
- return __qmljs_builtin_typeof(context, prop);
+ return Runtime::typeofValue(context, prop);
}
-QV4::ReturnedValue __qmljs_builtin_typeof_member(ExecutionContext *context, const ValueRef base, const StringRef name)
+QV4::ReturnedValue Runtime::typeofMember(ExecutionContext *context, const ValueRef base, const StringRef name)
{
Scope scope(context);
ScopedObject obj(scope, base->toObject(context));
if (scope.engine->hasException)
return Encode::undefined();
ScopedValue prop(scope, obj->get(name));
- return __qmljs_builtin_typeof(context, prop);
+ return Runtime::typeofValue(context, prop);
}
-QV4::ReturnedValue __qmljs_builtin_typeof_element(ExecutionContext *context, const ValueRef base, const ValueRef index)
+QV4::ReturnedValue Runtime::typeofElement(ExecutionContext *context, const ValueRef base, const ValueRef index)
{
Scope scope(context);
ScopedString name(scope, index->toString(context));
@@ -1053,41 +1052,41 @@ QV4::ReturnedValue __qmljs_builtin_typeof_element(ExecutionContext *context, con
if (scope.engine->hasException)
return Encode::undefined();
ScopedValue prop(scope, obj->get(name));
- return __qmljs_builtin_typeof(context, prop);
+ return Runtime::typeofValue(context, prop);
}
-ExecutionContext *__qmljs_builtin_push_with_scope(const ValueRef o, ExecutionContext *ctx)
+ExecutionContext *Runtime::pushWithScope(const ValueRef o, ExecutionContext *ctx)
{
Scope scope(ctx);
ScopedObject obj(scope, o->toObject(ctx));
return ctx->newWithContext(obj);
}
-ReturnedValue __qmljs_builtin_unwind_exception(ExecutionContext *ctx)
+ReturnedValue Runtime::unwindException(ExecutionContext *ctx)
{
if (!ctx->engine->hasException)
return Primitive::emptyValue().asReturnedValue();
return ctx->engine->catchException(ctx, 0);
}
-ExecutionContext *__qmljs_builtin_push_catch_scope(ExecutionContext *ctx, const StringRef exceptionVarName)
+ExecutionContext *Runtime::pushCatchScope(ExecutionContext *ctx, const StringRef exceptionVarName)
{
Scope scope(ctx);
ScopedValue v(scope, ctx->engine->catchException(ctx, 0));
return ctx->newCatchContext(exceptionVarName, v);
}
-ExecutionContext *__qmljs_builtin_pop_scope(ExecutionContext *ctx)
+ExecutionContext *Runtime::popScope(ExecutionContext *ctx)
{
return ctx->engine->popContext();
}
-void __qmljs_builtin_declare_var(ExecutionContext *ctx, bool deletable, const StringRef name)
+void Runtime::declareVar(ExecutionContext *ctx, bool deletable, const StringRef name)
{
ctx->createMutableBinding(name, deletable);
}
-ReturnedValue __qmljs_builtin_define_array(ExecutionContext *ctx, Value *values, uint length)
+ReturnedValue Runtime::arrayLiteral(ExecutionContext *ctx, Value *values, uint length)
{
Scope scope(ctx);
Scoped<ArrayObject> a(scope, ctx->engine->newArrayObject());
@@ -1100,7 +1099,7 @@ ReturnedValue __qmljs_builtin_define_array(ExecutionContext *ctx, Value *values,
return a.asReturnedValue();
}
-ReturnedValue __qmljs_builtin_define_object_literal(QV4::ExecutionContext *ctx, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags)
+ReturnedValue Runtime::objectLiteral(QV4::ExecutionContext *ctx, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags)
{
Scope scope(ctx);
QV4::InternalClass *klass = ctx->compilationUnit->runtimeClasses[classId];
@@ -1138,14 +1137,14 @@ ReturnedValue __qmljs_builtin_define_object_literal(QV4::ExecutionContext *ctx,
return o.asReturnedValue();
}
-QV4::ReturnedValue __qmljs_builtin_setup_arguments_object(ExecutionContext *ctx)
+QV4::ReturnedValue Runtime::setupArgumentsObject(ExecutionContext *ctx)
{
assert(ctx->type >= ExecutionContext::Type_CallContext);
CallContext *c = static_cast<CallContext *>(ctx);
return (new (c->engine->memoryManager) ArgumentsObject(c))->asReturnedValue();
}
-QV4::ReturnedValue __qmljs_increment(const QV4::ValueRef value)
+QV4::ReturnedValue Runtime::increment(const QV4::ValueRef value)
{
TRACE1(value);
@@ -1157,7 +1156,7 @@ QV4::ReturnedValue __qmljs_increment(const QV4::ValueRef value)
}
}
-QV4::ReturnedValue __qmljs_decrement(const QV4::ValueRef value)
+QV4::ReturnedValue Runtime::decrement(const QV4::ValueRef value)
{
TRACE1(value);
@@ -1169,85 +1168,79 @@ QV4::ReturnedValue __qmljs_decrement(const QV4::ValueRef value)
}
}
-QV4::ReturnedValue __qmljs_to_string(QV4::ExecutionContext *ctx, const QV4::ValueRef value)
+QV4::ReturnedValue RuntimeHelpers::toString(QV4::ExecutionContext *ctx, const QV4::ValueRef value)
{
if (value->isString())
return value.asReturnedValue();
- return __qmljs_convert_to_string(ctx, value)->asReturnedValue();
+ return RuntimeHelpers::convertToString(ctx, value)->asReturnedValue();
}
-QV4::ReturnedValue __qmljs_to_object(QV4::ExecutionContext *ctx, const QV4::ValueRef value)
+QV4::ReturnedValue RuntimeHelpers::toObject(QV4::ExecutionContext *ctx, const QV4::ValueRef value)
{
if (value->isObject())
return value.asReturnedValue();
- Returned<Object> *o = __qmljs_convert_to_object(ctx, value);
+ Returned<Object> *o = RuntimeHelpers::convertToObject(ctx, value);
if (!o) // type error
return Encode::undefined();
return Encode(o);
}
-ReturnedValue __qmljs_value_to_double(const ValueRef value)
+ReturnedValue Runtime::toDouble(const ValueRef value)
{
TRACE1(value);
return Encode(value->toNumber());
}
-int __qmljs_value_to_int32(const ValueRef value)
+int Runtime::toInt(const ValueRef value)
{
TRACE1(value);
return value->toInt32();
}
-int __qmljs_double_to_int32(const double &d)
+int Runtime::doubleToInt(const double &d)
{
TRACE0();
return Primitive::toInt32(d);
}
-unsigned __qmljs_value_to_uint32(const ValueRef value)
+unsigned Runtime::toUInt(const ValueRef value)
{
TRACE1(value);
return value->toUInt32();
}
-unsigned __qmljs_double_to_uint32(const double &d)
+unsigned Runtime::doubleToUInt(const double &d)
{
TRACE0();
return Primitive::toUInt32(d);
}
-ReturnedValue __qmljs_value_from_string(String *string)
-{
- TRACE0();
- return string->asReturnedValue();
-}
-
-ReturnedValue __qmljs_lookup_runtime_regexp(ExecutionContext *ctx, int id)
+ReturnedValue Runtime::regexpLiteral(ExecutionContext *ctx, int id)
{
return ctx->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
}
-ReturnedValue __qmljs_get_id_array(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlIdArray(NoThrowContext *ctx)
{
return ctx->engine->qmlContextObject()->getPointer()->as<QmlContextWrapper>()->idObjectsArray();
}
-ReturnedValue __qmljs_get_context_object(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlContextObject(NoThrowContext *ctx)
{
QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine);
return QObjectWrapper::wrap(ctx->engine, context->contextObject);
}
-ReturnedValue __qmljs_get_scope_object(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlScopeObject(NoThrowContext *ctx)
{
Scope scope(ctx);
QV4::Scoped<QmlContextWrapper> c(scope, ctx->engine->qmlContextObject()->getPointer()->as<QmlContextWrapper>());
return QObjectWrapper::wrap(ctx->engine, c->getScopeObject());
}
-ReturnedValue __qmljs_get_qobject_property(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired)
+ReturnedValue Runtime::getQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired)
{
Scope scope(ctx);
QV4::Scoped<QObjectWrapper> wrapper(scope, object);
@@ -1258,7 +1251,7 @@ ReturnedValue __qmljs_get_qobject_property(ExecutionContext *ctx, const ValueRef
return QV4::QObjectWrapper::getProperty(wrapper->object(), ctx, propertyIndex, captureRequired);
}
-QV4::ReturnedValue __qmljs_get_attached_property(ExecutionContext *ctx, int attachedPropertiesId, int propertyIndex)
+QV4::ReturnedValue Runtime::getQmlAttachedProperty(ExecutionContext *ctx, int attachedPropertiesId, int propertyIndex)
{
Scope scope(ctx);
QV4::Scoped<QmlContextWrapper> c(scope, ctx->engine->qmlContextObject()->getPointer()->as<QmlContextWrapper>());
@@ -1270,7 +1263,7 @@ QV4::ReturnedValue __qmljs_get_attached_property(ExecutionContext *ctx, int atta
return QV4::QObjectWrapper::getProperty(attachedObject, ctx, propertyIndex, /*captureRequired*/true);
}
-void __qmljs_set_qobject_property(ExecutionContext *ctx, const ValueRef object, int propertyIndex, const ValueRef value)
+void Runtime::setQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, const ValueRef value)
{
Scope scope(ctx);
QV4::Scoped<QObjectWrapper> wrapper(scope, object);
@@ -1281,18 +1274,18 @@ void __qmljs_set_qobject_property(ExecutionContext *ctx, const ValueRef object,
wrapper->setProperty(ctx, propertyIndex, value);
}
-ReturnedValue __qmljs_get_imported_scripts(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlImportedScripts(NoThrowContext *ctx)
{
QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine);
return context->importedScripts.value();
}
-QV4::ReturnedValue __qmljs_get_qml_singleton(QV4::NoThrowContext *ctx, const QV4::StringRef name)
+QV4::ReturnedValue Runtime::getQmlSingleton(QV4::NoThrowContext *ctx, const QV4::StringRef name)
{
return ctx->engine->qmlContextObject()->getPointer()->as<QmlContextWrapper>()->qmlSingletonWrapper(ctx->engine->v8Engine, name);
}
-void __qmljs_builtin_convert_this_to_object(ExecutionContext *ctx)
+void Runtime::convertThisToObject(ExecutionContext *ctx)
{
Value *t = &ctx->callData->thisObject;
if (t->isObject())
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h
index dbdb891328..4e28441e62 100644
--- a/src/qml/jsruntime/qv4runtime_p.h
+++ b/src/qml/jsruntime/qv4runtime_p.h
@@ -97,184 +97,178 @@ enum TypeHint {
STRING_HINT
};
-struct Function;
-struct Object;
-struct String;
-struct ExecutionContext;
-struct FunctionObject;
-struct BooleanObject;
-struct NumberObject;
-struct StringObject;
-struct DateObject;
-struct RegExpObject;
-struct ArrayObject;
-struct ErrorObject;
-struct ExecutionEngine;
-struct InternalClass;
-
// This is a trick to tell the code generators that functions taking a NoThrowContext won't
// throw exceptions and therefore don't need a check after the call.
struct NoThrowContext : public ExecutionContext
{
};
-// context
-QV4::ReturnedValue __qmljs_call_activation_property(QV4::ExecutionContext *, const QV4::StringRef name, CallDataRef callData);
-QV4::ReturnedValue __qmljs_call_property(QV4::ExecutionContext *context, const QV4::StringRef name, CallDataRef callData);
-QV4::ReturnedValue __qmljs_call_property_lookup(ExecutionContext *context, uint index, CallDataRef callData);
-QV4::ReturnedValue __qmljs_call_element(ExecutionContext *context, const ValueRef index, CallDataRef callData);
-QV4::ReturnedValue __qmljs_call_value(QV4::ExecutionContext *context, const QV4::ValueRef func, CallDataRef callData);
-
-QV4::ReturnedValue __qmljs_construct_activation_property(QV4::ExecutionContext *, const QV4::StringRef name, CallDataRef callData);
-QV4::ReturnedValue __qmljs_construct_property(QV4::ExecutionContext *context, const QV4::StringRef name, CallDataRef callData);
-QV4::ReturnedValue __qmljs_construct_property_lookup(ExecutionContext *context, uint index, CallDataRef callData);
-QV4::ReturnedValue __qmljs_construct_value(QV4::ExecutionContext *context, const QV4::ValueRef func, CallDataRef callData);
-
-QV4::ReturnedValue __qmljs_builtin_typeof(QV4::ExecutionContext *ctx, const QV4::ValueRef val);
-QV4::ReturnedValue __qmljs_builtin_typeof_name(QV4::ExecutionContext *context, const QV4::StringRef name);
-QV4::ReturnedValue __qmljs_builtin_typeof_member(QV4::ExecutionContext* context, const QV4::ValueRef base, const QV4::StringRef name);
-QV4::ReturnedValue __qmljs_builtin_typeof_element(QV4::ExecutionContext* context, const QV4::ValueRef base, const QV4::ValueRef index);
-
-void __qmljs_builtin_rethrow(QV4::ExecutionContext *context);
-QV4::ExecutionContext *__qmljs_builtin_push_with_scope(const QV4::ValueRef o, QV4::ExecutionContext *ctx);
-QV4::ExecutionContext *__qmljs_builtin_push_catch_scope(QV4::ExecutionContext *ctx, const QV4::StringRef exceptionVarName);
-QV4::ExecutionContext *__qmljs_builtin_pop_scope(QV4::ExecutionContext *ctx);
-ReturnedValue __qmljs_builtin_unwind_exception(ExecutionContext *ctx);
-void __qmljs_builtin_declare_var(QV4::ExecutionContext *ctx, bool deletable, const QV4::StringRef name);
-QV4::ReturnedValue __qmljs_builtin_define_array(QV4::ExecutionContext *ctx, Value *values, uint length);
-QV4::ReturnedValue __qmljs_builtin_define_object_literal(QV4::ExecutionContext *ctx, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags);
-QV4::ReturnedValue __qmljs_builtin_setup_arguments_object(ExecutionContext *ctx);
-void __qmljs_builtin_convert_this_to_object(ExecutionContext *ctx);
-
-QV4::ReturnedValue __qmljs_value_from_string(QV4::String *string);
-QV4::ReturnedValue __qmljs_lookup_runtime_regexp(QV4::ExecutionContext *ctx, int id);
-
-// constructors
-QV4::ReturnedValue __qmljs_init_closure(QV4::ExecutionContext *ctx, int functionId);
-
-// strings
-Q_QML_EXPORT double __qmljs_string_to_number(const QString &s);
-Returned<String> *__qmljs_string_from_number(QV4::ExecutionContext *ctx, double number);
-
-// objects
-Q_QML_EXPORT ReturnedValue __qmljs_object_default_value(QV4::Object *object, int typeHint);
-void __qmljs_set_activation_property(QV4::ExecutionContext *ctx, const QV4::StringRef name, const QV4::ValueRef value);
-void __qmljs_set_property(QV4::ExecutionContext *ctx, const QV4::ValueRef object, const QV4::StringRef name, const QV4::ValueRef value);
-QV4::ReturnedValue __qmljs_get_property(QV4::ExecutionContext *ctx, const QV4::ValueRef object, const QV4::StringRef name);
-QV4::ReturnedValue __qmljs_get_activation_property(QV4::ExecutionContext *ctx, const QV4::StringRef name);
-
-ReturnedValue __qmljs_call_global_lookup(QV4::ExecutionContext *context, uint index, CallDataRef callData);
-QV4::ReturnedValue __qmljs_construct_global_lookup(QV4::ExecutionContext *context, uint index, CallDataRef callData);
-
-
-QV4::ReturnedValue __qmljs_get_element(QV4::ExecutionContext *ctx, const QV4::ValueRef object, const QV4::ValueRef index);
-void __qmljs_set_element(QV4::ExecutionContext *ctx, const QV4::ValueRef object, const QV4::ValueRef index, const QV4::ValueRef value);
-
-QV4::ReturnedValue __qmljs_get_id_array(NoThrowContext *ctx);
-QV4::ReturnedValue __qmljs_get_imported_scripts(NoThrowContext *ctx);
-QV4::ReturnedValue __qmljs_get_context_object(NoThrowContext *ctx);
-QV4::ReturnedValue __qmljs_get_scope_object(NoThrowContext *ctx);
-QV4::ReturnedValue __qmljs_get_qobject_property(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired);
-QV4::ReturnedValue __qmljs_get_attached_property(ExecutionContext *ctx, int attachedPropertiesId, int propertyIndex);
-void __qmljs_set_qobject_property(ExecutionContext *ctx, const ValueRef object, int propertyIndex, const ValueRef value);
-QV4::ReturnedValue __qmljs_get_qml_singleton(NoThrowContext *ctx, const QV4::StringRef name);
-
-// For each
-QV4::ReturnedValue __qmljs_foreach_iterator_object(QV4::ExecutionContext *ctx, const QV4::ValueRef in);
-QV4::ReturnedValue __qmljs_foreach_next_property_name(const ValueRef foreach_iterator);
+struct Q_QML_EXPORT Runtime {
+ // call
+ static ReturnedValue callGlobalLookup(ExecutionContext *context, uint index, CallDataRef callData);
+ static ReturnedValue callActivationProperty(ExecutionContext *, const StringRef name, CallDataRef callData);
+ static ReturnedValue callProperty(ExecutionContext *context, const StringRef name, CallDataRef callData);
+ static ReturnedValue callPropertyLookup(ExecutionContext *context, uint index, CallDataRef callData);
+ static ReturnedValue callElement(ExecutionContext *context, const ValueRef index, CallDataRef callData);
+ static ReturnedValue callValue(ExecutionContext *context, const ValueRef func, CallDataRef callData);
+
+ // construct
+ static ReturnedValue constructGlobalLookup(ExecutionContext *context, uint index, CallDataRef callData);
+ static ReturnedValue constructActivationProperty(ExecutionContext *, const StringRef name, CallDataRef callData);
+ static ReturnedValue constructProperty(ExecutionContext *context, const StringRef name, CallDataRef callData);
+ static ReturnedValue constructPropertyLookup(ExecutionContext *context, uint index, CallDataRef callData);
+ static ReturnedValue constructValue(ExecutionContext *context, const ValueRef func, CallDataRef callData);
+
+ // set & get
+ static void setActivationProperty(ExecutionContext *ctx, const StringRef name, const ValueRef value);
+ static void setProperty(ExecutionContext *ctx, const ValueRef object, const StringRef name, const ValueRef value);
+ static void setElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index, const ValueRef value);
+ static ReturnedValue getProperty(ExecutionContext *ctx, const ValueRef object, const StringRef name);
+ static ReturnedValue getActivationProperty(ExecutionContext *ctx, const StringRef name);
+ static ReturnedValue getElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index);
+
+ // typeof
+ static ReturnedValue typeofValue(ExecutionContext *ctx, const ValueRef val);
+ static ReturnedValue typeofName(ExecutionContext *context, const StringRef name);
+ static ReturnedValue typeofMember(ExecutionContext* context, const ValueRef base, const StringRef name);
+ static ReturnedValue typeofElement(ExecutionContext* context, const ValueRef base, const ValueRef index);
+
+ // delete
+ static ReturnedValue deleteElement(ExecutionContext *ctx, const ValueRef base, const ValueRef index);
+ static ReturnedValue deleteMember(ExecutionContext *ctx, const ValueRef base, const StringRef name);
+ static ReturnedValue deleteName(ExecutionContext *ctx, const StringRef name);
+
+ // exceptions & scopes
+ static void throwException(ExecutionContext*, const ValueRef value);
+ static ReturnedValue unwindException(ExecutionContext *ctx);
+ static ExecutionContext *pushWithScope(const ValueRef o, ExecutionContext *ctx);
+ static ExecutionContext *pushCatchScope(ExecutionContext *ctx, const StringRef exceptionVarName);
+ static ExecutionContext *popScope(ExecutionContext *ctx);
+
+ // closures
+ static ReturnedValue closure(ExecutionContext *ctx, int functionId);
+
+ // function header
+ static void declareVar(ExecutionContext *ctx, bool deletable, const StringRef name);
+ static ReturnedValue setupArgumentsObject(ExecutionContext *ctx);
+ static void convertThisToObject(ExecutionContext *ctx);
+
+ // literals
+ static ReturnedValue arrayLiteral(ExecutionContext *ctx, Value *values, uint length);
+ static ReturnedValue objectLiteral(ExecutionContext *ctx, const Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags);
+ static ReturnedValue regexpLiteral(ExecutionContext *ctx, int id);
+
+ // foreach
+ static ReturnedValue foreachIterator(ExecutionContext *ctx, const ValueRef in);
+ static ReturnedValue foreachNextPropertyName(const ValueRef foreach_iterator);
+
+ // unary operators
+ typedef ReturnedValue (*UnaryOperation)(const ValueRef);
+ static ReturnedValue uPlus(const ValueRef value);
+ static ReturnedValue uMinus(const ValueRef value);
+ static ReturnedValue uNot(const ValueRef value);
+ static ReturnedValue complement(const ValueRef value);
+ static ReturnedValue increment(const ValueRef value);
+ static ReturnedValue decrement(const ValueRef value);
+
+ // binary operators
+ typedef ReturnedValue (*BinaryOperation)(const ValueRef left, const ValueRef right);
+ typedef ReturnedValue (*BinaryOperationContext)(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+
+ static ReturnedValue instanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ static ReturnedValue in(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ static ReturnedValue add(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ static ReturnedValue addString(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ static ReturnedValue bitOr(const ValueRef left, const ValueRef right);
+ static ReturnedValue bitXor(const ValueRef left, const ValueRef right);
+ static ReturnedValue bitAnd(const ValueRef left, const ValueRef right);
+ static ReturnedValue sub(const ValueRef left, const ValueRef right);
+ static ReturnedValue mul(const ValueRef left, const ValueRef right);
+ static ReturnedValue div(const ValueRef left, const ValueRef right);
+ static ReturnedValue mod(const ValueRef left, const ValueRef right);
+ static ReturnedValue shl(const ValueRef left, const ValueRef right);
+ static ReturnedValue shr(const ValueRef left, const ValueRef right);
+ static ReturnedValue ushr(const ValueRef left, const ValueRef right);
+ static ReturnedValue greaterThan(const ValueRef left, const ValueRef right);
+ static ReturnedValue lessThan(const ValueRef left, const ValueRef right);
+ static ReturnedValue greaterEqual(const ValueRef left, const ValueRef right);
+ static ReturnedValue lessEqual(const ValueRef left, const ValueRef right);
+ static ReturnedValue equal(const ValueRef left, const ValueRef right);
+ static ReturnedValue notEqual(const ValueRef left, const ValueRef right);
+ static ReturnedValue strictEqual(const ValueRef left, const ValueRef right);
+ static ReturnedValue strictNotEqual(const ValueRef left, const ValueRef right);
+
+ // comparisons
+ typedef Bool (*CompareOperation)(const ValueRef left, const ValueRef right);
+ static Bool compareGreaterThan(const ValueRef l, const ValueRef r);
+ static Bool compareLessThan(const ValueRef l, const ValueRef r);
+ static Bool compareGreaterEqual(const ValueRef l, const ValueRef r);
+ static Bool compareLessEqual(const ValueRef l, const ValueRef r);
+ static Bool compareEqual(const ValueRef left, const ValueRef right);
+ static Bool compareNotEqual(const ValueRef left, const ValueRef right);
+ static Bool compareStrictEqual(const ValueRef left, const ValueRef right);
+ static Bool compareStrictNotEqual(const ValueRef left, const ValueRef right);
+
+ typedef Bool (*CompareOperationContext)(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ static Bool compareInstanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ static Bool compareIn(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+
+ // conversions
+ static Bool toBoolean(const ValueRef value);
+ static ReturnedValue toDouble(const ValueRef value);
+ static int toInt(const ValueRef value);
+ static int doubleToInt(const double &d);
+ static unsigned toUInt(const ValueRef value);
+ static unsigned doubleToUInt(const double &d);
+
+ // qml
+ static ReturnedValue getQmlIdArray(NoThrowContext *ctx);
+ static ReturnedValue getQmlImportedScripts(NoThrowContext *ctx);
+ static ReturnedValue getQmlContextObject(NoThrowContext *ctx);
+ static ReturnedValue getQmlScopeObject(NoThrowContext *ctx);
+ static ReturnedValue getQmlSingleton(NoThrowContext *ctx, const StringRef name);
+ static ReturnedValue getQmlAttachedProperty(ExecutionContext *ctx, int attachedPropertiesId, int propertyIndex);
+ static ReturnedValue getQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired);
+ static void setQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, const ValueRef value);
+};
-// type conversion and testing
-QV4::ReturnedValue __qmljs_to_primitive(const ValueRef value, int typeHint);
-Q_QML_EXPORT QV4::Bool __qmljs_to_boolean(const QV4::ValueRef value);
-double __qmljs_to_number(const QV4::ValueRef value);
-QV4::ReturnedValue __qmljs_to_string(QV4::ExecutionContext *ctx, const ValueRef value);
-Q_QML_EXPORT Returned<String> *__qmljs_convert_to_string(QV4::ExecutionContext *ctx, const ValueRef value);
-void __qmljs_numberToString(QString *result, double num, int radix = 10);
-ReturnedValue __qmljs_to_object(QV4::ExecutionContext *ctx, const ValueRef value);
-Returned<Object> *__qmljs_convert_to_object(QV4::ExecutionContext *ctx, const ValueRef value);
-
-QV4::Bool __qmljs_equal_helper(const ValueRef x, const ValueRef y);
-Q_QML_EXPORT QV4::Bool __qmljs_strict_equal(const ValueRef x, const ValueRef y);
-
-// unary operators
-typedef QV4::ReturnedValue (*UnaryOpName)(const QV4::ValueRef);
-QV4::ReturnedValue __qmljs_uplus(const QV4::ValueRef value);
-QV4::ReturnedValue __qmljs_uminus(const QV4::ValueRef value);
-QV4::ReturnedValue __qmljs_compl(const QV4::ValueRef value);
-QV4::ReturnedValue __qmljs_not(const QV4::ValueRef value);
-QV4::ReturnedValue __qmljs_increment(const QV4::ValueRef value);
-QV4::ReturnedValue __qmljs_decrement(const QV4::ValueRef value);
-
-Q_QML_EXPORT ReturnedValue __qmljs_value_to_double(const ValueRef value);
-Q_QML_EXPORT int __qmljs_value_to_int32(const ValueRef value);
-Q_QML_EXPORT int __qmljs_double_to_int32(const double &d);
-Q_QML_EXPORT unsigned __qmljs_value_to_uint32(const ValueRef value);
-Q_QML_EXPORT unsigned __qmljs_double_to_uint32(const double &d);
-
-QV4::ReturnedValue __qmljs_delete_subscript(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::ValueRef index);
-ReturnedValue __qmljs_delete_member(QV4::ExecutionContext *ctx, const QV4::ValueRef base, const QV4::StringRef name);
-ReturnedValue __qmljs_delete_name(QV4::ExecutionContext *ctx, const QV4::StringRef name);
-
-void __qmljs_throw(QV4::ExecutionContext*, const QV4::ValueRef value);
+struct Q_QML_EXPORT RuntimeHelpers {
+ static ReturnedValue objectDefaultValue(Object *object, int typeHint);
+ static ReturnedValue toPrimitive(const ValueRef value, int typeHint);
+
+ static double stringToNumber(const QString &s);
+ static Returned<String> *stringFromNumber(ExecutionContext *ctx, double number);
+ static double toNumber(const ValueRef value);
+ static void numberToString(QString *result, double num, int radix = 10);
+
+ static ReturnedValue toString(ExecutionContext *ctx, const ValueRef value);
+ static Returned<String> *convertToString(ExecutionContext *ctx, const ValueRef value);
+
+ static ReturnedValue toObject(ExecutionContext *ctx, const ValueRef value);
+ static Returned<Object> *convertToObject(ExecutionContext *ctx, const ValueRef value);
+
+ static Bool equalHelper(const ValueRef x, const ValueRef y);
+ static Bool strictEqual(const ValueRef x, const ValueRef y);
+
+ static ReturnedValue addHelper(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+};
-// binary operators
-typedef QV4::ReturnedValue (*BinOp)(const QV4::ValueRef left, const QV4::ValueRef right);
-typedef QV4::ReturnedValue (*BinOpContext)(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right);
-
-QV4::ReturnedValue __qmljs_instanceof(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_in(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_add(ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_add_string(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_bit_or(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_bit_xor(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_bit_and(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_sub(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_mul(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_div(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_mod(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_shl(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_shr(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_ushr(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_gt(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_lt(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_ge(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_le(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_eq(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_ne(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_se(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::ReturnedValue __qmljs_sne(const QV4::ValueRef left, const QV4::ValueRef right);
-
-QV4::ReturnedValue __qmljs_add_helper(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right);
-
-typedef QV4::Bool (*CmpOp)(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::Bool __qmljs_cmp_gt(const QV4::ValueRef l, const QV4::ValueRef r);
-QV4::Bool __qmljs_cmp_lt(const QV4::ValueRef l, const QV4::ValueRef r);
-QV4::Bool __qmljs_cmp_ge(const QV4::ValueRef l, const QV4::ValueRef r);
-QV4::Bool __qmljs_cmp_le(const QV4::ValueRef l, const QV4::ValueRef r);
-QV4::Bool __qmljs_cmp_eq(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::Bool __qmljs_cmp_ne(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::Bool __qmljs_cmp_se(const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::Bool __qmljs_cmp_sne(const QV4::ValueRef left, const QV4::ValueRef right);
-
-typedef QV4::Bool (*CmpOpContext)(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::Bool __qmljs_cmp_instanceof(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right);
-QV4::Bool __qmljs_cmp_in(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right);
// type conversion and testing
-inline ReturnedValue __qmljs_to_primitive(const QV4::ValueRef value, int typeHint)
+inline ReturnedValue RuntimeHelpers::toPrimitive(const ValueRef value, int typeHint)
{
- QV4::Object *o = value->asObject();
+ Object *o = value->asObject();
if (!o)
return value.asReturnedValue();
- return __qmljs_object_default_value(o, typeHint);
+ return RuntimeHelpers::objectDefaultValue(o, typeHint);
}
-inline double __qmljs_to_number(const ValueRef value)
+inline double RuntimeHelpers::toNumber(const ValueRef value)
{
return value->toNumber();
}
-inline QV4::ReturnedValue __qmljs_uplus(const QV4::ValueRef value)
+inline ReturnedValue Runtime::uPlus(const ValueRef value)
{
TRACE1(value);
@@ -287,7 +281,7 @@ inline QV4::ReturnedValue __qmljs_uplus(const QV4::ValueRef value)
return Encode(n);
}
-inline QV4::ReturnedValue __qmljs_uminus(const QV4::ValueRef value)
+inline ReturnedValue Runtime::uMinus(const ValueRef value)
{
TRACE1(value);
@@ -295,12 +289,12 @@ inline QV4::ReturnedValue __qmljs_uminus(const QV4::ValueRef value)
if (value->isInteger() && value->integerValue())
return Encode(-value->integerValue());
else {
- double n = __qmljs_to_number(value);
+ double n = RuntimeHelpers::toNumber(value);
return Encode(-n);
}
}
-inline QV4::ReturnedValue __qmljs_compl(const QV4::ValueRef value)
+inline ReturnedValue Runtime::complement(const ValueRef value)
{
TRACE1(value);
@@ -308,7 +302,7 @@ inline QV4::ReturnedValue __qmljs_compl(const QV4::ValueRef value)
return Encode((int)~n);
}
-inline QV4::ReturnedValue __qmljs_not(const QV4::ValueRef value)
+inline ReturnedValue Runtime::uNot(const ValueRef value)
{
TRACE1(value);
@@ -317,7 +311,7 @@ inline QV4::ReturnedValue __qmljs_not(const QV4::ValueRef value)
}
// binary operators
-inline ReturnedValue __qmljs_bit_or(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::bitOr(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -326,7 +320,7 @@ inline ReturnedValue __qmljs_bit_or(const QV4::ValueRef left, const QV4::ValueRe
return Encode(lval | rval);
}
-inline ReturnedValue __qmljs_bit_xor(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::bitXor(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -335,7 +329,7 @@ inline ReturnedValue __qmljs_bit_xor(const QV4::ValueRef left, const QV4::ValueR
return Encode(lval ^ rval);
}
-inline ReturnedValue __qmljs_bit_and(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::bitAnd(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -344,19 +338,19 @@ inline ReturnedValue __qmljs_bit_and(const QV4::ValueRef left, const QV4::ValueR
return Encode(lval & rval);
}
-inline QV4::ReturnedValue __qmljs_add(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::add(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
if (left->isInteger() && right->isInteger())
return add_int32(left->integerValue(), right->integerValue()).asReturnedValue();
if (left->isNumber() && right->isNumber())
- return QV4::Primitive::fromDouble(left->asDouble() + right->asDouble()).asReturnedValue();
+ return Primitive::fromDouble(left->asDouble() + right->asDouble()).asReturnedValue();
- return __qmljs_add_helper(ctx, left, right);
+ return RuntimeHelpers::addHelper(ctx, left, right);
}
-inline QV4::ReturnedValue __qmljs_sub(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::sub(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -366,10 +360,10 @@ inline QV4::ReturnedValue __qmljs_sub(const QV4::ValueRef left, const QV4::Value
double lval = left->isNumber() ? left->asDouble() : left->toNumberImpl();
double rval = right->isNumber() ? right->asDouble() : right->toNumberImpl();
- return QV4::Primitive::fromDouble(lval - rval).asReturnedValue();
+ return Primitive::fromDouble(lval - rval).asReturnedValue();
}
-inline QV4::ReturnedValue __qmljs_mul(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::mul(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -379,34 +373,34 @@ inline QV4::ReturnedValue __qmljs_mul(const QV4::ValueRef left, const QV4::Value
double lval = left->isNumber() ? left->asDouble() : left->toNumberImpl();
double rval = right->isNumber() ? right->asDouble() : right->toNumberImpl();
- return QV4::Primitive::fromDouble(lval * rval).asReturnedValue();
+ return Primitive::fromDouble(lval * rval).asReturnedValue();
}
-inline QV4::ReturnedValue __qmljs_div(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::div(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
double lval = left->toNumber();
double rval = right->toNumber();
- return QV4::Primitive::fromDouble(lval / rval).asReturnedValue();
+ return Primitive::fromDouble(lval / rval).asReturnedValue();
}
-inline QV4::ReturnedValue __qmljs_mod(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::mod(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- if (QV4::Value::integerCompatible(*left, *right) && right->integerValue() != 0) {
+ if (Value::integerCompatible(*left, *right) && right->integerValue() != 0) {
int intRes = left->integerValue() % right->integerValue();
if (intRes != 0 || left->integerValue() >= 0)
return Encode(intRes);
}
- double lval = __qmljs_to_number(left);
- double rval = __qmljs_to_number(right);
- return QV4::Primitive::fromDouble(std::fmod(lval, rval)).asReturnedValue();
+ double lval = RuntimeHelpers::toNumber(left);
+ double rval = RuntimeHelpers::toNumber(right);
+ return Primitive::fromDouble(std::fmod(lval, rval)).asReturnedValue();
}
-inline QV4::ReturnedValue __qmljs_shl(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::shl(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -415,7 +409,7 @@ inline QV4::ReturnedValue __qmljs_shl(const QV4::ValueRef left, const QV4::Value
return Encode((int)(lval << rval));
}
-inline QV4::ReturnedValue __qmljs_shr(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::shr(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -424,7 +418,7 @@ inline QV4::ReturnedValue __qmljs_shr(const QV4::ValueRef left, const QV4::Value
return Encode((int)(lval >> rval));
}
-inline QV4::ReturnedValue __qmljs_ushr(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::ushr(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -435,71 +429,71 @@ inline QV4::ReturnedValue __qmljs_ushr(const QV4::ValueRef left, const QV4::Valu
return Encode(res);
}
-inline QV4::ReturnedValue __qmljs_gt(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::greaterThan(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- bool r = __qmljs_cmp_gt(left, right);
+ bool r = Runtime::compareGreaterThan(left, right);
return Encode(r);
}
-inline QV4::ReturnedValue __qmljs_lt(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::lessThan(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- bool r = __qmljs_cmp_lt(left, right);
+ bool r = Runtime::compareLessThan(left, right);
return Encode(r);
}
-inline QV4::ReturnedValue __qmljs_ge(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::greaterEqual(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- bool r = __qmljs_cmp_ge(left, right);
+ bool r = Runtime::compareGreaterEqual(left, right);
return Encode(r);
}
-inline QV4::ReturnedValue __qmljs_le(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::lessEqual(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- bool r = __qmljs_cmp_le(left, right);
+ bool r = Runtime::compareLessEqual(left, right);
return Encode(r);
}
-inline QV4::ReturnedValue __qmljs_eq(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::equal(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- bool r = __qmljs_cmp_eq(left, right);
+ bool r = Runtime::compareEqual(left, right);
return Encode(r);
}
-inline QV4::ReturnedValue __qmljs_ne(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::notEqual(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- bool r = !__qmljs_cmp_eq(left, right);
+ bool r = !Runtime::compareEqual(left, right);
return Encode(r);
}
-inline QV4::ReturnedValue __qmljs_se(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::strictEqual(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- bool r = __qmljs_strict_equal(left, right);
+ bool r = RuntimeHelpers::strictEqual(left, right);
return Encode(r);
}
-inline QV4::ReturnedValue __qmljs_sne(const QV4::ValueRef left, const QV4::ValueRef right)
+inline ReturnedValue Runtime::strictNotEqual(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- bool r = ! __qmljs_strict_equal(left, right);
+ bool r = ! RuntimeHelpers::strictEqual(left, right);
return Encode(r);
}
-inline QV4::Bool __qmljs_cmp_eq(const QV4::ValueRef left, const QV4::ValueRef right)
+inline Bool Runtime::compareEqual(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
@@ -514,45 +508,45 @@ inline QV4::Bool __qmljs_cmp_eq(const QV4::ValueRef left, const QV4::ValueRef ri
return left->managed()->isEqualTo(right->managed());
}
- return __qmljs_equal_helper(left, right);
+ return RuntimeHelpers::equalHelper(left, right);
}
-inline QV4::Bool __qmljs_cmp_ne(const QV4::ValueRef left, const QV4::ValueRef right)
+inline Bool Runtime::compareNotEqual(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- return !__qmljs_cmp_eq(left, right);
+ return !Runtime::compareEqual(left, right);
}
-inline QV4::Bool __qmljs_cmp_se(const QV4::ValueRef left, const QV4::ValueRef right)
+inline Bool Runtime::compareStrictEqual(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- return __qmljs_strict_equal(left, right);
+ return RuntimeHelpers::strictEqual(left, right);
}
-inline QV4::Bool __qmljs_cmp_sne(const QV4::ValueRef left, const QV4::ValueRef right)
+inline Bool Runtime::compareStrictNotEqual(const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
- return ! __qmljs_strict_equal(left, right);
+ return ! RuntimeHelpers::strictEqual(left, right);
}
-inline QV4::Bool __qmljs_cmp_instanceof(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right)
+inline Bool Runtime::compareInstanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
Scope scope(ctx);
- QV4::ScopedValue v(scope, __qmljs_instanceof(ctx, left, right));
+ ScopedValue v(scope, Runtime::instanceof(ctx, left, right));
return v->booleanValue();
}
-inline uint __qmljs_cmp_in(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right)
+inline uint Runtime::compareIn(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
{
TRACE2(left, right);
Scope scope(ctx);
- QV4::ScopedValue v(scope, __qmljs_in(ctx, left, right));
+ ScopedValue v(scope, Runtime::in(ctx, left, right));
return v->booleanValue();
}
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index a82dcffbca..89231cfe5f 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -123,7 +123,7 @@ static QString convertElementToString(const QUrl &element)
static QString convertElementToString(qreal element)
{
QString qstr;
- __qmljs_numberToString(&qstr, element, 10);
+ RuntimeHelpers::numberToString(&qstr, element, 10);
return qstr;
}
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index 3d0328dfcf..1c915914b5 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -285,7 +285,7 @@ uint String::toUInt(bool *ok) const
return stringHash;
// ### this conversion shouldn't be required
- double d = __qmljs_string_to_number(toQString());
+ double d = RuntimeHelpers::stringToNumber(toQString());
uint l = (uint)d;
if (d == l)
return l;
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 5b0891ebe1..f26c77e5bf 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -305,7 +305,7 @@ ReturnedValue StringPrototype::method_concat(CallContext *context)
ScopedValue v(scope);
for (int i = 0; i < context->callData->argc; ++i) {
- v = __qmljs_to_string(context, ValueRef(&context->callData->args[i]));
+ v = RuntimeHelpers::toString(context, ValueRef(&context->callData->args[i]));
if (scope.hasException())
return Encode::undefined();
Q_ASSERT(v->isString());
@@ -349,7 +349,7 @@ ReturnedValue StringPrototype::method_lastIndexOf(CallContext *context)
searchString = context->callData->args[0].toQString();
ScopedValue posArg(scope, context->argument(1));
- double position = __qmljs_to_number(posArg);
+ double position = RuntimeHelpers::toNumber(posArg);
if (std::isnan(position))
position = +qInf();
else
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp
index a610f0b73a..fa16662b46 100644
--- a/src/qml/jsruntime/qv4value.cpp
+++ b/src/qml/jsruntime/qv4value.cpp
@@ -88,11 +88,11 @@ double Value::toNumberImpl() const
return std::numeric_limits<double>::quiet_NaN();
case QV4::Value::Managed_Type:
if (isString())
- return __qmljs_string_to_number(stringValue()->toQString());
+ return RuntimeHelpers::stringToNumber(stringValue()->toQString());
{
ExecutionContext *ctx = objectValue()->internalClass->engine->currentContext();
Scope scope(ctx);
- ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), NUMBER_HINT));
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), NUMBER_HINT));
return prim->toNumber();
}
case QV4::Value::Null_Type:
@@ -126,7 +126,7 @@ QString Value::toQStringNoThrow() const
Scope scope(ctx);
ScopedValue ex(scope);
bool caughtException = false;
- ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), STRING_HINT));
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT));
if (scope.hasException()) {
ex = ctx->catchException();
caughtException = true;
@@ -135,7 +135,7 @@ QString Value::toQStringNoThrow() const
}
// Can't nest try/catch due to CXX ABI limitations for foreign exception nesting.
if (caughtException) {
- ScopedValue prim(scope, __qmljs_to_primitive(ex, STRING_HINT));
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ex, STRING_HINT));
if (scope.hasException()) {
ex = ctx->catchException();
} else if (prim->isPrimitive()) {
@@ -146,12 +146,12 @@ QString Value::toQStringNoThrow() const
}
case Value::Integer_Type: {
QString str;
- __qmljs_numberToString(&str, (double)int_32, 10);
+ RuntimeHelpers::numberToString(&str, (double)int_32, 10);
return str;
}
default: { // double
QString str;
- __qmljs_numberToString(&str, doubleValue(), 10);
+ RuntimeHelpers::numberToString(&str, doubleValue(), 10);
return str;
}
} // switch
@@ -177,17 +177,17 @@ QString Value::toQString() const
{
ExecutionContext *ctx = objectValue()->internalClass->engine->currentContext();
Scope scope(ctx);
- ScopedValue prim(scope, __qmljs_to_primitive(ValueRef::fromRawValue(this), STRING_HINT));
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT));
return prim->toQString();
}
case Value::Integer_Type: {
QString str;
- __qmljs_numberToString(&str, (double)int_32, 10);
+ RuntimeHelpers::numberToString(&str, (double)int_32, 10);
return str;
}
default: { // double
QString str;
- __qmljs_numberToString(&str, doubleValue(), 10);
+ RuntimeHelpers::numberToString(&str, doubleValue(), 10);
return str;
}
} // switch
@@ -272,13 +272,13 @@ String *Value::toString(ExecutionContext *ctx) const
{
if (isString())
return stringValue();
- return __qmljs_convert_to_string(ctx, ValueRef::fromRawValue(this))->getPointer();
+ return RuntimeHelpers::convertToString(ctx, ValueRef::fromRawValue(this))->getPointer();
}
Object *Value::toObject(ExecutionContext *ctx) const
{
if (isObject())
return objectValue();
- return __qmljs_convert_to_object(ctx, ValueRef::fromRawValue(this))->getPointer();
+ return RuntimeHelpers::convertToObject(ctx, ValueRef::fromRawValue(this))->getPointer();
}
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index b498581249..8e52ed5a96 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -257,12 +257,12 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(LoadRegExp)
MOTH_BEGIN_INSTR(LoadClosure)
- STOREVALUE(instr.result, __qmljs_init_closure(context, instr.value));
+ STOREVALUE(instr.result, Runtime::closure(context, instr.value));
MOTH_END_INSTR(LoadClosure)
MOTH_BEGIN_INSTR(LoadName)
TRACE(inline, "property name = %s", runtimeStrings[instr.name]->toQString().toUtf8().constData());
- STOREVALUE(instr.result, __qmljs_get_activation_property(context, runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::getActivationProperty(context, runtimeStrings[instr.name]));
MOTH_END_INSTR(LoadName)
MOTH_BEGIN_INSTR(GetGlobalLookup)
@@ -273,12 +273,12 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_BEGIN_INSTR(StoreName)
TRACE(inline, "property name = %s", runtimeStrings[instr.name]->toQString().toUtf8().constData());
- __qmljs_set_activation_property(context, runtimeStrings[instr.name], VALUEPTR(instr.source));
+ Runtime::setActivationProperty(context, runtimeStrings[instr.name], VALUEPTR(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreName)
MOTH_BEGIN_INSTR(LoadElement)
- STOREVALUE(instr.result, __qmljs_get_element(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
+ STOREVALUE(instr.result, Runtime::getElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
MOTH_END_INSTR(LoadElement)
MOTH_BEGIN_INSTR(LoadElementLookup)
@@ -287,7 +287,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(LoadElementLookup)
MOTH_BEGIN_INSTR(StoreElement)
- __qmljs_set_element(context, VALUEPTR(instr.base), VALUEPTR(instr.index), VALUEPTR(instr.source));
+ Runtime::setElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index), VALUEPTR(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreElement)
@@ -298,7 +298,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(StoreElementLookup)
MOTH_BEGIN_INSTR(LoadProperty)
- STOREVALUE(instr.result, __qmljs_get_property(context, VALUEPTR(instr.base), runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::getProperty(context, VALUEPTR(instr.base), runtimeStrings[instr.name]));
MOTH_END_INSTR(LoadProperty)
MOTH_BEGIN_INSTR(GetLookup)
@@ -307,7 +307,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(GetLookup)
MOTH_BEGIN_INSTR(StoreProperty)
- __qmljs_set_property(context, VALUEPTR(instr.base), runtimeStrings[instr.name], VALUEPTR(instr.source));
+ Runtime::setProperty(context, VALUEPTR(instr.base), runtimeStrings[instr.name], VALUEPTR(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreProperty)
@@ -318,16 +318,16 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(SetLookup)
MOTH_BEGIN_INSTR(StoreQObjectProperty)
- __qmljs_set_qobject_property(context, VALUEPTR(instr.base), instr.propertyIndex, VALUEPTR(instr.source));
+ Runtime::setQmlQObjectProperty(context, VALUEPTR(instr.base), instr.propertyIndex, VALUEPTR(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreQObjectProperty)
MOTH_BEGIN_INSTR(LoadQObjectProperty)
- STOREVALUE(instr.result, __qmljs_get_qobject_property(context, VALUEPTR(instr.base), instr.propertyIndex, instr.captureRequired));
+ STOREVALUE(instr.result, Runtime::getQmlQObjectProperty(context, VALUEPTR(instr.base), instr.propertyIndex, instr.captureRequired));
MOTH_END_INSTR(LoadQObjectProperty)
MOTH_BEGIN_INSTR(LoadAttachedQObjectProperty)
- STOREVALUE(instr.result, __qmljs_get_attached_property(context, instr.attachedPropertiesId, instr.propertyIndex));
+ STOREVALUE(instr.result, Runtime::getQmlAttachedProperty(context, instr.attachedPropertiesId, instr.propertyIndex));
MOTH_END_INSTR(LoadAttachedQObjectProperty)
MOTH_BEGIN_INSTR(Push)
@@ -356,7 +356,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, __qmljs_call_value(context, VALUEPTR(instr.dest), callData));
+ STOREVALUE(instr.result, Runtime::callValue(context, VALUEPTR(instr.dest), callData));
MOTH_END_INSTR(CallValue)
MOTH_BEGIN_INSTR(CallProperty)
@@ -366,7 +366,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, __qmljs_call_property(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::callProperty(context, runtimeStrings[instr.name], callData));
MOTH_END_INSTR(CallProperty)
MOTH_BEGIN_INSTR(CallPropertyLookup)
@@ -376,7 +376,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, __qmljs_call_property_lookup(context, instr.lookupIndex, callData));
+ STOREVALUE(instr.result, Runtime::callPropertyLookup(context, instr.lookupIndex, callData));
MOTH_END_INSTR(CallPropertyLookup)
MOTH_BEGIN_INSTR(CallElement)
@@ -385,7 +385,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, __qmljs_call_element(context, VALUEPTR(instr.index), callData));
+ STOREVALUE(instr.result, Runtime::callElement(context, VALUEPTR(instr.index), callData));
MOTH_END_INSTR(CallElement)
MOTH_BEGIN_INSTR(CallActivationProperty)
@@ -395,7 +395,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, __qmljs_call_activation_property(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::callActivationProperty(context, runtimeStrings[instr.name], callData));
MOTH_END_INSTR(CallActivationProperty)
MOTH_BEGIN_INSTR(CallGlobalLookup)
@@ -405,7 +405,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, __qmljs_call_global_lookup(context, instr.index, callData));
+ STOREVALUE(instr.result, Runtime::callGlobalLookup(context, instr.index, callData));
MOTH_END_INSTR(CallGlobalLookup)
MOTH_BEGIN_INSTR(SetExceptionHandler)
@@ -413,83 +413,83 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(SetExceptionHandler)
MOTH_BEGIN_INSTR(CallBuiltinThrow)
- __qmljs_throw(context, VALUEPTR(instr.arg));
+ Runtime::throwException(context, VALUEPTR(instr.arg));
CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinThrow)
MOTH_BEGIN_INSTR(CallBuiltinUnwindException)
- STOREVALUE(instr.result, __qmljs_builtin_unwind_exception(context));
+ STOREVALUE(instr.result, Runtime::unwindException(context));
MOTH_END_INSTR(CallBuiltinUnwindException)
MOTH_BEGIN_INSTR(CallBuiltinPushCatchScope)
- context = __qmljs_builtin_push_catch_scope(context, runtimeStrings[instr.name]);
+ context = Runtime::pushCatchScope(context, runtimeStrings[instr.name]);
MOTH_END_INSTR(CallBuiltinPushCatchScope)
MOTH_BEGIN_INSTR(CallBuiltinPushScope)
- context = __qmljs_builtin_push_with_scope(VALUEPTR(instr.arg), context);
+ context = Runtime::pushWithScope(VALUEPTR(instr.arg), context);
MOTH_END_INSTR(CallBuiltinPushScope)
MOTH_BEGIN_INSTR(CallBuiltinPopScope)
- context = __qmljs_builtin_pop_scope(context);
+ context = Runtime::popScope(context);
MOTH_END_INSTR(CallBuiltinPopScope)
MOTH_BEGIN_INSTR(CallBuiltinForeachIteratorObject)
- STOREVALUE(instr.result, __qmljs_foreach_iterator_object(context, VALUEPTR(instr.arg)));
+ STOREVALUE(instr.result, Runtime::foreachIterator(context, VALUEPTR(instr.arg)));
MOTH_END_INSTR(CallBuiltinForeachIteratorObject)
MOTH_BEGIN_INSTR(CallBuiltinForeachNextPropertyName)
- STOREVALUE(instr.result, __qmljs_foreach_next_property_name(VALUEPTR(instr.arg)));
+ STOREVALUE(instr.result, Runtime::foreachNextPropertyName(VALUEPTR(instr.arg)));
MOTH_END_INSTR(CallBuiltinForeachNextPropertyName)
MOTH_BEGIN_INSTR(CallBuiltinDeleteMember)
- STOREVALUE(instr.result, __qmljs_delete_member(context, VALUEPTR(instr.base), runtimeStrings[instr.member]));
+ STOREVALUE(instr.result, Runtime::deleteMember(context, VALUEPTR(instr.base), runtimeStrings[instr.member]));
MOTH_END_INSTR(CallBuiltinDeleteMember)
MOTH_BEGIN_INSTR(CallBuiltinDeleteSubscript)
- STOREVALUE(instr.result, __qmljs_delete_subscript(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
+ STOREVALUE(instr.result, Runtime::deleteElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
MOTH_END_INSTR(CallBuiltinDeleteSubscript)
MOTH_BEGIN_INSTR(CallBuiltinDeleteName)
- STOREVALUE(instr.result, __qmljs_delete_name(context, runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::deleteName(context, runtimeStrings[instr.name]));
MOTH_END_INSTR(CallBuiltinDeleteName)
MOTH_BEGIN_INSTR(CallBuiltinTypeofMember)
- STOREVALUE(instr.result, __qmljs_builtin_typeof_member(context, VALUEPTR(instr.base), runtimeStrings[instr.member]));
+ STOREVALUE(instr.result, Runtime::typeofMember(context, VALUEPTR(instr.base), runtimeStrings[instr.member]));
MOTH_END_INSTR(CallBuiltinTypeofMember)
MOTH_BEGIN_INSTR(CallBuiltinTypeofSubscript)
- STOREVALUE(instr.result, __qmljs_builtin_typeof_element(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
+ STOREVALUE(instr.result, Runtime::typeofElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
MOTH_END_INSTR(CallBuiltinTypeofSubscript)
MOTH_BEGIN_INSTR(CallBuiltinTypeofName)
- STOREVALUE(instr.result, __qmljs_builtin_typeof_name(context, runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::typeofName(context, runtimeStrings[instr.name]));
MOTH_END_INSTR(CallBuiltinTypeofName)
MOTH_BEGIN_INSTR(CallBuiltinTypeofValue)
- STOREVALUE(instr.result, __qmljs_builtin_typeof(context, VALUEPTR(instr.value)));
+ STOREVALUE(instr.result, Runtime::typeofValue(context, VALUEPTR(instr.value)));
MOTH_END_INSTR(CallBuiltinTypeofValue)
MOTH_BEGIN_INSTR(CallBuiltinDeclareVar)
- __qmljs_builtin_declare_var(context, instr.isDeletable, runtimeStrings[instr.varName]);
+ Runtime::declareVar(context, instr.isDeletable, runtimeStrings[instr.varName]);
MOTH_END_INSTR(CallBuiltinDeclareVar)
MOTH_BEGIN_INSTR(CallBuiltinDefineArray)
Q_ASSERT(instr.args + instr.argc <= stackSize);
QV4::Value *args = stack + instr.args;
- STOREVALUE(instr.result, __qmljs_builtin_define_array(context, args, instr.argc));
+ STOREVALUE(instr.result, Runtime::arrayLiteral(context, args, instr.argc));
MOTH_END_INSTR(CallBuiltinDefineArray)
MOTH_BEGIN_INSTR(CallBuiltinDefineObjectLiteral)
QV4::Value *args = stack + instr.args;
- STOREVALUE(instr.result, __qmljs_builtin_define_object_literal(context, args, instr.internalClassId, instr.arrayValueCount, instr.arrayGetterSetterCountAndFlags));
+ STOREVALUE(instr.result, Runtime::objectLiteral(context, args, instr.internalClassId, instr.arrayValueCount, instr.arrayGetterSetterCountAndFlags));
MOTH_END_INSTR(CallBuiltinDefineObjectLiteral)
MOTH_BEGIN_INSTR(CallBuiltinSetupArgumentsObject)
- STOREVALUE(instr.result, __qmljs_builtin_setup_arguments_object(context));
+ STOREVALUE(instr.result, Runtime::setupArgumentsObject(context));
MOTH_END_INSTR(CallBuiltinSetupArgumentsObject)
MOTH_BEGIN_INSTR(CallBuiltinConvertThisToObject)
- __qmljs_builtin_convert_this_to_object(context);
+ Runtime::convertThisToObject(context);
CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinConvertThisToObject)
@@ -499,7 +499,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, __qmljs_construct_value(context, VALUEPTR(instr.func), callData));
+ STOREVALUE(instr.result, Runtime::constructValue(context, VALUEPTR(instr.func), callData));
MOTH_END_INSTR(CreateValue)
MOTH_BEGIN_INSTR(CreateProperty)
@@ -508,7 +508,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, __qmljs_construct_property(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::constructProperty(context, runtimeStrings[instr.name], callData));
MOTH_END_INSTR(CreateProperty)
MOTH_BEGIN_INSTR(ConstructPropertyLookup)
@@ -517,7 +517,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, __qmljs_construct_property_lookup(context, instr.index, callData));
+ STOREVALUE(instr.result, Runtime::constructPropertyLookup(context, instr.index, callData));
MOTH_END_INSTR(ConstructPropertyLookup)
MOTH_BEGIN_INSTR(CreateActivationProperty)
@@ -527,7 +527,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, __qmljs_construct_activation_property(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::constructActivationProperty(context, runtimeStrings[instr.name], callData));
MOTH_END_INSTR(CreateActivationProperty)
MOTH_BEGIN_INSTR(ConstructGlobalLookup)
@@ -537,7 +537,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, __qmljs_construct_global_lookup(context, instr.index, callData));
+ STOREVALUE(instr.result, Runtime::constructGlobalLookup(context, instr.index, callData));
MOTH_END_INSTR(ConstructGlobalLookup)
MOTH_BEGIN_INSTR(Jump)
@@ -559,7 +559,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(JumpNe)
MOTH_BEGIN_INSTR(UNot)
- STOREVALUE(instr.result, __qmljs_not(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::uNot(VALUEPTR(instr.source)));
MOTH_END_INSTR(UNot)
MOTH_BEGIN_INSTR(UNotBool)
@@ -568,15 +568,15 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(UNotBool)
MOTH_BEGIN_INSTR(UPlus)
- STOREVALUE(instr.result, __qmljs_uplus(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::uPlus(VALUEPTR(instr.source)));
MOTH_END_INSTR(UPlus)
MOTH_BEGIN_INSTR(UMinus)
- STOREVALUE(instr.result, __qmljs_uminus(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::uMinus(VALUEPTR(instr.source)));
MOTH_END_INSTR(UMinus)
MOTH_BEGIN_INSTR(UCompl)
- STOREVALUE(instr.result, __qmljs_compl(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::complement(VALUEPTR(instr.source)));
MOTH_END_INSTR(UCompl)
MOTH_BEGIN_INSTR(UComplInt)
@@ -584,11 +584,11 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(UComplInt)
MOTH_BEGIN_INSTR(Increment)
- STOREVALUE(instr.result, __qmljs_increment(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::increment(VALUEPTR(instr.source)));
MOTH_END_INSTR(Increment)
MOTH_BEGIN_INSTR(Decrement)
- STOREVALUE(instr.result, __qmljs_decrement(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::decrement(VALUEPTR(instr.source)));
MOTH_END_INSTR(Decrement)
MOTH_BEGIN_INSTR(Binop)
@@ -596,19 +596,19 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(Binop)
MOTH_BEGIN_INSTR(Add)
- STOREVALUE(instr.result, __qmljs_add(context, VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::add(context, VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
MOTH_END_INSTR(Add)
MOTH_BEGIN_INSTR(BitAnd)
- STOREVALUE(instr.result, __qmljs_bit_and(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::bitAnd(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
MOTH_END_INSTR(BitAnd)
MOTH_BEGIN_INSTR(BitOr)
- STOREVALUE(instr.result, __qmljs_bit_or(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::bitOr(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
MOTH_END_INSTR(BitOr)
MOTH_BEGIN_INSTR(BitXor)
- STOREVALUE(instr.result, __qmljs_bit_xor(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::bitXor(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
MOTH_END_INSTR(BitXor)
MOTH_BEGIN_INSTR(Shr)
@@ -643,11 +643,11 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(ShlConst)
MOTH_BEGIN_INSTR(Mul)
- STOREVALUE(instr.result, __qmljs_mul(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::mul(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
MOTH_END_INSTR(Mul)
MOTH_BEGIN_INSTR(Sub)
- STOREVALUE(instr.result, __qmljs_sub(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::sub(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
MOTH_END_INSTR(Sub)
MOTH_BEGIN_INSTR(BinopContext)
@@ -676,23 +676,23 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(LoadThis)
MOTH_BEGIN_INSTR(LoadQmlIdArray)
- VALUE(instr.result) = __qmljs_get_id_array(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlIdArray(static_cast<QV4::NoThrowContext*>(context));
MOTH_END_INSTR(LoadQmlIdArray)
MOTH_BEGIN_INSTR(LoadQmlImportedScripts)
- VALUE(instr.result) = __qmljs_get_imported_scripts(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlImportedScripts(static_cast<QV4::NoThrowContext*>(context));
MOTH_END_INSTR(LoadQmlImportedScripts)
MOTH_BEGIN_INSTR(LoadQmlContextObject)
- VALUE(instr.result) = __qmljs_get_context_object(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlContextObject(static_cast<QV4::NoThrowContext*>(context));
MOTH_END_INSTR(LoadContextObject)
MOTH_BEGIN_INSTR(LoadQmlScopeObject)
- VALUE(instr.result) = __qmljs_get_scope_object(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlScopeObject(static_cast<QV4::NoThrowContext*>(context));
MOTH_END_INSTR(LoadScopeObject)
MOTH_BEGIN_INSTR(LoadQmlSingleton)
- VALUE(instr.result) = __qmljs_get_qml_singleton(static_cast<QV4::NoThrowContext*>(context), runtimeStrings[instr.name]);
+ VALUE(instr.result) = Runtime::getQmlSingleton(static_cast<QV4::NoThrowContext*>(context), runtimeStrings[instr.name]);
MOTH_END_INSTR(LoadQmlSingleton)
#ifdef MOTH_THREADED_INTERPRETER