Rename Context to ExecutionContext

This is so it'll map to the name used in the
ECMAScript spec once the other refactorings
are in.

Change-Id: I8dcc7ad43b457ce50e7123c57bc4c770bcda8d11
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
Lars Knoll 2012-11-16 23:07:10 +01:00 committed by Simon Hausmann
parent d6553a206b
commit d7416a80fa
16 changed files with 951 additions and 951 deletions

View File

@ -47,12 +47,12 @@ using namespace QQmlJS::VM;
extern "C" {
void __qmljs_llvm_return(Context *ctx, Value *result)
void __qmljs_llvm_return(ExecutionContext *ctx, Value *result)
{
ctx->result = *result;
}
Value *__qmljs_llvm_get_argument(Context *ctx, int index)
Value *__qmljs_llvm_get_argument(ExecutionContext *ctx, int index)
{
return &ctx->arguments[index];
}
@ -77,404 +77,404 @@ void __qmljs_llvm_init_number(Value *result, double value)
*result = Value::fromDouble(value);
}
void __qmljs_llvm_init_string(Context *ctx, Value *result, const char *str)
void __qmljs_llvm_init_string(ExecutionContext *ctx, Value *result, const char *str)
{
*result = Value::fromString(__qmljs_string_from_utf8(ctx, str));
}
void __qmljs_llvm_init_native_function(Context *ctx, Value *result, void (*code)(Context *))
void __qmljs_llvm_init_native_function(ExecutionContext *ctx, Value *result, void (*code)(ExecutionContext *))
{
*result = __qmljs_init_native_function(code, ctx);
}
bool __qmljs_llvm_to_boolean(Context *ctx, const Value *value)
bool __qmljs_llvm_to_boolean(ExecutionContext *ctx, const Value *value)
{
return __qmljs_to_boolean(*value, ctx);
}
void __qmljs_llvm_bit_and(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_bit_and(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_bit_and(*left, *right, ctx);
}
void __qmljs_llvm_bit_or(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_bit_or(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_bit_or(*left, *right, ctx);
}
void __qmljs_llvm_bit_xor(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_bit_xor(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_bit_xor(*left, *right, ctx);
}
void __qmljs_llvm_add(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_add(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_add(*left, *right, ctx);
}
void __qmljs_llvm_sub(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_sub(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_sub(*left, *right, ctx);
}
void __qmljs_llvm_mul(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_mul(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_mul(*left, *right, ctx);
}
void __qmljs_llvm_div(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_div(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_div(*left, *right, ctx);
}
void __qmljs_llvm_mod(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_mod(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_mod(*left, *right, ctx);
}
void __qmljs_llvm_shl(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_shl(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_shl(*left, *right, ctx);
}
void __qmljs_llvm_shr(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_shr(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_shr(*left, *right, ctx);
}
void __qmljs_llvm_ushr(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_ushr(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_ushr(*left, *right, ctx);
}
void __qmljs_llvm_gt(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_gt(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_gt(*left, *right, ctx);
}
void __qmljs_llvm_lt(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_lt(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_lt(*left, *right, ctx);
}
void __qmljs_llvm_ge(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_ge(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_ge(*left, *right, ctx);
}
void __qmljs_llvm_le(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_le(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_le(*left, *right, ctx);
}
void __qmljs_llvm_eq(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_eq(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_eq(*left, *right, ctx);
}
void __qmljs_llvm_ne(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_ne(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_ne(*left, *right, ctx);
}
void __qmljs_llvm_se(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_se(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_se(*left, *right, ctx);
}
void __qmljs_llvm_sne(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_sne(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_sne(*left, *right, ctx);
}
void __qmljs_llvm_instanceof(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_instanceof(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_instanceof(*left, *right, ctx);
}
void __qmljs_llvm_in(Context *ctx, Value *result, Value *left, Value *right)
void __qmljs_llvm_in(ExecutionContext *ctx, Value *result, Value *left, Value *right)
{
*result = __qmljs_in(*left, *right, ctx);
}
void __qmljs_llvm_uplus(Context *ctx, Value *result, const Value *value)
void __qmljs_llvm_uplus(ExecutionContext *ctx, Value *result, const Value *value)
{
*result = __qmljs_uplus(*value, ctx);
}
void __qmljs_llvm_uminus(Context *ctx, Value *result, const Value *value)
void __qmljs_llvm_uminus(ExecutionContext *ctx, Value *result, const Value *value)
{
*result = __qmljs_uminus(*value, ctx);
}
void __qmljs_llvm_compl(Context *ctx, Value *result, const Value *value)
void __qmljs_llvm_compl(ExecutionContext *ctx, Value *result, const Value *value)
{
*result = __qmljs_compl(*value, ctx);
}
void __qmljs_llvm_not(Context *ctx, Value *result, const Value *value)
void __qmljs_llvm_not(ExecutionContext *ctx, Value *result, const Value *value)
{
*result = __qmljs_not(*value, ctx);
}
void __qmljs_llvm_inplace_bit_and_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_bit_and_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_bit_and_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_bit_or_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_bit_or_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_bit_or_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_bit_xor_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_bit_xor_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_bit_xor_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_add_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_add_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_add_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_sub_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_sub_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_sub_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_mul_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_mul_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_mul_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_div_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_div_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_div_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_mod_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_mod_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_mod_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_shl_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_shl_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_shl_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_shr_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_shr_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_shr_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_ushr_name(Context *ctx, String *dest, Value *src)
void __qmljs_llvm_inplace_ushr_name(ExecutionContext *ctx, String *dest, Value *src)
{
__qmljs_inplace_ushr_name(*src, dest, ctx);
}
void __qmljs_llvm_inplace_bit_and_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_bit_and_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_bit_and_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_bit_or_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_bit_or_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_bit_or_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_bit_xor_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_bit_xor_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_bit_xor_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_add_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_add_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_add_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_sub_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_sub_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_sub_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_mul_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_mul_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_mul_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_div_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_div_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_div_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_mod_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_mod_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_mod_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_shl_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_shl_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_shl_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_shr_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_shr_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_shr_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_ushr_element(Context *ctx, Value *base, Value *index, Value *value)
void __qmljs_llvm_inplace_ushr_element(ExecutionContext *ctx, Value *base, Value *index, Value *value)
{
__qmljs_inplace_ushr_element(*base, *index, *value, ctx);
}
void __qmljs_llvm_inplace_bit_and_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_bit_and_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_bit_and_member(*value, *base, member, ctx);
}
void __qmljs_llvm_inplace_bit_or_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_bit_or_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_bit_or_member(*value, *base, member, ctx);
}
void __qmljs_llvm_inplace_bit_xor_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_bit_xor_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_bit_xor_member(*value, *base, member, ctx);
}
void __qmljs_llvm_inplace_add_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_add_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_add_member(*value, *base, member, ctx);
}
void __qmljs_llvm_inplace_sub_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_sub_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_sub_member(*value, *base, member, ctx);
}
void __qmljs_llvm_inplace_mul_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_mul_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_mul_member(*value, *base, member, ctx);
}
void __qmljs_llvm_inplace_div_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_div_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_div_member(*value, *base, member, ctx);
}
void __qmljs_llvm_inplace_mod_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_mod_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_mod_member(*value, *base, member, ctx);
}
void __qmljs_llvm_inplace_shl_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_shl_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_shl_member(*value, *base, member, ctx);
}
void __qmljs_llvm_inplace_shr_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_shr_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_shr_member(*value, *base, member, ctx);
}
void __qmljs_llvm_inplace_ushr_member(Context *ctx, Value *value, Value *base, String *member)
void __qmljs_llvm_inplace_ushr_member(ExecutionContext *ctx, Value *value, Value *base, String *member)
{
__qmljs_inplace_ushr_member(*value, *base, member, ctx);
}
String *__qmljs_llvm_identifier_from_utf8(Context *ctx, const char *str)
String *__qmljs_llvm_identifier_from_utf8(ExecutionContext *ctx, const char *str)
{
return __qmljs_identifier_from_utf8(ctx, str); // ### make it unique
}
void __qmljs_llvm_call_activation_property(Context *context, Value *result, String *name, Value *args, int argc)
void __qmljs_llvm_call_activation_property(ExecutionContext *context, Value *result, String *name, Value *args, int argc)
{
*result = __qmljs_call_activation_property(context, name, args, argc);
}
void __qmljs_llvm_call_value(Context *context, Value *result, const Value *thisObject, const Value *func, Value *args, int argc)
void __qmljs_llvm_call_value(ExecutionContext *context, Value *result, const Value *thisObject, const Value *func, Value *args, int argc)
{
Value that = thisObject ? *thisObject : Value::undefinedValue();
*result = __qmljs_call_value(context, that, *func, args, argc);
}
void __qmljs_llvm_construct_activation_property(Context *context, Value *result, String *name, Value *args, int argc)
void __qmljs_llvm_construct_activation_property(ExecutionContext *context, Value *result, String *name, Value *args, int argc)
{
*result = __qmljs_construct_activation_property(context, name, args, argc);
}
void __qmljs_llvm_construct_value(Context *context, Value *result, const Value *func, Value *args, int argc)
void __qmljs_llvm_construct_value(ExecutionContext *context, Value *result, const Value *func, Value *args, int argc)
{
*result = __qmljs_construct_value(context, *func, args, argc);
}
void __qmljs_llvm_get_activation_property(Context *ctx, Value *result, String *name)
void __qmljs_llvm_get_activation_property(ExecutionContext *ctx, Value *result, String *name)
{
*result = __qmljs_get_activation_property(ctx, name);
}
void __qmljs_llvm_set_activation_property(Context *ctx, String *name, Value *value)
void __qmljs_llvm_set_activation_property(ExecutionContext *ctx, String *name, Value *value)
{
__qmljs_set_activation_property(ctx, name, *value);
}
void __qmljs_llvm_get_property(Context *ctx, Value *result, Value *object, String *name)
void __qmljs_llvm_get_property(ExecutionContext *ctx, Value *result, Value *object, String *name)
{
*result = __qmljs_get_property(ctx, *object, name);
}
void __qmljs_llvm_call_property(Context *context, Value *result, const Value *base, String *name, Value *args, int argc)
void __qmljs_llvm_call_property(ExecutionContext *context, Value *result, const Value *base, String *name, Value *args, int argc)
{
*result = __qmljs_call_property(context, *base, name, args, argc);
}
void __qmljs_llvm_construct_property(Context *context, Value *result, const Value *base, String *name, Value *args, int argc)
void __qmljs_llvm_construct_property(ExecutionContext *context, Value *result, const Value *base, String *name, Value *args, int argc)
{
*result = __qmljs_construct_property(context, *base, name, args, argc);
}
void __qmljs_llvm_get_element(Context *ctx, Value *result, Value *object, Value *index)
void __qmljs_llvm_get_element(ExecutionContext *ctx, Value *result, Value *object, Value *index)
{
*result = __qmljs_get_element(ctx, *object, *index);
}
void __qmljs_llvm_set_element(Context *ctx, Value *object, Value *index, Value *value)
void __qmljs_llvm_set_element(ExecutionContext *ctx, Value *object, Value *index, Value *value)
{
__qmljs_set_element(ctx, *object, *index, *value);
}
void __qmljs_llvm_set_property(Context *ctx, Value *object, String *name, Value *value)
void __qmljs_llvm_set_property(ExecutionContext *ctx, Value *object, String *name, Value *value)
{
__qmljs_set_property(ctx, *object, name, *value);
}
void __qmljs_llvm_typeof(Context *ctx, Value *result, const Value *value)
void __qmljs_llvm_typeof(ExecutionContext *ctx, Value *result, const Value *value)
{
*result = __qmljs_typeof(*value, ctx);
}
void __qmljs_llvm_throw(Context *context, Value *value)
void __qmljs_llvm_throw(ExecutionContext *context, Value *value)
{
__qmljs_throw(*value, context);
}
void __qmljs_llvm_create_exception_handler(Context *context, Value *result)
void __qmljs_llvm_create_exception_handler(ExecutionContext *context, Value *result)
{
void *buf = __qmljs_create_exception_handler(context);
*result = Value::fromInt32(setjmp(* static_cast<jmp_buf *>(buf)));
}
void __qmljs_llvm_delete_exception_handler(Context *context)
void __qmljs_llvm_delete_exception_handler(ExecutionContext *context)
{
__qmljs_delete_exception_handler(context);
}
void __qmljs_llvm_get_exception(Context *context, Value *result)
void __qmljs_llvm_get_exception(ExecutionContext *context, Value *result)
{
*result = __qmljs_get_exception(context);
}
void __qmljs_llvm_foreach_iterator_object(Context *context, Value *result, Value *in)
void __qmljs_llvm_foreach_iterator_object(ExecutionContext *context, Value *result, Value *in)
{
*result = __qmljs_foreach_iterator_object(*in, context);
}
@ -484,27 +484,27 @@ void __qmljs_llvm_foreach_next_property_name(Value *result, Value *it)
*result = __qmljs_foreach_next_property_name(*it);
}
void __qmljs_llvm_get_this_object(Context *ctx, Value *result)
void __qmljs_llvm_get_this_object(ExecutionContext *ctx, Value *result)
{
*result = __qmljs_get_thisObject(ctx);
}
void __qmljs_llvm_delete_subscript(Context *ctx, Value *result, Value *base, Value *index)
void __qmljs_llvm_delete_subscript(ExecutionContext *ctx, Value *result, Value *base, Value *index)
{
*result = __qmljs_delete_subscript(ctx, *base, *index);
}
void __qmljs_llvm_delete_member(Context *ctx, Value *result, Value *base, String *name)
void __qmljs_llvm_delete_member(ExecutionContext *ctx, Value *result, Value *base, String *name)
{
*result = __qmljs_delete_member(ctx, *base, name);
}
void __qmljs_llvm_delete_property(Context *ctx, Value *result, String *name)
void __qmljs_llvm_delete_property(ExecutionContext *ctx, Value *result, String *name)
{
*result = __qmljs_delete_property(ctx, name);
}
void __qmljs_llvm_delete_value(Context *ctx, Value *result, Value *value)
void __qmljs_llvm_delete_value(ExecutionContext *ctx, Value *result, Value *value)
{
*result = __qmljs_delete_value(ctx, *value);
}

View File

@ -67,9 +67,9 @@ using namespace QQmlJS::VM;
struct Print: FunctionObject
{
Print(Context *scope): FunctionObject(scope) {}
Print(ExecutionContext *scope): FunctionObject(scope) {}
virtual void call(Context *ctx)
virtual void call(ExecutionContext *ctx)
{
for (unsigned int i = 0; i < ctx->argumentCount; ++i) {
String *s = ctx->argument(i).toString(ctx);
@ -83,9 +83,9 @@ struct Print: FunctionObject
struct TestHarnessError: FunctionObject
{
TestHarnessError(Context *scope, bool &errorInTestHarness): FunctionObject(scope), errorOccurred(errorInTestHarness) {}
TestHarnessError(ExecutionContext *scope, bool &errorInTestHarness): FunctionObject(scope), errorOccurred(errorInTestHarness) {}
virtual void call(Context *ctx)
virtual void call(ExecutionContext *ctx)
{
errorOccurred = true;
@ -282,7 +282,7 @@ int main(int argc, char *argv[])
case use_moth: {
bool useInterpreter = mode == use_moth;
QQmlJS::VM::ExecutionEngine vm;
QQmlJS::VM::Context *ctx = vm.rootContext;
QQmlJS::VM::ExecutionContext *ctx = vm.rootContext;
QQmlJS::VM::Object *globalObject = vm.globalObject.objectValue();
globalObject->__put__(ctx, vm.identifier(QStringLiteral("print")),

View File

@ -240,13 +240,13 @@ union Instr
};
struct instr_unop {
MOTH_INSTR_HEADER
VM::Value (*alu)(const VM::Value value, VM::Context *ctx);
VM::Value (*alu)(const VM::Value value, VM::ExecutionContext *ctx);
int e;
int targetTempIndex;
};
struct instr_binop {
MOTH_INSTR_HEADER
VM::Value (*alu)(const VM::Value , const VM::Value, VM::Context *);
VM::Value (*alu)(const VM::Value , const VM::Value, VM::ExecutionContext *);
int targetTempIndex;
ValueOrTemp lhs;
ValueOrTemp rhs;
@ -259,7 +259,7 @@ union Instr
};
struct instr_inplaceElementOp {
MOTH_INSTR_HEADER
void (*alu)(VM::Value, VM::Value, VM::Value, VM::Context *);
void (*alu)(VM::Value, VM::Value, VM::Value, VM::ExecutionContext *);
int targetBase;
int targetIndex;
ValueOrTemp source;
@ -267,7 +267,7 @@ union Instr
};
struct instr_inplaceMemberOp {
MOTH_INSTR_HEADER
void (*alu)(VM::Value, VM::Value, VM::String *, VM::Context *);
void (*alu)(VM::Value, VM::Value, VM::String *, VM::ExecutionContext *);
int targetBase;
VM::String *targetMember;
ValueOrTemp source;
@ -275,7 +275,7 @@ union Instr
};
struct instr_inplaceNameOp {
MOTH_INSTR_HEADER
void (*alu)(VM::Value, VM::String *, VM::Context *);
void (*alu)(VM::Value, VM::String *, VM::ExecutionContext *);
VM::String *targetName;
ValueOrTemp source;
unsigned sourceIsTemp:1;

View File

@ -307,7 +307,7 @@ void InstructionSelection::visitLeave(IR::Leave *)
Q_UNREACHABLE();
}
typedef VM::Value (*ALUFunction)(const VM::Value, const VM::Value, VM::Context*);
typedef VM::Value (*ALUFunction)(const VM::Value, const VM::Value, VM::ExecutionContext*);
static inline ALUFunction aluOpFunction(IR::AluOp op)
{
switch (op) {
@ -461,7 +461,7 @@ void InstructionSelection::visitMove(IR::Move *s)
addInstruction(load);
} else if (IR::Unop *u = s->source->asUnop()) {
if (IR::Temp *e = u->expr->asTemp()) {
VM::Value (*op)(const VM::Value value, VM::Context *ctx) = 0;
VM::Value (*op)(const VM::Value value, VM::ExecutionContext *ctx) = 0;
switch (u->op) {
case IR::OpIfTrue: assert(!"unreachable"); break;
case IR::OpNot: op = VM::__qmljs_not; break;
@ -506,7 +506,7 @@ void InstructionSelection::visitMove(IR::Move *s)
return;
} else if (IR::Name *n = s->target->asName()) {
if (s->source->asTemp() || s->source->asConst()) {
void (*op)(VM::Value value, VM::String *name, VM::Context *ctx) = 0;
void (*op)(VM::Value value, VM::String *name, VM::ExecutionContext *ctx) = 0;
switch (s->op) {
case IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_name; break;
case IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_name; break;
@ -540,7 +540,7 @@ void InstructionSelection::visitMove(IR::Move *s)
qWarning("NAME");
} else if (IR::Subscript *ss = s->target->asSubscript()) {
if (s->source->asTemp() || s->source->asConst()) {
void (*op)(VM::Value base, VM::Value index, VM::Value value, VM::Context *ctx) = 0;
void (*op)(VM::Value base, VM::Value index, VM::Value value, VM::ExecutionContext *ctx) = 0;
switch (s->op) {
case IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_element; break;
case IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_element; break;
@ -576,7 +576,7 @@ void InstructionSelection::visitMove(IR::Move *s)
qWarning("SUBSCRIPT");
} else if (IR::Member *m = s->target->asMember()) {
if (s->source->asTemp() || s->source->asConst()) {
void (*op)(VM::Value value, VM::Value base, VM::String *name, VM::Context *ctx) = 0;
void (*op)(VM::Value value, VM::Value base, VM::String *name, VM::ExecutionContext *ctx) = 0;
switch (s->op) {
case IR::OpBitAnd: op = VM::__qmljs_inplace_bit_and_member; break;
case IR::OpBitOr: op = VM::__qmljs_inplace_bit_or_member; break;

View File

@ -47,7 +47,7 @@ using namespace QQmlJS::Moth;
#endif
static inline VM::Value *tempValue(QQmlJS::VM::Context *context, QVector<VM::Value> &stack, int index)
static inline VM::Value *tempValue(QQmlJS::VM::ExecutionContext *context, QVector<VM::Value> &stack, int index)
{
#ifdef DO_TRACE_INSTR
const char *kind;
@ -79,7 +79,7 @@ static inline VM::Value *tempValue(QQmlJS::VM::Context *context, QVector<VM::Val
#define TEMP(index) *tempValue(context, stack, index)
void VME::operator()(QQmlJS::VM::Context *context, const uchar *code
void VME::operator()(QQmlJS::VM::ExecutionContext *context, const uchar *code
#ifdef MOTH_THREADED_INTERPRETER
, void ***storeJumpTable
#endif
@ -345,20 +345,20 @@ void **VME::instructionJumpTable()
}
#endif
void VME::exec(VM::Context *ctxt, const uchar *code)
void VME::exec(VM::ExecutionContext *ctxt, const uchar *code)
{
VME vme;
vme(ctxt, code);
}
void VME::restoreState(VM::Context *context, int &targetTempIndex, const uchar *&code)
void VME::restoreState(VM::ExecutionContext *context, int &targetTempIndex, const uchar *&code)
{
VM::ExecutionEngine::ExceptionHandler &handler = context->engine->unwindStack.last();
targetTempIndex = handler.targetTempIndex;
code = handler.code;
}
void VME::saveState(VM::Context *context, int targetTempIndex, const uchar *code)
void VME::saveState(VM::ExecutionContext *context, int targetTempIndex, const uchar *code)
{
VM::ExecutionEngine::ExceptionHandler &handler = context->engine->unwindStack.last();
handler.targetTempIndex = targetTempIndex;

View File

@ -10,9 +10,9 @@ namespace Moth {
class VME
{
public:
static void exec(VM::Context *, const uchar *);
static void exec(VM::ExecutionContext *, const uchar *);
void operator()(QQmlJS::VM::Context *, const uchar *code
void operator()(QQmlJS::VM::ExecutionContext *, const uchar *code
#ifdef MOTH_THREADED_INTERPRETER
, void ***storeJumpTable = 0
#endif
@ -23,8 +23,8 @@ public:
#endif
private:
static void restoreState(VM::Context *context, int &targetTempIndex, const uchar *&code);
static void saveState(VM::Context *context, int targetTempIndex, const uchar *code);
static void restoreState(VM::ExecutionContext *context, int &targetTempIndex, const uchar *&code);
static void saveState(VM::ExecutionContext *context, int targetTempIndex, const uchar *code);
};
} // namespace Moth

View File

@ -68,18 +68,18 @@ Object::~Object()
delete members;
}
void Object::__put__(Context *ctx, const QString &name, const Value &value)
void Object::__put__(ExecutionContext *ctx, const QString &name, const Value &value)
{
__put__(ctx, ctx->engine->identifier(name), value);
}
void Object::__put__(Context *ctx, const QString &name, void (*code)(Context *), int count)
void Object::__put__(ExecutionContext *ctx, const QString &name, void (*code)(ExecutionContext *), int count)
{
Q_UNUSED(count);
__put__(ctx, name, Value::fromObject(ctx->engine->newNativeFunction(ctx, code)));
}
Value Object::getValue(Context *ctx, PropertyDescriptor *p) const
Value Object::getValue(ExecutionContext *ctx, PropertyDescriptor *p) const
{
if (p->isData())
return p->value;
@ -90,7 +90,7 @@ Value Object::getValue(Context *ctx, PropertyDescriptor *p) const
return ctx->result;
}
bool Object::inplaceBinOp(Value rhs, String *name, BinOp op, Context *ctx)
bool Object::inplaceBinOp(Value rhs, String *name, BinOp op, ExecutionContext *ctx)
{
PropertyDescriptor to_fill;
PropertyDescriptor *pd = __getPropertyDescriptor__(ctx, name, &to_fill);
@ -101,7 +101,7 @@ bool Object::inplaceBinOp(Value rhs, String *name, BinOp op, Context *ctx)
return true;
}
bool Object::inplaceBinOp(Value rhs, Value index, BinOp op, Context *ctx)
bool Object::inplaceBinOp(Value rhs, Value index, BinOp op, ExecutionContext *ctx)
{
String *name = index.toString(ctx);
assert(name);
@ -109,7 +109,7 @@ bool Object::inplaceBinOp(Value rhs, Value index, BinOp op, Context *ctx)
}
// Section 8.12.1
PropertyDescriptor *Object::__getOwnProperty__(Context *, String *name)
PropertyDescriptor *Object::__getOwnProperty__(ExecutionContext *, String *name)
{
if (members)
return members->find(name);
@ -117,7 +117,7 @@ PropertyDescriptor *Object::__getOwnProperty__(Context *, String *name)
}
// Section 8.12.2
PropertyDescriptor *Object::__getPropertyDescriptor__(Context *ctx, String *name, PropertyDescriptor *to_fill)
PropertyDescriptor *Object::__getPropertyDescriptor__(ExecutionContext *ctx, String *name, PropertyDescriptor *to_fill)
{
if (PropertyDescriptor *p = __getOwnProperty__(ctx, name))
return p;
@ -128,7 +128,7 @@ PropertyDescriptor *Object::__getPropertyDescriptor__(Context *ctx, String *name
}
// Section 8.12.3
Value Object::__get__(Context *ctx, String *name)
Value Object::__get__(ExecutionContext *ctx, String *name)
{
if (name->isEqualTo(ctx->engine->id___proto__))
return Value::fromObject(prototype);
@ -141,7 +141,7 @@ Value Object::__get__(Context *ctx, String *name)
}
// Section 8.12.4
bool Object::__canPut__(Context *ctx, String *name)
bool Object::__canPut__(ExecutionContext *ctx, String *name)
{
if (PropertyDescriptor *p = __getOwnProperty__(ctx, name)) {
if (p->isAccessor())
@ -166,7 +166,7 @@ bool Object::__canPut__(Context *ctx, String *name)
}
// Section 8.12.5
void Object::__put__(Context *ctx, String *name, const Value &value, bool throwException)
void Object::__put__(ExecutionContext *ctx, String *name, const Value &value, bool throwException)
{
// clause 1
if (!__canPut__(ctx, name))
@ -216,7 +216,7 @@ void Object::__put__(Context *ctx, String *name, const Value &value, bool throwE
}
// Section 8.12.6
bool Object::__hasProperty__(Context *ctx, String *name) const
bool Object::__hasProperty__(ExecutionContext *ctx, String *name) const
{
if (members)
return members->find(name) != 0;
@ -225,7 +225,7 @@ bool Object::__hasProperty__(Context *ctx, String *name) const
}
// Section 8.12.7
bool Object::__delete__(Context *ctx, String *name, bool throwException)
bool Object::__delete__(ExecutionContext *ctx, String *name, bool throwException)
{
if (members) {
if (PropertyTableEntry *entry = members->findEntry(name)) {
@ -242,7 +242,7 @@ bool Object::__delete__(Context *ctx, String *name, bool throwException)
}
// Section 8.12.9
bool Object::__defineOwnProperty__(Context *ctx, String *name, PropertyDescriptor *desc, bool throwException)
bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, PropertyDescriptor *desc, bool throwException)
{
if (!members)
members = new PropertyTable();
@ -340,14 +340,14 @@ String *ForEachIteratorObject::nextPropertyName()
}
}
Value ArrayObject::__get__(Context *ctx, String *name)
Value ArrayObject::__get__(ExecutionContext *ctx, String *name)
{
if (name->isEqualTo(ctx->engine->id_length))
return Value::fromDouble(value.size());
return Object::__get__(ctx, name);
}
bool ArrayObject::inplaceBinOp(Value rhs, Value index, BinOp op, Context *ctx)
bool ArrayObject::inplaceBinOp(Value rhs, Value index, BinOp op, ExecutionContext *ctx)
{
if (index.isNumber()) {
const quint32 idx = index.toUInt32(ctx);
@ -359,7 +359,7 @@ bool ArrayObject::inplaceBinOp(Value rhs, Value index, BinOp op, Context *ctx)
return Object::inplaceBinOp(rhs, index, op, ctx);
}
bool FunctionObject::hasInstance(Context *ctx, const Value &value)
bool FunctionObject::hasInstance(ExecutionContext *ctx, const Value &value)
{
if (! value.isObject()) {
ctx->throwTypeError();
@ -385,20 +385,20 @@ bool FunctionObject::hasInstance(Context *ctx, const Value &value)
return false;
}
Value FunctionObject::construct(Context *context, Value *args, int argc)
Value FunctionObject::construct(ExecutionContext *context, Value *args, int argc)
{
Context k;
Context *ctx = needsActivation ? context->engine->newContext() : &k;
ExecutionContext k;
ExecutionContext *ctx = needsActivation ? context->engine->newContext() : &k;
ctx->initConstructorContext(context, Value::nullValue(), this, args, argc);
construct(ctx);
ctx->leaveConstructorContext(this);
return ctx->result;
}
Value FunctionObject::call(Context *context, Value thisObject, Value *args, int argc, bool strictMode)
Value FunctionObject::call(ExecutionContext *context, Value thisObject, Value *args, int argc, bool strictMode)
{
Context k;
Context *ctx = needsActivation ? context->engine->newContext() : &k;
ExecutionContext k;
ExecutionContext *ctx = needsActivation ? context->engine->newContext() : &k;
if (!strictMode && !thisObject.isObject()) {
if (thisObject.isUndefined() || thisObject.isNull())
@ -412,18 +412,18 @@ Value FunctionObject::call(Context *context, Value thisObject, Value *args, int
return ctx->result;
}
void FunctionObject::call(Context *ctx)
void FunctionObject::call(ExecutionContext *ctx)
{
Q_UNUSED(ctx);
}
void FunctionObject::construct(Context *ctx)
void FunctionObject::construct(ExecutionContext *ctx)
{
ctx->thisObject = Value::fromObject(ctx->engine->newObject());
call(ctx);
}
ScriptFunction::ScriptFunction(Context *scope, IR::Function *function)
ScriptFunction::ScriptFunction(ExecutionContext *scope, IR::Function *function)
: FunctionObject(scope)
, function(function)
{
@ -453,13 +453,13 @@ ScriptFunction::~ScriptFunction()
delete[] varList;
}
void ScriptFunction::call(VM::Context *ctx)
void ScriptFunction::call(VM::ExecutionContext *ctx)
{
function->code(ctx, function->codeData);
}
Value EvalFunction::call(Context *context, Value thisObject, Value *args, int argc, bool strictMode)
Value EvalFunction::call(ExecutionContext *context, Value thisObject, Value *args, int argc, bool strictMode)
{
Value s = context->argument(0);
if (!s.isString()) {
@ -471,7 +471,7 @@ Value EvalFunction::call(Context *context, Value thisObject, Value *args, int ar
// ### how to determine this correctly
bool directCall = true;
Context k, *ctx;
ExecutionContext k, *ctx;
if (!directCall) {
// ###
} else if (strictMode) {
@ -497,7 +497,7 @@ static inline bool protect(const void *addr, size_t size)
}
int EvalFunction::evaluate(QQmlJS::VM::Context *ctx, const QString &fileName,
int EvalFunction::evaluate(QQmlJS::VM::ExecutionContext *ctx, const QString &fileName,
const QString &source, bool useInterpreter,
QQmlJS::Codegen::Mode mode)
{
@ -589,7 +589,7 @@ int EvalFunction::evaluate(QQmlJS::VM::Context *ctx, const QString &fileName,
}
Value RegExpObject::__get__(Context *ctx, String *name)
Value RegExpObject::__get__(ExecutionContext *ctx, String *name)
{
QString n = name->toQString();
if (n == QLatin1String("source"))
@ -605,7 +605,7 @@ Value RegExpObject::__get__(Context *ctx, String *name)
return Object::__get__(ctx, name);
}
Value ErrorObject::__get__(Context *ctx, String *name)
Value ErrorObject::__get__(ExecutionContext *ctx, String *name)
{
QString n = name->toQString();
if (n == QLatin1String("message"))
@ -613,12 +613,12 @@ Value ErrorObject::__get__(Context *ctx, String *name)
return Object::__get__(ctx, name);
}
void ErrorObject::setNameProperty(Context *ctx)
void ErrorObject::setNameProperty(ExecutionContext *ctx)
{
__put__(ctx, QLatin1String("name"), Value::fromString(ctx, className()));
}
void ScriptFunction::construct(VM::Context *ctx)
void ScriptFunction::construct(VM::ExecutionContext *ctx)
{
Object *obj = ctx->engine->newObject();
Value proto = __get__(ctx, ctx->engine->id_prototype);
@ -628,7 +628,7 @@ void ScriptFunction::construct(VM::Context *ctx)
function->code(ctx, function->codeData);
}
PropertyDescriptor *ActivationObject::__getPropertyDescriptor__(Context *ctx, String *name, PropertyDescriptor *to_fill)
PropertyDescriptor *ActivationObject::__getPropertyDescriptor__(ExecutionContext *ctx, String *name, PropertyDescriptor *to_fill)
{
if (context) {
for (unsigned int i = 0; i < context->varCount; ++i) {
@ -665,14 +665,14 @@ PropertyDescriptor *ActivationObject::__getPropertyDescriptor__(Context *ctx, St
return Object::__getPropertyDescriptor__(ctx, name, to_fill);
}
Value ArgumentsObject::__get__(Context *ctx, String *name)
Value ArgumentsObject::__get__(ExecutionContext *ctx, String *name)
{
if (name->isEqualTo(ctx->engine->id_length))
return Value::fromDouble(context->argumentCount);
return Object::__get__(ctx, name);
}
PropertyDescriptor *ArgumentsObject::__getPropertyDescriptor__(Context *ctx, String *name, PropertyDescriptor *to_fill)
PropertyDescriptor *ArgumentsObject::__getPropertyDescriptor__(ExecutionContext *ctx, String *name, PropertyDescriptor *to_fill)
{
if (context) {
const quint32 i = Value::fromString(name).toUInt32(ctx);
@ -807,9 +807,9 @@ ExecutionEngine::ExecutionEngine()
}
Context *ExecutionEngine::newContext()
ExecutionContext *ExecutionEngine::newContext()
{
return new Context();
return new ExecutionContext();
}
String *ExecutionEngine::identifier(const QString &s)
@ -820,14 +820,14 @@ String *ExecutionEngine::identifier(const QString &s)
return id;
}
FunctionObject *ExecutionEngine::newNativeFunction(Context *scope, void (*code)(Context *))
FunctionObject *ExecutionEngine::newNativeFunction(ExecutionContext *scope, void (*code)(ExecutionContext *))
{
NativeFunction *f = new NativeFunction(scope, code);
f->prototype = scope->engine->functionPrototype;
return f;
}
FunctionObject *ExecutionEngine::newScriptFunction(Context *scope, IR::Function *function)
FunctionObject *ExecutionEngine::newScriptFunction(ExecutionContext *scope, IR::Function *function)
{
ScriptFunction *f = new ScriptFunction(scope, function);
Object *proto = scope->engine->newObject();
@ -844,7 +844,7 @@ Object *ExecutionEngine::newObject()
return object;
}
FunctionObject *ExecutionEngine::newObjectCtor(Context *ctx)
FunctionObject *ExecutionEngine::newObjectCtor(ExecutionContext *ctx)
{
return new ObjectCtor(ctx);
}
@ -861,7 +861,7 @@ Object *ExecutionEngine::newStringObject(const Value &value)
return object;
}
FunctionObject *ExecutionEngine::newStringCtor(Context *ctx)
FunctionObject *ExecutionEngine::newStringCtor(ExecutionContext *ctx)
{
return new StringCtor(ctx);
}
@ -873,7 +873,7 @@ Object *ExecutionEngine::newNumberObject(const Value &value)
return object;
}
FunctionObject *ExecutionEngine::newNumberCtor(Context *ctx)
FunctionObject *ExecutionEngine::newNumberCtor(ExecutionContext *ctx)
{
return new NumberCtor(ctx);
}
@ -885,19 +885,19 @@ Object *ExecutionEngine::newBooleanObject(const Value &value)
return object;
}
FunctionObject *ExecutionEngine::newBooleanCtor(Context *ctx)
FunctionObject *ExecutionEngine::newBooleanCtor(ExecutionContext *ctx)
{
return new BooleanCtor(ctx);
}
Object *ExecutionEngine::newFunctionObject(Context *ctx)
Object *ExecutionEngine::newFunctionObject(ExecutionContext *ctx)
{
Object *object = new FunctionObject(ctx);
object->prototype = functionPrototype;
return object;
}
FunctionObject *ExecutionEngine::newFunctionCtor(Context *ctx)
FunctionObject *ExecutionEngine::newFunctionCtor(ExecutionContext *ctx)
{
return new FunctionCtor(ctx);
}
@ -916,7 +916,7 @@ Object *ExecutionEngine::newArrayObject(const Array &value)
return object;
}
FunctionObject *ExecutionEngine::newArrayCtor(Context *ctx)
FunctionObject *ExecutionEngine::newArrayCtor(ExecutionContext *ctx)
{
return new ArrayCtor(ctx);
}
@ -928,7 +928,7 @@ Object *ExecutionEngine::newDateObject(const Value &value)
return object;
}
FunctionObject *ExecutionEngine::newDateCtor(Context *ctx)
FunctionObject *ExecutionEngine::newDateCtor(ExecutionContext *ctx)
{
return new DateCtor(ctx);
}
@ -947,7 +947,7 @@ Object *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
return object;
}
FunctionObject *ExecutionEngine::newRegExpCtor(Context *ctx)
FunctionObject *ExecutionEngine::newRegExpCtor(ExecutionContext *ctx)
{
return new RegExpCtor(ctx);
}
@ -959,14 +959,14 @@ Object *ExecutionEngine::newErrorObject(const Value &value)
return object;
}
Object *ExecutionEngine::newMathObject(Context *ctx)
Object *ExecutionEngine::newMathObject(ExecutionContext *ctx)
{
MathObject *object = new MathObject(ctx);
object->prototype = objectPrototype;
return object;
}
Object *ExecutionEngine::newActivationObject(Context *ctx)
Object *ExecutionEngine::newActivationObject(ExecutionContext *ctx)
{
return new ActivationObject(ctx);
}

View File

@ -72,7 +72,7 @@ struct RegExpObject;
struct ErrorObject;
struct ActivationObject;
struct ArgumentsObject;
struct Context;
struct ExecutionContext;
struct ExecutionEngine;
struct ObjectPrototype;
@ -403,24 +403,24 @@ struct Object {
virtual ActivationObject *asActivationObject() { return 0; }
virtual ArgumentsObject *asArgumentsObject() { return 0; }
virtual Value __get__(Context *ctx, String *name);
virtual PropertyDescriptor *__getOwnProperty__(Context *ctx, String *name);
virtual PropertyDescriptor *__getPropertyDescriptor__(Context *ctx, String *name, PropertyDescriptor *to_fill);
virtual void __put__(Context *ctx, String *name, const Value &value, bool throwException = false);
virtual bool __canPut__(Context *ctx, String *name);
virtual bool __hasProperty__(Context *ctx, String *name) const;
virtual bool __delete__(Context *ctx, String *name, bool throwException);
virtual bool __defineOwnProperty__(Context *ctx, String *name, PropertyDescriptor *desc, bool throwException = false);
virtual Value __get__(ExecutionContext *ctx, String *name);
virtual PropertyDescriptor *__getOwnProperty__(ExecutionContext *ctx, String *name);
virtual PropertyDescriptor *__getPropertyDescriptor__(ExecutionContext *ctx, String *name, PropertyDescriptor *to_fill);
virtual void __put__(ExecutionContext *ctx, String *name, const Value &value, bool throwException = false);
virtual bool __canPut__(ExecutionContext *ctx, String *name);
virtual bool __hasProperty__(ExecutionContext *ctx, String *name) const;
virtual bool __delete__(ExecutionContext *ctx, String *name, bool throwException);
virtual bool __defineOwnProperty__(ExecutionContext *ctx, String *name, PropertyDescriptor *desc, bool throwException = false);
//
// helpers
//
void __put__(Context *ctx, const QString &name, const Value &value);
void __put__(Context *ctx, const QString &name, void (*code)(Context *), int count = 0);
void __put__(ExecutionContext *ctx, const QString &name, const Value &value);
void __put__(ExecutionContext *ctx, const QString &name, void (*code)(ExecutionContext *), int count = 0);
Value getValue(Context *ctx, PropertyDescriptor *p) const;
bool inplaceBinOp(Value rhs, String *name, BinOp op, Context *ctx);
virtual bool inplaceBinOp(Value rhs, Value index, BinOp op, Context *ctx);
Value getValue(ExecutionContext *ctx, PropertyDescriptor *p) const;
bool inplaceBinOp(Value rhs, String *name, BinOp op, ExecutionContext *ctx);
virtual bool inplaceBinOp(Value rhs, Value index, BinOp op, ExecutionContext *ctx);
};
struct ForEachIteratorObject: Object {
@ -467,13 +467,13 @@ struct ArrayObject: Object {
ArrayObject(const Array &value): value(value) {}
virtual QString className() { return QStringLiteral("Array"); }
virtual ArrayObject *asArrayObject() { return this; }
virtual Value __get__(Context *ctx, String *name);
virtual Value __get__(ExecutionContext *ctx, String *name);
virtual bool inplaceBinOp(Value rhs, Value index, BinOp op, Context *ctx);
virtual bool inplaceBinOp(Value rhs, Value index, BinOp op, ExecutionContext *ctx);
};
struct FunctionObject: Object {
Context *scope;
ExecutionContext *scope;
String *name;
String **formalParameterList;
unsigned int formalParameterCount;
@ -481,7 +481,7 @@ struct FunctionObject: Object {
unsigned int varCount;
bool needsActivation;
FunctionObject(Context *scope)
FunctionObject(ExecutionContext *scope)
: scope(scope)
, name(0)
, formalParameterList(0)
@ -492,43 +492,43 @@ struct FunctionObject: Object {
virtual QString className() { return QStringLiteral("Function"); }
virtual FunctionObject *asFunctionObject() { return this; }
virtual bool hasInstance(Context *ctx, const Value &value);
virtual bool hasInstance(ExecutionContext *ctx, const Value &value);
Value construct(Context *context, Value *args, int argc);
virtual Value call(Context *context, Value thisObject, Value *args, int argc, bool strictMode = false);
Value construct(ExecutionContext *context, Value *args, int argc);
virtual Value call(ExecutionContext *context, Value thisObject, Value *args, int argc, bool strictMode = false);
protected:
virtual void call(Context *ctx);
virtual void construct(Context *ctx);
virtual void call(ExecutionContext *ctx);
virtual void construct(ExecutionContext *ctx);
};
struct NativeFunction: FunctionObject {
void (*code)(Context *);
void (*code)(ExecutionContext *);
NativeFunction(Context *scope, void (*code)(Context *)): FunctionObject(scope), code(code) {}
virtual void call(Context *ctx) { code(ctx); }
virtual void construct(Context *ctx) { code(ctx); }
NativeFunction(ExecutionContext *scope, void (*code)(ExecutionContext *)): FunctionObject(scope), code(code) {}
virtual void call(ExecutionContext *ctx) { code(ctx); }
virtual void construct(ExecutionContext *ctx) { code(ctx); }
};
struct ScriptFunction: FunctionObject {
IR::Function *function;
ScriptFunction(Context *scope, IR::Function *function);
ScriptFunction(ExecutionContext *scope, IR::Function *function);
virtual ~ScriptFunction();
virtual void call(Context *ctx);
virtual void construct(Context *ctx);
virtual void call(ExecutionContext *ctx);
virtual void construct(ExecutionContext *ctx);
};
struct EvalFunction : FunctionObject
{
EvalFunction(Context *scope): FunctionObject(scope) {}
EvalFunction(ExecutionContext *scope): FunctionObject(scope) {}
static int evaluate(QQmlJS::VM::Context *ctx, const QString &fileName,
static int evaluate(QQmlJS::VM::ExecutionContext *ctx, const QString &fileName,
const QString &source, bool useInterpreter,
QQmlJS::Codegen::Mode mode);
virtual Value call(Context *context, Value thisObject, Value *args, int argc, bool strictMode = false);
virtual Value call(ExecutionContext *context, Value thisObject, Value *args, int argc, bool strictMode = false);
};
struct RegExpObject: Object {
@ -538,7 +538,7 @@ struct RegExpObject: Object {
RegExpObject(const QRegularExpression &value, bool global): value(value), lastIndex(Value::fromInt32(0)), global(global) {}
virtual QString className() { return QStringLiteral("RegExp"); }
virtual RegExpObject *asRegExpObject() { return this; }
virtual Value __get__(Context *ctx, String *name);
virtual Value __get__(ExecutionContext *ctx, String *name);
};
struct ErrorObject: Object {
@ -546,63 +546,63 @@ struct ErrorObject: Object {
ErrorObject(const Value &message): value(message) {}
virtual QString className() { return QStringLiteral("Error"); }
virtual ErrorObject *asErrorObject() { return this; }
virtual Value __get__(Context *ctx, String *name);
virtual Value __get__(ExecutionContext *ctx, String *name);
protected:
void setNameProperty(Context *ctx);
void setNameProperty(ExecutionContext *ctx);
};
struct EvalErrorObject: ErrorObject {
EvalErrorObject(Context *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
EvalErrorObject(ExecutionContext *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
virtual QString className() { return QStringLiteral("EvalError"); }
};
struct RangeErrorObject: ErrorObject {
RangeErrorObject(Context *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
RangeErrorObject(ExecutionContext *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
virtual QString className() { return QStringLiteral("RangeError"); }
};
struct ReferenceErrorObject: ErrorObject {
ReferenceErrorObject(Context *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
ReferenceErrorObject(ExecutionContext *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
virtual QString className() { return QStringLiteral("ReferenceError"); }
};
struct SyntaxErrorObject: ErrorObject {
SyntaxErrorObject(Context *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
SyntaxErrorObject(ExecutionContext *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
virtual QString className() { return QStringLiteral("SyntaxError"); }
};
struct TypeErrorObject: ErrorObject {
TypeErrorObject(Context *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
TypeErrorObject(ExecutionContext *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
virtual QString className() { return QStringLiteral("TypeError"); }
};
struct URIErrorObject: ErrorObject {
URIErrorObject(Context *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
URIErrorObject(ExecutionContext *ctx): ErrorObject(ctx->argument(0)) { setNameProperty(ctx); }
virtual QString className() { return QStringLiteral("URIError"); }
};
struct ActivationObject: Object {
Context *context;
ExecutionContext *context;
Value arguments;
ActivationObject(Context *context): context(context), arguments(Value::undefinedValue()) {}
ActivationObject(ExecutionContext *context): context(context), arguments(Value::undefinedValue()) {}
virtual QString className() { return QStringLiteral("Activation"); }
virtual ActivationObject *asActivationObject() { return this; }
virtual PropertyDescriptor *__getPropertyDescriptor__(Context *ctx, String *name, PropertyDescriptor *to_fill);
virtual PropertyDescriptor *__getPropertyDescriptor__(ExecutionContext *ctx, String *name, PropertyDescriptor *to_fill);
};
struct ArgumentsObject: Object {
Context *context;
ArgumentsObject(Context *context): context(context) {}
ExecutionContext *context;
ArgumentsObject(ExecutionContext *context): context(context) {}
virtual QString className() { return QStringLiteral("Arguments"); }
virtual ArgumentsObject *asArgumentsObject() { return this; }
virtual Value __get__(Context *ctx, String *name);
virtual PropertyDescriptor *__getPropertyDescriptor__(Context *ctx, String *name, PropertyDescriptor *to_fill);
virtual Value __get__(ExecutionContext *ctx, String *name);
virtual PropertyDescriptor *__getPropertyDescriptor__(ExecutionContext *ctx, String *name, PropertyDescriptor *to_fill);
};
struct ExecutionEngine
{
Context *rootContext;
ExecutionContext *rootContext;
Value globalObject;
Value objectCtor;
@ -646,7 +646,7 @@ struct ExecutionEngine
String *id___proto__;
struct ExceptionHandler {
Context *context;
ExecutionContext *context;
const uchar *code; // Interpreter state
int targetTempIndex; // Interpreter state
jmp_buf stackFrame;
@ -656,42 +656,42 @@ struct ExecutionEngine
ExecutionEngine();
Context *newContext();
ExecutionContext *newContext();
String *identifier(const QString &s);
FunctionObject *newNativeFunction(Context *scope, void (*code)(Context *));
FunctionObject *newScriptFunction(Context *scope, IR::Function *function);
FunctionObject *newNativeFunction(ExecutionContext *scope, void (*code)(ExecutionContext *));
FunctionObject *newScriptFunction(ExecutionContext *scope, IR::Function *function);
Object *newObject();
FunctionObject *newObjectCtor(Context *ctx);
FunctionObject *newObjectCtor(ExecutionContext *ctx);
String *newString(const QString &s);
Object *newStringObject(const Value &value);
FunctionObject *newStringCtor(Context *ctx);
FunctionObject *newStringCtor(ExecutionContext *ctx);
Object *newNumberObject(const Value &value);
FunctionObject *newNumberCtor(Context *ctx);
FunctionObject *newNumberCtor(ExecutionContext *ctx);
Object *newBooleanObject(const Value &value);
FunctionObject *newBooleanCtor(Context *ctx);
FunctionObject *newBooleanCtor(ExecutionContext *ctx);
Object *newFunctionObject(Context *ctx);
FunctionObject *newFunctionCtor(Context *ctx);
Object *newFunctionObject(ExecutionContext *ctx);
FunctionObject *newFunctionCtor(ExecutionContext *ctx);
Object *newArrayObject();
Object *newArrayObject(const Array &value);
FunctionObject *newArrayCtor(Context *ctx);
FunctionObject *newArrayCtor(ExecutionContext *ctx);
Object *newDateObject(const Value &value);
FunctionObject *newDateCtor(Context *ctx);
FunctionObject *newDateCtor(ExecutionContext *ctx);
Object *newRegExpObject(const QString &pattern, int flags);
FunctionObject *newRegExpCtor(Context *ctx);
FunctionObject *newRegExpCtor(ExecutionContext *ctx);
Object *newErrorObject(const Value &value);
Object *newMathObject(Context *ctx);
Object *newActivationObject(Context *ctx);
Object *newMathObject(ExecutionContext *ctx);
Object *newActivationObject(ExecutionContext *ctx);
Object *newForEachIteratorObject(Object *o);
};

View File

@ -56,7 +56,7 @@
namespace QQmlJS {
namespace VM {
static inline Value callFunction(Context *context, Value thisObject, FunctionObject *func, Value *args, int argc)
static inline Value callFunction(ExecutionContext *context, Value thisObject, FunctionObject *func, Value *args, int argc)
{
if (func) {
return func->call(context, thisObject, args, argc);
@ -113,7 +113,7 @@ QString numberToString(double num, int radix = 10)
}
Value Value::fromString(Context *ctx, const QString &s)
Value Value::fromString(ExecutionContext *ctx, const QString &s)
{
return fromString(ctx->engine->newString(s));
}
@ -225,12 +225,12 @@ ActivationObject *Value::asArgumentsObject() const
return isObject() ? objectValue()->asActivationObject() : 0;
}
Value Value::property(Context *ctx, String *name) const
Value Value::property(ExecutionContext *ctx, String *name) const
{
return isObject() ? objectValue()->__get__(ctx, name) : undefinedValue();
}
void Context::init(ExecutionEngine *eng)
void ExecutionContext::init(ExecutionEngine *eng)
{
engine = eng;
parent = 0;
@ -246,9 +246,9 @@ void Context::init(ExecutionEngine *eng)
varCount = 0;
}
PropertyDescriptor *Context::lookupPropertyDescriptor(String *name, PropertyDescriptor *tmp)
PropertyDescriptor *ExecutionContext::lookupPropertyDescriptor(String *name, PropertyDescriptor *tmp)
{
for (Context *ctx = this; ctx; ctx = ctx->parent) {
for (ExecutionContext *ctx = this; ctx; ctx = ctx->parent) {
if (ctx->activation) {
if (PropertyDescriptor *pd = ctx->activation->__getPropertyDescriptor__(this, name, tmp))
return pd;
@ -257,9 +257,9 @@ PropertyDescriptor *Context::lookupPropertyDescriptor(String *name, PropertyDesc
return 0;
}
void Context::inplaceBitOp(Value value, String *name, BinOp op)
void ExecutionContext::inplaceBitOp(Value value, String *name, BinOp op)
{
for (Context *ctx = this; ctx; ctx = ctx->parent) {
for (ExecutionContext *ctx = this; ctx; ctx = ctx->parent) {
if (ctx->activation) {
if (ctx->activation->inplaceBinOp(value, name, op, this))
return;
@ -268,38 +268,38 @@ void Context::inplaceBitOp(Value value, String *name, BinOp op)
throwReferenceError(Value::fromString(name));
}
void Context::throwError(Value value)
void ExecutionContext::throwError(Value value)
{
result = value;
__qmljs_builtin_throw(value, this);
}
void Context::throwError(const QString &message)
void ExecutionContext::throwError(const QString &message)
{
Value v = Value::fromString(this, message);
throwError(Value::fromObject(engine->newErrorObject(v)));
}
void Context::throwTypeError()
void ExecutionContext::throwTypeError()
{
Value v = Value::fromString(this, QStringLiteral("Type error"));
throwError(Value::fromObject(engine->newErrorObject(v)));
}
void Context::throwUnimplemented(const QString &message)
void ExecutionContext::throwUnimplemented(const QString &message)
{
Value v = Value::fromString(this, QStringLiteral("Unimplemented ") + message);
throwError(Value::fromObject(engine->newErrorObject(v)));
}
void Context::throwReferenceError(Value value)
void ExecutionContext::throwReferenceError(Value value)
{
String *s = value.toString(this);
QString msg = s->toQString() + QStringLiteral(" is not defined");
throwError(Value::fromObject(engine->newErrorObject(Value::fromString(this, msg))));
}
void Context::initCallContext(Context *parent, const Value that, FunctionObject *f, Value *args, unsigned argc)
void ExecutionContext::initCallContext(ExecutionContext *parent, const Value that, FunctionObject *f, Value *args, unsigned argc)
{
engine = parent->engine;
this->parent = f->scope;
@ -331,7 +331,7 @@ void Context::initCallContext(Context *parent, const Value that, FunctionObject
std::fill(locals, locals + varCount, Value::undefinedValue());
}
void Context::leaveCallContext()
void ExecutionContext::leaveCallContext()
{
if (activation) {
delete[] locals;
@ -339,18 +339,18 @@ void Context::leaveCallContext()
}
}
void Context::initConstructorContext(Context *parent, Value that, FunctionObject *f, Value *args, unsigned argc)
void ExecutionContext::initConstructorContext(ExecutionContext *parent, Value that, FunctionObject *f, Value *args, unsigned argc)
{
initCallContext(parent, that, f, args, argc);
}
void Context::leaveConstructorContext(FunctionObject *f)
void ExecutionContext::leaveConstructorContext(FunctionObject *f)
{
wireUpPrototype(f);
leaveCallContext();
}
void Context::wireUpPrototype(FunctionObject *f)
void ExecutionContext::wireUpPrototype(FunctionObject *f)
{
assert(thisObject.isObject());
result = thisObject;
@ -364,62 +364,62 @@ void Context::wireUpPrototype(FunctionObject *f)
extern "C" {
Value __qmljs_init_closure(IR::Function *clos, Context *ctx)
Value __qmljs_init_closure(IR::Function *clos, ExecutionContext *ctx)
{
return Value::fromObject(ctx->engine->newScriptFunction(ctx, clos));
}
Value __qmljs_init_native_function(void (*code)(Context *), Context *ctx)
Value __qmljs_init_native_function(void (*code)(ExecutionContext *), ExecutionContext *ctx)
{
return Value::fromObject(ctx->engine->newNativeFunction(ctx, code));
}
Value __qmljs_string_literal_undefined(Context *ctx)
Value __qmljs_string_literal_undefined(ExecutionContext *ctx)
{
return Value::fromString(ctx->engine->identifier(QStringLiteral("undefined")));
}
Value __qmljs_string_literal_null(Context *ctx)
Value __qmljs_string_literal_null(ExecutionContext *ctx)
{
return Value::fromString(ctx->engine->identifier(QStringLiteral("null")));
}
Value __qmljs_string_literal_true(Context *ctx)
Value __qmljs_string_literal_true(ExecutionContext *ctx)
{
return Value::fromString(ctx->engine->identifier(QStringLiteral("true")));
}
Value __qmljs_string_literal_false(Context *ctx)
Value __qmljs_string_literal_false(ExecutionContext *ctx)
{
return Value::fromString(ctx->engine->identifier(QStringLiteral("false")));
}
Value __qmljs_string_literal_object(Context *ctx)
Value __qmljs_string_literal_object(ExecutionContext *ctx)
{
return Value::fromString(ctx->engine->identifier(QStringLiteral("object")));
}
Value __qmljs_string_literal_boolean(Context *ctx)
Value __qmljs_string_literal_boolean(ExecutionContext *ctx)
{
return Value::fromString(ctx->engine->identifier(QStringLiteral("boolean")));
}
Value __qmljs_string_literal_number(Context *ctx)
Value __qmljs_string_literal_number(ExecutionContext *ctx)
{
return Value::fromString(ctx->engine->identifier(QStringLiteral("number")));
}
Value __qmljs_string_literal_string(Context *ctx)
Value __qmljs_string_literal_string(ExecutionContext *ctx)
{
return Value::fromString(ctx->engine->identifier(QStringLiteral("string")));
}
Value __qmljs_string_literal_function(Context *ctx)
Value __qmljs_string_literal_function(ExecutionContext *ctx)
{
return Value::fromString(ctx->engine->identifier(QStringLiteral("function")));
}
Value __qmljs_delete_subscript(Context *ctx, Value base, Value index)
Value __qmljs_delete_subscript(ExecutionContext *ctx, Value base, Value index)
{
if (ArrayObject *a = base.asArrayObject()) {
int n = -1;
@ -439,13 +439,13 @@ Value __qmljs_delete_subscript(Context *ctx, Value base, Value index)
return __qmljs_delete_member(ctx, base, name);
}
Value __qmljs_delete_member(Context *ctx, Value base, String *name)
Value __qmljs_delete_member(ExecutionContext *ctx, Value base, String *name)
{
Value obj = base.toObject(ctx);
return Value::fromBoolean(obj.objectValue()->__delete__(ctx, name, true));
}
Value __qmljs_delete_property(Context *ctx, String *name)
Value __qmljs_delete_property(ExecutionContext *ctx, String *name)
{
Object *obj = ctx->activation;
if (!obj)
@ -453,13 +453,13 @@ Value __qmljs_delete_property(Context *ctx, String *name)
return Value::fromBoolean(obj->__delete__(ctx, name, true));
}
Value __qmljs_delete_value(Context *ctx, Value value)
Value __qmljs_delete_value(ExecutionContext *ctx, Value value)
{
Q_UNUSED(value);
return __qmljs_throw_type_error(ctx); // ### throw syntax error
}
Value __qmljs_add_helper(Value left, Value right, Context *ctx)
Value __qmljs_add_helper(Value left, Value right, ExecutionContext *ctx)
{
Value pleft = __qmljs_to_primitive(left, ctx, PREFERREDTYPE_HINT);
Value pright = __qmljs_to_primitive(right, ctx, PREFERREDTYPE_HINT);
@ -476,7 +476,7 @@ Value __qmljs_add_helper(Value left, Value right, Context *ctx)
return Value::fromDouble(x + y);
}
Value __qmljs_instanceof(Value left, Value right, Context *ctx)
Value __qmljs_instanceof(Value left, Value right, ExecutionContext *ctx)
{
if (FunctionObject *function = right.asFunctionObject()) {
bool r = function->hasInstance(ctx, left);
@ -486,7 +486,7 @@ Value __qmljs_instanceof(Value left, Value right, Context *ctx)
return __qmljs_throw_type_error(ctx);
}
Value __qmljs_in(Value left, Value right, Context *ctx)
Value __qmljs_in(Value left, Value right, ExecutionContext *ctx)
{
if (right.isObject()) {
Value s = __qmljs_to_string(left, ctx);
@ -497,209 +497,209 @@ Value __qmljs_in(Value left, Value right, Context *ctx)
}
}
void __qmljs_inplace_bit_and_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_bit_and_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_bit_and);
}
void __qmljs_inplace_bit_or_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_bit_or_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_bit_or);
}
void __qmljs_inplace_bit_xor_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_bit_xor_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_bit_xor);
}
void __qmljs_inplace_add_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_add_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_add);
}
void __qmljs_inplace_sub_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_sub_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_sub);
}
void __qmljs_inplace_mul_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_mul_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_mul);
}
void __qmljs_inplace_div_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_div_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_div);
}
void __qmljs_inplace_mod_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_mod_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_mod);
}
void __qmljs_inplace_shl_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_shl_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_shl);
}
void __qmljs_inplace_shr_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_shr_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_shr);
}
void __qmljs_inplace_ushr_name(Value value, String *name, Context *ctx)
void __qmljs_inplace_ushr_name(Value value, String *name, ExecutionContext *ctx)
{
ctx->inplaceBitOp(value, name, __qmljs_ushr);
}
void __qmljs_inplace_bit_and_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_bit_and_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_bit_and, ctx);
}
void __qmljs_inplace_bit_or_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_bit_or_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_bit_or, ctx);
}
void __qmljs_inplace_bit_xor_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_bit_xor_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_bit_xor, ctx);
}
void __qmljs_inplace_add_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_add_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_add, ctx);
}
void __qmljs_inplace_sub_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_sub_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_sub, ctx);
}
void __qmljs_inplace_mul_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_mul_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_mul, ctx);
}
void __qmljs_inplace_div_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_div_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_div, ctx);
}
void __qmljs_inplace_mod_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_mod_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_mod, ctx);
}
void __qmljs_inplace_shl_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_shl_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_shl, ctx);
}
void __qmljs_inplace_shr_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_shr_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_shr, ctx);
}
void __qmljs_inplace_ushr_element(Value base, Value index, Value value, Context *ctx)
void __qmljs_inplace_ushr_element(Value base, Value index, Value value, ExecutionContext *ctx)
{
Object *obj = base.toObject(ctx).objectValue();
obj->inplaceBinOp(value, index, __qmljs_ushr, ctx);
}
void __qmljs_inplace_bit_and_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_bit_and_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_bit_and, ctx);
}
void __qmljs_inplace_bit_or_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_bit_or_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_bit_or, ctx);
}
void __qmljs_inplace_bit_xor_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_bit_xor_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_bit_xor, ctx);
}
void __qmljs_inplace_add_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_add_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_add, ctx);
}
void __qmljs_inplace_sub_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_sub_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_sub, ctx);
}
void __qmljs_inplace_mul_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_mul_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_mul, ctx);
}
void __qmljs_inplace_div_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_div_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_div, ctx);
}
void __qmljs_inplace_mod_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_mod_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_mod, ctx);
}
void __qmljs_inplace_shl_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_shl_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_shl, ctx);
}
void __qmljs_inplace_shr_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_shr_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_shr, ctx);
}
void __qmljs_inplace_ushr_member(Value value, Value base, String *name, Context *ctx)
void __qmljs_inplace_ushr_member(Value value, Value base, String *name, ExecutionContext *ctx)
{
Object *o = base.toObject(ctx).objectValue();
o->inplaceBinOp(value, name, __qmljs_ushr, ctx);
}
String *__qmljs_string_from_utf8(Context *ctx, const char *s)
String *__qmljs_string_from_utf8(ExecutionContext *ctx, const char *s)
{
return ctx->engine->newString(QString::fromUtf8(s));
}
String *__qmljs_identifier_from_utf8(Context *ctx, const char *s)
String *__qmljs_identifier_from_utf8(ExecutionContext *ctx, const char *s)
{
return ctx->engine->identifier(QString::fromUtf8(s));
}
int __qmljs_string_length(Context *, String *string)
int __qmljs_string_length(ExecutionContext *, String *string)
{
return string->toQString().length();
}
double __qmljs_string_to_number(Context *, String *string)
double __qmljs_string_to_number(ExecutionContext *, String *string)
{
const QString s = string->toQString();
if (s.startsWith(QLatin1String("0x")) || s.startsWith(QLatin1String("0X")))
@ -710,13 +710,13 @@ double __qmljs_string_to_number(Context *, String *string)
return d;
}
Value __qmljs_string_from_number(Context *ctx, double number)
Value __qmljs_string_from_number(ExecutionContext *ctx, double number)
{
String *string = ctx->engine->newString(numberToString(number, 10));
return Value::fromString(string);
}
Bool __qmljs_string_compare(Context *, String *left, String *right)
Bool __qmljs_string_compare(ExecutionContext *, String *left, String *right)
{
return left->toQString() < right->toQString();
}
@ -726,7 +726,7 @@ Bool __qmljs_string_equal(String *left, String *right)
return left->isEqualTo(right);
}
String *__qmljs_string_concat(Context *ctx, String *first, String *second)
String *__qmljs_string_concat(ExecutionContext *ctx, String *first, String *second)
{
return ctx->engine->newString(first->toQString() + second->toQString());
}
@ -736,7 +736,7 @@ Bool __qmljs_is_function(Value value)
return value.objectValue()->asFunctionObject() != 0;
}
Value __qmljs_object_default_value(Context *ctx, Value object, int typeHint)
Value __qmljs_object_default_value(ExecutionContext *ctx, Value object, int typeHint)
{
if (typeHint == PREFERREDTYPE_HINT) {
if (object.asDateObject())
@ -771,67 +771,67 @@ Value __qmljs_object_default_value(Context *ctx, Value object, int typeHint)
return Value::undefinedValue();
}
Value __qmljs_throw_type_error(Context *ctx)
Value __qmljs_throw_type_error(ExecutionContext *ctx)
{
ctx->throwTypeError();
return ctx->result;
}
Value __qmljs_new_object(Context *ctx)
Value __qmljs_new_object(ExecutionContext *ctx)
{
return Value::fromObject(ctx->engine->newObject());
}
Value __qmljs_new_boolean_object(Context *ctx, bool boolean)
Value __qmljs_new_boolean_object(ExecutionContext *ctx, bool boolean)
{
Value value = Value::fromBoolean(boolean);
return Value::fromObject(ctx->engine->newBooleanObject(value));
}
Value __qmljs_new_number_object(Context *ctx, double number)
Value __qmljs_new_number_object(ExecutionContext *ctx, double number)
{
Value value = Value::fromDouble(number);
return Value::fromObject(ctx->engine->newNumberObject(value));
}
Value __qmljs_new_string_object(Context *ctx, String *string)
Value __qmljs_new_string_object(ExecutionContext *ctx, String *string)
{
Value value = Value::fromString(string);
return Value::fromObject(ctx->engine->newStringObject(value));
}
void __qmljs_set_property(Context *ctx, Value object, String *name, Value value)
void __qmljs_set_property(ExecutionContext *ctx, Value object, String *name, Value value)
{
object.objectValue()->__put__(ctx, name, value, /*flags*/ 0);
}
void __qmljs_set_property_boolean(Context *ctx, Value *object, String *name, bool b)
void __qmljs_set_property_boolean(ExecutionContext *ctx, Value *object, String *name, bool b)
{
Value value = Value::fromBoolean(b);
object->objectValue()->__put__(ctx, name, value, /*flag*/ 0);
}
void __qmljs_set_property_number(Context *ctx, Value *object, String *name, double number)
void __qmljs_set_property_number(ExecutionContext *ctx, Value *object, String *name, double number)
{
Q_UNUSED(ctx);
Value value = Value::fromDouble(number);
object->objectValue()->__put__(ctx, name, value, /*flag*/ 0);
}
void __qmljs_set_property_string(Context *ctx, Value *object, String *name, String *s)
void __qmljs_set_property_string(ExecutionContext *ctx, Value *object, String *name, String *s)
{
Q_UNUSED(ctx);
Value value = Value::fromString(s);
object->objectValue()->__put__(ctx, name, value, /*flag*/ 0);
}
void __qmljs_set_property_closure(Context *ctx, Value *object, String *name, IR::Function *function)
void __qmljs_set_property_closure(ExecutionContext *ctx, Value *object, String *name, IR::Function *function)
{
Value value = __qmljs_init_closure(function, ctx);
object->objectValue()->__put__(ctx, name, value, /*flag*/ 0);
}
Value __qmljs_get_element(Context *ctx, Value object, Value index)
Value __qmljs_get_element(ExecutionContext *ctx, Value object, Value index)
{
if (index.isNumber()) {
if (object.isString()) {
@ -854,7 +854,7 @@ Value __qmljs_get_element(Context *ctx, Value object, Value index)
return object.objectValue()->__get__(ctx, name);
}
void __qmljs_set_element(Context *ctx, Value object, Value index, Value value)
void __qmljs_set_element(ExecutionContext *ctx, Value object, Value index, Value value)
{
if (index.isNumber()) {
if (ArrayObject *a = object.asArrayObject()) {
@ -871,7 +871,7 @@ void __qmljs_set_element(Context *ctx, Value object, Value index, Value value)
object.objectValue()->__put__(ctx, name, value, /*flags*/ 0);
}
Value __qmljs_foreach_iterator_object(Value in, Context *ctx)
Value __qmljs_foreach_iterator_object(Value in, ExecutionContext *ctx)
{
in = __qmljs_to_object(in, ctx);
Object *it = ctx->engine->newForEachIteratorObject(in.objectValue());
@ -892,7 +892,7 @@ Value __qmljs_foreach_next_property_name(Value foreach_iterator)
}
void __qmljs_set_activation_property(Context *ctx, String *name, Value value)
void __qmljs_set_activation_property(ExecutionContext *ctx, String *name, Value value)
{
PropertyDescriptor tmp;
if (PropertyDescriptor *prop = ctx->lookupPropertyDescriptor(name, &tmp))
@ -901,31 +901,31 @@ void __qmljs_set_activation_property(Context *ctx, String *name, Value value)
ctx->engine->globalObject.objectValue()->__put__(ctx, name, value);
}
void __qmljs_set_activation_property_boolean(Context *ctx, String *name, bool b)
void __qmljs_set_activation_property_boolean(ExecutionContext *ctx, String *name, bool b)
{
Value value = Value::fromBoolean(b);
__qmljs_set_activation_property(ctx, name, value);
}
void __qmljs_set_activation_property_number(Context *ctx, String *name, double number)
void __qmljs_set_activation_property_number(ExecutionContext *ctx, String *name, double number)
{
Value value = Value::fromDouble(number);
__qmljs_set_activation_property(ctx, name, value);
}
void __qmljs_set_activation_property_string(Context *ctx, String *name, String *string)
void __qmljs_set_activation_property_string(ExecutionContext *ctx, String *name, String *string)
{
Value value = Value::fromString(string);
__qmljs_set_activation_property(ctx, name, value);
}
void __qmljs_set_activation_property_closure(Context *ctx, String *name, IR::Function *clos)
void __qmljs_set_activation_property_closure(ExecutionContext *ctx, String *name, IR::Function *clos)
{
Value value = __qmljs_init_closure(clos, ctx);
__qmljs_set_activation_property(ctx, name, value);
}
Value __qmljs_get_property(Context *ctx, Value object, String *name)
Value __qmljs_get_property(ExecutionContext *ctx, Value object, String *name)
{
if (object.isObject()) {
return object.objectValue()->__get__(ctx, name);
@ -943,7 +943,7 @@ Value __qmljs_get_property(Context *ctx, Value object, String *name)
}
}
Value __qmljs_get_activation_property(Context *ctx, String *name)
Value __qmljs_get_activation_property(ExecutionContext *ctx, String *name)
{
PropertyDescriptor tmp;
if (PropertyDescriptor *prop = ctx->lookupPropertyDescriptor(name, &tmp))
@ -952,14 +952,14 @@ Value __qmljs_get_activation_property(Context *ctx, String *name)
return Value::undefinedValue();
}
Value __qmljs_get_thisObject(Context *ctx)
Value __qmljs_get_thisObject(ExecutionContext *ctx)
{
if (ctx->thisObject.isObject())
return ctx->thisObject;
return ctx->engine->globalObject;
}
uint __qmljs_equal(Value x, Value y, Context *ctx)
uint __qmljs_equal(Value x, Value y, ExecutionContext *ctx)
{
if (x.type() == y.type()) {
switch (x.type()) {
@ -1012,7 +1012,7 @@ uint __qmljs_equal(Value x, Value y, Context *ctx)
}
// TODO: remove this function. Backends should just generate a __qmljs_get_activation_property followed by a __qmljs_call_value
Value __qmljs_call_activation_property(Context *context, String *name, Value *args, int argc)
Value __qmljs_call_activation_property(ExecutionContext *context, String *name, Value *args, int argc)
{
Value func = __qmljs_get_activation_property(context, name);
if (FunctionObject *f = func.asFunctionObject()) {
@ -1023,7 +1023,7 @@ Value __qmljs_call_activation_property(Context *context, String *name, Value *ar
}
}
Value __qmljs_call_property(Context *context, Value base, String *name, Value *args, int argc)
Value __qmljs_call_property(ExecutionContext *context, Value base, String *name, Value *args, int argc)
{
Object *baseObject;
Value thisObject;
@ -1043,12 +1043,12 @@ Value __qmljs_call_property(Context *context, Value base, String *name, Value *a
return callFunction(context, thisObject, func.asFunctionObject(), args, argc);
}
Value __qmljs_call_value(Context *context, Value thisObject, Value func, Value *args, int argc)
Value __qmljs_call_value(ExecutionContext *context, Value thisObject, Value func, Value *args, int argc)
{
return callFunction(context, thisObject, func.asFunctionObject(), args, argc);
}
Value __qmljs_construct_activation_property(Context *context, String *name, Value *args, int argc)
Value __qmljs_construct_activation_property(ExecutionContext *context, String *name, Value *args, int argc)
{
PropertyDescriptor tmp;
PropertyDescriptor *func = context->lookupPropertyDescriptor(name, &tmp);
@ -1059,7 +1059,7 @@ Value __qmljs_construct_activation_property(Context *context, String *name, Valu
return __qmljs_construct_value(context, func->value, args, argc);
}
Value __qmljs_construct_value(Context *context, Value func, Value *args, int argc)
Value __qmljs_construct_value(ExecutionContext *context, Value func, Value *args, int argc)
{
if (FunctionObject *f = func.asFunctionObject())
return f->construct(context, args, argc);
@ -1068,7 +1068,7 @@ Value __qmljs_construct_value(Context *context, Value func, Value *args, int arg
return Value::undefinedValue();
}
Value __qmljs_construct_property(Context *context, Value base, String *name, Value *args, int argc)
Value __qmljs_construct_property(ExecutionContext *context, Value base, String *name, Value *args, int argc)
{
Value thisObject = base;
if (!thisObject.isObject())
@ -1082,7 +1082,7 @@ Value __qmljs_construct_property(Context *context, Value base, String *name, Val
return Value::undefinedValue();
}
void __qmljs_throw(Value value, Context *context)
void __qmljs_throw(Value value, ExecutionContext *context)
{
assert(!context->engine->unwindStack.isEmpty());
@ -1099,7 +1099,7 @@ void __qmljs_throw(Value value, Context *context)
longjmp(handler.stackFrame, 1);
}
void *__qmljs_create_exception_handler(Context *context)
void *__qmljs_create_exception_handler(ExecutionContext *context)
{
context->engine->unwindStack.append(ExecutionEngine::ExceptionHandler());
ExecutionEngine::ExceptionHandler &handler = context->engine->unwindStack.last();
@ -1107,24 +1107,24 @@ void *__qmljs_create_exception_handler(Context *context)
return handler.stackFrame;
}
void __qmljs_delete_exception_handler(Context *context)
void __qmljs_delete_exception_handler(ExecutionContext *context)
{
assert(!context->engine->unwindStack.isEmpty());
context->engine->unwindStack.pop_back();
}
Value __qmljs_get_exception(Context *context)
Value __qmljs_get_exception(ExecutionContext *context)
{
return context->result;
}
Value __qmljs_builtin_typeof(Value val, Context *context)
Value __qmljs_builtin_typeof(Value val, ExecutionContext *context)
{
return __qmljs_typeof(val, context);
}
void __qmljs_builtin_throw(Value val, Context *context)
void __qmljs_builtin_throw(Value val, ExecutionContext *context)
{
__qmljs_throw(val, context);
}

View File

@ -75,7 +75,7 @@ enum TypeHint {
struct Object;
struct String;
struct PropertyDescriptor;
struct Context;
struct ExecutionContext;
struct FunctionObject;
struct BooleanObject;
struct NumberObject;
@ -208,21 +208,21 @@ struct Value
static Value fromObject(Object *o);
#ifndef QMLJS_LLVM_RUNTIME
static Value fromString(Context *ctx, const QString &fromString);
static Value fromString(ExecutionContext *ctx, const QString &fromString);
#endif
static double toInteger(double fromNumber);
static int toInt32(double value);
static unsigned int toUInt32(double value);
inline int toUInt16(Context *ctx);
inline int toInt32(Context *ctx);
inline unsigned int toUInt32(Context *ctx);
inline Bool toBoolean(Context *ctx) const;
inline double toInteger(Context *ctx) const;
double toNumber(Context *ctx) const;
inline String *toString(Context *ctx) const;
inline Value toObject(Context *ctx) const;
inline int toUInt16(ExecutionContext *ctx);
inline int toInt32(ExecutionContext *ctx);
inline unsigned int toUInt32(ExecutionContext *ctx);
inline Bool toBoolean(ExecutionContext *ctx) const;
inline double toInteger(ExecutionContext *ctx) const;
double toNumber(ExecutionContext *ctx) const;
inline String *toString(ExecutionContext *ctx) const;
inline Value toObject(ExecutionContext *ctx) const;
inline bool isPrimitive() const { return !isObject(); }
#if CPU(X86_64)
@ -260,7 +260,7 @@ struct Value
ErrorObject *asErrorObject() const;
ActivationObject *asArgumentsObject() const;
Value property(Context *ctx, String *name) const;
Value property(ExecutionContext *ctx, String *name) const;
// Section 9.12
bool sameValue(Value other);
@ -269,182 +269,182 @@ struct Value
extern "C" {
// context
Value __qmljs_call_activation_property(Context *, String *name, Value *args, int argc);
Value __qmljs_call_property(Context *context, Value base, String *name, Value *args, int argc);
Value __qmljs_call_value(Context *context, Value thisObject, Value func, Value *args, int argc);
Value __qmljs_call_activation_property(ExecutionContext *, String *name, Value *args, int argc);
Value __qmljs_call_property(ExecutionContext *context, Value base, String *name, Value *args, int argc);
Value __qmljs_call_value(ExecutionContext *context, Value thisObject, Value func, Value *args, int argc);
Value __qmljs_construct_activation_property(Context *, String *name, Value *args, int argc);
Value __qmljs_construct_property(Context *context, Value base, String *name, Value *args, int argc);
Value __qmljs_construct_value(Context *context, Value func, Value *args, int argc);
Value __qmljs_construct_activation_property(ExecutionContext *, String *name, Value *args, int argc);
Value __qmljs_construct_property(ExecutionContext *context, Value base, String *name, Value *args, int argc);
Value __qmljs_construct_value(ExecutionContext *context, Value func, Value *args, int argc);
Value __qmljs_builtin_typeof(Value val, Context *context);
void __qmljs_builtin_throw(Value val, Context *context);
Value __qmljs_builtin_typeof(Value val, ExecutionContext *context);
void __qmljs_builtin_throw(Value val, ExecutionContext *context);
// constructors
Value __qmljs_init_closure(IR::Function *clos, Context *ctx);
Value __qmljs_init_native_function(void (*code)(Context *), Context *ctx);
Value __qmljs_init_closure(IR::Function *clos, ExecutionContext *ctx);
Value __qmljs_init_native_function(void (*code)(ExecutionContext *), ExecutionContext *ctx);
Bool __qmljs_is_function(Value value);
// string literals
Value __qmljs_string_literal_undefined(Context *ctx);
Value __qmljs_string_literal_null(Context *ctx);
Value __qmljs_string_literal_true(Context *ctx);
Value __qmljs_string_literal_false(Context *ctx);
Value __qmljs_string_literal_object(Context *ctx);
Value __qmljs_string_literal_boolean(Context *ctx);
Value __qmljs_string_literal_number(Context *ctx);
Value __qmljs_string_literal_string(Context *ctx);
Value __qmljs_string_literal_function(Context *ctx);
Value __qmljs_string_literal_undefined(ExecutionContext *ctx);
Value __qmljs_string_literal_null(ExecutionContext *ctx);
Value __qmljs_string_literal_true(ExecutionContext *ctx);
Value __qmljs_string_literal_false(ExecutionContext *ctx);
Value __qmljs_string_literal_object(ExecutionContext *ctx);
Value __qmljs_string_literal_boolean(ExecutionContext *ctx);
Value __qmljs_string_literal_number(ExecutionContext *ctx);
Value __qmljs_string_literal_string(ExecutionContext *ctx);
Value __qmljs_string_literal_function(ExecutionContext *ctx);
// strings
String *__qmljs_string_from_utf8(Context *ctx, const char *s);
int __qmljs_string_length(Context *ctx, String *string);
double __qmljs_string_to_number(Context *ctx, String *string);
Value __qmljs_string_from_number(Context *ctx, double number);
Bool __qmljs_string_compare(Context *ctx, String *left, String *right);
String *__qmljs_string_from_utf8(ExecutionContext *ctx, const char *s);
int __qmljs_string_length(ExecutionContext *ctx, String *string);
double __qmljs_string_to_number(ExecutionContext *ctx, String *string);
Value __qmljs_string_from_number(ExecutionContext *ctx, double number);
Bool __qmljs_string_compare(ExecutionContext *ctx, String *left, String *right);
Bool __qmljs_string_equal(String *left, String *right);
String *__qmljs_string_concat(Context *ctx, String *first, String *second);
String *__qmljs_identifier_from_utf8(Context *ctx, const char *s);
String *__qmljs_string_concat(ExecutionContext *ctx, String *first, String *second);
String *__qmljs_identifier_from_utf8(ExecutionContext *ctx, const char *s);
// objects
Value __qmljs_object_default_value(Context *ctx, Value object, int typeHint);
Value __qmljs_throw_type_error(Context *ctx);
Value __qmljs_new_object(Context *ctx);
Value __qmljs_new_boolean_object(Context *ctx, bool boolean);
Value __qmljs_new_number_object(Context *ctx, double n);
Value __qmljs_new_string_object(Context *ctx, String *string);
void __qmljs_set_activation_property(Context *ctx, String *name, Value value);
void __qmljs_set_property(Context *ctx, Value object, String *name, Value value);
Value __qmljs_get_property(Context *ctx, Value object, String *name);
Value __qmljs_get_activation_property(Context *ctx, String *name);
Value __qmljs_object_default_value(ExecutionContext *ctx, Value object, int typeHint);
Value __qmljs_throw_type_error(ExecutionContext *ctx);
Value __qmljs_new_object(ExecutionContext *ctx);
Value __qmljs_new_boolean_object(ExecutionContext *ctx, bool boolean);
Value __qmljs_new_number_object(ExecutionContext *ctx, double n);
Value __qmljs_new_string_object(ExecutionContext *ctx, String *string);
void __qmljs_set_activation_property(ExecutionContext *ctx, String *name, Value value);
void __qmljs_set_property(ExecutionContext *ctx, Value object, String *name, Value value);
Value __qmljs_get_property(ExecutionContext *ctx, Value object, String *name);
Value __qmljs_get_activation_property(ExecutionContext *ctx, String *name);
Value __qmljs_get_element(Context *ctx, Value object, Value index);
void __qmljs_set_element(Context *ctx, Value object, Value index, Value value);
Value __qmljs_get_element(ExecutionContext *ctx, Value object, Value index);
void __qmljs_set_element(ExecutionContext *ctx, Value object, Value index, Value value);
// For each
Value __qmljs_foreach_iterator_object(Value in, Context *ctx);
Value __qmljs_foreach_iterator_object(Value in, ExecutionContext *ctx);
Value __qmljs_foreach_next_property_name(Value foreach_iterator);
// context
Value __qmljs_get_thisObject(Context *ctx);
Value __qmljs_get_thisObject(ExecutionContext *ctx);
// type conversion and testing
Value __qmljs_to_primitive(Value value, Context *ctx, int typeHint);
Bool __qmljs_to_boolean(Value value, Context *ctx);
double __qmljs_to_number(Value value, Context *ctx);
double __qmljs_to_integer(Value value, Context *ctx);
int __qmljs_to_int32(Value value, Context *ctx);
unsigned short __qmljs_to_uint16(Value value, Context *ctx);
Value __qmljs_to_string(Value value, Context *ctx);
Value __qmljs_to_object(Value value, Context *ctx);
Value __qmljs_to_primitive(Value value, ExecutionContext *ctx, int typeHint);
Bool __qmljs_to_boolean(Value value, ExecutionContext *ctx);
double __qmljs_to_number(Value value, ExecutionContext *ctx);
double __qmljs_to_integer(Value value, ExecutionContext *ctx);
int __qmljs_to_int32(Value value, ExecutionContext *ctx);
unsigned short __qmljs_to_uint16(Value value, ExecutionContext *ctx);
Value __qmljs_to_string(Value value, ExecutionContext *ctx);
Value __qmljs_to_object(Value value, ExecutionContext *ctx);
//uint __qmljs_check_object_coercible(Context *ctx, Value *result, Value *value);
Bool __qmljs_is_callable(Value value, Context *ctx);
Value __qmljs_default_value(Value value, Context *ctx, int typeHint);
Bool __qmljs_is_callable(Value value, ExecutionContext *ctx);
Value __qmljs_default_value(Value value, ExecutionContext *ctx, int typeHint);
Bool __qmljs_equal(Value x, Value y, Context *ctx);
Bool __qmljs_equal(Value x, Value y, ExecutionContext *ctx);
Bool __qmljs_strict_equal(Value x, Value y);
// unary operators
Value __qmljs_uplus(Value value, Context *ctx);
Value __qmljs_uminus(Value value, Context *ctx);
Value __qmljs_compl(Value value, Context *ctx);
Value __qmljs_not(Value value, Context *ctx);
Value __qmljs_uplus(Value value, ExecutionContext *ctx);
Value __qmljs_uminus(Value value, ExecutionContext *ctx);
Value __qmljs_compl(Value value, ExecutionContext *ctx);
Value __qmljs_not(Value value, ExecutionContext *ctx);
Value __qmljs_delete_subscript(Context *ctx, Value base, Value index);
Value __qmljs_delete_member(Context *ctx, Value base, String *name);
Value __qmljs_delete_property(Context *ctx, String *name);
Value __qmljs_delete_value(Context *ctx, Value value);
Value __qmljs_delete_subscript(ExecutionContext *ctx, Value base, Value index);
Value __qmljs_delete_member(ExecutionContext *ctx, Value base, String *name);
Value __qmljs_delete_property(ExecutionContext *ctx, String *name);
Value __qmljs_delete_value(ExecutionContext *ctx, Value value);
Value __qmljs_typeof(Value value, Context *ctx);
void __qmljs_throw(Value value, Context *context);
Value __qmljs_typeof(Value value, ExecutionContext *ctx);
void __qmljs_throw(Value value, ExecutionContext *context);
// actually returns a jmp_buf *
void *__qmljs_create_exception_handler(Context *context);
void __qmljs_delete_exception_handler(Context *context);
Value __qmljs_get_exception(Context *context);
void *__qmljs_create_exception_handler(ExecutionContext *context);
void __qmljs_delete_exception_handler(ExecutionContext *context);
Value __qmljs_get_exception(ExecutionContext *context);
// binary operators
typedef Value (*BinOp)(Value left, Value right, Context *ctx);
typedef Value (*BinOp)(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_instanceof(Value left, Value right, Context *ctx);
Value __qmljs_in(Value left, Value right, Context *ctx);
Value __qmljs_bit_or(Value left, Value right, Context *ctx);
Value __qmljs_bit_xor(Value left, Value right, Context *ctx);
Value __qmljs_bit_and(Value left, Value right, Context *ctx);
Value __qmljs_add(Value left, Value right, Context *ctx);
Value __qmljs_sub(Value left, Value right, Context *ctx);
Value __qmljs_mul(Value left, Value right, Context *ctx);
Value __qmljs_div(Value left, Value right, Context *ctx);
Value __qmljs_mod(Value left, Value right, Context *ctx);
Value __qmljs_shl(Value left, Value right, Context *ctx);
Value __qmljs_shr(Value left, Value right, Context *ctx);
Value __qmljs_ushr(Value left, Value right, Context *ctx);
Value __qmljs_gt(Value left, Value right, Context *ctx);
Value __qmljs_lt(Value left, Value right, Context *ctx);
Value __qmljs_ge(Value left, Value right, Context *ctx);
Value __qmljs_le(Value left, Value right, Context *ctx);
Value __qmljs_eq(Value left, Value right, Context *ctx);
Value __qmljs_ne(Value left, Value right, Context *ctx);
Value __qmljs_se(Value left, Value right, Context *ctx);
Value __qmljs_sne(Value left, Value right, Context *ctx);
Value __qmljs_instanceof(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_in(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_bit_or(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_bit_xor(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_bit_and(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_add(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_sub(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_mul(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_div(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_mod(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_shl(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_shr(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_ushr(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_gt(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_lt(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_ge(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_le(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_eq(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_ne(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_se(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_sne(Value left, Value right, ExecutionContext *ctx);
Value __qmljs_add_helper(Value left, Value right, Context *ctx);
Value __qmljs_add_helper(Value left, Value right, ExecutionContext *ctx);
void __qmljs_inplace_bit_and_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_bit_or_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_bit_xor_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_add_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_sub_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_mul_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_div_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_mod_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_shl_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_shr_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_ushr_name(Value value, String *name, Context *ctx);
void __qmljs_inplace_bit_and_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_bit_or_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_bit_xor_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_add_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_sub_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_mul_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_div_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_mod_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_shl_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_shr_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_ushr_name(Value value, String *name, ExecutionContext *ctx);
void __qmljs_inplace_bit_and_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_bit_or_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_bit_xor_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_add_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_sub_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_mul_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_div_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_mod_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_shl_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_shr_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_ushr_element(Value base, Value index, Value value, Context *ctx);
void __qmljs_inplace_bit_and_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_bit_or_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_bit_xor_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_add_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_sub_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_mul_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_div_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_mod_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_shl_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_shr_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_ushr_element(Value base, Value index, Value value, ExecutionContext *ctx);
void __qmljs_inplace_bit_and_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_bit_or_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_bit_xor_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_add_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_sub_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_mul_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_div_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_mod_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_shl_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_shr_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_ushr_member(Value value, Value base, String *name, Context *ctx);
void __qmljs_inplace_bit_and_member(Value value, Value base, String *name, ExecutionContext *ctx);
void __qmljs_inplace_bit_or_member(Value value, Value base, String *name, ExecutionContext *ctx);
void __qmljs_inplace_bit_xor_member(Value value, Value base, String *name, ExecutionContext *ctx);
void __qmljs_inplace_add_member(Value value, Value base, String *name, ExecutionContext *ctx);
void __qmljs_inplace_sub_member(Value value, Value base, String *name, ExecutionContext *ctx);
void __qmljs_inplace_mul_member(Value value, Value base, String *name, ExecutionContext *ctx);
void __qmljs_inplace_div_member(Value value, Value base, String *name, ExecutionContext *ctx);
void __qmljs_inplace_mod_member(Value value, Value base, String *name, ExecutionContext *ctx);
void __qmljs_inplace_shl_member(Value value, Value base, String *name, ExecutionContext *ctx);
void __qmljs_inplace_shr_member(Value value, Value base, String *name, ExecutionContext *ctx);
void __qmljs_inplace_ushr_member(Value value, Value base, String *name, ExecutionContext *ctx);
Bool __qmljs_cmp_gt(Value left, Value right, Context *ctx);
Bool __qmljs_cmp_lt(Value left, Value right, Context *ctx);
Bool __qmljs_cmp_ge(Value left, Value right, Context *ctx);
Bool __qmljs_cmp_le(Value left, Value right, Context *ctx);
Bool __qmljs_cmp_eq(Value left, Value right, Context *ctx);
Bool __qmljs_cmp_ne(Value left, Value right, Context *ctx);
Bool __qmljs_cmp_se(Value left, Value right, Context *ctx);
Bool __qmljs_cmp_sne(Value left, Value right, Context *ctx);
Bool __qmljs_cmp_instanceof(Value left, Value right, Context *ctx);
Bool __qmljs_cmp_in(Value left, Value right, Context *ctx);
Bool __qmljs_cmp_gt(Value left, Value right, ExecutionContext *ctx);
Bool __qmljs_cmp_lt(Value left, Value right, ExecutionContext *ctx);
Bool __qmljs_cmp_ge(Value left, Value right, ExecutionContext *ctx);
Bool __qmljs_cmp_le(Value left, Value right, ExecutionContext *ctx);
Bool __qmljs_cmp_eq(Value left, Value right, ExecutionContext *ctx);
Bool __qmljs_cmp_ne(Value left, Value right, ExecutionContext *ctx);
Bool __qmljs_cmp_se(Value left, Value right, ExecutionContext *ctx);
Bool __qmljs_cmp_sne(Value left, Value right, ExecutionContext *ctx);
Bool __qmljs_cmp_instanceof(Value left, Value right, ExecutionContext *ctx);
Bool __qmljs_cmp_in(Value left, Value right, ExecutionContext *ctx);
} // extern "C"
inline int Value::toUInt16(Context *ctx)
inline int Value::toUInt16(ExecutionContext *ctx)
{
return __qmljs_to_uint16(*this, ctx);
}
inline int Value::toInt32(Context *ctx)
inline int Value::toInt32(ExecutionContext *ctx)
{
if (isConvertibleToInt())
return int_32;
@ -452,7 +452,7 @@ inline int Value::toInt32(Context *ctx)
return Value::toInt32(__qmljs_to_number(*this, ctx));
}
inline unsigned int Value::toUInt32(Context *ctx)
inline unsigned int Value::toUInt32(ExecutionContext *ctx)
{
if (isConvertibleToInt())
return (unsigned) int_32;
@ -460,29 +460,29 @@ inline unsigned int Value::toUInt32(Context *ctx)
return toUInt32(__qmljs_to_number(*this, ctx));
}
inline Bool Value::toBoolean(Context *ctx) const
inline Bool Value::toBoolean(ExecutionContext *ctx) const
{
return __qmljs_to_boolean(*this, ctx);
}
inline double Value::toInteger(Context *ctx) const
inline double Value::toInteger(ExecutionContext *ctx) const
{
return __qmljs_to_integer(*this, ctx);
}
inline double Value::toNumber(Context *ctx) const
inline double Value::toNumber(ExecutionContext *ctx) const
{
return __qmljs_to_number(*this, ctx);
}
inline String *Value::toString(Context *ctx) const
inline String *Value::toString(ExecutionContext *ctx) const
{
Value v = __qmljs_to_string(*this, ctx);
assert(v.isString());
return v.stringValue();
}
inline Value Value::toObject(Context *ctx) const
inline Value Value::toObject(ExecutionContext *ctx) const
{
return __qmljs_to_object(*this, ctx);
}
@ -570,9 +570,9 @@ inline bool Value::sameValue(Value other) {
#include <qmljs_math.h>
struct Context {
struct ExecutionContext {
ExecutionEngine *engine;
Context *parent;
ExecutionContext *parent;
Object *activation;
Value thisObject;
Value *arguments;
@ -596,10 +596,10 @@ struct Context {
void init(ExecutionEngine *eng);
void initCallContext(Context *parent, const Value that, FunctionObject *f, Value *args, unsigned argc);
void initCallContext(ExecutionContext *parent, const Value that, FunctionObject *f, Value *args, unsigned argc);
void leaveCallContext();
void initConstructorContext(Context *parent, Value that, FunctionObject *f, Value *args, unsigned argc);
void initConstructorContext(ExecutionContext *parent, Value that, FunctionObject *f, Value *args, unsigned argc);
void leaveConstructorContext(FunctionObject *f);
void wireUpPrototype(FunctionObject *f);
@ -615,14 +615,14 @@ struct Context {
extern "C" {
// type conversion and testing
inline Value __qmljs_to_primitive(Value value, Context *ctx, int typeHint)
inline Value __qmljs_to_primitive(Value value, ExecutionContext *ctx, int typeHint)
{
if (!value.isObject())
return value;
return __qmljs_default_value(value, ctx, typeHint);
}
inline Bool __qmljs_to_boolean(Value value, Context *ctx)
inline Bool __qmljs_to_boolean(Value value, ExecutionContext *ctx)
{
switch (value.type()) {
case Value::Undefined_Type:
@ -642,7 +642,7 @@ inline Bool __qmljs_to_boolean(Value value, Context *ctx)
}
}
inline double __qmljs_to_number(Value value, Context *ctx)
inline double __qmljs_to_number(Value value, ExecutionContext *ctx)
{
switch (value.type()) {
case Value::Undefined_Type:
@ -664,7 +664,7 @@ inline double __qmljs_to_number(Value value, Context *ctx)
}
}
inline double __qmljs_to_integer(Value value, Context *ctx)
inline double __qmljs_to_integer(Value value, ExecutionContext *ctx)
{
if (value.isConvertibleToInt())
return value.int_32;
@ -672,7 +672,7 @@ inline double __qmljs_to_integer(Value value, Context *ctx)
return Value::toInteger(__qmljs_to_number(value, ctx));
}
inline int __qmljs_to_int32(Value value, Context *ctx)
inline int __qmljs_to_int32(Value value, ExecutionContext *ctx)
{
if (value.isConvertibleToInt())
return value.int_32;
@ -680,7 +680,7 @@ inline int __qmljs_to_int32(Value value, Context *ctx)
return Value::toInt32(__qmljs_to_number(value, ctx));
}
inline unsigned short __qmljs_to_uint16(Value value, Context *ctx)
inline unsigned short __qmljs_to_uint16(Value value, ExecutionContext *ctx)
{
if (value.isConvertibleToInt())
return (ushort)(uint)value.integerValue();
@ -706,7 +706,7 @@ inline unsigned short __qmljs_to_uint16(Value value, Context *ctx)
return (unsigned short)number;
}
inline Value __qmljs_to_string(Value value, Context *ctx)
inline Value __qmljs_to_string(Value value, ExecutionContext *ctx)
{
switch (value.type()) {
case Value::Undefined_Type:
@ -742,7 +742,7 @@ inline Value __qmljs_to_string(Value value, Context *ctx)
} // switch
}
inline Value __qmljs_to_object(Value value, Context *ctx)
inline Value __qmljs_to_object(Value value, ExecutionContext *ctx)
{
switch (value.type()) {
case Value::Undefined_Type:
@ -781,7 +781,7 @@ inline uint __qmljs_check_object_coercible(Context *ctx, Value *result, Value *v
}
*/
inline Bool __qmljs_is_callable(Value value, Context * /*ctx*/)
inline Bool __qmljs_is_callable(Value value, ExecutionContext * /*ctx*/)
{
if (value.isObject())
return __qmljs_is_function(value);
@ -789,7 +789,7 @@ inline Bool __qmljs_is_callable(Value value, Context * /*ctx*/)
return false;
}
inline Value __qmljs_default_value(Value value, Context *ctx, int typeHint)
inline Value __qmljs_default_value(Value value, ExecutionContext *ctx, int typeHint)
{
if (value.isObject())
return __qmljs_object_default_value(ctx, value, typeHint);
@ -798,7 +798,7 @@ inline Value __qmljs_default_value(Value value, Context *ctx, int typeHint)
// unary operators
inline Value __qmljs_typeof(Value value, Context *ctx)
inline Value __qmljs_typeof(Value value, ExecutionContext *ctx)
{
switch (value.type()) {
case Value::Undefined_Type:
@ -825,7 +825,7 @@ inline Value __qmljs_typeof(Value value, Context *ctx)
}
}
inline Value __qmljs_uplus(Value value, Context *ctx)
inline Value __qmljs_uplus(Value value, ExecutionContext *ctx)
{
TRACE1(value);
@ -836,7 +836,7 @@ inline Value __qmljs_uplus(Value value, Context *ctx)
return Value::fromDouble(n);
}
inline Value __qmljs_uminus(Value value, Context *ctx)
inline Value __qmljs_uminus(Value value, ExecutionContext *ctx)
{
TRACE1(value);
@ -846,7 +846,7 @@ inline Value __qmljs_uminus(Value value, Context *ctx)
return Value::fromDouble(-n);
}
inline Value __qmljs_compl(Value value, Context *ctx)
inline Value __qmljs_compl(Value value, ExecutionContext *ctx)
{
TRACE1(value);
@ -859,7 +859,7 @@ inline Value __qmljs_compl(Value value, Context *ctx)
return Value::fromInt32(~n);
}
inline Value __qmljs_not(Value value, Context *ctx)
inline Value __qmljs_not(Value value, ExecutionContext *ctx)
{
TRACE1(value);
@ -868,7 +868,7 @@ inline Value __qmljs_not(Value value, Context *ctx)
}
// binary operators
inline Value __qmljs_bit_or(Value left, Value right, Context *ctx)
inline Value __qmljs_bit_or(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -880,7 +880,7 @@ inline Value __qmljs_bit_or(Value left, Value right, Context *ctx)
return Value::fromInt32(lval | rval);
}
inline Value __qmljs_bit_xor(Value left, Value right, Context *ctx)
inline Value __qmljs_bit_xor(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -892,7 +892,7 @@ inline Value __qmljs_bit_xor(Value left, Value right, Context *ctx)
return Value::fromInt32(lval ^ rval);
}
inline Value __qmljs_bit_and(Value left, Value right, Context *ctx)
inline Value __qmljs_bit_and(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -904,7 +904,7 @@ inline Value __qmljs_bit_and(Value left, Value right, Context *ctx)
return Value::fromInt32(lval & rval);
}
inline Value __qmljs_add(Value left, Value right, Context *ctx)
inline Value __qmljs_add(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -919,7 +919,7 @@ inline Value __qmljs_add(Value left, Value right, Context *ctx)
return __qmljs_add_helper(left, right, ctx);
}
inline Value __qmljs_sub(Value left, Value right, Context *ctx)
inline Value __qmljs_sub(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -933,7 +933,7 @@ inline Value __qmljs_sub(Value left, Value right, Context *ctx)
return Value::fromDouble(lval - rval);
}
inline Value __qmljs_mul(Value left, Value right, Context *ctx)
inline Value __qmljs_mul(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -947,7 +947,7 @@ inline Value __qmljs_mul(Value left, Value right, Context *ctx)
return Value::fromDouble(lval * rval);
}
inline Value __qmljs_div(Value left, Value right, Context *ctx)
inline Value __qmljs_div(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -956,7 +956,7 @@ inline Value __qmljs_div(Value left, Value right, Context *ctx)
return Value::fromDouble(lval / rval);
}
inline Value __qmljs_mod(Value left, Value right, Context *ctx)
inline Value __qmljs_mod(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -970,7 +970,7 @@ inline Value __qmljs_mod(Value left, Value right, Context *ctx)
// ### unsigned shl missing?
inline Value __qmljs_shl(Value left, Value right, Context *ctx)
inline Value __qmljs_shl(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -982,7 +982,7 @@ inline Value __qmljs_shl(Value left, Value right, Context *ctx)
return Value::fromInt32(lval << rval);
}
inline Value __qmljs_shr(Value left, Value right, Context *ctx)
inline Value __qmljs_shr(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -994,7 +994,7 @@ inline Value __qmljs_shr(Value left, Value right, Context *ctx)
return Value::fromInt32(lval >> rval);
}
inline Value __qmljs_ushr(Value left, Value right, Context *ctx)
inline Value __qmljs_ushr(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -1006,49 +1006,49 @@ inline Value __qmljs_ushr(Value left, Value right, Context *ctx)
return Value::fromInt32(lval >> rval);
}
inline Value __qmljs_gt(Value left, Value right, Context *ctx)
inline Value __qmljs_gt(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
return Value::fromBoolean(__qmljs_cmp_gt(left, right, ctx));
}
inline Value __qmljs_lt(Value left, Value right, Context *ctx)
inline Value __qmljs_lt(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
return Value::fromBoolean(__qmljs_cmp_lt(left, right, ctx));
}
inline Value __qmljs_ge(Value left, Value right, Context *ctx)
inline Value __qmljs_ge(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
return Value::fromBoolean(__qmljs_cmp_ge(left, right, ctx));
}
inline Value __qmljs_le(Value left, Value right, Context *ctx)
inline Value __qmljs_le(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
return Value::fromBoolean(__qmljs_cmp_le(left, right, ctx));
}
inline Value __qmljs_eq(Value left, Value right, Context *ctx)
inline Value __qmljs_eq(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
return Value::fromBoolean(__qmljs_cmp_eq(left, right, ctx));
}
inline Value __qmljs_ne(Value left, Value right, Context *ctx)
inline Value __qmljs_ne(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
return Value::fromBoolean(!__qmljs_cmp_eq(left, right, ctx));
}
inline Value __qmljs_se(Value left, Value right, Context *)
inline Value __qmljs_se(Value left, Value right, ExecutionContext *)
{
TRACE2(left, right);
@ -1056,7 +1056,7 @@ inline Value __qmljs_se(Value left, Value right, Context *)
return Value::fromBoolean(r);
}
inline Value __qmljs_sne(Value left, Value right, Context *)
inline Value __qmljs_sne(Value left, Value right, ExecutionContext *)
{
TRACE2(left, right);
@ -1064,7 +1064,7 @@ inline Value __qmljs_sne(Value left, Value right, Context *)
return Value::fromBoolean(r);
}
inline Bool __qmljs_cmp_gt(Value left, Value right, Context *ctx)
inline Bool __qmljs_cmp_gt(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -1084,7 +1084,7 @@ inline Bool __qmljs_cmp_gt(Value left, Value right, Context *ctx)
}
}
inline Bool __qmljs_cmp_lt(Value left, Value right, Context *ctx)
inline Bool __qmljs_cmp_lt(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -1104,7 +1104,7 @@ inline Bool __qmljs_cmp_lt(Value left, Value right, Context *ctx)
}
}
inline Bool __qmljs_cmp_ge(Value left, Value right, Context *ctx)
inline Bool __qmljs_cmp_ge(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -1124,7 +1124,7 @@ inline Bool __qmljs_cmp_ge(Value left, Value right, Context *ctx)
}
}
inline Bool __qmljs_cmp_le(Value left, Value right, Context *ctx)
inline Bool __qmljs_cmp_le(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -1144,7 +1144,7 @@ inline Bool __qmljs_cmp_le(Value left, Value right, Context *ctx)
}
}
inline Bool __qmljs_cmp_eq(Value left, Value right, Context *ctx)
inline Bool __qmljs_cmp_eq(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -1159,28 +1159,28 @@ inline Bool __qmljs_cmp_eq(Value left, Value right, Context *ctx)
return __qmljs_equal(left, right, ctx);
}
inline Bool __qmljs_cmp_ne(Value left, Value right, Context *ctx)
inline Bool __qmljs_cmp_ne(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
return !__qmljs_cmp_eq(left, right, ctx);
}
inline Bool __qmljs_cmp_se(Value left, Value right, Context *)
inline Bool __qmljs_cmp_se(Value left, Value right, ExecutionContext *)
{
TRACE2(left, right);
return __qmljs_strict_equal(left, right);
}
inline Bool __qmljs_cmp_sne(Value left, Value right, Context *)
inline Bool __qmljs_cmp_sne(Value left, Value right, ExecutionContext *)
{
TRACE2(left, right);
return ! __qmljs_strict_equal(left, right);
}
inline Bool __qmljs_cmp_instanceof(Value left, Value right, Context *ctx)
inline Bool __qmljs_cmp_instanceof(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);
@ -1188,7 +1188,7 @@ inline Bool __qmljs_cmp_instanceof(Value left, Value right, Context *ctx)
return v.booleanValue();
}
inline uint __qmljs_cmp_in(Value left, Value right, Context *ctx)
inline uint __qmljs_cmp_in(Value left, Value right, ExecutionContext *ctx)
{
TRACE2(left, right);

View File

@ -68,7 +68,7 @@ public:
inline void concat(const Array &other);
inline Value pop();
inline Value takeFirst();
inline void sort(Context *context, const Value &comparefn);
inline void sort(ExecutionContext *context, const Value &comparefn);
inline void splice(double start, double deleteCount,
const QVector<Value> &items,
Array &other);
@ -81,13 +81,13 @@ private:
class ArrayElementLessThan
{
public:
inline ArrayElementLessThan(Context *context, const Value &comparefn)
inline ArrayElementLessThan(ExecutionContext *context, const Value &comparefn)
: m_context(context), m_comparefn(comparefn) {}
bool operator()(const Value &v1, const Value &v2) const;
private:
Context *m_context;
ExecutionContext *m_context;
Value m_comparefn;
};
@ -183,7 +183,7 @@ inline Value Array::takeFirst()
return v;
}
inline void Array::sort(Context *context, const Value &comparefn)
inline void Array::sort(ExecutionContext *context, const Value &comparefn)
{
ArrayElementLessThan lessThan(context, comparefn);
std::sort(to_vector->begin(), to_vector->end(), lessThan);

File diff suppressed because it is too large Load Diff

View File

@ -49,299 +49,299 @@ namespace VM {
struct ObjectCtor: FunctionObject
{
ObjectCtor(Context *scope);
ObjectCtor(ExecutionContext *scope);
virtual void construct(Context *ctx);
virtual void call(Context *ctx);
virtual Value __get__(Context *ctx, String *name);
virtual void construct(ExecutionContext *ctx);
virtual void call(ExecutionContext *ctx);
virtual Value __get__(ExecutionContext *ctx, String *name);
};
struct ObjectPrototype: Object
{
void init(Context *ctx, const Value &ctor);
void init(ExecutionContext *ctx, const Value &ctor);
static void method_getPrototypeOf(Context *ctx);
static void method_getOwnPropertyDescriptor(Context *ctx);
static void method_getOwnPropertyNames(Context *ctx);
static void method_create(Context *ctx);
static void method_defineProperty(Context *ctx);
static void method_defineProperties(Context *ctx);
static void method_seal(Context *ctx);
static void method_freeze(Context *ctx);
static void method_preventExtensions(Context *ctx);
static void method_isSealed(Context *ctx);
static void method_isFrozen(Context *ctx);
static void method_isExtensible(Context *ctx);
static void method_keys(Context *ctx);
static void method_getPrototypeOf(ExecutionContext *ctx);
static void method_getOwnPropertyDescriptor(ExecutionContext *ctx);
static void method_getOwnPropertyNames(ExecutionContext *ctx);
static void method_create(ExecutionContext *ctx);
static void method_defineProperty(ExecutionContext *ctx);
static void method_defineProperties(ExecutionContext *ctx);
static void method_seal(ExecutionContext *ctx);
static void method_freeze(ExecutionContext *ctx);
static void method_preventExtensions(ExecutionContext *ctx);
static void method_isSealed(ExecutionContext *ctx);
static void method_isFrozen(ExecutionContext *ctx);
static void method_isExtensible(ExecutionContext *ctx);
static void method_keys(ExecutionContext *ctx);
static void method_toString(Context *ctx);
static void method_toLocaleString(Context *ctx);
static void method_valueOf(Context *ctx);
static void method_hasOwnProperty(Context *ctx);
static void method_isPrototypeOf(Context *ctx);
static void method_propertyIsEnumerable(Context *ctx);
static void method_toString(ExecutionContext *ctx);
static void method_toLocaleString(ExecutionContext *ctx);
static void method_valueOf(ExecutionContext *ctx);
static void method_hasOwnProperty(ExecutionContext *ctx);
static void method_isPrototypeOf(ExecutionContext *ctx);
static void method_propertyIsEnumerable(ExecutionContext *ctx);
};
struct StringCtor: FunctionObject
{
StringCtor(Context *scope);
StringCtor(ExecutionContext *scope);
virtual void construct(Context *ctx);
virtual void call(Context *ctx);
virtual void construct(ExecutionContext *ctx);
virtual void call(ExecutionContext *ctx);
};
struct StringPrototype: StringObject
{
StringPrototype(Context *ctx): StringObject(Value::fromString(ctx, QString())) {}
void init(Context *ctx, const Value &ctor);
StringPrototype(ExecutionContext *ctx): StringObject(Value::fromString(ctx, QString())) {}
void init(ExecutionContext *ctx, const Value &ctor);
static QString getThisString(Context *ctx);
static QString getThisString(ExecutionContext *ctx);
static void method_toString(Context *ctx);
static void method_valueOf(Context *ctx);
static void method_charAt(Context *ctx);
static void method_charCodeAt(Context *ctx);
static void method_concat(Context *ctx);
static void method_indexOf(Context *ctx);
static void method_lastIndexOf(Context *ctx);
static void method_localeCompare(Context *ctx);
static void method_match(Context *ctx);
static void method_replace(Context *ctx);
static void method_search(Context *ctx);
static void method_slice(Context *ctx);
static void method_split(Context *ctx);
static void method_substr(Context *ctx);
static void method_substring(Context *ctx);
static void method_toLowerCase(Context *ctx);
static void method_toLocaleLowerCase(Context *ctx);
static void method_toUpperCase(Context *ctx);
static void method_toLocaleUpperCase(Context *ctx);
static void method_fromCharCode(Context *ctx);
static void method_toString(ExecutionContext *ctx);
static void method_valueOf(ExecutionContext *ctx);
static void method_charAt(ExecutionContext *ctx);
static void method_charCodeAt(ExecutionContext *ctx);
static void method_concat(ExecutionContext *ctx);
static void method_indexOf(ExecutionContext *ctx);
static void method_lastIndexOf(ExecutionContext *ctx);
static void method_localeCompare(ExecutionContext *ctx);
static void method_match(ExecutionContext *ctx);
static void method_replace(ExecutionContext *ctx);
static void method_search(ExecutionContext *ctx);
static void method_slice(ExecutionContext *ctx);
static void method_split(ExecutionContext *ctx);
static void method_substr(ExecutionContext *ctx);
static void method_substring(ExecutionContext *ctx);
static void method_toLowerCase(ExecutionContext *ctx);
static void method_toLocaleLowerCase(ExecutionContext *ctx);
static void method_toUpperCase(ExecutionContext *ctx);
static void method_toLocaleUpperCase(ExecutionContext *ctx);
static void method_fromCharCode(ExecutionContext *ctx);
};
struct NumberCtor: FunctionObject
{
NumberCtor(Context *scope);
NumberCtor(ExecutionContext *scope);
virtual void construct(Context *ctx);
virtual void call(Context *ctx);
virtual void construct(ExecutionContext *ctx);
virtual void call(ExecutionContext *ctx);
};
struct NumberPrototype: NumberObject
{
NumberPrototype(): NumberObject(Value::fromDouble(0)) {}
void init(Context *ctx, const Value &ctor);
void init(ExecutionContext *ctx, const Value &ctor);
static void method_toString(Context *ctx);
static void method_toLocaleString(Context *ctx);
static void method_valueOf(Context *ctx);
static void method_toFixed(Context *ctx);
static void method_toExponential(Context *ctx);
static void method_toPrecision(Context *ctx);
static void method_toString(ExecutionContext *ctx);
static void method_toLocaleString(ExecutionContext *ctx);
static void method_valueOf(ExecutionContext *ctx);
static void method_toFixed(ExecutionContext *ctx);
static void method_toExponential(ExecutionContext *ctx);
static void method_toPrecision(ExecutionContext *ctx);
};
struct BooleanCtor: FunctionObject
{
BooleanCtor(Context *scope);
BooleanCtor(ExecutionContext *scope);
virtual void construct(Context *ctx);
virtual void call(Context *ctx);
virtual void construct(ExecutionContext *ctx);
virtual void call(ExecutionContext *ctx);
};
struct BooleanPrototype: BooleanObject
{
BooleanPrototype(): BooleanObject(Value::fromBoolean(false)) {}
void init(Context *ctx, const Value &ctor);
void init(ExecutionContext *ctx, const Value &ctor);
static void method_toString(Context *ctx);
static void method_valueOf(Context *ctx);
static void method_toString(ExecutionContext *ctx);
static void method_valueOf(ExecutionContext *ctx);
};
struct ArrayCtor: FunctionObject
{
ArrayCtor(Context *scope);
ArrayCtor(ExecutionContext *scope);
virtual void construct(Context *ctx);
virtual void call(Context *ctx);
virtual void construct(ExecutionContext *ctx);
virtual void call(ExecutionContext *ctx);
};
struct ArrayPrototype: ArrayObject
{
void init(Context *ctx, const Value &ctor);
void init(ExecutionContext *ctx, const Value &ctor);
static void method_toString(Context *ctx);
static void method_toLocaleString(Context *ctx);
static void method_concat(Context *ctx);
static void method_join(Context *ctx);
static void method_pop(Context *ctx);
static void method_push(Context *ctx);
static void method_reverse(Context *ctx);
static void method_shift(Context *ctx);
static void method_slice(Context *ctx);
static void method_sort(Context *ctx);
static void method_splice(Context *ctx);
static void method_unshift(Context *ctx);
static void method_indexOf(Context *ctx);
static void method_lastIndexOf(Context *ctx);
static void method_every(Context *ctx);
static void method_some(Context *ctx);
static void method_forEach(Context *ctx);
static void method_map(Context *ctx);
static void method_filter(Context *ctx);
static void method_reduce(Context *ctx);
static void method_reduceRight(Context *ctx);
static void method_toString(ExecutionContext *ctx);
static void method_toLocaleString(ExecutionContext *ctx);
static void method_concat(ExecutionContext *ctx);
static void method_join(ExecutionContext *ctx);
static void method_pop(ExecutionContext *ctx);
static void method_push(ExecutionContext *ctx);
static void method_reverse(ExecutionContext *ctx);
static void method_shift(ExecutionContext *ctx);
static void method_slice(ExecutionContext *ctx);
static void method_sort(ExecutionContext *ctx);
static void method_splice(ExecutionContext *ctx);
static void method_unshift(ExecutionContext *ctx);
static void method_indexOf(ExecutionContext *ctx);
static void method_lastIndexOf(ExecutionContext *ctx);
static void method_every(ExecutionContext *ctx);
static void method_some(ExecutionContext *ctx);
static void method_forEach(ExecutionContext *ctx);
static void method_map(ExecutionContext *ctx);
static void method_filter(ExecutionContext *ctx);
static void method_reduce(ExecutionContext *ctx);
static void method_reduceRight(ExecutionContext *ctx);
};
struct FunctionCtor: FunctionObject
{
FunctionCtor(Context *scope);
FunctionCtor(ExecutionContext *scope);
virtual void construct(Context *ctx);
virtual void call(Context *ctx);
virtual void construct(ExecutionContext *ctx);
virtual void call(ExecutionContext *ctx);
};
struct FunctionPrototype: FunctionObject
{
FunctionPrototype(Context *ctx): FunctionObject(ctx) {}
void init(Context *ctx, const Value &ctor);
FunctionPrototype(ExecutionContext *ctx): FunctionObject(ctx) {}
void init(ExecutionContext *ctx, const Value &ctor);
static void method_toString(Context *ctx);
static void method_apply(Context *ctx);
static void method_call(Context *ctx);
static void method_bind(Context *ctx);
static void method_toString(ExecutionContext *ctx);
static void method_apply(ExecutionContext *ctx);
static void method_call(ExecutionContext *ctx);
static void method_bind(ExecutionContext *ctx);
};
struct DateCtor: FunctionObject
{
DateCtor(Context *scope);
DateCtor(ExecutionContext *scope);
virtual void construct(Context *ctx);
virtual void call(Context *ctx);
virtual void construct(ExecutionContext *ctx);
virtual void call(ExecutionContext *ctx);
};
struct DatePrototype: DateObject
{
DatePrototype(): DateObject(Value::fromDouble(qSNaN())) {}
void init(Context *ctx, const Value &ctor);
void init(ExecutionContext *ctx, const Value &ctor);
static double getThisDate(Context *ctx);
static double getThisDate(ExecutionContext *ctx);
static void method_MakeTime(Context *ctx);
static void method_MakeDate(Context *ctx);
static void method_TimeClip(Context *ctx);
static void method_parse(Context *ctx);
static void method_UTC(Context *ctx);
static void method_toString(Context *ctx);
static void method_toDateString(Context *ctx);
static void method_toTimeString(Context *ctx);
static void method_toLocaleString(Context *ctx);
static void method_toLocaleDateString(Context *ctx);
static void method_toLocaleTimeString(Context *ctx);
static void method_valueOf(Context *ctx);
static void method_getTime(Context *ctx);
static void method_getYear(Context *ctx);
static void method_getFullYear(Context *ctx);
static void method_getUTCFullYear(Context *ctx);
static void method_getMonth(Context *ctx);
static void method_getUTCMonth(Context *ctx);
static void method_getDate(Context *ctx);
static void method_getUTCDate(Context *ctx);
static void method_getDay(Context *ctx);
static void method_getUTCDay(Context *ctx);
static void method_getHours(Context *ctx);
static void method_getUTCHours(Context *ctx);
static void method_getMinutes(Context *ctx);
static void method_getUTCMinutes(Context *ctx);
static void method_getSeconds(Context *ctx);
static void method_getUTCSeconds(Context *ctx);
static void method_getMilliseconds(Context *ctx);
static void method_getUTCMilliseconds(Context *ctx);
static void method_getTimezoneOffset(Context *ctx);
static void method_setTime(Context *ctx);
static void method_setMilliseconds(Context *ctx);
static void method_setUTCMilliseconds(Context *ctx);
static void method_setSeconds(Context *ctx);
static void method_setUTCSeconds(Context *ctx);
static void method_setMinutes(Context *ctx);
static void method_setUTCMinutes(Context *ctx);
static void method_setHours(Context *ctx);
static void method_setUTCHours(Context *ctx);
static void method_setDate(Context *ctx);
static void method_setUTCDate(Context *ctx);
static void method_setMonth(Context *ctx);
static void method_setUTCMonth(Context *ctx);
static void method_setYear(Context *ctx);
static void method_setFullYear(Context *ctx);
static void method_setUTCFullYear(Context *ctx);
static void method_toUTCString(Context *ctx);
static void method_MakeTime(ExecutionContext *ctx);
static void method_MakeDate(ExecutionContext *ctx);
static void method_TimeClip(ExecutionContext *ctx);
static void method_parse(ExecutionContext *ctx);
static void method_UTC(ExecutionContext *ctx);
static void method_toString(ExecutionContext *ctx);
static void method_toDateString(ExecutionContext *ctx);
static void method_toTimeString(ExecutionContext *ctx);
static void method_toLocaleString(ExecutionContext *ctx);
static void method_toLocaleDateString(ExecutionContext *ctx);
static void method_toLocaleTimeString(ExecutionContext *ctx);
static void method_valueOf(ExecutionContext *ctx);
static void method_getTime(ExecutionContext *ctx);
static void method_getYear(ExecutionContext *ctx);
static void method_getFullYear(ExecutionContext *ctx);
static void method_getUTCFullYear(ExecutionContext *ctx);
static void method_getMonth(ExecutionContext *ctx);
static void method_getUTCMonth(ExecutionContext *ctx);
static void method_getDate(ExecutionContext *ctx);
static void method_getUTCDate(ExecutionContext *ctx);
static void method_getDay(ExecutionContext *ctx);
static void method_getUTCDay(ExecutionContext *ctx);
static void method_getHours(ExecutionContext *ctx);
static void method_getUTCHours(ExecutionContext *ctx);
static void method_getMinutes(ExecutionContext *ctx);
static void method_getUTCMinutes(ExecutionContext *ctx);
static void method_getSeconds(ExecutionContext *ctx);
static void method_getUTCSeconds(ExecutionContext *ctx);
static void method_getMilliseconds(ExecutionContext *ctx);
static void method_getUTCMilliseconds(ExecutionContext *ctx);
static void method_getTimezoneOffset(ExecutionContext *ctx);
static void method_setTime(ExecutionContext *ctx);
static void method_setMilliseconds(ExecutionContext *ctx);
static void method_setUTCMilliseconds(ExecutionContext *ctx);
static void method_setSeconds(ExecutionContext *ctx);
static void method_setUTCSeconds(ExecutionContext *ctx);
static void method_setMinutes(ExecutionContext *ctx);
static void method_setUTCMinutes(ExecutionContext *ctx);
static void method_setHours(ExecutionContext *ctx);
static void method_setUTCHours(ExecutionContext *ctx);
static void method_setDate(ExecutionContext *ctx);
static void method_setUTCDate(ExecutionContext *ctx);
static void method_setMonth(ExecutionContext *ctx);
static void method_setUTCMonth(ExecutionContext *ctx);
static void method_setYear(ExecutionContext *ctx);
static void method_setFullYear(ExecutionContext *ctx);
static void method_setUTCFullYear(ExecutionContext *ctx);
static void method_toUTCString(ExecutionContext *ctx);
};
struct RegExpCtor: FunctionObject
{
RegExpCtor(Context *scope);
RegExpCtor(ExecutionContext *scope);
virtual void construct(Context *ctx);
virtual void call(Context *ctx);
virtual void construct(ExecutionContext *ctx);
virtual void call(ExecutionContext *ctx);
};
struct RegExpPrototype: RegExpObject
{
RegExpPrototype(): RegExpObject(QRegularExpression(), false) {}
void init(Context *ctx, const Value &ctor);
void init(ExecutionContext *ctx, const Value &ctor);
static void method_exec(Context *ctx);
static void method_test(Context *ctx);
static void method_toString(Context *ctx);
static void method_exec(ExecutionContext *ctx);
static void method_test(ExecutionContext *ctx);
static void method_toString(ExecutionContext *ctx);
};
struct ErrorCtor: FunctionObject
{
ErrorCtor(Context *scope);
ErrorCtor(ExecutionContext *scope);
virtual void construct(Context *ctx);
virtual void call(Context *ctx);
virtual void construct(ExecutionContext *ctx);
virtual void call(ExecutionContext *ctx);
};
struct EvalErrorCtor: ErrorCtor
{
EvalErrorCtor(Context *scope): ErrorCtor(scope) {}
EvalErrorCtor(ExecutionContext *scope): ErrorCtor(scope) {}
virtual void construct(Context *ctx);
virtual void construct(ExecutionContext *ctx);
};
struct RangeErrorCtor: ErrorCtor
{
RangeErrorCtor(Context *scope): ErrorCtor(scope) {}
RangeErrorCtor(ExecutionContext *scope): ErrorCtor(scope) {}
virtual void construct(Context *ctx);
virtual void construct(ExecutionContext *ctx);
};
struct ReferenceErrorCtor: ErrorCtor
{
ReferenceErrorCtor(Context *scope): ErrorCtor(scope) {}
ReferenceErrorCtor(ExecutionContext *scope): ErrorCtor(scope) {}
virtual void construct(Context *ctx);
virtual void construct(ExecutionContext *ctx);
};
struct SyntaxErrorCtor: ErrorCtor
{
SyntaxErrorCtor(Context *scope): ErrorCtor(scope) {}
SyntaxErrorCtor(ExecutionContext *scope): ErrorCtor(scope) {}
virtual void construct(Context *ctx);
virtual void construct(ExecutionContext *ctx);
};
struct TypeErrorCtor: ErrorCtor
{
TypeErrorCtor(Context *scope): ErrorCtor(scope) {}
TypeErrorCtor(ExecutionContext *scope): ErrorCtor(scope) {}
virtual void construct(Context *ctx);
virtual void construct(ExecutionContext *ctx);
};
struct URIErrorCtor: ErrorCtor
{
URIErrorCtor(Context *scope): ErrorCtor(scope) {}
URIErrorCtor(ExecutionContext *scope): ErrorCtor(scope) {}
virtual void construct(Context *ctx);
virtual void construct(ExecutionContext *ctx);
};
@ -349,71 +349,71 @@ struct ErrorPrototype: ErrorObject
{
// ### shouldn't be undefined
ErrorPrototype(): ErrorObject(Value::undefinedValue()) {}
void init(Context *ctx, const Value &ctor) { init(ctx, ctor, this); }
void init(ExecutionContext *ctx, const Value &ctor) { init(ctx, ctor, this); }
static void init(Context *ctx, const Value &ctor, Object *obj);
static void method_toString(Context *ctx);
static void init(ExecutionContext *ctx, const Value &ctor, Object *obj);
static void method_toString(ExecutionContext *ctx);
};
struct EvalErrorPrototype: EvalErrorObject
{
EvalErrorPrototype(Context *ctx): EvalErrorObject(ctx) {}
void init(Context *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
EvalErrorPrototype(ExecutionContext *ctx): EvalErrorObject(ctx) {}
void init(ExecutionContext *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
};
struct RangeErrorPrototype: RangeErrorObject
{
RangeErrorPrototype(Context *ctx): RangeErrorObject(ctx) {}
void init(Context *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
RangeErrorPrototype(ExecutionContext *ctx): RangeErrorObject(ctx) {}
void init(ExecutionContext *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
};
struct ReferenceErrorPrototype: ReferenceErrorObject
{
ReferenceErrorPrototype(Context *ctx): ReferenceErrorObject(ctx) {}
void init(Context *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
ReferenceErrorPrototype(ExecutionContext *ctx): ReferenceErrorObject(ctx) {}
void init(ExecutionContext *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
};
struct SyntaxErrorPrototype: SyntaxErrorObject
{
SyntaxErrorPrototype(Context *ctx): SyntaxErrorObject(ctx) {}
void init(Context *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
SyntaxErrorPrototype(ExecutionContext *ctx): SyntaxErrorObject(ctx) {}
void init(ExecutionContext *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
};
struct TypeErrorPrototype: TypeErrorObject
{
TypeErrorPrototype(Context *ctx): TypeErrorObject(ctx) {}
void init(Context *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
TypeErrorPrototype(ExecutionContext *ctx): TypeErrorObject(ctx) {}
void init(ExecutionContext *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
};
struct URIErrorPrototype: URIErrorObject
{
URIErrorPrototype(Context *ctx): URIErrorObject(ctx) {}
void init(Context *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
URIErrorPrototype(ExecutionContext *ctx): URIErrorObject(ctx) {}
void init(ExecutionContext *ctx, const Value &ctor) { ErrorPrototype::init(ctx, ctor, this); }
};
struct MathObject: Object
{
MathObject(Context *ctx);
MathObject(ExecutionContext *ctx);
static void method_abs(Context *ctx);
static void method_acos(Context *ctx);
static void method_asin(Context *ctx);
static void method_atan(Context *ctx);
static void method_atan2(Context *ctx);
static void method_ceil(Context *ctx);
static void method_cos(Context *ctx);
static void method_exp(Context *ctx);
static void method_floor(Context *ctx);
static void method_log(Context *ctx);
static void method_max(Context *ctx);
static void method_min(Context *ctx);
static void method_pow(Context *ctx);
static void method_random(Context *ctx);
static void method_round(Context *ctx);
static void method_sin(Context *ctx);
static void method_sqrt(Context *ctx);
static void method_tan(Context *ctx);
static void method_abs(ExecutionContext *ctx);
static void method_acos(ExecutionContext *ctx);
static void method_asin(ExecutionContext *ctx);
static void method_atan(ExecutionContext *ctx);
static void method_atan2(ExecutionContext *ctx);
static void method_ceil(ExecutionContext *ctx);
static void method_cos(ExecutionContext *ctx);
static void method_exp(ExecutionContext *ctx);
static void method_floor(ExecutionContext *ctx);
static void method_log(ExecutionContext *ctx);
static void method_max(ExecutionContext *ctx);
static void method_min(ExecutionContext *ctx);
static void method_pow(ExecutionContext *ctx);
static void method_random(ExecutionContext *ctx);
static void method_round(ExecutionContext *ctx);
static void method_sin(ExecutionContext *ctx);
static void method_sqrt(ExecutionContext *ctx);
static void method_tan(ExecutionContext *ctx);
};
} // end of namespace VM

View File

@ -71,7 +71,7 @@ class QQmlType;
namespace QQmlJS {
namespace VM {
struct Context;
struct ExecutionContext;
struct Value;
}
@ -596,7 +596,7 @@ struct Function {
QList<const QString *> locals;
IR::BasicBlock *handlersBlock;
void (*code)(VM::Context *, const uchar *);
void (*code)(VM::ExecutionContext *, const uchar *);
const uchar *codeData;
JSC::MacroAssemblerCodeRef codeRef;

View File

@ -165,7 +165,7 @@ void InstructionSelection::operator()(IR::Function *function)
_function->codeRef = linkBuffer.finalizeCodeWithoutDisassembly();
}
_function->code = (void (*)(VM::Context *, const uchar *)) _function->codeRef.code().executableAddress();
_function->code = (void (*)(VM::ExecutionContext *, const uchar *)) _function->codeRef.code().executableAddress();
qSwap(_function, function);
}
@ -180,10 +180,10 @@ InstructionSelection::Pointer InstructionSelection::loadTempAddress(RegisterID r
int32_t offset = 0;
if (t->index < 0) {
const int arg = -t->index - 1;
loadPtr(Address(ContextRegister, offsetof(Context, arguments)), reg);
loadPtr(Address(ContextRegister, offsetof(ExecutionContext, arguments)), reg);
offset = arg * sizeof(Value);
} else if (t->index < _function->locals.size()) {
loadPtr(Address(ContextRegister, offsetof(Context, locals)), reg);
loadPtr(Address(ContextRegister, offsetof(ExecutionContext, locals)), reg);
offset = t->index * sizeof(Value);
} else {
const int arg = _function->maxNumberOfArguments + t->index - _function->locals.size();
@ -424,7 +424,7 @@ void InstructionSelection::visitMove(IR::Move *s)
return;
} else if (IR::Unop *u = s->source->asUnop()) {
if (IR::Temp *e = u->expr->asTemp()) {
Value (*op)(const Value value, Context *ctx) = 0;
Value (*op)(const Value value, ExecutionContext *ctx) = 0;
const char *opName = 0;
switch (u->op) {
case IR::OpIfTrue: assert(!"unreachable"); break;
@ -442,7 +442,7 @@ void InstructionSelection::visitMove(IR::Move *s)
} else if (IR::Binop *b = s->source->asBinop()) {
if ((b->left->asTemp() || b->left->asConst()) &&
(b->right->asTemp() || b->right->asConst())) {
Value (*op)(const Value, const Value, Context *) = 0;
Value (*op)(const Value, const Value, ExecutionContext *) = 0;
const char* opName = 0;
switch ((IR::AluOp) b->op) {
@ -521,7 +521,7 @@ void InstructionSelection::visitMove(IR::Move *s)
// inplace assignment, e.g. x += 1, ++x, ...
if (IR::Temp *t = s->target->asTemp()) {
if (s->source->asTemp() || s->source->asConst()) {
Value (*op)(const Value left, const Value right, Context *ctx) = 0;
Value (*op)(const Value left, const Value right, ExecutionContext *ctx) = 0;
const char *opName = 0;
switch (s->op) {
case IR::OpBitAnd: setOp(op, opName, __qmljs_bit_and); break;
@ -545,7 +545,7 @@ void InstructionSelection::visitMove(IR::Move *s)
}
} else if (IR::Name *n = s->target->asName()) {
if (s->source->asTemp() || s->source->asConst()) {
void (*op)(const Value value, String *name, Context *ctx) = 0;
void (*op)(const Value value, String *name, ExecutionContext *ctx) = 0;
const char *opName = 0;
switch (s->op) {
case IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_name); break;
@ -570,7 +570,7 @@ void InstructionSelection::visitMove(IR::Move *s)
}
} else if (IR::Subscript *ss = s->target->asSubscript()) {
if (s->source->asTemp() || s->source->asConst()) {
void (*op)(Value base, Value index, Value value, Context *ctx) = 0;
void (*op)(Value base, Value index, Value value, ExecutionContext *ctx) = 0;
const char *opName = 0;
switch (s->op) {
case IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_element); break;
@ -598,7 +598,7 @@ void InstructionSelection::visitMove(IR::Move *s)
}
} else if (IR::Member *m = s->target->asMember()) {
if (s->source->asTemp() || s->source->asConst()) {
void (*op)(Value value, Value base, String *name, Context *ctx) = 0;
void (*op)(Value value, Value base, String *name, ExecutionContext *ctx) = 0;
const char *opName = 0;
switch (s->op) {
case IR::OpBitAnd: setOp(op, opName, __qmljs_inplace_bit_and_member); break;
@ -671,7 +671,7 @@ void InstructionSelection::visitCJump(IR::CJump *s)
} else if (IR::Binop *b = s->cond->asBinop()) {
if ((b->left->asTemp() || b->left->asConst()) &&
(b->right->asTemp() || b->right->asConst())) {
Bool (*op)(const Value, const Value, Context *ctx) = 0;
Bool (*op)(const Value, const Value, ExecutionContext *ctx) = 0;
const char *opName = 0;
switch (b->op) {
default: Q_UNREACHABLE(); assert(!"todo"); break;
@ -706,7 +706,7 @@ void InstructionSelection::visitCJump(IR::CJump *s)
void InstructionSelection::visitRet(IR::Ret *s)
{
if (IR::Temp *t = s->expr->asTemp()) {
copyValue(Pointer(ContextRegister, offsetof(Context, result)), t);
copyValue(Pointer(ContextRegister, offsetof(ExecutionContext, result)), t);
return;
}
Q_UNIMPLEMENTED();

View File

@ -579,8 +579,8 @@ private:
int prepareVariableArguments(IR::ExprList* args);
typedef VM::Value (*ActivationMethod)(VM::Context *, VM::String *name, VM::Value *args, int argc);
typedef VM::Value (*BuiltinMethod)(VM::Context *, VM::Value *args, int argc);
typedef VM::Value (*ActivationMethod)(VM::ExecutionContext *, VM::String *name, VM::Value *args, int argc);
typedef VM::Value (*BuiltinMethod)(VM::ExecutionContext *, VM::Value *args, int argc);
void callRuntimeMethodImp(IR::Temp *result, const char* name, ActivationMethod method, IR::Expr *base, IR::ExprList *args);
void callRuntimeMethodImp(IR::Temp *result, const char* name, BuiltinMethod method, IR::ExprList *args);
#define callRuntimeMethod(result, function, ...) \