From: Simon Hausmann Date: Thu, 14 Feb 2013 15:15:19 +0000 (+0100) Subject: Ported run-time exception throwing functions to new calling convention X-Git-Tag: upstream/5.2.1~669^2~659^2~238 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6ad661feb23e50ab0287a1a47143696b9bb450e;p=platform%2Fupstream%2Fqtdeclarative.git Ported run-time exception throwing functions to new calling convention Change-Id: Icc05eb78deb6d087a06f77d28b71fd49c9705e4c Reviewed-by: Lars Knoll --- diff --git a/src/v4/debugging.cpp b/src/v4/debugging.cpp index 80afe01..9f53a4a 100644 --- a/src/v4/debugging.cpp +++ b/src/v4/debugging.cpp @@ -159,9 +159,9 @@ void Debugger::leaveFunction(FunctionState *state) _callStack[callIndex(state->context())].state = 0; } -void Debugger::aboutToThrow(VM::Value *value) +void Debugger::aboutToThrow(const VM::Value &value) { - qDebug() << "*** We are about to throw...:" << value->toString(currentState()->context())->toQString(); + qDebug() << "*** We are about to throw...:" << value.toString(currentState()->context())->toQString(); } FunctionState *Debugger::currentState() const diff --git a/src/v4/debugging.h b/src/v4/debugging.h index ecb596f..ee749de 100644 --- a/src/v4/debugging.h +++ b/src/v4/debugging.h @@ -117,7 +117,7 @@ public: // execution hooks void justLeft(VM::ExecutionContext *context); void enterFunction(FunctionState *state); void leaveFunction(FunctionState *state); - void aboutToThrow(VM::Value *value); + void aboutToThrow(const VM::Value &value); public: // debugging hooks FunctionState *currentState() const; diff --git a/src/v4/llvm_runtime.cpp b/src/v4/llvm_runtime.cpp index 61b95be..9b1bc11 100644 --- a/src/v4/llvm_runtime.cpp +++ b/src/v4/llvm_runtime.cpp @@ -470,7 +470,7 @@ void __qmljs_llvm_typeof(ExecutionContext *ctx, Value *result, const Value *valu void __qmljs_llvm_throw(ExecutionContext *context, Value *value) { - __qmljs_throw(*value, context); + __qmljs_throw(context, *value); } void __qmljs_llvm_create_exception_handler(ExecutionContext *context, Value *result) diff --git a/src/v4/moth/qv4vme_moth.cpp b/src/v4/moth/qv4vme_moth.cpp index 0f9f618..9c3901e 100644 --- a/src/v4/moth/qv4vme_moth.cpp +++ b/src/v4/moth/qv4vme_moth.cpp @@ -244,7 +244,7 @@ VM::Value VME::operator()(QQmlJS::VM::ExecutionContext *context, const uchar *co MOTH_END_INSTR(CallActivationProperty) MOTH_BEGIN_INSTR(CallBuiltinThrow) - __qmljs_builtin_throw(VALUE(instr.arg), context); + __qmljs_builtin_throw(context, VALUE(instr.arg)); MOTH_END_INSTR(CallBuiltinThrow) MOTH_BEGIN_INSTR(CallBuiltinCreateExceptionHandler) diff --git a/src/v4/qmljs_environment.cpp b/src/v4/qmljs_environment.cpp index 801f8d7..f31c65c 100644 --- a/src/v4/qmljs_environment.cpp +++ b/src/v4/qmljs_environment.cpp @@ -511,9 +511,9 @@ void ExecutionContext::inplaceBitOp(String *name, const Value &value, BinOp op) setProperty(name, result); } -void ExecutionContext::throwError(Value value) +void ExecutionContext::throwError(const Value &value) { - __qmljs_builtin_throw(value, this); + __qmljs_builtin_throw(this, value); } void ExecutionContext::throwError(const QString &message) diff --git a/src/v4/qmljs_environment.h b/src/v4/qmljs_environment.h index 473b2ea..27de8b6 100644 --- a/src/v4/qmljs_environment.h +++ b/src/v4/qmljs_environment.h @@ -121,7 +121,7 @@ struct ExecutionContext void wireUpPrototype(); - void throwError(Value value); + void throwError(const Value &value); void throwError(const QString &message); void throwSyntaxError(DiagnosticMessage *message); void throwTypeError(); diff --git a/src/v4/qmljs_runtime.cpp b/src/v4/qmljs_runtime.cpp index ed4cee2..ad871d6 100644 --- a/src/v4/qmljs_runtime.cpp +++ b/src/v4/qmljs_runtime.cpp @@ -975,12 +975,12 @@ void __qmljs_construct_property(ExecutionContext *context, Value *result, const context->throwTypeError(); } -void __qmljs_throw(Value value, ExecutionContext *context) +void __qmljs_throw(ExecutionContext *context, const Value &value) { assert(!context->engine->unwindStack.isEmpty()); if (context->engine->debugger) - context->engine->debugger->aboutToThrow(&value); + context->engine->debugger->aboutToThrow(value); ExecutionEngine::ExceptionHandler &handler = context->engine->unwindStack.last(); @@ -1228,9 +1228,9 @@ void __qmljs_builtin_post_decrement_element(ExecutionContext *context, Value *re o->__put__(context, idx, v); } -void __qmljs_builtin_throw(Value val, ExecutionContext *context) +void __qmljs_builtin_throw(ExecutionContext *context, const Value &val) { - __qmljs_throw(val, context); + __qmljs_throw(context, val); } ExecutionContext *__qmljs_builtin_push_with_scope(Value o, ExecutionContext *ctx) diff --git a/src/v4/qmljs_runtime.h b/src/v4/qmljs_runtime.h index 3680c8d..98bc2e6 100644 --- a/src/v4/qmljs_runtime.h +++ b/src/v4/qmljs_runtime.h @@ -116,7 +116,7 @@ void __qmljs_builtin_post_decrement_name(ExecutionContext *context, Value *resul void __qmljs_builtin_post_decrement_member(ExecutionContext *context, Value *result, const Value &base, String *name); void __qmljs_builtin_post_decrement_element(ExecutionContext *context, Value *result, const Value &base, const Value &index); -void __qmljs_builtin_throw(Value val, ExecutionContext *context); +void __qmljs_builtin_throw(ExecutionContext *context, const Value &val); void __qmljs_builtin_rethrow(ExecutionContext *context); ExecutionContext *__qmljs_builtin_push_with_scope(Value o, ExecutionContext *ctx); ExecutionContext *__qmljs_builtin_push_catch_scope(String *exceptionVarName, ExecutionContext *ctx); @@ -213,7 +213,7 @@ void __qmljs_delete_subscript(ExecutionContext *ctx, Value *result, const Value void __qmljs_delete_member(ExecutionContext *ctx, Value *result, const Value &base, String *name); void __qmljs_delete_name(ExecutionContext *ctx, Value *result, String *name); -void __qmljs_throw(Value value, ExecutionContext *context); +void __qmljs_throw(ExecutionContext*, const Value &value); // actually returns a jmp_buf * Q_V4_EXPORT void *__qmljs_create_exception_handler(ExecutionContext *context); void __qmljs_delete_exception_handler(ExecutionContext *context); diff --git a/src/v4/qv4isel_masm.cpp b/src/v4/qv4isel_masm.cpp index 1d8a09e..19d237f 100644 --- a/src/v4/qv4isel_masm.cpp +++ b/src/v4/qv4isel_masm.cpp @@ -568,7 +568,7 @@ void InstructionSelection::callBuiltinPostDecrementValue(IR::Temp *value, IR::Te void InstructionSelection::callBuiltinThrow(IR::Temp *arg) { - generateFunctionCall(Assembler::Void, __qmljs_builtin_throw, arg, Assembler::ContextRegister); + generateFunctionCall(Assembler::Void, __qmljs_builtin_throw, Assembler::ContextRegister, Assembler::PointerToValue(arg)); } void InstructionSelection::callBuiltinCreateExceptionHandler(IR::Temp *result, IR::Temp *contextTemp)