From: Simon Hausmann Date: Thu, 14 Feb 2013 11:56:05 +0000 (+0100) Subject: Convert builtin type of functions to new calling convention X-Git-Tag: upstream/5.2.1~669^2~659^2~250 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7fb0347efac6320fcbae121b27618f3347717bb8;p=platform%2Fupstream%2Fqtdeclarative.git Convert builtin type of functions to new calling convention Change-Id: Ie0c9300eead2171c899bca54635e6fdf301385d3 Reviewed-by: Lars Knoll --- diff --git a/src/v4/llvm_runtime.cpp b/src/v4/llvm_runtime.cpp index 9be3b6d..1dc4800 100644 --- a/src/v4/llvm_runtime.cpp +++ b/src/v4/llvm_runtime.cpp @@ -465,7 +465,7 @@ void __qmljs_llvm_builtin_declare_var(ExecutionContext *ctx, bool deletable, Str void __qmljs_llvm_typeof(ExecutionContext *ctx, Value *result, const Value *value) { - *result = __qmljs_builtin_typeof(*value, ctx); + __qmljs_builtin_typeof(ctx, result, *value); } void __qmljs_llvm_throw(ExecutionContext *context, Value *value) diff --git a/src/v4/moth/qv4vme_moth.cpp b/src/v4/moth/qv4vme_moth.cpp index f711fd0..a8d9243 100644 --- a/src/v4/moth/qv4vme_moth.cpp +++ b/src/v4/moth/qv4vme_moth.cpp @@ -316,15 +316,15 @@ VM::Value VME::operator()(QQmlJS::VM::ExecutionContext *context, const uchar *co MOTH_END_INSTR(CallBuiltinTypeofMember) MOTH_BEGIN_INSTR(CallBuiltinTypeofSubscript) - VALUE(instr.result) = __qmljs_builtin_typeof_element(VALUE(instr.base), VALUE(instr.index), context); + __qmljs_builtin_typeof_element(context, VALUEPTR(instr.result), VALUE(instr.base), VALUE(instr.index)); MOTH_END_INSTR(CallBuiltinTypeofSubscript) MOTH_BEGIN_INSTR(CallBuiltinTypeofName) - VALUE(instr.result) = __qmljs_builtin_typeof_name(instr.name, context); + __qmljs_builtin_typeof_name(context, VALUEPTR(instr.result), instr.name); MOTH_END_INSTR(CallBuiltinTypeofName) MOTH_BEGIN_INSTR(CallBuiltinTypeofValue) - VALUE(instr.result) = __qmljs_builtin_typeof(VALUE(instr.value), context); + __qmljs_builtin_typeof(context, VALUEPTR(instr.result), VALUE(instr.value)); MOTH_END_INSTR(CallBuiltinTypeofValue) MOTH_BEGIN_INSTR(CallBuiltinPostIncMember) diff --git a/src/v4/qmljs_runtime.cpp b/src/v4/qmljs_runtime.cpp index 1976bd2..d35b6f6 100644 --- a/src/v4/qmljs_runtime.cpp +++ b/src/v4/qmljs_runtime.cpp @@ -1006,50 +1006,54 @@ Value __qmljs_get_exception(ExecutionContext *context) return context->engine->exception; } -Value __qmljs_builtin_typeof(Value value, ExecutionContext *ctx) +void __qmljs_builtin_typeof(ExecutionContext *ctx, Value *result, const Value &value) { + if (!result) + return; switch (value.type()) { case Value::Undefined_Type: - return __qmljs_string_literal_undefined(ctx); + *result =__qmljs_string_literal_undefined(ctx); break; case Value::Null_Type: - return __qmljs_string_literal_object(ctx); + *result = __qmljs_string_literal_object(ctx); break; case Value::Boolean_Type: - return __qmljs_string_literal_boolean(ctx); + *result =__qmljs_string_literal_boolean(ctx); break; case Value::String_Type: - return __qmljs_string_literal_string(ctx); + *result = __qmljs_string_literal_string(ctx); break; case Value::Object_Type: if (__qmljs_is_callable(value, ctx)) - return __qmljs_string_literal_function(ctx); + *result =__qmljs_string_literal_function(ctx); else - return __qmljs_string_literal_object(ctx); // ### implementation-defined + *result = __qmljs_string_literal_object(ctx); // ### implementation-defined break; default: - return __qmljs_string_literal_number(ctx); + *result =__qmljs_string_literal_number(ctx); break; } } -Value __qmljs_builtin_typeof_name(String *name, ExecutionContext *context) +void __qmljs_builtin_typeof_name(ExecutionContext *context, Value *result, String *name) { - return __qmljs_builtin_typeof(context->getPropertyNoThrow(name), context); + if (result) + __qmljs_builtin_typeof(context, result, context->getPropertyNoThrow(name)); } void __qmljs_builtin_typeof_member(ExecutionContext *context, Value *result, const Value &base, String *name) { Value obj = base.toObject(context); if (result) - *result = __qmljs_builtin_typeof(obj.objectValue()->__get__(context, name), context); + __qmljs_builtin_typeof(context, result, obj.objectValue()->__get__(context, name)); } -Value __qmljs_builtin_typeof_element(Value base, Value index, ExecutionContext *context) +void __qmljs_builtin_typeof_element(ExecutionContext *context, Value *result, const Value &base, const Value &index) { String *name = index.toString(context); Value obj = base.toObject(context); - return __qmljs_builtin_typeof(obj.objectValue()->__get__(context, name), context); + if (result) + __qmljs_builtin_typeof(context, result, obj.objectValue()->__get__(context, name)); } void __qmljs_builtin_post_increment(ExecutionContext *ctx, Value *result, Value *val) diff --git a/src/v4/qmljs_runtime.h b/src/v4/qmljs_runtime.h index c0f2643..ae9d75b 100644 --- a/src/v4/qmljs_runtime.h +++ b/src/v4/qmljs_runtime.h @@ -101,10 +101,10 @@ void __qmljs_construct_activation_property(ExecutionContext *, Value *result, St 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, ExecutionContext *ctx); -Value __qmljs_builtin_typeof_name(String *name, ExecutionContext *context); +void __qmljs_builtin_typeof(ExecutionContext *ctx, Value *result, const Value &val); +void __qmljs_builtin_typeof_name(ExecutionContext *context, Value* result, String *name); void __qmljs_builtin_typeof_member(ExecutionContext* context, Value* result, const Value &base, String *name); -Value __qmljs_builtin_typeof_element(Value base, Value index, ExecutionContext *context); +void __qmljs_builtin_typeof_element(ExecutionContext* context, Value *result, const Value &base, const Value &index); void __qmljs_builtin_post_increment(ExecutionContext *ctx, Value *result, Value *val); void __qmljs_builtin_post_increment_name(ExecutionContext *context, Value *result, String *name); diff --git a/src/v4/qv4isel_masm.cpp b/src/v4/qv4isel_masm.cpp index 4337c72..f7a4cc4 100644 --- a/src/v4/qv4isel_masm.cpp +++ b/src/v4/qv4isel_masm.cpp @@ -485,17 +485,17 @@ void InstructionSelection::callBuiltinTypeofMember(IR::Temp *base, const QString void InstructionSelection::callBuiltinTypeofSubscript(IR::Temp *base, IR::Temp *index, IR::Temp *result) { - generateFunctionCall(result, __qmljs_builtin_typeof_element, base, index, Assembler::ContextRegister); + generateFunctionCall(Assembler::Void, __qmljs_builtin_typeof_element, Assembler::ContextRegister, Assembler::PointerToValue(result), Assembler::PointerToValue(base), Assembler::PointerToValue(index)); } void InstructionSelection::callBuiltinTypeofName(const QString &name, IR::Temp *result) { - generateFunctionCall(result, __qmljs_builtin_typeof_name, identifier(name), Assembler::ContextRegister); + generateFunctionCall(Assembler::Void, __qmljs_builtin_typeof_name, Assembler::ContextRegister, Assembler::PointerToValue(result), identifier(name)); } void InstructionSelection::callBuiltinTypeofValue(IR::Temp *value, IR::Temp *result) { - generateFunctionCall(result, __qmljs_builtin_typeof, value, Assembler::ContextRegister); + generateFunctionCall(Assembler::Void, __qmljs_builtin_typeof, Assembler::ContextRegister, Assembler::PointerToValue(result), Assembler::PointerToValue(value)); } void InstructionSelection::callBuiltinDeleteMember(IR::Temp *base, const QString &name, IR::Temp *result)