Ported run-time exception throwing functions to new calling convention
authorSimon Hausmann <simon.hausmann@digia.com>
Thu, 14 Feb 2013 15:15:19 +0000 (16:15 +0100)
committerLars Knoll <lars.knoll@digia.com>
Thu, 14 Feb 2013 19:30:14 +0000 (20:30 +0100)
Change-Id: Icc05eb78deb6d087a06f77d28b71fd49c9705e4c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/v4/debugging.cpp
src/v4/debugging.h
src/v4/llvm_runtime.cpp
src/v4/moth/qv4vme_moth.cpp
src/v4/qmljs_environment.cpp
src/v4/qmljs_environment.h
src/v4/qmljs_runtime.cpp
src/v4/qmljs_runtime.h
src/v4/qv4isel_masm.cpp

index 80afe01..9f53a4a 100644 (file)
@@ -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
index ecb596f..ee749de 100644 (file)
@@ -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;
index 61b95be..9b1bc11 100644 (file)
@@ -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)
index 0f9f618..9c3901e 100644 (file)
@@ -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)
index 801f8d7..f31c65c 100644 (file)
@@ -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)
index 473b2ea..27de8b6 100644 (file)
@@ -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();
index ed4cee2..ad871d6 100644 (file)
@@ -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)
index 3680c8d..98bc2e6 100644 (file)
@@ -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);
index 1d8a09e..19d237f 100644 (file)
@@ -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)